成人国产在线小视频_日韩寡妇人妻调教在线播放_色成人www永久在线观看_2018国产精品久久_亚洲欧美高清在线30p_亚洲少妇综合一区_黄色在线播放国产_亚洲另类技巧小说校园_国产主播xx日韩_a级毛片在线免费

資訊專欄INFORMATION COLUMN

dubbox/dubbo+spring+mybatis+gradle構(gòu)建REST服務(wù)

fireflow / 3345人閱讀

摘要:修正了在上的部分修正了比如協(xié)議中序列化的問題。配置文件在配置配置在目錄下面配置后的工程基本目錄結(jié)構(gòu)在項(xiàng)目

雜七雜八的雜

個(gè)人博客: 呆萌的程序猿
原文:dubbox/dubbo+spring+mybatis+gradle構(gòu)建REST服務(wù)
聲明:
由于sf的編輯自動(dòng)校驗(yàn),導(dǎo)致某些英文單詞出錯(cuò),例如:gradle被編輯器自動(dòng)替換為grade,jdk替換為idk等,查看的時(shí)候,請(qǐng)自行翻譯。

------------------------------多圖預(yù)警------------------------------

什么是dubbox?看看別人怎么說的:

Dubbox是Dubbo的一個(gè)擴(kuò)展,假如你知道java, javax 和 dubbo,那你就會(huì)明白dubbox是什么了。

Dubbox增加的功能如RESTful remoting, Kyro/FST 系列化等。它已經(jīng)應(yīng)用在當(dāng)當(dāng)網(wǎng)內(nèi)部的多個(gè)項(xiàng)目中。

dubbox的功能

支持REST風(fēng)格遠(yuǎn)程調(diào)用(HTTP + JSON/XML):基于非常成熟的JBoss RestEasy框架,在dubbo中實(shí)現(xiàn)了REST風(fēng)格(HTTP + JSON/XML)的遠(yuǎn)程調(diào)用,以顯著簡(jiǎn)化企業(yè)內(nèi)部的跨語言交互,同時(shí)顯著簡(jiǎn)化企業(yè)對(duì)外的Open API、無線API甚至AJAX服務(wù)端等等的開發(fā)。事實(shí)上,這個(gè)REST調(diào)用也使得Dubbo可以對(duì)當(dāng)今特別流行的“微服務(wù)”架構(gòu)提供基礎(chǔ)性支持。 另外,REST調(diào)用也達(dá)到了比較高的性能,在基準(zhǔn)測(cè)試下,HTTP + JSON與Dubbo 2.x默認(rèn)的RPC協(xié)議(即TCP + Hessian2二進(jìn)制序列化)之間只有1.5倍左右的差距,詳見文檔中的基準(zhǔn)測(cè)試報(bào)告。

支持基于Kryo和FST的Java高效序列化實(shí)現(xiàn):基于當(dāng)今比較知名的Kryo和FST高性能序列化庫(kù),為Dubbo 默認(rèn)的RPC協(xié)議添加新的序列化實(shí)現(xiàn),并優(yōu)化調(diào)整了其序列化體系,比較顯著的提高了Dubbo RPC的性能,詳見文檔中的基準(zhǔn)測(cè)試報(bào)告。

支持基于嵌入式Tomcat的HTTP remoting體系:基于嵌入式tomcat實(shí)現(xiàn)dubbo 的HTTP remoting體系(即dubbo-remoting-http),用以逐步取代Dubbo中舊版本的嵌入式Jetty,可以顯著的提高REST等的遠(yuǎn)程調(diào)用性能,并將Servlet API的支持從2.5升級(jí)到3.1。(注:除了REST,dubbo中的WebServices、Hessian、HTTP Invoker等協(xié)議都基于這個(gè)HTTP remoting體系)。

升級(jí)Spring:將dubbo中Spring由2.x升級(jí)到目前最常用的3.x版本,減少版本沖突帶來的麻煩

升級(jí)ZooKeeper客戶端:將dubbo中的zookeeper客戶端升級(jí)到最新的版本,以修正老版本中包含的bug。

