0 Replies Latest reply on Aug 12, 2010 4:55 AM by caravan johns

    Port already in use: 1098

    caravan johns Newbie

      hi all

      my project is spring based and I am getting 'Port already used " exception when my tomcat load applicationContext.xml, here is my spring configuration applicationContext.xml

       

       

      <?xml version="1.0" encoding="UTF-8"?>
      <bean name="namingServerImpl"
      init-method="start" destroy-method="stop">
      <property name="useGlobalService" value="false" />
      </bean>
      <bean name="namingServer" init-method="start"
      destroy-method="stop">
      <property name="namingInfo" ref="namingServerImpl" />
      <property name="port" value="1099" />
      <property name="bindAddress" value="server-ip" />
      <property name="rmiPort" value="1098" />
      <property name="rmiBindAddress" value="server-ip" />
      </bean>
      <bean name="mbeanServer"
      factory-method="getPlatformMBeanServer" />
      <bean name="fileConfiguration"
      init-method="start" destroy-method="stop" />
      <bean name="hornetQSecurityManagerImpl"
      class="org.hornetq.spi.core.security.HornetQSecurityManagerImpl" />
      <bean name="hornetQServerImpl">
      <constructor-arg ref="fileConfiguration" />
      <constructor-arg ref="mbeanServer" />
      <constructor-arg ref="hornetQSecurityManagerImpl" />
      </bean>
      <bean name="jmsServerManagerImpl"
      init-method="start" destroy-method="stop"
      depends-on="namingServer, systemPropertyConfigurer">
      <constructor-arg ref="hornetQServerImpl" />
      </bean>
      <bean name="systemPropertyConfigurer">
      <property name="systemProperties">
      <props>
      <prop key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</prop>
      </props>
      </property>
      </bean>
      <bean name="connectionFactory">
      <constructor-arg>
      <bean>
      <constructor-arg
      value="org.hornetq.integration.transports.netty.NettyConnectorFactory" />
      <constructor-arg>
      <map key-type="java.lang.String" value-type="java.lang.Object">
      <entry key="port" value="5445"></entry>
      </map>
      </constructor-arg>
      </bean>
      </constructor-arg>
      </bean>
      <bean name="jmsTemplate">
      <property name="connectionFactory" ref="connectionFactory"></property>
      </bean>
      <bean id="inVMConnectionFactory"
      depends-on="jmsServerManagerImpl">
      <property name="jndiName">
      <value>java:/ConnectionFactory</value>
      </property>
      </bean>
      <bean id="notificationsQueue"
      depends-on="jmsServerManagerImpl">
      <property name="jndiName">
      <value>/queue/genesisq</value>
      </property>
      </bean>
      </beans>

       

       

       

      and here is my java stack trace

       

       

      SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener

      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'namingServer' defined in file [/work/installations/apache-tomcat-6.0.26/webapps/hq2.0/WEB-INF/classes/applicationContext.xml]: Invocation of init method failed; nested exception is java.rmi.server.ExportException: Port already in use: 1098; nested exception is:

           java.net.BindException: Cannot assign requested address

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1403)

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)

           at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)

           at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)

           at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)

           at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)

           at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:562)

           at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:871)

           at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:423)

           at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:272)

           at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:196)

           at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)

           at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)

           at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)

           at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)

           at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)

           at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)

           at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)

           at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:563)

           at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498)

           at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)

           at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)

           at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)

           at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)

           at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)

           at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)

           at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)

           at org.apache.catalina.core.StandardService.start(StandardService.java:519)

           at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)

           at org.apache.catalina.startup.Catalina.start(Catalina.java:581)

           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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)

           at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

      Caused by: java.rmi.server.ExportException: Port already in use: 1098; nested exception is:

           java.net.BindException: Cannot assign requested address

           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:394)

           at sun.rmi.transport.LiveRef.exportObject(LiveRef.java:130)

           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:462)

           at org.jnp.server.Main.start(Main.java:422)

           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.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1527)

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1468)

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1400)

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)

           at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)

           at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)

           at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)

           at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)

           at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:562)

           at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:872)

           at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:423)

           at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:272)

           at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:196)

           at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:48)

           at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)

           at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)

           at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:792)

           at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)

           at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:548)

           at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)

           at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:563)

           at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:500)

           at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)

           at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)

           at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)

           at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1056)

           at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)

           at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)

           at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)

           at org.apache.catalina.core.StandardService.start(StandardService.java:519)

           at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)

           at org.apache.catalina.startup.Catalina.start(Catalina.java:581)

           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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:291)

           ... 1 more

      Caused by: java.net.BindException: Cannot assign requested address

           at java.net.PlainSocketImpl.socketBind(Native Method)

           at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:365)

           at java.net.ServerSocket.bind(ServerSocket.java:319)

           at java.net.ServerSocket.<init>(ServerSocket.java:185)

           at org.jboss.net.sockets.DefaultSocketFactory.createServerSocket(DefaultSocketFactory.java:124)

           at org.jboss.net.sockets.DefaultSocketFactory.createServerSocket(DefaultSocketFactory.java:99)

           at sun.rmi.transport.tcp.TCPEndpoint.newServerSocket(TCPEndpoint.java:649)

           at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:299)

           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:462)

           at org.jnp.server.Main.start(Main.java:422)

           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.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1527)

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1468)

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1400)

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)

           at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)

           at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)

           at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)

           at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)

           at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:562)

           at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:871)

           at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:423)

           at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:272)

           at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:196)

           at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)

           at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)

           at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)

           at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)

           at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)

           at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)

           at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)

           at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:563)

           at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498)

           at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)

           at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)

           at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)

           at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)

           at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)

           at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)

           at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)

           at org.apache.catalina.core.StandardService.start(StandardService.java:519)

           at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)

           at org.apache.catalina.startup.Catalina.start(Catalina.java:581)

           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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)

       

       

       

      jboss6*.m4 is deployed on a remote server, ...I could interact with hornetq server successfully when I use some other non-spring based programs...

      here is my server port status...

       

       

      tcp        0      0 127.0.0.1:2208              0.0.0.0:*                   LISTEN      4822/hpiod         

      tcp        0      0 222.18.63.38:3873           0.0.0.0:*                   LISTEN      24999/java         

      tcp        0      0 222.18.63.38:1090           0.0.0.0:*                   LISTEN      24999/java         

      tcp        0      0 222.18.63.38:1091           0.0.0.0:*                   LISTEN      24999/java         

      tcp        0      0 222.18.63.38:5445           0.0.0.0:*                   LISTEN      24999/java         

      tcp        0      0 222.18.63.38:4712           0.0.0.0:*                   LISTEN      24999/java         

      tcp        0      0 222.18.63.38:8009           0.0.0.0:*                   LISTEN      24999/java         

      tcp        0      0 222.18.63.38:4713           0.0.0.0:*                   LISTEN      24999/java         

      tcp        0      0 127.0.0.1:4714              0.0.0.0:*                   LISTEN      24999/java         

      tcp        0      0 222.18.63.38:1098           0.0.0.0:*                   LISTEN      24999/java         

      tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      20394/mysqld       

      tcp        0      0 222.18.63.38:1099           0.0.0.0:*                   LISTEN      24999/java         

      tcp        0      0 0.0.0.0:972                 0.0.0.0:*                   LISTEN      4606/rpc.statd  

      could anybody help me out with this ? thanks regards