<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    溫馨提示:您的每一次轉(zhuǎn)載,體現(xiàn)了我寫此文的意義!!!煩請您在轉(zhuǎn)載時注明出處http://m.tkk7.com/sxyx2008/謝謝合作!!!

    雪山飛鵠

    溫馨提示:您的每一次轉(zhuǎn)載,體現(xiàn)了我寫此文的意義!!!煩請您在轉(zhuǎn)載時注明出處http://m.tkk7.com/sxyx2008/謝謝合作!!!

    BlogJava 首頁 新隨筆 聯(lián)系 聚合 管理
      215 Posts :: 1 Stories :: 674 Comments :: 0 Trackbacks
    1. 單臺Linux服務(wù)器中如何部署多個獨立應(yīng)用,即多個應(yīng)用不能run在一個jboss實例中?
      換言之,這個問題也可以這樣描述:在單臺Linux服務(wù)器中服務(wù)啟動多個Jboss實例?
      默認情況下,jboss啟動時加載server/default/目錄下的配置,要實現(xiàn)多個實例的啟動,主要是解決端口沖突的問題,因為一套端口只能被一個應(yīng)用占有;
      一般來說,我們可以在Jboss啟動時通過-Djboss.server.home設(shè)置當前實例啟動時加載不同的目錄來實現(xiàn);
      比如Jboss主程序安裝在/usr/xx/jboss/,應(yīng)用放在/home/admin/app/;那此時就可以cp一份default目錄到當前應(yīng)用app目錄下,通過-Djboss.server.home=/home/admin/app/default來啟動該實例;
      若直接在/usr/xx/jboss/server/下復(fù)制default目錄并改名為yy,則可以用更簡單的參數(shù)-c yy來啟動;
      對于多應(yīng)用的情況,我們?nèi)匀灰鉀Q端口沖突的問題,有兩種方式:
      其一,直接修改各應(yīng)用對應(yīng)的default目錄下的所有配置端口,主要涉及配置文件conf/jboss-service.xml、tomcat下的server.xml;該方法比較土,很容易出錯,因為端口眾多,只要有一項端口沒有改,jboss就將無法正常啟動;若應(yīng)用較少,比如就只有2個,那這種方式勉強可以用用;
      其二,在jboss-service.xml中啟用jboss.system:service=ServiceBindingManager這個mbean服務(wù),設(shè)置ServerName、StoreURL屬性;將各套應(yīng)用對應(yīng)的端口全部配置在同一個文件中;推薦采用該方案,具體可參考:

    1. <mbean code="org.jboss.services.binding.ServiceBindingManager" 
    2.   name="jboss.system:service=ServiceBindingManager"> 
    3.   <attribute name="ServerName">ports-01</attribute> 
    4.   <attribute name="StoreURL">${jboss.home.url}/docs/examples/binding-manager/sample-bindings.xml</attribute> 
    5.   <attribute name="StoreFactoryClassName"> 
    6.     org.jboss.services.binding.XMLServicesStoreFactory 
    7.   </attribute> 
    8. </mbean> 

     

  • Jboss無法正常啟動,報異常javax.management.MBeanRegistrationException: preRegister() failed?
    一般來說,上面的異常出現(xiàn)在4.2及其以后的版本中,比較詳細的異常如下:
    1. javax.management.MBeanRegistrationException: preRegister() failed: [ObjectName='jboss.remoting:service=NetworkRegistry', Class=org.jboss.remoting.network.NetworkRegistry (org.jboss.remoting.network.NetworkRegistry@16b6c55)] 
    2.         at org.jboss.mx.server.registry.BasicMBeanRegistry.invokePreRegister(BasicMBeanRegistry.java:713
    3.         at org.jboss.mx.server.registry.BasicMBeanRegistry.registerMBean(BasicMBeanRegistry.java:211
    4.         at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source) 
    5.         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25
    6.         at java.lang.reflect.Method.invoke(Method.java:585
    7.         at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155
    8.         ... 51 more 
    9. Caused by: java.lang.RuntimeException: Exception creating identity: mall_dev4: mall_dev4 
    10.         at org.jboss.remoting.ident.Identity.get(Identity.java:211
    11.         at org.jboss.remoting.network.NetworkRegistry.preRegister(NetworkRegistry.java:268
    12.         at org.jboss.mx.server.AbstractMBeanInvoker.invokePreRegister(AbstractMBeanInvoker.java:966
    13.         at org.jboss.mx.modelmbean.ModelMBeanInvoker.invokePreRegister(ModelMBeanInvoker.java:489
    14.         at org.jboss.mx.server.AbstractMBeanInvoker.preRegister(AbstractMBeanInvoker.java:654
    15.         at org.jboss.mx.server.registry.BasicMBeanRegistry.invokePreRegister(BasicMBeanRegistry.java:697
    16.         ... 56 more 

    這主要是因為Jboss啟動了一個jboss.remoting:service=NetworkRegistry的mbean服務(wù),啟動時卻又無法根據(jù)當前hostname找到IP!
    解決方案為在/etc/hosts中綁定當前服務(wù)器的主機名和IP,比如10.2.224.214 mall_dev4;
    對于4.2系列之前的版本,如果沒有綁定主機名和IP,雖然會出現(xiàn)以下的異常,但并不一定會影響應(yīng)用的正常啟動;
    1. 11:32:12,427 WARN  [ServiceController] Problem starting service jboss:service=invoker,type=http 
    2. java.net.UnknownHostException: mall_dev4: mall_dev4 
    3.         at java.net.InetAddress.getLocalHost(InetAddress.java:1308
    4.         at org.jboss.invocation.http.server.HttpInvoker.checkInvokerURL(HttpInvoker.java:204
    5.         at org.jboss.invocation.http.server.HttpInvoker.startService(HttpInvoker.java:101
    6.         at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289
    7.         at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245
    8.         at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source) 
    9.         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25
    10.         at java.lang.reflect.Method.invoke(Method.java:585
    11.         at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155
    12.         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94
    13.         at org.jboss.mx.server.Invocation.invoke(Invocation.java:86
    14.         at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264
    15.         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659
    16.         at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978
    17.         at $Proxy0.start(Unknown Source) 
    18.         at org.jboss.system.ServiceController.start(ServiceController.java:417
  • Jboss已經(jīng)正常啟動,但是無法用IP或者綁定IP訪問應(yīng)用?
    熟悉Linux相關(guān)知識的筒靴都知道一個端口是綁定在某個地址上的,可以是一個,也可以是多個,一個端口在同一個地址上不能被兩個應(yīng)用占有;
    出現(xiàn)這個問題一般是因為你使用的是4.2系列及其之后的版本,因為從這個系列開始,Jboss默認綁定的端口由之前的0.0.0.0變成了127.0.0.1;前者表示綁定當前服務(wù)器下所有地址,包括自身的IP、127.0.0.1;而后者只綁定了127.0.0.1,而沒有綁定本機IP,通過IP去訪問應(yīng)用自然也就無法成功了,因為訪問的IP地址沒有開放對應(yīng)的端口;
    對于默認的這種情況,一般來說jboss是要和apache搭配使用的,apache暴露應(yīng)用外部訪問的端口,然后apache再監(jiān)聽本地(也就是127.0.0.1)的端口;
    當然這個默認配置也是可以修改的,方式也比較多,比如:
    方式1,啟動腳本中通過參數(shù)-b, --host=<host or ip>指定地址,比如-b 0.0.0.0就表示綁定所有地址;
    方式2,啟動腳本中通過參數(shù)-Djboss.bind.address指定地址,比如-Djboss.bind.address=0.0.0.0;
    方式3,直接修改需要對外暴露的端口綁定地址,比如tomcat/server.xml中的http端口綁定address信息;
  • Jboss正常啟動,但是用shutdown腳本無法關(guān)閉應(yīng)用?
    對于jboss的關(guān)閉,shutdown命令允許好幾種方式的關(guān)閉,可以參考該命令的幫助:
    1. usage: shutdown [options] <operation> 
    2. options: 
    3.     -h, --help                Show this help message (default
    4.     -D<name>[=<value>]        Set a system property 
    5.     --                        Stop processing options 
    6.     -s, --server=<url>        Specify the JNDI URL of the remote server 
    7.     -n, --serverName=<url>    Specify the JMX name of the ServerImpl 
    8.     -a, --adapter=<name>      Specify JNDI name of the MBeanServerConnection to use 
    9.     -u, --user=<name>         Specify the username for authentication 
    10.     -p, --password=<name>     Specify the password for authentication 
    11. operations: 
    12.     -S, --shutdown            Shutdown the server 
    13.     -e, --exit=<code>         Force the VM to exit with a status code 
    14.     -H, --halt=<code>         Force the VM to halt with a status code 
    一般來說,我們使用-s參數(shù)來關(guān)閉,也即通過JNDI URL;
    若是基于JNDI URL的方式出現(xiàn)這種情況一般有三種可能:
    其一,當前應(yīng)用所使用的default目錄內(nèi)的內(nèi)容與當前運行jboss自身的default內(nèi)容不一致,比如當前jboss版本為4.0.5,而啟動時指定的default卻是從jboss 4.2.1中cp過來的;這種情況在搭建環(huán)境時經(jīng)常出現(xiàn),因為一般直接從另外一臺linux服務(wù)器中scp過來,但其實兩臺服務(wù)器自身安裝的jboss版本不一致;
    其二,shutdown命令中指定的JNDI端口與實際應(yīng)用啟動的JNDI端口不一致
    其三,/etc/hosts中對當前主機名綁定的IP地址不正確,比如當前服務(wù)器實際的IP地址為10.2.224.214,而hosts中綁定的卻是10.0.0.1;
    總之,出現(xiàn)此類情況都是因為jboss自身無法正確接收到正確的關(guān)閉命令所致,一般來說在jboss的server.log中會拋如下的異常信息:
    1. Exception in thread "main" javax.naming.CommunicationException [Root exception is java.rmi.ConnectException: Connection refused to host: 10.0.0.1; nested exception is:  
    2.         java.net.ConnectException: Connection timed out]  
    3.         at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:707)  
    4.         at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)  
    5.         at javax.naming.InitialContext.lookup(InitialContext.java:351)  
    6.         at org.jboss.Shutdown.main(Shutdown.java:202)  
    7. Caused by: java.rmi.ConnectException: Connection refused to host: 10.0.0.1; nested exception is:  
    8.         java.net.ConnectException: Connection timed out  
    9.         at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:574)  
    10.         at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)  
    11.         at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)  
    12.         at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:94)  
    13.         at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)  
    14.         at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:610)  
    15.         ... 3 more  
  • 如何對Linux下的Jboss應(yīng)用進行debug?
    其實這個問題和Jboss是否部署在Linux下沒有直接關(guān)系,可以在jboss啟動時指定遠程debug端口即可,比如:
    1. -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n 

    然后在eclipse中新建remote debug時指定對應(yīng)的端口即可;

  • Linux下Jboss啟動、關(guān)閉、端口配置等常見問題FAQ 
    關(guān)于JBOSS端口被占用的問題
    posted on 2012-03-28 10:58 雪山飛鵠 閱讀(5415) 評論(0)  編輯  收藏

    只有注冊用戶登錄后才能發(fā)表評論。


    網(wǎng)站導(dǎo)航:
     
    主站蜘蛛池模板: 亚洲午夜精品在线| 久久亚洲AV午夜福利精品一区| 亚洲国产成人精品无码一区二区| 毛片免费在线观看| 亚洲av无码一区二区三区网站| 国产精品福利在线观看免费不卡| 免费中文字幕一级毛片| 亚洲aⅴ无码专区在线观看 | 亚洲AV无码乱码麻豆精品国产| 三年片在线观看免费观看大全一| 亚洲AV日韩AV永久无码下载| 午夜无码A级毛片免费视频| 精品亚洲国产成AV人片传媒| 最近免费中文字幕mv电影| 亚洲精品中文字幕麻豆| 99久久免费国产精品特黄| 亚洲日本VA午夜在线电影| 国产精品久久免费视频| 老司机免费午夜精品视频| 亚洲人妻av伦理| 日本免费人成网ww555在线| 亚洲最大福利视频网站| 国色精品卡一卡2卡3卡4卡免费| 亚洲国产日韩综合久久精品| 国产一级高清视频免费看| 久久久久免费视频| 中文字幕亚洲第一在线| 成人免费无遮挡无码黄漫视频| 处破女第一次亚洲18分钟| 亚洲午夜久久久影院伊人| 3344免费播放观看视频| 亚洲精品无码少妇30P| 亚洲一区二区三区无码影院| 免费A级毛片在线播放| 亚洲精品国产综合久久久久紧| 亚洲综合区小说区激情区 | 亚洲AV无码精品蜜桃| 亚洲精品无码你懂的网站| 免费国产黄网站在线观看| 老司机免费午夜精品视频| 亚洲精品国产福利片|