首页 > 代码库 > dubbo-admin 2.5.4 编译和部署

dubbo-admin 2.5.4 编译和部署

前言:

    公司比较奇葩,应用服务器用的还是老版本的resin、jboss这些。由于原有dubbo-admin无法访问,就想用tomcat重新部署套。官网dubbo.io提供的下载地址已经无法下载,那就用源码编译吧。

环境:

    系统:linux

    maven:3.5.0

    java:1.7.0_80

问题:

    git clone https://github.com/alibaba/dubbo.git

    git完源码后,以为按照github上的说明一步一步来就可以编译成功,其实不然。官方文档没有说明java版本,而说明的maven版本是2.2,mvn install 一直报错,加了-X参数后看到一些详细信息,但搜索到的都是说java版本问题。


解决:

    于是将java版本从1.6-1.8都试了,但还是一样的错误……无果,于是找了位开发,让其帮build下,结果……居然成功了,但启tomcat时又是各种错,就问了下开发的编译环境:

    maven:3.5+

    java:1.8+


    这次查tomcat日志信息确实是java版本的问题了,但不是tomcat使用的java版本,而是build dubbo时使用的java版本问题,build dubbo时不能使用java1.8+的版本。于是使用java1.7 自己重新build了下,在放到tomcat中运行,可以正常访问了


插曲:

    看到网上有人说直接到duboo-admin目录下mvn package -Dmaven.skip.test=true 就可以打包成功,但我这报错,错误信息如下:

[ERROR] Failed to execute goal on project dubbo-admin: Could not resolve dependencies for project com.alibaba:dubbo-admin:war:2.5.4-SNAPSHOT: Could not find artifact com.alibaba:dubbo:jar:2.5.4-SNAPSHOT -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project dubbo-admin: Could not resolve dependencies for project com.alibaba:dubbo-admin:war:2.5.4-SNAPSHOT: Could not find artifact com.alibaba:dubbo:jar:2.5.4-SNAPSHOT
    at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:221)
    at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies(LifecycleDependencyResolver.java:127)
    at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved(MojoExecutor.java:246)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:200)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.project.DependencyResolutionException: Could not resolve dependencies for project com.alibaba:dubbo-admin:war:2.5.4-SNAPSHOT: Could not find artifact com.alibaba:dubbo:jar:2.5.4-SNAPSHOT
    at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:208)
    at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:195)
    ... 23 more
Caused by: org.eclipse.aether.resolution.DependencyResolutionException: Could not find artifact com.alibaba:dubbo:jar:2.5.4-SNAPSHOT
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:393)
    at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:202)
    ... 24 more
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not find artifact com.alibaba:dubbo:jar:2.5.4-SNAPSHOT
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:453)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:255)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:376)
    ... 25 more
Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact com.alibaba:dubbo:jar:2.5.4-SNAPSHOT
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:443)
    ... 27 more
[ERROR] 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException


想着应该是没有编译dubbo的问题导致缺少依赖jar,于是到dubbo主目录,将dubbo全编译了下,看到成功后,在dubbo-admin/target 下就生成了需要的dubbo-admin-2.5.4-SNAPSHOT.war文件。这时可将dubbo-admin-2.5.4-SNAPSHOT目录内的文件直接放到tomcat的ROOT目录下,修改dubbo.properties文件内的zookeeper

集群方式为

dubbo.registry.address=zookeeper://ip_1:2181?backup=ip_2:2181,ip_3:2181
dubbo.admin.root.password=root
dubbo.admin.guest.password=guest


验证:

    浏览器访问tomcat地址,用root或guest登录,页面如下


技术分享



本文出自 “morrowind” 博客,请务必保留此出处http://morrowind.blog.51cto.com/1181631/1933538

dubbo-admin 2.5.4 编译和部署