资讯专栏INFORMATION COLUMN

dubbox/dubbo+spring+mybatis+gradle构建REST服务

fireflow / 3295人阅读

摘要:修正了在上的部分修正了比如协议中序列化的问题。配置文件在配置配置在目录下面配置后的工程基本目录结构在项目

杂七杂八的杂

个人博客: 呆萌的程序猿
原文:dubbox/dubbo+spring+mybatis+gradle构建REST服务
声明:
由于sf的编辑自动校验,导致某些英文单词出错,例如:gradle被编辑器自动替换为grade,jdk替换为idk等,查看的时候,请自行翻译。

------------------------------多图预警------------------------------

什么是dubbox?看看别人怎么说的:

Dubbox是Dubbo的一个扩展,假如你知道java, javax 和 dubbo,那你就会明白dubbox是什么了。

Dubbox增加的功能如RESTful remoting, Kyro/FST 系列化等。它已经应用在当当网内部的多个项目中。

dubbox的功能

支持REST风格远程调用(HTTP + JSON/XML):基于非常成熟的JBoss RestEasy框架,在dubbo中实现了REST风格(HTTP + JSON/XML)的远程调用,以显著简化企业内部的跨语言交互,同时显著简化企业对外的Open API、无线API甚至AJAX服务端等等的开发。事实上,这个REST调用也使得Dubbo可以对当今特别流行的“微服务”架构提供基础性支持。 另外,REST调用也达到了比较高的性能,在基准测试下,HTTP + JSON与Dubbo 2.x默认的RPC协议(即TCP + Hessian2二进制序列化)之间只有1.5倍左右的差距,详见文档中的基准测试报告。

支持基于Kryo和FST的Java高效序列化实现:基于当今比较知名的Kryo和FST高性能序列化库,为Dubbo 默认的RPC协议添加新的序列化实现,并优化调整了其序列化体系,比较显著的提高了Dubbo RPC的性能,详见文档中的基准测试报告。

支持基于嵌入式Tomcat的HTTP remoting体系:基于嵌入式tomcat实现dubbo 的HTTP remoting体系(即dubbo-remoting-http),用以逐步取代Dubbo中旧版本的嵌入式Jetty,可以显著的提高REST等的远程调用性能,并将Servlet API的支持从2.5升级到3.1。(注:除了REST,dubbo中的WebServices、Hessian、HTTP Invoker等协议都基于这个HTTP remoting体系)。

升级Spring:将dubbo中Spring由2.x升级到目前最常用的3.x版本,减少版本冲突带来的麻烦

升级ZooKeeper客户端:将dubbo中的zookeeper客户端升级到最新的版本,以修正老版本中包含的bug。

调整Demo应用:暂时将dubbo的demo应用调整并改写以主要演示REST功能和新的Java高效序列化等等。

修正了在JDK1.7上dubbo的部分bug:修正了比如dubbo协议中json序列化的问题。但是还没有修正所有发现的bug。

注:dubbox和dubbo 2.x是兼容的,没有改变dubbo的任何已有的功能和配置方式(除了升级了spring之类的版本)

注:以上文字均为《Dubbo扩展:Dubbox》一文。

环境安装 jdk安装

能看此文的人,我假设你会安装java开发环境,此处省略999+的废话,否则你看到此处心中一定会奔腾着十万匹草泥马。

gradle安装

如题,Mac开发环境,windows请自行实践,如果出了什么问题,别骂我就行。

废话少说,言归正传。

相信你看到这里会对gradle多多少少有些了解,如果不了解,也没关系,gradle就是maven的升级版,也适用于java项目的包管理器,它抛弃了如maven基于xml的繁琐配置。

Gradle是一个基于JVM的构建工具,它提供了:

像Ant一样,通用灵活的构建工具

可以切换的,基于约定的构建框架

强大的多工程构建支持

基于Apache Ivy的强大的依赖管理

支持maven, Ivy仓库

支持传递性依赖管理,而不需要远程仓库或者是pom.xml和ivy.xml配置文件。

对Ant的任务做了很好的集成

基于Groovy,build脚本使用Groovy编写

有广泛的领域模型支持构建

安装jdk。安装gradle之前一定先安装jdk,并配置JAVA_HOME环境变量。因为gradle是用Groovy编写的,而Groovy基于JAVA。

用vim打开根目录下的 ~/.bashrc或者~/.bash_profile配置用户级别的环境变量,或者打开/etc/profile文件配置系统级别的环境变量,将下面的内容复制到上述文件之一保存(vim保存,编辑后先按ESC进入命令模式,输入:wq保存并退出,然后加载配置后的文件,用命令source ~/.bashrc或者source ~/.bash_profile或者source /etc/profile)即可。

    JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home

下载。在这里下载gradle。


解压
下载好的文件是zip格式,mac下载后自动解压,如果没有自动解压,在findler中打开下载目录,双击即可解压,如果还不行,执行命令解压,mac自带了unzip命令工具,如果没有unzip,使用brew安装吧。

安装unzip命令:

brew install unzip

解压zip文件命令:

cd /Users/xxx/Downloads && unzip gradle-2.13-all.zip

上面命令解释:cd首先进入到你的工作空间,xxx替换为个人用户名;然后执行unzip命令解压gradle。

PS:说一下我的安装习惯吧。

一般情况下,用命令安装的软件基本都在/usr/local/Cellar/目录下面,二进制文件可能会软连接到/usr/local/bin/和/usr/local/sbin/目录下面,配置文件在/usr/local/etc/目录下面。

但是,有一些软件还是喜欢放在个人工作空间,用起来比较方便。比如tomcat,zookeeper,gradle,jmeter等工具,放在用户目录下面的Documents/software目录下,software原来没有,自建一个software文件夹。

上面是我的工作空间。只希望给自己创建一个干净整齐的工作空间。

gradle配置

在gradle的根目录下面,找到init.d目录,这就是它的配置文件夹,里面有一个磨人的配置文件init.gradle。

