Dubbo+Zookeeper+Springmvc整合

下面先來介紹安裝zookeeper: 
解壓zookeeper-3.4.6.tar.gz到指定目錄,進入zookeeper-3.4.6\conf目錄並複製zoo_sample.cfg文件更名爲zoo.cfg,由於zookeeper啓動時默認找zoo.cfg這個文件,修改zoo.cfg文件內容以下: javascript

Java代碼 css

核心技術:Maven,Springmvc mybatis shiro, Druid, Restful, Dubbo, ZooKeeper,Redis,FastDFS,ActiveMQ,Nginx html

  1. # The number of milliseconds of each tick  
  2. tickTime=2000  
  3. # The number of ticks that the initial   
  4. # synchronization phase can take  
  5. initLimit=10  
  6. # The number of ticks that can pass between   
  7. # sending a request and getting an acknowledgement  
  8. syncLimit=5  
  9. # the directory where the snapshot is stored.  
  10. # do not use /tmp for storage, /tmp here is just   
  11. # example sakes.  
  12. dataDir=D:\zookeeper-3.4.6\zookeeperinstall\data  
  13. # the port at which the clients will connect  
  14. clientPort=2181  
  15. # the maximum number of client connections.  
  16. # increase this if you need to handle more clients  
  17. #maxClientCnxns=60  
  18. #  
  19. # Be sure to read the maintenance section of the   
  20. # administrator guide before turning on autopurge.  
  21. #  
  22. # http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance  
  23. #  
  24. # The number of snapshots to retain in dataDir  
  25. #autopurge.snapRetainCount=3  
  26. # Purge task interval in hours  
  27. # Set to "0" to disable auto purge feature  
  28. #autopurge.purgeInterval=1  


到此zookeeper安裝完畢,進入zookeeper-3.4.6\bin目錄,執行zkServer.cmd或者zkServer.sh腳本就能夠啓動zookeeper了,例如在Windows下進入cmd命令行,D:\zookeeper-3.4.6\bin>zkServer.cmd  這裏直接回車便可。 


安裝dubbo-admin-2.5.4.war管理控制檯: 
把apache-tomcat-6.0.43/webapps/ROOT目錄中的全部內容所有刪除掉,把dubbo-admin-2.5.4.war文件解壓並把所有內容拷貝到apache-tomcat-6.0.43/webapps/ROOT目錄下,以下圖 

修改WEB-INF目錄下的dubbo.properties文件: 
dubbo.registry.address=zookeeper://127.0.0.1:2181 
dubbo.admin.root.password=root 
dubbo.admin.guest.password=guest 
啓動tomcat 
訪問http://127.0.0.1:8080/governance/applications/ 
登陸的用戶名和密碼都是root,不是root/guest 

到此爲止dubbo-admin-2.5.4.war管理控制檯安裝完畢。 


下面編寫服務提供者代碼: 
 
applicationCustomer.xml文件代碼以下: java

Java代碼 web

 收藏代碼

  1. <?xml version="1.0" encoding="UTF-8"?>    
  2. <beans xmlns="http://www.springframework.org/schema/beans"    
  3.   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"    
  4.   xsi:schemaLocation="http://www.springframework.org/schema/beans    
  5.     http://www.springframework.org/schema/beans/spring-beans.xsd    
  6.     http://code.alibabatech.com/schema/dubbo    
  7.     http://code.alibabatech.com/schema/dubbo/dubbo.xsd ">   
  8.   <!-- 具體的實現bean -->    
  9.   <bean id="demoService" class="com.shihuan.zooshare.service.impl.CustomerServiceImpl" />    
  10.   <!-- 提供方應用信息,用於計算依賴關係 -->    
  11.   <dubbo:application name="shihuan_customer"  />    
  12.   <!-- 使用multicast廣播註冊中心暴露服務地址     
  13.   <dubbo:registry address="multicast://localhost:1234" />-->     
  14.   <!-- 使用zookeeper註冊中心暴露服務地址 -->    
  15.   <dubbo:registry address="zookeeper://127.0.0.1:2181" />    
  16.   <!-- 用dubbo協議在20880端口暴露服務 -->    
  17.   <dubbo:protocol name="dubbo" port="20880" />    
  18.   <!-- 聲明須要暴露的服務接口 -->    
  19.   <dubbo:service interface="com.shihuan.zooshare.service.CustomerService" ref="demoService" />  
  20. </beans>  