調(diào)整Demo應(yīng)用:暫時(shí)將dubbo的demo應(yīng)用調(diào)整并改寫以主要演示REST功能和新的Java高效序列化等等。

修正了在JDK1.7上dubbo的部分bug:修正了比如dubbo協(xié)議中json序列化的問題。但是還沒有修正所有發(fā)現(xiàn)的bug。

注:dubbox和dubbo 2.x是兼容的,沒有改變dubbo的任何已有的功能和配置方式(除了升級(jí)了spring之類的版本)

注:以上文字均為《Dubbo擴(kuò)展:Dubbox》一文。

環(huán)境安裝 jdk安裝

能看此文的人,我假設(shè)你會(huì)安裝java開發(fā)環(huán)境,此處省略999+的廢話,否則你看到此處心中一定會(huì)奔騰著十萬匹草泥馬。

gradle安裝

如題,Mac開發(fā)環(huán)境,windows請(qǐng)自行實(shí)踐,如果出了什么問題,別罵我就行。

廢話少說,言歸正傳。

相信你看到這里會(huì)對(duì)gradle多多少少有些了解,如果不了解,也沒關(guān)系,gradle就是maven的升級(jí)版,也適用于java項(xiàng)目的包管理器,它拋棄了如maven基于xml的繁瑣配置。

Gradle是一個(gè)基于JVM的構(gòu)建工具,它提供了:

像Ant一樣,通用靈活的構(gòu)建工具

可以切換的,基于約定的構(gòu)建框架

強(qiáng)大的多工程構(gòu)建支持

基于Apache Ivy的強(qiáng)大的依賴管理

支持maven, Ivy倉(cāng)庫(kù)

支持傳遞性依賴管理,而不需要遠(yuǎn)程倉(cāng)庫(kù)或者是pom.xml和ivy.xml配置文件。

對(duì)Ant的任務(wù)做了很好的集成

基于Groovy,build腳本使用Groovy編寫

有廣泛的領(lǐng)域模型支持構(gòu)建

安裝jdk。安裝gradle之前一定先安裝jdk,并配置JAVA_HOME環(huán)境變量。因?yàn)間radle是用Groovy編寫的,而Groovy基于JAVA。

用vim打開根目錄下的 ~/.bashrc或者~/.bash_profile配置用戶級(jí)別的環(huán)境變量,或者打開/etc/profile文件配置系統(tǒng)級(jí)別的環(huán)境變量,將下面的內(nèi)容復(fù)制到上述文件之一保存(vim保存,編輯后先按ESC進(jìn)入命令模式,輸入:wq保存并退出,然后加載配置后的文件,用命令source ~/.bashrc或者source ~/.bash_profile或者source /etc/profile)即可。

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

下載。在這里下載gradle。


解壓。
下載好的文件是zip格式,mac下載后自動(dòng)解壓,如果沒有自動(dòng)解壓,在findler中打開下載目錄,雙擊即可解壓,如果還不行,執(zhí)行命令解壓,mac自帶了unzip命令工具,如果沒有unzip,使用brew安裝吧。

安裝unzip命令:

brew install unzip

解壓zip文件命令:

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

上面命令解釋:cd首先進(jìn)入到你的工作空間,xxx替換為個(gè)人用戶名;然后執(zhí)行unzip命令解壓gradle。

PS:說一下我的安裝習(xí)慣吧。

一般情況下,用命令安裝的軟件基本都在/usr/local/Cellar/目錄下面,二進(jìn)制文件可能會(huì)軟連接到/usr/local/bin/和/usr/local/sbin/目錄下面,配置文件在/usr/local/etc/目錄下面。

但是,有一些軟件還是喜歡放在個(gè)人工作空間,用起來比較方便。比如tomcat,zookeeper,gradle,jmeter等工具,放在用戶目錄下面的Documents/software目錄下,software原來沒有,自建一個(gè)software文件夾。

上面是我的工作空間。只希望給自己創(chuàng)建一個(gè)干凈整齊的工作空間。

gradle配置

在gradle的根目錄下面,找到init.d目錄,這就是它的配置文件夾,里面有一個(gè)磨人的配置文件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"
        }
    }
}