allprojects {
    apply plugin: "java"
    apply plugin: "idea"
    buildDir = "target"
    buildDir = "target"
    repositories {
        // maven repository
        maven {
           url "http://127.0.0.1:8082/nexus/content/groups/public/"
        }
    mavenLocal()
    mavenCentral()
    }

    buildscript {
        repositories {
        maven {
        url "http://127.0.0.1:8082/nexus/content/groups/public/"
        }
        mavenLocal()
               mavenCentral()
        }
    dependencies {
            classpath "net.nisgits.gradle:gradle-executable-jar-plugin:1.7.0"
        }
    }
}

上面的仓库地址可以改成你自己的maven仓库,也可以指定为第三方的maven仓库。我这里是本地搭建的,请记得修改

tomcat安装

下载:tomcat的下载点击这里
首先登录官网,点击导航菜单的download,进入下载页面。左边栏就能看到download的下面的一些版本,建议下载8,不要用9,这里只说mac的,我尝试了几次,9在IDEA编辑中运行代码回报错误权限不足,而我的tomcat的意境是777的权限,网上查了一下,也没有更好的解决方案,都是chmod给*.sh权限。


以8版本为例,点击进入之后就是这样的:

mac和linux用户还是选择tar.gz格式,我们只需要下载Core的包,其他的估计也用不上,完整文档的就别下载了,我相信自己不会去看的,除非你不相信自己或者过分相信自己。
解压:使用tar命令就好,假设你已经进入到下载目录:

tar -zxvf apache-tomcat-8.0.35.tar

忽然发现,下载的tomcat8的文件格式不是tar.gz,而是tar;tomcat9的却是tar.gz。不管哪一种,解压命令一样,都可达到你要的效果。

zookeeper安装

zk的下载和安装网上有很多教程,这里不做详细的讲解。默认情况下,运行代码之前假设已经开启了zk,开启命令:

sudo sh zkServer.sh start

再次强调,运行dubbox/dubbo构建的代码,一定要开启zk,端口默认2181,如果你修改了端口,后面提到的config.properties文件中记得修改。

用IDEA搭建框架

帮助别人,其实是在帮助自己;纪录总会有用处,只是需要到一定的时机。
[写作感悟]
环境终于配置结束了。

首先搭建一个简单的gradle的project。

打开IDEA,选择创建一个新工程[Create New Project]

选择gradle,然后选择jdk,右下角next:

接下来填写groupie,artifacts,version,这三个值构成了一个坐标系统,这是maven标识一个工程的唯一依据,gradle依然在使用这个坐标。

本地配置了gradle,就选择使用本地的吧,勾选一下自动创建空内容根目录,也就是帮你创建了src,resource等资源文件夹:

接下来可以改一下project name为test-demo.
我们的工程目录如下:

IDEA很神奇,提供了命令窗口,当然没有mac的好用,对中文的致辞不友好。在改窗口下输入命令(build命令在以后经常用到,用于构建打包):

gradle clean idea build --daemon

或者

 gradle clean build --daemon
 gradle clean idea
配置gradle工程依赖

打开工程目录下的build.gradle文件,配置dubbed/dubbo、spring、zk、öson等依赖包下面的配置中spring的版本是3.x,你可选择配置4.x版本。

group "Joyven"
version "1.0-SNAPSHOT"

apply plugin: "java"
apply plugin: "war"

sourceCompatibility = 1.8

repositories {
    mavenLocal()
    mavenCentral()
}

dependencies {

    compile "com.google.code.gson:gson:2.3.1"
    // log4j2
    compile "org.apache.logging.log4j:log4j-core:2.4.1"
    compile "org.apache.logging.log4j:log4j-api:2.4.1"
    compile "org.apache.logging.log4j:log4j-slf4j-impl:2.4.1"

    // validator
    compile "org.hibernate:hibernate-validator:5.2.0.Final"
    compile "javax.validation:validation-api:1.1.0.Final"

    compile "org.jboss.resteasy:jaxrs-api:3.0.7.Final"

    //http 异步
    compile  "org.apache.httpcomponents:httpasyncclient:4.1.1"


    // dubbo
    compile ("com.alibaba:dubbo:2.8.4") {
        exclude(module: "log4j")
    }
    compile "com.alibaba:dubbo-rpc-rest:2.8.4"


    // jackson
    compile "com.fasterxml.jackson.core:jackson-core:2.7.0-rc2"
    compile "com.fasterxml.jackson.core:jackson-databind:2.7.0-rc2"

    compile "org.apache.kafka:kafka-clients:0.9.0.0"

    compile "com.alibaba.rocketmq:rocketmq-client:3.2.6"

    //mongodb
    compile "org.springframework.data:spring-data-mongodb:1.8.0.RELEASE"
    compile "org.mongodb:mongo-java-driver:3.1.0"

    compile "com.alibaba:druid:1.0.15"
    compile "org.mybatis:mybatis:3.3.0"
    compile "org.mybatis:mybatis-spring:1.2.3"

    compile "mysql:mysql-connector-java:5.1.36"
    compile "joda-time:joda-time:2.8.1"
    compile "org.springframework:spring-jdbc:3.2.9.RELEASE"
    compile "org.springframework:spring-test:3.2.9.RELEASE"
    compile "org.springframework:spring-webmvc:3.0.9.RELEASE"
    compile "org.springframework.hateoas:spring-hateoas:0.19.0.RELEASE"
    compile "org.glassfish:javax.el:3.0.1-b08"
    compile "commons-beanutils:commons-beanutils:1.8.3"

    compile "org.apache.zookeeper:zookeeper:3.5.0-alpha"
    compile "com.github.sgroschupf:zkclient:0.1"

    compile "log4j:log4j:1.2.17"
    testCompile "junit:junit:4.11"

}

war {
    archiveName = "test-demo.war"
}

最后一行的意思是,gradle build的时候,打包的war包文件名,不是带有一串很长的groupid,version等信息的包名,而是指定的包,如test-demo.war

配置玩gradle后,执行上面说过的build命令gradle clean build --daemon,构建依赖包,此过程如果用的是第三方的maven仓库,可能事件会很长。

----------- 本来以为一篇就写完了,前戏太长,一篇容纳不下,但是,sf表字段肯定足够大,表担心,我们还是继续把这场戏演完------------

项目基本配置 工程结构