CustomerService.java文件代碼以下: spring

Java代碼 sql

 收藏代碼

  1. package com.shihuan.zooshare.service;  
  2.   
  3. public interface CustomerService {  
  4.     public String getName();  
  5. }  


CustomerServiceImpl.java代碼以下: express

Java代碼 apache

 收藏代碼

  1. package com.shihuan.zooshare.service.impl;  
  2.   
  3. import com.shihuan.zooshare.service.CustomerService;  
  4.   
  5. public class CustomerServiceImpl implements CustomerService {  
  6.   
  7.     @Override  
  8.     public String getName() {  
  9.         System.out.print("shihuan print !!!");  
  10.         return "print result !!!";  
  11.     }  
  12.   
  13. }  


DubooCustomer.java文件代碼以下: json

Java代碼 

 收藏代碼

  1. package com.shihuan.zooshare.main;  
  2.   
  3. import java.io.IOException;  
  4.   
  5. import org.springframework.beans.BeansException;  
  6. import org.springframework.context.support.ClassPathXmlApplicationContext;  
  7.   
  8. public class DubooCustomer {  
  9.   
  10.     public static void main(String[] args) {  
  11.         try {  
  12.             ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[]{"applicationCustomer.xml"});  
  13.             context.start();    
  14.             System.out.println("Press any key to exit.");  
  15.               
  16.             System.in.read();  
  17.         } catch (BeansException e) {  
  18.             System.err.println(e.getMessage());  
  19.             e.printStackTrace();  
  20.         } catch (IOException e) {  
  21.             System.err.println(e.getMessage());  
  22.             e.printStackTrace();  
  23.         }  
  24.     }  
  25.   
  26. }  


build.xml文件內容以下: 

Java代碼 

 收藏代碼

  1. <?xml version="1.0" encoding="UTF-8" ?>  
  2. <project name="zooshare" default="genericjar" basedir=".">  
  3. <property name="src" value="${basedir}/src"/>  
  4. <property name="classes" value="${basedir}/bin"/>  
  5. <property name="dest" value="${basedir}/dist"/>  
  6. <property name="zooshare" value="zooshare.jar"/>  
  7. <property name="mainclass" value="com.shihuan.zooshare.main.DubooCustomer" />  
  8.       
  9.     <path id="lib-classpath">    
  10.             <fileset dir="${basedir}/lib">    
  11.                 <include name="**/*.jar"/>       
  12.                 <exclude name="**/*.bak"/>    
  13.             </fileset>    
  14.         </path>  
  15.       
  16.     <target name="clean">    
  17.             <delete dir="${basedir}/bin" />    
  18.             <delete dir="${basedir}/dist" />    
  19.         </target>  
  20.       
  21. <target name="init">  
  22.    <mkdir dir="${dest}"/>  
  23. </target>  
  24. <target name="compile" depends="init">  
  25.    <javac encoding="utf-8" srcdir="${src}" destdir="${dest}" includeantruntime="false" source="1.6" debug="yes" verbose="yes" failonerror="true" optimize="false">  
  26.         <compilerarg line="-encoding UTF-8"/>       
  27.         <classpath refid="lib-classpath" />  
  28.    </javac>  
  29.     <copy todir="${classes}">        
  30.                 <fileset dir="${src}">        
  31.                     <include name="**/*.properties"/>    
  32.                     <include name="**/*.xml"/>    
  33.                     <exclude name="**/*.bak"/>      
  34.                 </fileset>        
  35.             </copy>  
  36. </target>   
  37.       
  38.     <target name="antjar" depends="compile">    
  39.             <!--Create a property containing all .jar files,      
  40.             prefix lib/, and seperated with a space-->      
  41.             <pathconvert property="mf.classpath" pathsep=" ">      
  42.                 <mapper>      
  43.                     <chainedmapper>      
  44.                         <!-- jar包文件只留文件名,去掉目錄信息 -->      
  45.                         <flattenmapper/>      
  46.                         <!-- add lib/ prefix -->      
  47.                         <globmapper from="*" to="lib/*"/>      
  48.                     </chainedmapper>      
  49.                 </mapper>     
  50.                 <path refid="lib-classpath"/>    
  51.             </pathconvert>    
  52.             <jar destfile="${dest}/zooshare.jar" basedir="${classes}">      
  53.                 <manifest>      
  54.                     <attribute name="Main-class" value="${mainclass}"/>      
  55.                     <attribute name="Class-Path" value="${mf.classpath}"/>      
  56.                 </manifest>      
  57.             </jar>    
  58.           
  59.         </target>   
  60.       
  61.     <target name="genericjar" depends="antjar"></target>  
  62. </project>  



