在 Windows Server 2008 机器上,我试图运行同一应用程序的两个实例。此应用程序 (i2b2) 正在使用 Apache Axis 2 Web 服务。JAX-WS Web 服务在端口 9090 上运行,并在端口 8083 上调用 JBoss 中的应用程序源代码。我制作了应用程序代码的完整副本(其中包括 Apache Axis 2 提取的 war 文件)以避免混淆,并且在 {jboss 文件夹}\server\default\deploy\jboss-webdeployer\server.xml 中将第二个实例上 Web 服务的端口连接从 9090 更改为 9091。
我可能会以错误的方式解决这个问题。我不太关心在不同的端口上运行,我只需要有两个实例。因此,如果复制应用程序编译的源代码并切换端口不是解决此问题的最佳方法,如果您有不同的想法,请告诉我。
<Connector port="9091" address="${jboss.bind.address}"
maxThreads="250" maxHttpHeaderSize="8192"
emptySessionPath="true" protocol="HTTP/1.1"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />
启动 JBoss 后,使用 JBoss bin 文件夹中的此命令,我得到以下异常。查看我发现引用端口 8083 的位置的更多详细信息。
run -b 0.0.0.0 > debug.txt
例外:
14:39:04,011 INFO [Server] Starting JBoss (MX MicroKernel)...
14:39:04,011 INFO [Server] Release ID: JBoss [Trinity] 4.2.2.GA (build: SVNTag=JBoss_4_2_2_GA date=200710221139)
14:39:04,011 INFO [Server] Home Dir: C:\i2b2\jboss-4.2.2.GA - QA
14:39:04,011 INFO [Server] Home URL: file:/C:/i2b2/jboss-4.2.2.GA - QA/
14:39:04,011 INFO [Server] Patch URL: null
14:39:04,011 INFO [Server] Server Name: default
14:39:04,011 INFO [Server] Server Home Dir: C:\i2b2\jboss-4.2.2.GA - QA\server\default
14:39:04,011 INFO [Server] Server Home URL: file:/C:/i2b2/jboss-4.2.2.GA - QA/server/default/
14:39:04,011 INFO [Server] Server Log Dir: C:\i2b2\jboss-4.2.2.GA - QA\server\default\log
14:39:04,011 INFO [Server] Server Temp Dir: C:\i2b2\jboss-4.2.2.GA - QA\server\default\tmp
14:39:04,011 INFO [Server] Root Deployment Filename: jboss-service.xml
14:39:04,395 INFO [ServerInfo] Java version: 1.6.0_26,Sun Microsystems Inc.
14:39:04,395 INFO [ServerInfo] Java VM: Java HotSpot(TM) 64-Bit Server VM 20.1-b02,Sun Microsystems Inc.
14:39:04,396 INFO [ServerInfo] OS-System: Windows Server 2008 6.0,amd64
14:39:06,280 INFO [Server] Core system initialized
14:39:07,778 INFO [WebService] Using RMI server codebase: http://dev-himci2b2:8083/
14:39:07,779 INFO [Log4jService$URLWatchTimerTask] Configuring from URL: resource:jboss-log4j.xml
14:39:07,893 WARN [ServiceController] Problem starting service jboss:service=WebService
java.lang.Exception: Port 8083 already in use.
at org.jboss.web.WebServer.start(WebServer.java:233)
at org.jboss.web.WebService.startService(WebService.java:322)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
at $Proxy0.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:417)
at org.jboss.system.ServiceController.start(ServiceController.java:435)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy4.start(Unknown Source)
at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy5.deploy(Unknown Source)
at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
at org.jboss.Main.boot(Main.java:200)
at org.jboss.Main$1.run(Main.java:508)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.net.BindException: Address already in use: JVM_Bind
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:383)
at java.net.ServerSocket.bind(ServerSocket.java:328)
at java.net.ServerSocket.<init>(ServerSocket.java:194)
at org.jboss.web.WebServer.start(WebServer.java:226)
... 50 more
14:39:07,919 WARN [ServiceController] Problem starting service jboss:service=Naming
java.rmi.server.ExportException: Port already in use: 1098; nested exception is:
java.net.BindException: Address already in use: JVM_Bind
at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:310)
at sun.rmi.transport.tcp.TCPTransport.exportObject(TCPTransport.java:218)
at sun.rmi.transport.tcp.TCPEndpoint.exportObject(TCPEndpoint.java:393)
这是我发现引用端口 8083 的地方。我尝试将其更改为端口 8084,但它似乎仍在寻找端口 8083。
jboss-4.2.2.GA\server\all\conf\jboss-service.xml
jboss-service.xml 的源代码:
<!-- ==================================================================== -->
<!-- Class Loading -->
<!-- ==================================================================== -->
<!-- A mini webserver used for dynamic and class and resource loading -->
<mbean code="org.jboss.web.WebService"
name="jboss:service=WebService">
<!-- The Bind address and Port -->
<attribute name="BindAddress">${jboss.bind.address}</attribute>
<attribute name="Port">8083</attribute>
<!-- The address to use for the host portion of the RMI codebase URL -->
<attribute name="Host">${java.rmi.server.hostname}</attribute>
<!-- Should non-EJB .class files be downloadable -->
<attribute name="DownloadServerClasses">true</attribute>
<!-- Should resources other than .class files be downloadable. Both
DownloadServerClasses and DownloadResources must be true for resources
to be downloadable. This is false by default because its generally a
bad idea as server configuration files that container security
information can be accessed.
-->
<attribute name="DownloadResources">false</attribute>
<!-- Use the default thread pool for dynamic class loading -->
<depends optional-attribute-name="ThreadPool"
proxy-type="attribute">jboss.system:service=ThreadPool</depends>
</mbean>
编辑@ 2013 年 3 月 18 日下午 4:20:
将此端口更新为 8084:
\jboss-4.2.2.GA\server\default\conf\jboss-service.xml
源代码:
<!-- ==================================================================== -->
<!-- Class Loading -->
<!-- ==================================================================== -->
<!-- A mini webserver used for dynamic and class and resource loading -->
<mbean code="org.jboss.web.WebService"
name="jboss:service=WebService">
<!-- The Bind address and Port -->
<attribute name="BindAddress">${jboss.bind.address}</attribute>
<attribute name="Port">8084</attribute>
<!-- The address to use for the host portion of the RMI codebase URL -->
<attribute name="Host">${java.rmi.server.hostname}</attribute>
<!-- Should non-EJB .class files be downloadable -->
<attribute name="DownloadServerClasses">true</attribute>
<!-- Should resources other than .class files be downloadable. Both
DownloadServerClasses and DownloadResources must be true for resources
to be downloadable. This is false by default because its generally a
bad idea as server configuration files that container security
information can be accessed.
-->
<attribute name="DownloadResources">false</attribute>
<!-- Use the default thread pool for dynamic class loading -->
<depends optional-attribute-name="ThreadPool"
proxy-type="attribute">jboss.system:service=ThreadPool</depends>
</mbean>
现在我得到了这个例外:
16:19:49,473 INFO [Server] Starting JBoss (MX MicroKernel)...
16:19:49,475 INFO [Server] Release ID: JBoss [Trinity] 4.2.2.GA (build: SVNTag=JBoss_4_2_2_GA date=200710221139)
16:19:49,475 INFO [Server] Home Dir: C:\i2b2\jboss-4.2.2.GA - QA
16:19:49,475 INFO [Server] Home URL: file:/C:/i2b2/jboss-4.2.2.GA - QA/
16:19:49,476 INFO [Server] Patch URL: null
16:19:49,476 INFO [Server] Server Name: default
16:19:49,476 INFO [Server] Server Home Dir: C:\i2b2\jboss-4.2.2.GA - QA\server\default
16:19:49,476 INFO [Server] Server Home URL: file:/C:/i2b2/jboss-4.2.2.GA - QA/server/default/
16:19:49,476 INFO [Server] Server Log Dir: C:\i2b2\jboss-4.2.2.GA - QA\server\default\log
16:19:49,476 INFO [Server] Server Temp Dir: C:\i2b2\jboss-4.2.2.GA - QA\server\default\tmp
16:19:49,477 INFO [Server] Root Deployment Filename: jboss-service.xml
16:19:49,642 INFO [ServerInfo] Java version: 1.6.0_26,Sun Microsystems Inc.
16:19:49,643 INFO [ServerInfo] Java VM: Java HotSpot(TM) 64-Bit Server VM 20.1-b02,Sun Microsystems Inc.
16:19:49,643 INFO [ServerInfo] OS-System: Windows Server 2008 6.0,amd64
16:19:49,871 INFO [Server] Core system initialized
16:19:51,393 INFO [WebService] Using RMI server codebase: http://dev-himci2b2:8084/
16:19:51,395 INFO [Log4jService$URLWatchTimerTask] Configuring from URL: resource:jboss-log4j.xml
16:19:51,546 WARN [ServiceController] Problem starting service jboss:service=Naming
java.rmi.server.ExportException: Port already in use: 1098; nested exception is:
java.net.BindException: Address already in use: JVM_Bind
at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:310)
at sun.rmi.transport.tcp.TCPTransport.exportObject(TCPTransport.java:218)
at sun.rmi.transport.tcp.TCPEndpoint.exportObject(TCPEndpoint.java:393)
at sun.rmi.transport.LiveRef.exportObject(LiveRef.java:129)
at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:190)
at java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:293)
at java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:256)
at org.jnp.server.Main.initJnpInvoker(Main.java:354)
at org.jnp.server.Main.start(Main.java:316)
at org.jboss.naming.NamingService.startService(NamingService.java:284)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
at $Proxy0.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:417)
at org.jboss.system.ServiceController.start(ServiceController.java:435)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy4.start(Unknown Source)
at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy5.deploy(Unknown Source)
at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
at org.jboss.Main.boot(Main.java:200)
at org.jboss.Main$1.run(Main.java:508)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.net.BindException: Address already in use: JVM_Bind
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:383)
at java.net.ServerSocket.bind(ServerSocket.java:328)
at java.net.ServerSocket.<init>(ServerSocket.java:194)
at org.jboss.net.sockets.DefaultSocketFactory.createServerSocket(DefaultSocketFactory.java:120)
at org.jboss.net.sockets.DefaultSocketFactory.createServerSocket(DefaultSocketFactory.java:95)
at sun.rmi.transport.tcp.TCPEndpoint.newServerSocket(TCPEndpoint.java:649)
at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:299)
... 61 more
16:19:51,594 INFO [TransactionManagerService] JBossTS Transaction Service (JTA version) - JBoss Inc.
16:19:51,594 INFO [TransactionManagerService] Setting up property manager MBean and JMX layer
编辑 2013 年 3 月 18 日下午 6:35:
这些是最好的指示。 http://darrellgrainger.blogspot.com/2010/02/changeing-ports-in-jboss.html ...
-->
好消息...是我能够通过移动XML 标记之前取消注释掉 xml 文件中的 JBoss port-01 部分。然后我制作了 jboss\default\ 文件夹的副本并将其重命名default-qa
。所以 JBoss 的第二个实例现在应该使用端口 8183。默认情况下,文件夹的 port-defaultdefault
仍应绑定到端口 8083。并通过从 jboss bin 文件夹中执行此操作来启动 JBoss 的第二个实例run -b 0.0.0.0 -c default-qa > debug-qa.txt
。那工作得很好。
坏消息...应用程序代码具有 ${jboss.home}/server/default/deploy/ 硬编码,并且 Spring Web Framework *.properties 文件中的 Apache Axis 2 端口设置为 9090。由于 JBoss 的第二个实例依赖于 Apache Axis 9091,我想我现在需要制作另一个源代码副本并使用端口 9091,并且在第二个实例中保持相同的文件夹结构,但移动根文件夹别的地方。然后重新编译。