在main文件夹下面新建一个webapp,webapp下心间一个WEB-INF,web.xml就在WEB-INF目录下面。

|____build.gradle
|____settings.gradle
|____src
| |____main
| | |____java
| | |____resources
| | |____webapp
| | | |____index.jsp
| | | |____WEB-INF
| | | | |____web.xml
| |____test
| | |____java
| | |____resources
|____target

上面的目录结构就是我的工程结构,其中一部份idea和gradle的文件没有贴出来。

spring配置

在resource目录下创建一个文件夹:META-INF.spring,在改文件夹下面创建一个spring配置文件services-config.xml。






    

    

    

    
        
        
        
            
                
                classpath:conf/properties/*.properties
            
        
    


    

    
    


    
    

    

    

    

    

说明:

该文件配置的就是你所期望的dubbox/dubbo和spring的信息。这一句配置的内容暂时为空,后面要指定我们要扫描的包。

这一句指出dubbo应用的名字、所属以及组织,name一半填写工程名字,owner一般指定为公司,或者项目组,organization一般为公司,我是自用组织者,哈哈?~~

估计眼明的你已经看到了,extension="com.alibaba.dubbo.rpc.protocol.rest.support.LoggingFilter"/>,这里面的配置都是动态获取的,${variable}指代properties文件中配置的属性。

port的配置必须与服务器的端口相同,这个是实现rest服务所必须要求的,而在dubbo中是不做要求的,因为dubbo只是一个服务提供方,不提供直接通过http协议访问。

contextpath路径必须与工程部署的路径相同,意思呢,就是contextpath的值和war包的名字一样。

server 如果不指定,默认启动Jetty服务器,如果是tomcat指定servlet,方便在web.xml中配置rest过滤器。如果配置成tomcat,则会出现一些错误。

配置properties文件,在main/conf/properties/config.properties:

server.port=30010

dubbo.server.port=30011
dubbo.server.host=127.0.0.1

rest.server.port=8080

zkHost=127.0.0.1:2181
web.xml配置


    
        contextConfigLocation
        classpath:META-INF/spring/*.xml
    

    
        log4jConfigLocation
        WEB-INF/classes/log4j.xml
    

    
        log4jRefreshInterval
        60000
    



    
    
        com.alibaba.dubbo.remoting.http.servlet.BootstrapListener
    

    
        org.springframework.web.context.ContextLoaderListener
    

    
        org.springframework.web.util.Log4jConfigListener
    

    
        dispatcher
        com.alibaba.dubbo.remoting.http.servlet.DispatcherServlet
        1
    


    
        dispatcher
        /*
    

    
log4j.xml配置

log4j.xml在main/resources/目录下面:





 
  
   
  
 
 
  
  
  
   
  
 
 
  
  
  
 
 配置后的工程基本目录结构
|____build.gradle
|____settings.gradle
|____src
| |____main
| | |____java
| | |____resources
| | | |____log4j.xml
| | | |____META-INF
| | | | |____spring
| | | | | |____services-config.xml
| | |____webapp
| | | |____index.jsp
| | | |____WEB-INF
| | | | |____web.xml
| |____test
| | |____java
| | |____resources
Talk is cheap Show you my code

在项目的main文件夹下面新建几个包:
com.web.service (接口)
com.web.biz (实现+业务)
com.web.repository (dao层)
com.web.mapper (db映射mapper)

至此,一个完整的项目结构成型。回过头来,修改spring的配置,指明扫描包路径。services-config.xml中的这一句替换为

这个很重要,否则会报错误。

现在我们在IDEA中配置tomcat,然后运行一下,应该可以启动了。
打印的日志如下:

/Users/zhoujunwen/Documents/software/apache-tomcat-8.0.35/bin/catalina.sh run
[2016-05-21 05:46:49,256] Artifact Gradle : Joyven:test : test-demo.war (exploded): Server is not connected. Deploy is not available.
21-May-2016 17:46:51.467 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.0.35
21-May-2016 17:46:51.468 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          May 11 2016 21:57:08 UTC
21-May-2016 17:46:51.469 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.0.35.0
21-May-2016 17:46:51.469 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Mac OS X
21-May-2016 17:46:51.469 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            10.11.4
21-May-2016 17:46:51.469 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          x86_64
21-May-2016 17:46:51.469 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre
21-May-2016 17:46:51.469 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.8.0_91-b14
21-May-2016 17:46:51.469 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
21-May-2016 17:46:51.469 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         /Users/zhoujunwen/Library/Caches/IntelliJIdea15/tomcat/Unnamed_test
21-May-2016 17:46:51.470 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         /Users/zhoujunwen/Documents/software/apache-tomcat-8.0.35
21-May-2016 17:46:51.471 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/Users/zhoujunwen/Library/Caches/IntelliJIdea15/tomcat/Unnamed_test/conf/logging.properties
21-May-2016 17:46:51.471 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
21-May-2016 17:46:51.471 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote=
21-May-2016 17:46:51.471 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.port=1099
21-May-2016 17:46:51.471 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.ssl=false
21-May-2016 17:46:51.471 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.authenticate=false
21-May-2016 17:46:51.471 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.rmi.server.hostname=127.0.0.1
21-May-2016 17:46:51.472 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
21-May-2016 17:46:51.472 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.endorsed.dirs=/Users/zhoujunwen/Documents/software/apache-tomcat-8.0.35/endorsed
21-May-2016 17:46:51.472 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/Users/zhoujunwen/Library/Caches/IntelliJIdea15/tomcat/Unnamed_test
21-May-2016 17:46:51.472 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/Users/zhoujunwen/Documents/software/apache-tomcat-8.0.35
21-May-2016 17:46:51.472 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/Users/zhoujunwen/Documents/software/apache-tomcat-8.0.35/temp
21-May-2016 17:46:51.472 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /Users/zhoujunwen/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
21-May-2016 17:46:51.712 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
21-May-2016 17:46:51.827 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
21-May-2016 17:46:51.833 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
21-May-2016 17:46:51.834 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
21-May-2016 17:46:51.839 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 1559 ms
21-May-2016 17:46:51.913 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
21-May-2016 17:46:51.913 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.35
21-May-2016 17:46:51.935 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
21-May-2016 17:46:51.947 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
21-May-2016 17:46:51.948 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 109 ms
Connected to server
[2016-05-21 05:46:52,287] Artifact Gradle : Joyven:test : test-demo.war (exploded): Artifact is being deployed, please wait...
21-May-2016 17:46:57.182 INFO [RMI TCP Connection(2)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/zhoujunwen/Documents/workspace/java/test-demo/out/artifacts/test/exploded/test-demo.war/WEB-INF/lib/log4j-slf4j-impl-2.4.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/zhoujunwen/Documents/workspace/java/test-demo/out/artifacts/test/exploded/test-demo.war/WEB-INF/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.
[21/05/16 05:46:58:058 CST] RMI TCP Connection(2)-127.0.0.1  INFO logger.LoggerFactory: using logger: com.alibaba.dubbo.common.logger.log4j.Log4jLoggerAdapter
[21/05/16 05:46:58:058 CST] RMI TCP Connection(2)-127.0.0.1 ERROR common.Version:  [DUBBO] Duplicate class com/alibaba/dubbo/common/Version.class in 2 jar [file:/Users/zhoujunwen/Documents/workspace/java/test-demo/out/artifacts/test/exploded/test-demo.war/WEB-INF/lib/dubbo-2.8.4.jar!/com/alibaba/dubbo/common/Version.class, file:/Users/zhoujunwen/Documents/workspace/java/test-demo/out/artifacts/test/exploded/test-demo.war/WEB-INF/lib/dubbo-common-2.8.4.jar!/com/alibaba/dubbo/common/Version.class], dubbo version: 2.8.4, current host: 127.0.0.1
[21/05/16 05:46:58:058 CST] RMI TCP Connection(2)-127.0.0.1  INFO config.AbstractConfig:  [DUBBO] The service ready on spring started. service: com.web.services.TestService, dubbo version: 2.8.4, current host: 127.0.0.1
[21/05/16 05:46:58:058 CST] RMI TCP Connection(2)-127.0.0.1  INFO config.AbstractConfig:  [DUBBO] Export dubbo service com.web.services.TestService to local registry, dubbo version: 2.8.4, current host: 127.0.0.1
[21/05/16 05:46:58:058 CST] RMI TCP Connection(2)-127.0.0.1  INFO config.AbstractConfig:  [DUBBO] Export dubbo service com.web.services.TestService to url rest://192.168.0.4:8080/test-demo/com.web.services.TestService?accepts=500&anyhost=true&application=test-demo&dubbo=2.8.4&extension=com.alibaba.dubbo.rpc.protocol.rest.support.LoggingFilter&generic=false&interface=com.web.services.TestService&methods=sayHello&organization=freedom&owner=Joyven&pid=1417&server=servlet&side=provider&threads=500×tamp=1463824018811, dubbo version: 2.8.4, current host: 127.0.0.1
[21/05/16 05:46:58:058 CST] RMI TCP Connection(2)-127.0.0.1  INFO config.AbstractConfig:  [DUBBO] Register dubbo service com.web.services.TestService url rest://192.168.0.4:8080/test-demo/com.web.services.TestService?accepts=500&anyhost=true&application=test-demo&dubbo=2.8.4&extension=com.alibaba.dubbo.rpc.protocol.rest.support.LoggingFilter&generic=false&interface=com.web.services.TestService&methods=sayHello&organization=freedom&owner=Joyven&pid=1417&server=servlet&side=provider&threads=500×tamp=1463824018811 to registry registry://127.0.0.1:2181/com.alibaba.dubbo.registry.RegistryService?application=test-demo&dubbo=2.8.4&organization=freedom&owner=Joyven&pid=1417®istry=zookeeper×tamp=1463824018795, dubbo version: 2.8.4, current host: 127.0.0.1
[21/05/16 05:46:59:059 CST] RMI TCP Connection(2)-127.0.0.1  INFO zookeeper.ZookeeperRegistry:  [DUBBO] Load registry store file /Users/zhoujunwen/.dubbo/dubbo-registry-127.0.0.1.cache, data: {cn.idongjia.tianji.services.NotifyService=empty://10.0.0.24/cn.idongjia.tianji.services.NotifyService?application=dongjia-web-service&category=configurators&check=false&dubbo=2.8.4&interface=cn.idongjia.tianji.services.NotifyService&methods=notifyOne,notifyAll,sms,unregister,notifyList,messageSend,register,checkCode&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044355564 empty://10.0.0.24/cn.idongjia.tianji.services.NotifyService?application=dongjia-web-service&category=routers&check=false&dubbo=2.8.4&interface=cn.idongjia.tianji.services.NotifyService&methods=notifyOne,notifyAll,sms,unregister,notifyList,messageSend,register,checkCode&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044355564 empty://10.0.0.24/cn.idongjia.tianji.services.NotifyService?application=dongjia-web-service&category=providers&check=false&dubbo=2.8.4&interface=cn.idongjia.tianji.services.NotifyService&methods=notifyOne,notifyAll,sms,unregister,notifyList,messageSend,register,checkCode&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044355564, com.web.services.TestService=empty://192.168.0.4:8080/test-demo/com.web.services.TestService?accepts=500&anyhost=true&application=test-demo&category=configurators&check=false&dubbo=2.8.4&extension=com.alibaba.dubbo.rpc.protocol.rest.support.LoggingFilter&generic=false&interface=com.web.services.TestService&methods=sayHello&organization=freedom&owner=Joyven&pid=1376&server=servlet&side=provider&threads=500×tamp=1463822337491, cn.idongjia.tianji.services.ReturnGoodsService=empty://10.0.0.24/cn.idongjia.tianji.services.ReturnGoodsService?application=dongjia-web-service&category=configurators&check=false&dubbo=2.8.4&interface=cn.idongjia.tianji.services.ReturnGoodsService&methods=cancel,allow,aliNotify,apply,list,confirm,disallow,reject,batchGet,getByOrder,detail,send&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044359264 empty://10.0.0.24/cn.idongjia.tianji.services.ReturnGoodsService?application=dongjia-web-service&category=routers&check=false&dubbo=2.8.4&interface=cn.idongjia.tianji.services.ReturnGoodsService&methods=cancel,allow,aliNotify,apply,list,confirm,disallow,reject,batchGet,getByOrder,detail,send&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044359264 empty://10.0.0.24/cn.idongjia.tianji.services.ReturnGoodsService?application=dongjia-web-service&category=providers&check=false&dubbo=2.8.4&interface=cn.idongjia.tianji.services.ReturnGoodsService&methods=cancel,allow,aliNotify,apply,list,confirm,disallow,reject,batchGet,getByOrder,detail,send&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044359264, cn.idongjia.tianji.services.BankcardService=empty://10.0.0.24/cn.idongjia.tianji.services.BankcardService?application=dongjia-web-service&category=configurators&check=false&dubbo=2.8.4&interface=cn.idongjia.tianji.services.BankcardService&methods=add,getAll,modifyDefault,get,update,delete,getCount,getUserBankcard&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044355819 empty://10.0.0.24/cn.idongjia.tianji.services.BankcardService?application=dongjia-web-service&category=routers&check=false&dubbo=2.8.4&interface=cn.idongjia.tianji.services.BankcardService&methods=add,getAll,modifyDefault,get,update,delete,getCount,getUserBankcard&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044355819 empty://10.0.0.24/cn.idongjia.tianji.services.BankcardService?application=dongjia-web-service&category=providers&check=false&dubbo=2.8.4&interface=cn.idongjia.tianji.services.BankcardService&methods=add,getAll,modifyDefault,get,update,delete,getCount,getUserBankcard&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044355819, cn.idongjia.cashout.service.CashoutService=empty://10.0.0.24/cn.idongjia.cashout.service.CashoutService?application=dongjia-web-service&category=configurators&check=false&dubbo=2.8.4&interface=cn.idongjia.cashout.service.CashoutService&methods=execute&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044355776 empty://10.0.0.24/cn.idongjia.cashout.service.CashoutService?application=dongjia-web-service&category=routers&check=false&dubbo=2.8.4&interface=cn.idongjia.cashout.service.CashoutService&methods=execute&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044355776 empty://10.0.0.24/cn.idongjia.cashout.service.CashoutService?application=dongjia-web-service&category=providers&check=false&dubbo=2.8.4&interface=cn.idongjia.cashout.service.CashoutService&methods=execute&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044355776, cn.idongjia.tianji.services.OrderService=empty://10.0.0.24/cn.idongjia.tianji.services.OrderService?application=dongjia-web-service&category=configurators&check=false&dubbo=2.8.4&interface=cn.idongjia.tianji.services.OrderService&methods=notes,hidden,getDetail,setPayed,searchCount,update,ship,delete,wxNotify,search,inWXPay,get,changeAddress,alipayNotify,close,getCount,payed,add,getAll,pay,confirm,delay,changeRealpay,evaluate&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044355881 empty://10.0.0.24/cn.idongjia.tianji.services.OrderService?application=dongjia-web-service&category=routers&check=false&dubbo=2.8.4&interface=cn.idongjia.tianji.services.OrderService&methods=notes,hidden,getDetail,setPayed,searchCount,update,ship,delete,wxNotify,search,inWXPay,get,changeAddress,alipayNotify,close,getCount,payed,add,getAll,pay,confirm,delay,changeRealpay,evaluate&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044355881 empty://10.0.0.24/cn.idongjia.tianji.services.OrderService?application=dongjia-web-service&category=providers&check=false&dubbo=2.8.4&interface=cn.idongjia.tianji.services.OrderService&methods=notes,hidden,getDetail,setPayed,searchCount,update,ship,delete,wxNotify,search,inWXPay,get,changeAddress,alipayNotify,close,getCount,payed,add,getAll,pay,confirm,delay,changeRealpay,evaluate&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044355881, cn.idongjia.search.service.QueryService=empty://10.0.0.24/cn.idongjia.search.service.QueryService?application=dongjia-web-service&category=configurators&check=false&dubbo=2.8.4&interface=cn.idongjia.search.service.QueryService&methods=searchCraftsMan,searchItemWithPrice,searchItem&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044359316 empty://10.0.0.24/cn.idongjia.search.service.QueryService?application=dongjia-web-service&category=routers&check=false&dubbo=2.8.4&interface=cn.idongjia.search.service.QueryService&methods=searchCraftsMan,searchItemWithPrice,searchItem&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044359316 empty://10.0.0.24/cn.idongjia.search.service.QueryService?application=dongjia-web-service&category=providers&check=false&dubbo=2.8.4&interface=cn.idongjia.search.service.QueryService&methods=searchCraftsMan,searchItemWithPrice,searchItem&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044359316, cn.idongjia.tianji.services.ItemService=empty://10.0.0.24/cn.idongjia.tianji.services.ItemService?application=dongjia-web-service&category=configurators&check=false&dubbo=2.8.4&interface=cn.idongjia.tianji.services.ItemService&methods=add,onShelf,getEvaluateCount,getAll,tagItems,getLogs,addAndDown,searchCount,update,getFeed,craftsmans,delete,search,createAuction,getFeeds,offShelf,get,getAuction,addStock,topic,batchGet,getEvaluates,getCount&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044355306 empty://10.0.0.24/cn.idongjia.tianji.services.ItemService?application=dongjia-web-service&category=routers&check=false&dubbo=2.8.4&interface=cn.idongjia.tianji.services.ItemService&methods=add,onShelf,getEvaluateCount,getAll,tagItems,getLogs,addAndDown,searchCount,update,getFeed,craftsmans,delete,search,createAuction,getFeeds,offShelf,get,getAuction,addStock,topic,batchGet,getEvaluates,getCount&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044355306 empty://10.0.0.24/cn.idongjia.tianji.services.ItemService?application=dongjia-web-service&category=providers&check=false&dubbo=2.8.4&interface=cn.idongjia.tianji.services.ItemService&methods=add,onShelf,getEvaluateCount,getAll,tagItems,getLogs,addAndDown,searchCount,update,getFeed,craftsmans,delete,search,createAuction,getFeeds,offShelf,get,getAuction,addStock,topic,batchGet,getEvaluates,getCount&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044355306, cn.idongjia.auction.api.AuctionService=empty://10.0.0.24/cn.idongjia.auction.api.AuctionService?application=dongjia-web-service&category=configurators&check=false&dubbo=2.8.4&interface=cn.idongjia.auction.api.AuctionService&methods=createAuction,getMaxAuction,getAuctionRecord,getAuction,updateAuction,getAuctionRecordCount,searchAuctionCount,searchAuction&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044355418 empty://10.0.0.24/cn.idongjia.auction.api.AuctionService?application=dongjia-web-service&category=routers&check=false&dubbo=2.8.4&interface=cn.idongjia.auction.api.AuctionService&methods=createAuction,getMaxAuction,getAuctionRecord,getAuction,updateAuction,getAuctionRecordCount,searchAuctionCount,searchAuction&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044355418 empty://10.0.0.24/cn.idongjia.auction.api.AuctionService?application=dongjia-web-service&category=providers&check=false&dubbo=2.8.4&interface=cn.idongjia.auction.api.AuctionService&methods=createAuction,getMaxAuction,getAuctionRecord,getAuction,updateAuction,getAuctionRecordCount,searchAuctionCount,searchAuction&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044355418, cn.idongjia.tianji.services.AfterSaleService=empty://10.0.0.24/cn.idongjia.tianji.services.AfterSaleService?application=dongjia-web-service&category=configurators&check=false&dubbo=2.8.4&interface=cn.idongjia.tianji.services.AfterSaleService&methods=add,getAll,get,update,delete,getCount&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044355478 empty://10.0.0.24/cn.idongjia.tianji.services.AfterSaleService?application=dongjia-web-service&category=routers&check=false&dubbo=2.8.4&interface=cn.idongjia.tianji.services.AfterSaleService&methods=add,getAll,get,update,delete,getCount&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044355478 empty://10.0.0.24/cn.idongjia.tianji.services.AfterSaleService?application=dongjia-web-service&category=providers&check=false&dubbo=2.8.4&interface=cn.idongjia.tianji.services.AfterSaleService&methods=add,getAll,get,update,delete,getCount&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044355478, cn.idongjia.tianji.services.AutoTaskService=empty://10.0.0.24/cn.idongjia.tianji.services.AutoTaskService?application=dongjia-web-service&category=configurators&check=false&dubbo=2.8.4&interface=cn.idongjia.tianji.services.AutoTaskService&methods=addCollect&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044355958 empty://10.0.0.24/cn.idongjia.tianji.services.AutoTaskService?application=dongjia-web-service&category=routers&check=false&dubbo=2.8.4&interface=cn.idongjia.tianji.services.AutoTaskService&methods=addCollect&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044355958 empty://10.0.0.24/cn.idongjia.tianji.services.AutoTaskService?application=dongjia-web-service&category=providers&check=false&dubbo=2.8.4&interface=cn.idongjia.tianji.services.AutoTaskService&methods=addCollect&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044355958, cn.idongjia.kuaidi.services.ShipService=empty://10.0.0.24/cn.idongjia.kuaidi.services.ShipService?application=dongjia-web-service&category=configurators&check=false&dubbo=2.8.4&interface=cn.idongjia.kuaidi.services.ShipService&methods=add,deleteCompany,getCompanies,getAll,getShipment,subscribe,addCompany,update,getMessage,delete,getCount&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044359376 empty://10.0.0.24/cn.idongjia.kuaidi.services.ShipService?application=dongjia-web-service&category=routers&check=false&dubbo=2.8.4&interface=cn.idongjia.kuaidi.services.ShipService&methods=add,deleteCompany,getCompanies,getAll,getShipment,subscribe,addCompany,update,getMessage,delete,getCount&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044359376 empty://10.0.0.24/cn.idongjia.kuaidi.services.ShipService?application=dongjia-web-service&category=providers&check=false&dubbo=2.8.4&interface=cn.idongjia.kuaidi.services.ShipService&methods=add,deleteCompany,getCompanies,getAll,getShipment,subscribe,addCompany,update,getMessage,delete,getCount&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044359376, cn.idongjia.web.service.VideoViewService=empty://192.168.0.4:8080/presentation/cn.idongjia.web.service.VideoViewService?accepts=500&anyhost=true&application=doangjia-data-presentation&category=configurators&check=false&dubbo=2.8.4&extension=com.alibaba.dubbo.rpc.protocol.rest.support.LoggingFilter&generic=false&interface=cn.idongjia.web.service.VideoViewService&methods=getVideoViews,count&organization=dongjia&owner=dongjia&pid=611&server=servlet&side=provider&threads=500×tamp=1463817345564, cn.idongjia.web.service.PageViewService=empty://192.168.0.4:8080/presentation/cn.idongjia.web.service.PageViewService?accepts=500&anyhost=true&application=doangjia-data-presentation&category=configurators&check=false&dubbo=2.8.4&extension=com.alibaba.dubbo.rpc.protocol.rest.support.LoggingFilter&generic=false&interface=cn.idongjia.web.service.PageViewService&methods=getCount,getPageView&organization=dongjia&owner=dongjia&pid=1330&server=servlet&side=provider&threads=500×tamp=1463822156360, cn.idongjia.web.service.OrderChannelService=empty://192.168.0.4:8080/presentation/cn.idongjia.web.service.OrderChannelService?accepts=500&anyhost=true&application=doangjia-data-presentation&category=configurators&check=false&dubbo=2.8.4&extension=com.alibaba.dubbo.rpc.protocol.rest.support.LoggingFilter&generic=false&interface=cn.idongjia.web.service.OrderChannelService&methods=totalCountByOrderInfo,getChannelByOderInfo&organization=dongjia&owner=dongjia&pid=1330&server=servlet&side=provider&threads=500×tamp=1463822157325, cn.idongjia.web.service.ConversionRateService=empty://192.168.0.4:8080/presentation/cn.idongjia.web.service.ConversionRateService?accepts=500&anyhost=true&application=doangjia-data-presentation&category=configurators&check=false&dubbo=2.8.4&extension=com.alibaba.dubbo.rpc.protocol.rest.support.LoggingFilter&generic=false&interface=cn.idongjia.web.service.ConversionRateService&methods=getConversionRateCount,getConversionRate&organization=dongjia&owner=dongjia&pid=611&server=servlet&side=provider&threads=500×tamp=1463817345675, cn.idongjia.kunwu.service.RiskService=empty://10.0.0.24/cn.idongjia.kunwu.service.RiskService?application=dongjia-web-service&category=configurators&check=false&dubbo=2.8.4&interface=cn.idongjia.kunwu.service.RiskService&methods=execute&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044353160 empty://10.0.0.24/cn.idongjia.kunwu.service.RiskService?application=dongjia-web-service&category=routers&check=false&dubbo=2.8.4&interface=cn.idongjia.kunwu.service.RiskService&methods=execute&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044353160 empty://10.0.0.24/cn.idongjia.kunwu.service.RiskService?application=dongjia-web-service&category=providers&check=false&dubbo=2.8.4&interface=cn.idongjia.kunwu.service.RiskService&methods=execute&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044353160, cn.idongjia.article.services.ArticleService=empty://10.0.0.24/cn.idongjia.article.services.ArticleService?application=dongjia-web-service&category=configurators&check=false&dubbo=2.8.4&interface=cn.idongjia.article.services.ArticleService&methods=getRecommends,getTabs,getRed,getFeeds,getNewGoodNum,getNewGoodFeeds,getNewGoodTitle,getSearchInfo&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044359189 empty://10.0.0.24/cn.idongjia.article.services.ArticleService?application=dongjia-web-service&category=routers&check=false&dubbo=2.8.4&interface=cn.idongjia.article.services.ArticleService&methods=getRecommends,getTabs,getRed,getFeeds,getNewGoodNum,getNewGoodFeeds,getNewGoodTitle,getSearchInfo&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044359189 empty://10.0.0.24/cn.idongjia.article.services.ArticleService?application=dongjia-web-service&category=providers&check=false&dubbo=2.8.4&interface=cn.idongjia.article.services.ArticleService&methods=getRecommends,getTabs,getRed,getFeeds,getNewGoodNum,getNewGoodFeeds,getNewGoodTitle,getSearchInfo&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044359189, cn.idongjia.mq.config.MessageQueueService=empty://10.0.0.24/cn.idongjia.mq.config.MessageQueueService?application=dongjia-web-service&category=configurators&check=false&dubbo=2.8.4&interface=cn.idongjia.mq.config.MessageQueueService&methods=getMqConfig&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044356001 empty://10.0.0.24/cn.idongjia.mq.config.MessageQueueService?application=dongjia-web-service&category=routers&check=false&dubbo=2.8.4&interface=cn.idongjia.mq.config.MessageQueueService&methods=getMqConfig&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044356001 empty://10.0.0.24/cn.idongjia.mq.config.MessageQueueService?application=dongjia-web-service&category=providers&check=false&dubbo=2.8.4&interface=cn.idongjia.mq.config.MessageQueueService&methods=getMqConfig&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044356001, cn.idongjia.tianji.services.UserMergeService=empty://10.0.0.24/cn.idongjia.tianji.services.UserMergeService?application=dongjia-web-service&category=configurators&check=false&dubbo=2.8.4&interface=cn.idongjia.tianji.services.UserMergeService&methods=mergeAll,mergeByUid,isWxLogin,ifNeedMerge,merge&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044359443 empty://10.0.0.24/cn.idongjia.tianji.services.UserMergeService?application=dongjia-web-service&category=routers&check=false&dubbo=2.8.4&interface=cn.idongjia.tianji.services.UserMergeService&methods=mergeAll,mergeByUid,isWxLogin,ifNeedMerge,merge&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044359443 empty://10.0.0.24/cn.idongjia.tianji.services.UserMergeService?application=dongjia-web-service&category=providers&check=false&dubbo=2.8.4&interface=cn.idongjia.tianji.services.UserMergeService&methods=mergeAll,mergeByUid,isWxLogin,ifNeedMerge,merge&organization=dongjia&owner=dongjia&pid=27456&revision=1.2.3-63111df&side=consumer×tamp=1463044359443}, dubbo version: 2.8.4, current host: 127.0.0.1
[21/05/16 05:46:59:059 CST] ZkClient-EventThread-39-127.0.0.1:2181  INFO zkclient.ZkEventThread: Starting ZkClient event thread.
[21/05/16 05:46:59:059 CST] RMI TCP Connection(2)-127.0.0.1-EventThread  INFO zkclient.ZkClient: zookeeper state changed (SyncConnected)
[21/05/16 05:46:59:059 CST] RMI TCP Connection(2)-127.0.0.1  INFO zookeeper.ZookeeperRegistry:  [DUBBO] Register: rest://192.168.0.4:8080/test-demo/com.web.services.TestService?accepts=500&anyhost=true&application=test-demo&dubbo=2.8.4&extension=com.alibaba.dubbo.rpc.protocol.rest.support.LoggingFilter&generic=false&interface=com.web.services.TestService&methods=sayHello&organization=freedom&owner=Joyven&pid=1417&server=servlet&side=provider&threads=500×tamp=1463824018811, dubbo version: 2.8.4, current host: 127.0.0.1
[21/05/16 05:46:59:059 CST] RMI TCP Connection(2)-127.0.0.1  INFO zookeeper.ZookeeperRegistry:  [DUBBO] Subscribe: provider://192.168.0.4:8080/test-demo/com.web.services.TestService?accepts=500&anyhost=true&application=test-demo&category=configurators&check=false&dubbo=2.8.4&extension=com.alibaba.dubbo.rpc.protocol.rest.support.LoggingFilter&generic=false&interface=com.web.services.TestService&methods=sayHello&organization=freedom&owner=Joyven&pid=1417&server=servlet&side=provider&threads=500×tamp=1463824018811, dubbo version: 2.8.4, current host: 127.0.0.1
[21/05/16 05:46:59:059 CST] RMI TCP Connection(2)-127.0.0.1  INFO zookeeper.ZookeeperRegistry:  [DUBBO] Notify urls for subscribe url provider://192.168.0.4:8080/test-demo/com.web.services.TestService?accepts=500&anyhost=true&application=test-demo&category=configurators&check=false&dubbo=2.8.4&extension=com.alibaba.dubbo.rpc.protocol.rest.support.LoggingFilter&generic=false&interface=com.web.services.TestService&methods=sayHello&organization=freedom&owner=Joyven&pid=1417&server=servlet&side=provider&threads=500×tamp=1463824018811, urls: [empty://192.168.0.4:8080/test-demo/com.web.services.TestService?accepts=500&anyhost=true&application=test-demo&category=configurators&check=false&dubbo=2.8.4&extension=com.alibaba.dubbo.rpc.protocol.rest.support.LoggingFilter&generic=false&interface=com.web.services.TestService&methods=sayHello&organization=freedom&owner=Joyven&pid=1417&server=servlet&side=provider&threads=500×tamp=1463824018811], dubbo version: 2.8.4, current host: 127.0.0.1
[2016-05-21 05:46:59,636] Artifact Gradle : Joyven:test : test-demo.war (exploded): Artifact is deployed successfully
[2016-05-21 05:46:59,637] Artifact Gradle : Joyven:test : test-demo.war (exploded): Deploy took 7,350 milliseconds
[21/05/16 05:47:00:000 CST] http-nio-8080-exec-1  WARN core.ExceptionHandler: failed to execute
javax.ws.rs.NotFoundException: Could not find resource for full path: http://localhost:8080//
    at org.jboss.resteasy.core.registry.ClassNode.match(ClassNode.java:73)
    at org.jboss.resteasy.core.registry.RootClassNode.match(RootClassNode.java:48)
    at org.jboss.resteasy.core.ResourceMethodRegistry.getResourceInvoker(ResourceMethodRegistry.java:444)

有一个错误,说的是http://localhost:8080/找不到,因为我们的请求路径在web.xml中做了过滤,不支持这种请求,它必须是service中的@path指定的路由。

先跑一个demo:

com.web.service/TestService.java

package com.web.service;

import java.util.List;

/**
 * Created by zhoujunwen on 16/5/21.
 */