zooshare.jar服務的結構以下圖所示: 


startZooshare.bat文件內容以下: 

Java代碼 

 收藏代碼

  1. @echo off  
  2. set CURR_DIR=D:\AppDynamics\dubbo+zookeeper\zooshare  
  3. cd /D %CURR_DIR%  
  4.   
  5. set JAVA_HOME=D:\Java\jdk1.6.0_45  
  6.   
  7. set PATH=%JAVA_HOME%\bin;%PATH%  
  8.   
  9. rem 設置變量爲延遲加載  
  10. setlocal=EnableDelayedExpansion  
  11. set CLASSPATH=.;%JAVA_HOME%\lib;%JAVA_HOME%\jre\lib  
  12. for %%j in (lib\*.jar) DO (  
  13.     echo %%j  
  14.     set CLASSPATH=!CLASSPATH!;%CURR_DIR%\%%j  
  15.     echo %CLASSPATH%  
  16. )  
  17. echo "#############################################"  
  18. echo %CLASSPATH%  
  19. echo "#############################################"  
  20.   
  21. rem set JVM_ARGS="-Xms:512m -XX:MinPermSize=128m"  
  22. rem echo JVM_ARGS=$JVM_ARGS  
  23.   
  24. @echo on  
  25. java -cp %CLASSPATH%;zooshare.jar com.shihuan.zooshare.main.DubooCustomer  


startZooshare.sh文件內容以下: 

Java代碼 

 收藏代碼

  1. #!/bin/sh  
  2.   
  3. export CURR_DIR=/home/zoodubbo/  
  4. cd $CURR_DIR  
  5. export JAVA_HOME=/usr/java/jdk1.6.0_45  
  6. #echo JAVA_HOME=$JAVA_HOME  
  7.   
  8. export PATH=$JAVA_HOME/bin:$PATH  
  9. #echo PATH=$PATH  
  10.   
  11. java -version  
  12.   
  13. export CLASSPATH=$CURR_DIR/lib:$CURR_DIR:$JAVA_HOME/lib:$JAVA_HOME/jre/lib  
  14.   
  15. for jarfile in `ls $CURR_DIR/lib/*.jar`  
  16. do  
  17.  export CLASSPATH=$CLASSPATH:$jarfile  
  18. done  
  19.   
  20. #echo CLASSPATH=$CLASSPATH  
  21. JVM_ARGS="-Xms:512m -XX:MinPermSize=128m"  
  22. echo JVM_ARGS=$JVM_ARGS  
  23. ulimit -n 400000  
  24. echo "" > nohup.out  
  25. #java org.jboss.netty.bootstrap.Bootstrap  
  26. nohup $JAVA_HOME/bin/java -cp $CLASSPATH:zoodubbo-0.0.1.jar com.shihuan.zoodubbo.C3p0TestMysql &  



在Windows環境中運行cmd窗口執行startZooshare.bat就能夠啓動zooshare服務了。 


下面來介紹服務消費者代碼: 
dubooweb工程所須要的jar文件截圖(這裏要把zooshare.jar加進來) 
 
 
dubooweb工程整體結構圖 
 
jdbc-context.xml文件代碼以下: 

