WebSphere集群 应用端口冲突
大概结构是这样,有两台物理机A和B,每台机器上有两个server,这四个server建立集群cluster_test。
A:AS1,AS2
B:BS1,BS2
我们的应用部署到该集群上,应用中的jmxContext.xml中有如下配置:
XML/HTML code?12345678910 <bean id="registryRmiPort" class="org.springframework.remoting.rmi.RmiRegistryFactoryBean"> <property name="port" value="8882"/> </bean> <bean id="serverConnector" class="org.springframework.jmx.support.ConnectorServerFactoryBean"> <property name="objectName" value="connector:name=rmi"/> <property name="server" ref="mbeanServer"/> <property name="serviceUrl" value="service:jmx:rmi://localhost:7772/jndi/rmi://localhost:8882/test"/> </bean>
由于两个server在同一台机器上,启动应用时,就会报端口冲突。这种情况该怎么解决。
Java code?123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 [11-7-6 9:22:53:829 CST] 00000021 ContextLoader E org.springframework.web.context.ContextLoader initWebApplicationContext Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'registryRmiPort' defined in ServletContext resource [/WEB-INF/config/jmxContext.xml]: Invocation of init method failed; nested exception is java.rmi.server.ExportException: Listen failed on port: 8882; nested exception is: java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind java.rmi.server.ExportException: Listen failed on port: 8882; nested exception is: java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:324) at sun.rmi.transport.tcp.TCPTransport.exportObject(TCPTransport.java:230) at sun.rmi.transport.tcp.TCPEndpoint.exportObject(TCPEndpoint.java:405) at sun.rmi.transport.LiveRef.exportObject(LiveRef.java:141) at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:190) at sun.rmi.registry.RegistryImpl.setup(RegistryImpl.java:104) at sun.rmi.registry.RegistryImpl.<init>(RegistryImpl.java:90) at java.rmi.registry.LocateRegistry.createRegistry(LocateRegistry.java:197) at org.springframework.remoting.rmi.RmiRegistryFactoryBean.getRegistry(RmiRegistryFactoryBean.java:226) at org.springframework.remoting.rmi.RmiRegistryFactoryBean.getRegistry(RmiRegistryFactoryBean.java:201) at org.springframework.remoting.rmi.RmiRegistryFactoryBean.getRegistry(RmiRegistryFactoryBean.java:165) at org.springframework.remoting.rmi.RmiRegistryFactoryBean.afterPropertiesSet(RmiRegistryFactoryBean.java:136) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:856) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:825) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:418) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:241) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:152) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:247) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:331) at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:155) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184) at org.springframework.web.context.ContextLoaderServlet.init(ContextLoaderServlet.java:83) at javax.servlet.GenericServlet.init(GenericServlet.java:241) at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:358) at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.init(ServletWrapperImpl.java:169) at com.ibm.ws.webcontainer.servlet.ServletWrapper.initialize(ServletWrapper.java:1809) at com.ibm.wsspi.webcontainer.extension.WebExtensionProcessor.createServletWrapper(WebExtensionProcessor.java:98) at com.ibm.ws.webcontainer.webapp.WebApp.initializeTargetMappings(WebApp.java:704) at com.ibm.ws.webcontainer.webapp.WebApp.commonInitializationFinally(WebApp.java:435) at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:304) at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:100) at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:166) at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:731) at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:616) at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:376) at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:668) at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1123) at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1319) at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:610) at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:944) at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:726) at com.ibm.ws.runtime.component.ApplicationMgrImpl$1.run(ApplicationMgrImpl.java:1268) at com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:4588) at com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:4766) at com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:255) at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplicationDynamically(ApplicationMgrImpl.java:1273) at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2045) at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:441) at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123) at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:384) at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:655) at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:617) at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:1180) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:599) at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:36) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:599) at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:243) at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1085) at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:966) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:848) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:773) at com.ibm.ws.management.AdminServiceImpl$1.run(AdminServiceImpl.java:1332) at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118) at com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:1225) at com.ibm.ws.management.connector.AdminServiceDelegator.invoke(AdminServiceDelegator.java:181) at com.ibm.ws.management.connector.ipc.CallRouter.route(CallRouter.java:242) at com.ibm.ws.management.connector.ipc.IPCConnectorInboundLink.doWork(IPCConnectorInboundLink.java:353) at com.ibm.ws.management.connector.ipc.IPCConnectorInboundLink$IPCConnectorReadCallback.complete(IPCConnectorInboundLink.java:595) at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165) at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161) at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138) at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204) at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775) at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1604) Caused by: java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:378) at java.net.ServerSocket.bind(ServerSocket.java:330) at java.net.ServerSocket.<init>(ServerSocket.java:196) at java.net.ServerSocket.<init>(ServerSocket.java:108) at sun.rmi.transport.proxy.RMIDirectSocketFactory.createServerSocket(RMIDirectSocketFactory.java:39) at sun.rmi.transport.proxy.RMIMasterSocketFactory.createServerSocket(RMIMasterSocketFactory.java:345) at sun.rmi.transport.tcp.TCPEndpoint.newServerSocket(TCPEndpoint.java:661) at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:311) ... 82 more
JVM_Bind错误 是不是2个Server用同一个端口啦? 端口冲突,查看报错的那个端口是哪个进程占用的,如果被占用,那就换个呗