public interface TestService {
    List sayHello();
}

com.web.biz/TestServiceImpl.java

package com.web.biz;

import com.alibaba.dubbo.rpc.protocol.rest.support.ContentType;
import com.web.service.TestService;
import org.springframework.stereotype.Component;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import java.util.ArrayList;
import java.util.List;


@Component("testService")
@Path("test")
@Produces({ContentType.APPLICATION_JSON_UTF_8})
public class TestServiceImpl implements TestService {
    @Override
    @GET
    @Path("say")
    public List sayHello() {
        List list = new ArrayList<>();
        list.add("I am a test service");
        return list;
    }
}

使用gradle命令编译打包,gradle clean build --daemon,打包完后运行代码,服务启动后,在浏览器中访问:http://127.0.0.1:8080/test-demo/test/say,可以看到页面中的内容:

在Advance REST Client中看到是这样的:

下面实现一个与mybatis整合的demo。

配置mybatis

在main/resource/META-INF/spring/下面创建mybatis.xml文件:




    

    
        
    

    
    
        
        
        
        
        
        
        

        
        

        
        

        
        

        

        
        
        

        
        

        
        
        
        
    

    
        
            
            
            
            
            
            
        
    

    
                 
               
              

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/65949.html

相关文章

  • Spring Boot QuickStart (1)

    摘要:开始介绍简化了基于的应用开发,你只需要就能创建一个独立的,产品级别的应用。该包含很多搭建,快速运行项目所需的依赖,并提供一致的,可管理传递性的依赖集。日志级别通过标识开启控制台级别日志记录,也可以在中指定日志级别配置示例 开始 介绍 Spring Boot 简化了基于 Spring 的应用开发,你只需要 run 就能创建一个独立的,产品级别的 Spring 应用。 Spring 平台...

    klinson 评论0 收藏0
  • 《 Kotlin + Spring Boot : 下一代 Java 服务端开发 》

    摘要:下一代服务端开发下一代服务端开发第部门快速开始第章快速开始环境准备,,快速上手实现一个第章企业级服务开发从到语言的缺点发展历程的缺点为什么是产生的背景解决了哪些问题为什么是的发展历程容器的配置地狱是什么从到下一代企业级服务开发在移动开发领域 《 Kotlin + Spring Boot : 下一代 Java 服务端开发 》 Kotlin + Spring Boot : 下一代 Java...

    springDevBird 评论0 收藏0
  • Spring 指南(目录)

    摘要:指南无论你正在构建什么,这些指南都旨在让你尽快提高工作效率使用团队推荐的最新项目版本和技术。使用进行消息传递了解如何将用作消息代理。安全架构的主题指南,这些位如何组合以及它们如何与交互。使用的主题指南以及如何为应用程序创建容器镜像。 Spring 指南 无论你正在构建什么,这些指南都旨在让你尽快提高工作效率 — 使用Spring团队推荐的最新Spring项目版本和技术。 入门指南 这些...

    only_do 评论0 收藏0
  • 海航生态科技舆情大数据平台容器化改造

    摘要:本文转载自微信公众号账号,作者为海航生态科技技术研究院大数据开发工程师高颜。文章介绍了海航生态科技舆情大数据平台的容器化改造经验,包括初期技术架构应用容器化架构迁移持续发布与部署。 本文转载自微信公众号Docker(账号:dockerone),作者为海航生态科技技术研究院大数据开发工程师高颜。 文章介绍了海航生态科技舆情大数据平台的容器化改造经验,包括初期技术架构、应用容器化、架构迁...

    idealcn 评论0 收藏0
  • Spring 指南(构建RESTful Web服务

    摘要:构建服务本指南将引导你完成使用创建服务的过程。接下来,你将创建将为这些问候语提供服务的资源控制器。告诉在包中查找其他组件配置和服务,允许它找到控制器。显示日志输出,该服务应在几秒内启动并运行。 构建RESTful Web服务 本指南将引导你完成使用Spring创建hello world RESTful Web服务的过程。 将要构建什么 你将构建一个接受HTTP GET请求的服务: ht...

    yzzz 评论0 收藏0

发表评论

0条评论

最新活动
阅读需要支付1元查看
<