Java代碼 

 收藏代碼

  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <beans xmlns="http://www.springframework.org/schema/beans"    
  3.     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"     
  4.     xmlns:context="http://www.springframework.org/schema/context"    
  5.     xsi:schemaLocation="     
  6.           http://www.springframework.org/schema/beans     
  7.           http://www.springframework.org/schema/beans/spring-beans-3.1.xsd    
  8.           http://www.springframework.org/schema/context     
  9.           http://www.springframework.org/schema/context/spring-context-3.1.xsd" default-autowire="byName">  
  10.   
  11.      <context:property-placeholder location="classpath:*.properties"/>  
  12.        
  13.      <!-- 自動掃描組件,須要把controller去掉,不然影響事務管理 -->  
  14.      <context:component-scan base-package="com.shihuan.web">  
  15.         <context:exclude-filter type="regex" expression="com.shihuan.web.*"/>  
  16.      </context:component-scan>  
  17.        
  18. </beans>  


springmvc-servlet.xml文件代碼以下: 

Java代碼 

 收藏代碼

  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <beans xmlns="http://www.springframework.org/schema/beans"    
  3.     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"    
  4.     xmlns:context="http://www.springframework.org/schema/context"    
  5.     xmlns:mvc="http://www.springframework.org/schema/mvc"    
  6.     xmlns:util="http://www.springframework.org/schema/util"  
  7.     xsi:schemaLocation="     
  8.            http://www.springframework.org/schema/beans     
  9.            http://www.springframework.org/schema/beans/spring-beans-3.1.xsd     
  10.            http://www.springframework.org/schema/context     
  11.            http://www.springframework.org/schema/context/spring-context-3.1.xsd    
  12.            http://www.springframework.org/schema/mvc     
  13.            http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd  
  14.            http://www.springframework.org/schema/util   
  15.            http://www.springframework.org/schema/util/spring-util-3.1.xsd">  
  16.       
  17.     <bean id="mappingJacksonHttpMessageConverter" class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">  
  18.         <property name="supportedMediaTypes">  
  19.             <list>  
  20.                 <value>text/html;charset=UTF-8</value>  
  21.             </list>  
  22.         </property>  
  23.     </bean>  
  24.   
  25.     <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">  
  26.         <property name="messageConverters">  
  27.             <util:list id="beanList">  
  28.                 <ref bean="mappingJacksonHttpMessageConverter" />  
  29.             </util:list>  
  30.         </property>  
  31.     </bean>  
  32.              
  33.       
  34.     <!-- 啓動掃描全部的controller -->  
  35.     <context:component-scan base-package="com.shihuan.web"/>  
  36.       
  37.     <!--  主要做用於@Controller ,激活該模式  
  38.           
  39.         下面是一種簡寫形式,徹底能夠手動配置替代這種簡寫形式;  
  40.          它會自動註冊DefaultAnnotationHandlerMapping與AnnotationMethodHandlerAdapter 兩個bean,  
  41.            是spring MVC爲@Controllers分發請求所必須的  
  42.      -->  
  43.     <mvc:annotation-driven/>  
  44.         
  45.     <!-- 這裏攔截器還有一種配置方法【針對路徑進行配置】 推薦使用這個,方便直觀-->  
  46.     <mvc:interceptors>  
  47.         <mvc:interceptor>  
  48.             <mvc:mapping path="/*"/>  
  49.             <bean class="com.shihuan.web.interceptor.DubboWebInterceptor"></bean>  
  50.         </mvc:interceptor>  
  51.     </mvc:interceptors>  
  52.       
  53.      <!-- 全局配置   
  54.     <mvc:interceptors>  
  55.         <bean class="com.olm.website.server.web.interceptor.MyInterceptor"></bean>  
  56.     </mvc:interceptors>  
  57.     -->  
  58.     <!-- 配置js,css等靜態文件直接映射到對應的文件夾,不被DispatcherServlet處理 -->  
  59.     <mvc:resources location="/resources/**" mapping="/resources"/>  
  60.       
  61.     <!-- jsp頁面解析器,當Controller返回XXX字符串時,先經過攔截器,而後該類就會在/WEB-INF/views/目錄下,查找XXX.jsp文件-->  
  62.     <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">  
  63.             <property name="prefix" value="/"></property>  
  64.             <property name="suffix" value=".jsp"></property>  
  65.     </bean>  
  66. </beans>  