上面的倉(cāng)庫(kù)地址可以改成你自己的maven倉(cāng)庫(kù),也可以指定為第三方的maven倉(cāng)庫(kù)。我這里是本地搭建的,請(qǐng)記得修改。

tomcat安裝

下載:tomcat的下載點(diǎn)擊這里
首先登錄官網(wǎng),點(diǎn)擊導(dǎo)航菜單的download,進(jìn)入下載頁面。左邊欄就能看到download的下面的一些版本,建議下載8,不要用9,這里只說mac的,我嘗試了幾次,9在IDEA編輯中運(yùn)行代碼回報(bào)錯(cuò)誤權(quán)限不足,而我的tomcat的意境是777的權(quán)限,網(wǎng)上查了一下,也沒有更好的解決方案,都是chmod給*.sh權(quán)限。


以8版本為例,點(diǎn)擊進(jìn)入之后就是這樣的:

mac和linux用戶還是選擇tar.gz格式,我們只需要下載Core的包,其他的估計(jì)也用不上,完整文檔的就別下載了,我相信自己不會(huì)去看的,除非你不相信自己或者過分相信自己。
解壓:使用tar命令就好,假設(shè)你已經(jīng)進(jìn)入到下載目錄:

tar -zxvf apache-tomcat-8.0.35.tar

忽然發(fā)現(xiàn),下載的tomcat8的文件格式不是tar.gz,而是tar;tomcat9的卻是tar.gz。不管哪一種,解壓命令一樣,都可達(dá)到你要的效果。

zookeeper安裝

zk的下載和安裝網(wǎng)上有很多教程,這里不做詳細(xì)的講解。默認(rèn)情況下,運(yùn)行代碼之前假設(shè)已經(jīng)開啟了zk,開啟命令:

sudo sh zkServer.sh start

再次強(qiáng)調(diào),運(yùn)行dubbox/dubbo構(gòu)建的代碼,一定要開啟zk,端口默認(rèn)2181,如果你修改了端口,后面提到的config.properties文件中記得修改。

用IDEA搭建框架

幫助別人,其實(shí)是在幫助自己;紀(jì)錄總會(huì)有用處,只是需要到一定的時(shí)機(jī)。
[寫作感悟]
環(huán)境終于配置結(jié)束了。

首先搭建一個(gè)簡(jiǎn)單的gradle的project。

打開IDEA,選擇創(chuàng)建一個(gè)新工程[Create New Project]

選擇gradle,然后選擇jdk,右下角next:

接下來填寫groupie,artifacts,version,這三個(gè)值構(gòu)成了一個(gè)坐標(biāo)系統(tǒng),這是maven標(biāo)識(shí)一個(gè)工程的唯一依據(jù),gradle依然在使用這個(gè)坐標(biāo)。

本地配置了gradle,就選擇使用本地的吧,勾選一下自動(dòng)創(chuàng)建空內(nèi)容根目錄,也就是幫你創(chuàng)建了src,resource等資源文件夾:

接下來可以改一下project name為test-demo.
我們的工程目錄如下:

IDEA很神奇,提供了命令窗口,當(dāng)然沒有mac的好用,對(duì)中文的致辭不友好。在改窗口下輸入命令(build命令在以后經(jīng)常用到,用于構(gòu)建打包):

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的時(shí)候,打包的war包文件名,不是帶有一串很長(zhǎng)的groupid,version等信息的包名,而是指定的包,如test-demo.war。

配置玩gradle后,執(zhí)行上面說過的build命令gradle clean build --daemon,構(gòu)建依賴包,此過程如果用的是第三方的maven倉(cāng)庫(kù),可能事件會(huì)很長(zhǎng)。

----------- 本來以為一篇就寫完了,前戲太長(zhǎng),一篇容納不下,但是,sf表字段肯定足夠大,表擔(dān)心,我們還是繼續(xù)把這場(chǎng)戲演完------------

項(xiàng)目基本配置 工程結(jié)構(gòu)

在main文件夾下面新建一個(gè)webapp,webapp下心間一個(gè)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

上面的目錄結(jié)構(gòu)就是我的工程結(jié)構(gòu),其中一部份idea和gradle的文件沒有貼出來。

spring配置

