在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>
将此端口更新为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
这些是最好的指示。 http://darrellgrainger.blogspot.com/2010/02/changing-ports-in-jboss.html ......
好消息是,我能够通过在XML标记之前移动-->
来取消注释xml文件中的JBoss port-01部分。然后我制作了jboss \ default \文件夹的副本并将其重命名为default-qa
。所以JBoss的第二个实例现在应该使用端口8183。默认情况下,文件夹default
的port-default仍应绑定到端口8083。通过从jboss bin文件夹run -b 0.0.0.0 -c default-qa > debug-qa.txt
执行此操作,启动了JBoss的第二个实例。这很好。
坏消息......应用程序代码有$ {jboss.home} / server / default / deploy / hard coded,而Spring Axace 2。端口设置在Spring Web Framework * .properties文件中,到9090到处都是。由于JBoss的第二个实例依赖于Apache Axis 9091,我认为我需要制作另一个源代码副本并立即使用端口9091,并在第二个实例中保持相同的文件夹结构,但移动根文件夹别的地方。然后重新编译。
答案 0 :(得分:1)
如果你想在同一台机器上运行两个JBoss实例,你应该更改端口出价(参见例如JBoss 4.X How to run multiple instances of JBoss in a one single machine?。注意,对于每个JBoss版本,这是不同的配置(see this )。
也可能发生其他一些程序占用了所需的端口。两个最常犯的是MS Outlook和Skype。要检查此次运行:
netstat -a -o
将为您提供已占用端口和进程ID的列表。您可以在任务管理器中检入哪个程序正在使用给定端口,并可能将其终止。