applicationConsumer.xml文件代碼以下: 

Java代碼 

 收藏代碼

  1. <?xml version="1.0" encoding="UTF-8"?>    
  2. <beans xmlns="http://www.springframework.org/schema/beans"    
  3.   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"    
  4.   xsi:schemaLocation="http://www.springframework.org/schema/beans    
  5.     http://www.springframework.org/schema/beans/spring-beans.xsd    
  6.     http://code.alibabatech.com/schema/dubbo    
  7.     http://code.alibabatech.com/schema/dubbo/dubbo.xsd ">          
  8.   <!-- 消費方應用名,用於計算依賴關係,不是匹配條件,不要與提供方同樣 -->    
  9.   <dubbo:application name="consumer-of-shihuan-app" />       
  10.     <!-- 使用multicast廣播註冊中心暴露發現服務地址 -->    
  11.   <dubbo:registry  protocol="zookeeper" address="zookeeper://127.0.0.1:2181" />        
  12.     <!-- 生成遠程服務代理,能夠和本地bean同樣使用demoService -->    
  13.   <dubbo:reference id="demoService" interface="com.shihuan.zooshare.service.CustomerService" />    
  14. </beans>  


logging.properties文件代碼以下: 

Java代碼 

 收藏代碼

  1. handlers = org.apache.juli.FileHandler, java.util.logging.ConsoleHandler  
  2.   
  3. ############################################################  
  4. # Handler specific properties.  
  5. # Describes specific configuration info for Handlers.  
  6. ############################################################  
  7.   
  8. org.apache.juli.FileHandler.level = FINE  
  9. org.apache.juli.FileHandler.directory = ${catalina.base}/logs  
  10. org.apache.juli.FileHandler.prefix = error-debug.  
  11.   
  12. java.util.logging.ConsoleHandler.level = FINE  
  13. java.util.logging.ConsoleHandler.formatter =java.util.logging.SimpleFormatter  


web.xml文件代碼以下: 