在resource目錄下創(chuàng)建一個(gè)文件夾:META-INF.spring,在改文件夾下面創(chuàng)建一個(gè)spring配置文件services-config.xml。






    

    

    

    
        
        
        
            
                
                classpath:conf/properties/*.properties
            
        
    


    

    
    


    
    

    

    

    

    

說明:

該文件配置的就是你所期望的dubbox/dubbo和spring的信息。這一句配置的內(nèi)容暫時(shí)為空,后面要指定我們要掃描的包。

這一句指出dubbo應(yīng)用的名字、所屬以及組織,name一半填寫工程名字,owner一般指定為公司,或者項(xiàng)目組,organization一般為公司,我是自用組織者,哈哈?~~

估計(jì)眼明的你已經(jīng)看到了,extension="com.alibaba.dubbo.rpc.protocol.rest.support.LoggingFilter"/>,這里面的配置都是動(dòng)態(tài)獲取的,${variable}指代properties文件中配置的屬性。

port的配置必須與服務(wù)器的端口相同,這個(gè)是實(shí)現(xiàn)rest服務(wù)所必須要求的,而在dubbo中是不做要求的,因?yàn)閐ubbo只是一個(gè)服務(wù)提供方,不提供直接通過http協(xié)議訪問。

contextpath路徑必須與工程部署的路徑相同,意思呢,就是contextpath的值和war包的名字一樣。

server 如果不指定,默認(rèn)啟動(dòng)Jetty服務(wù)器,如果是tomcat指定servlet,方便在web.xml中配置rest過濾器。如果配置成tomcat,則會(huì)出現(xiàn)一些錯(cuò)誤。

配置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/目錄下面:





 
  
   
  
 
 
  
  
  
   
  
 
 
  
  
  
 
?配置后的工程基本目錄結(jié)構(gòu)
|____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

在項(xiàng)目的main文件夾下面新建幾個(gè)包:
com.web.service (接口)
com.web.biz (實(shí)現(xiàn)+業(yè)務(wù))
com.web.repository (dao層)
com.web.mapper (db映射mapper)

至此,一個(gè)完整的項(xiàng)目結(jié)構(gòu)成型。回過頭來,修改spring的配置,指明掃描包路徑。services-config.xml中的這一句替換為。

這個(gè)很重要,否則會(huì)報(bào)錯(cuò)誤。

現(xiàn)在我們?cè)贗DEA中配置tomcat,然后運(yùn)行一下,應(yīng)該可以啟動(dòng)了。
打印的日志如下:

/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)

有一個(gè)錯(cuò)誤,說的是http://localhost:8080/找不到,因?yàn)槲覀兊恼?qǐng)求路徑在web.xml中做了過濾,不支持這種請(qǐng)求,它必須是service中的@path指定的路由。

先跑一個(gè)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,打包完后運(yùn)行代碼,服務(wù)啟動(dòng)后,在瀏覽器中訪問:http://127.0.0.1:8080/test-demo/test/say,可以看到頁面中的內(nèi)容:

在Advance REST Client中看到是這樣的:

下面實(shí)現(xiàn)一個(gè)與mybatis整合的demo。

配置mybatis

在main/resource/META-INF/spring/下面創(chuàng)建mybatis.xml文件:




    

    
        
    

    
    
        
        
        
        
        
        
        

        
        

        
        

        
        

        

        
        
        

        
        

        
        
        
        
    

    
        
            
            
            
            
            
            
        
    

    
                 
               
              

文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。

轉(zhuǎn)載請(qǐng)注明本文地址:http://systransis.cn/yun/65949.html

相關(guān)文章

  • Spring Boot QuickStart (1)

    摘要:開始介紹簡(jiǎn)化了基于的應(yīng)用開發(fā),你只需要就能創(chuàng)建一個(gè)獨(dú)立的,產(chǎn)品級(jí)別的應(yīng)用。該包含很多搭建,快速運(yùn)行項(xiàng)目所需的依賴,并提供一致的,可管理傳遞性的依賴集。日志級(jí)別通過標(biāo)識(shí)開啟控制臺(tái)級(jí)別日志記錄,也可以在中指定日志級(jí)別配置示例 開始 介紹 Spring Boot 簡(jiǎn)化了基于 Spring 的應(yīng)用開發(fā),你只需要 run 就能創(chuàng)建一個(gè)獨(dú)立的,產(chǎn)品級(jí)別的 Spring 應(yīng)用。 Spring 平臺(tái)...

    klinson 評(píng)論0 收藏0
  • 《 Kotlin + Spring Boot : 下一代 Java 服務(wù)端開發(fā) 》

    摘要:下一代服務(wù)端開發(fā)下一代服務(wù)端開發(fā)第部門快速開始第章快速開始環(huán)境準(zhǔn)備,,快速上手實(shí)現(xiàn)一個(gè)第章企業(yè)級(jí)服務(wù)開發(fā)從到語言的缺點(diǎn)發(fā)展歷程的缺點(diǎn)為什么是產(chǎn)生的背景解決了哪些問題為什么是的發(fā)展歷程容器的配置地獄是什么從到下一代企業(yè)級(jí)服務(wù)開發(fā)在移動(dòng)開發(fā)領(lǐng)域 《 Kotlin + Spring Boot : 下一代 Java 服務(wù)端開發(fā) 》 Kotlin + Spring Boot : 下一代 Java...

    springDevBird 評(píng)論0 收藏0
  • Spring 指南(目錄)

    摘要:指南無論你正在構(gòu)建什么,這些指南都旨在讓你盡快提高工作效率使用團(tuán)隊(duì)推薦的最新項(xiàng)目版本和技術(shù)。使用進(jìn)行消息傳遞了解如何將用作消息代理。安全架構(gòu)的主題指南,這些位如何組合以及它們?nèi)绾闻c交互。使用的主題指南以及如何為應(yīng)用程序創(chuàng)建容器鏡像。 Spring 指南 無論你正在構(gòu)建什么,這些指南都旨在讓你盡快提高工作效率 — 使用Spring團(tuán)隊(duì)推薦的最新Spring項(xiàng)目版本和技術(shù)。 入門指南 這些...

    only_do 評(píng)論0 收藏0
  • 海航生態(tài)科技輿情大數(shù)據(jù)平臺(tái)容器化改造

    摘要:本文轉(zhuǎn)載自微信公眾號(hào)賬號(hào),作者為海航生態(tài)科技技術(shù)研究院大數(shù)據(jù)開發(fā)工程師高顏。文章介紹了海航生態(tài)科技輿情大數(shù)據(jù)平臺(tái)的容器化改造經(jīng)驗(yàn),包括初期技術(shù)架構(gòu)應(yīng)用容器化架構(gòu)遷移持續(xù)發(fā)布與部署。 本文轉(zhuǎn)載自微信公眾號(hào)Docker(賬號(hào):dockerone),作者為海航生態(tài)科技技術(shù)研究院大數(shù)據(jù)開發(fā)工程師高顏。 文章介紹了海航生態(tài)科技輿情大數(shù)據(jù)平臺(tái)的容器化改造經(jīng)驗(yàn),包括初期技術(shù)架構(gòu)、應(yīng)用容器化、架構(gòu)遷...

    idealcn 評(píng)論0 收藏0
  • Spring 指南(構(gòu)建RESTful Web服務(wù)

    摘要:構(gòu)建服務(wù)本指南將引導(dǎo)你完成使用創(chuàng)建服務(wù)的過程。接下來,你將創(chuàng)建將為這些問候語提供服務(wù)的資源控制器。告訴在包中查找其他組件配置和服務(wù),允許它找到控制器。顯示日志輸出,該服務(wù)應(yīng)在幾秒內(nèi)啟動(dòng)并運(yùn)行。 構(gòu)建RESTful Web服務(wù) 本指南將引導(dǎo)你完成使用Spring創(chuàng)建hello world RESTful Web服務(wù)的過程。 將要構(gòu)建什么 你將構(gòu)建一個(gè)接受HTTP GET請(qǐng)求的服務(wù): ht...

    yzzz 評(píng)論0 收藏0

發(fā)表評(píng)論

0條評(píng)論

最新活動(dòng)
閱讀需要支付1元查看
<