Java代碼 

 收藏代碼

  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <web-app version="2.5"   
  3.     xmlns="http://java.sun.com/xml/ns/javaee"   
  4.     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   
  5.     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee   
  6.     http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">  
  7.       
  8.     <display-name>dubboweb</display-name>  
  9.   <context-param>  
  10.     <param-name>dubbowebRootKey</param-name>  
  11.     <param-value>dubboweb.root</param-value>  
  12.   </context-param>  
  13.   <context-param>  
  14.     <param-name>contextConfigLocation</param-name>  
  15.     <param-value>classpath:jdbc-context.xml,classpath:applicationConsumer.xml</param-value>  
  16.   </context-param>  
  17.   <listener>  
  18.     <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>  
  19.   </listener>  
  20.       
  21.     <servlet>  
  22.     <servlet-name>spring-mvc</servlet-name>  
  23.     <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>  
  24.     <init-param>  
  25.       <param-name>contextConfigLocation</param-name>  
  26.       <param-value>classpath:springmvc-servlet.xml</param-value>  
  27.     </init-param>  
  28.     <load-on-startup>1</load-on-startup>  
  29.   </servlet>  
  30.   <servlet-mapping>  
  31.     <servlet-name>spring-mvc</servlet-name>  
  32.     <url-pattern>/</url-pattern>  
  33.   </servlet-mapping>  
  34.   <filter>  
  35.     <filter-name>encodingFilter</filter-name>  
  36.     <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>  
  37.     <init-param>  
  38.       <param-name>encoding</param-name>  
  39.       <param-value>UTF-8</param-value>  
  40.     </init-param>  
  41.     <init-param>  
  42.       <param-name>forceEncoding</param-name>  
  43.       <param-value>true</param-value>  
  44.     </init-param>  
  45.   </filter>  
  46.   <filter-mapping>  
  47.     <filter-name>encodingFilter</filter-name>  
  48.     <url-pattern>/*</url-pattern>  
  49.   </filter-mapping>  
  50.       
  51.       
  52.   <welcome-file-list>  
  53.     <welcome-file>index.jsp</welcome-file>  
  54.   </welcome-file-list>  
  55. </web-app>  


index.jsp文件代碼以下: 

Java代碼 

 收藏代碼

  1. <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>  
  2. <%  
  3. String path = request.getContextPath();  
  4. %>  
  5.   
  6. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">  
  7. <html>  
  8.   <head>  
  9.       
  10.     <title>index.jsp starting page</title>  
  11.     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">  
  12.   </head>  
  13.     
  14.   <body>  
  15.     <form action="<%=path%>/duboo1.do" method="post">  
  16.         <input type="submit" value="submit" />  
  17.     </form>  
  18.   </body>  
  19. </html>  


DubboWebInterceptor.java文件代碼以下: 

Java代碼 

 收藏代碼

  1. package com.shihuan.web.interceptor;  
  2.   
  3. import javax.servlet.http.HttpServletRequest;  
  4. import javax.servlet.http.HttpServletResponse;  
  5.   
  6. import org.springframework.web.servlet.ModelAndView;  
  7. import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;  
  8.   
  9. public class DubboWebInterceptor extends HandlerInterceptorAdapter {  
  10.   
  11.     public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {  
  12.         super.afterCompletion(request, response, handler, ex);  
  13.     }  
  14.       
  15.     public void postHandler(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {  
  16.         super.postHandle(request, response, handler, modelAndView);  
  17.     }  
  18.       
  19.     public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {  
  20.         String url = request.getRequestURI();  
  21.         System.out.println("ConsumerInterceptor.preHandle()" + url);  
  22.           
  23.         return super.preHandle(request, response, handler);  
  24.     }  
  25.       
  26. }  


DubboWebController.java文件代碼以下: 

Java代碼 

 收藏代碼

  1. package com.shihuan.web.controller;  
  2.   
  3. import org.springframework.beans.factory.annotation.Autowired;  
  4. import org.springframework.stereotype.Controller;  
  5. import org.springframework.web.bind.annotation.RequestMapping;  
  6.   
  7. import com.shihuan.zooshare.service.CustomerService;  
  8.   
  9. @Controller  
  10. @RequestMapping(value="/")  
  11. public class DubboWebController {  
  12.   
  13.     @Autowired  
  14.     public CustomerService demoService;  
  15.       
  16.     @RequestMapping(value="duboo1")  
  17.     public String duboo1(){  
  18.         System.out.println("come into WebController ......");  
  19.         String zoosharestr = demoService.getName();  
  20.         System.out.println(zoosharestr);  
  21.         return "index";  
  22.     }  
  23.       
  24.     /* 
  25.     @RequestMapping(value="duboo1") 
  26.     public String duboo1(){ 
  27.         System.out.println("jinru......"); 
  28.         return "index"; 
  29.     } 
  30.     */  
  31.       
  32. }  


到此爲止服務消費者代碼編寫完畢。 
把dubboweb工程部署到tomcat6的webapps目錄下便可。 

【注】:各個模塊的啓動順序不能錯。 

第一步:啓動zookeeper服務 
 
第二步:啓動zooshare.jar服務,控制檯應該輸出"Press any key to exit." 
 
第三步:啓動tomcat6 

第四步:訪問http://127.0.0.1:8080/governance/applications/ 

第五步:訪問http://127.0.0.1:8080/dubooweb/ 

第六步:查看tomcat6控制檯和zooshare.jar服務控制檯是否有正確輸出,tomcat6控制檯應該輸出"come into WebController ......"和"print result !!!",zooshare.jar服務控制檯應該輸出"shihuan print !!!" 


都啓動好了後,操做截圖以下: 









 
 

核心技術:Maven,Springmvc mybatis shiro, Druid, Restful, Dubbo, ZooKeeper,Redis,FastDFS,ActiveMQ,Nginx 
分佈式框架介紹 - kafkaee - kafkaee的博客

分佈式框架介紹 - kafkaee - kafkaee的博客

分佈式框架介紹 - kafkaee - kafkaee的博客

分佈式框架介紹 - kafkaee - kafkaee的博客

相關文章
相關標籤/搜索