3 Replies Latest reply on Nov 18, 2009 8:07 PM by njiang

    running camel-example-spring-jms in eclipse for debug mode

    vcheruvu1

      Hi ,

       

      I have managed to import the examples of Fuse Medetion as Maven project into my Eclipse. I have run the camel-example-spring-jms from eclipse using external tools configuration. Now, i wanted to run this example in debug mode. So, I  have added the  target main class "org.apache.camel.spring.Main" in the  debug configuation

       

      project = camel-example-spring-jms

      Main class = org.apache.camel.spring.Main

       

      I tried running the example in eclipse I keep getting address already in used error. Please see the error details below. I have used netstat -ano |find /i "61616"  to ensure existing process is killed.  However when i run from external tool configuration I do not have problem running came-server. How do you run this example from Eclipse in debug mode without having to use mvn exec:java -PCamelClient.. I need to debug code to understand how this example works.  I hope you can help guide me how to run this example in debug mode in Eclipse. Thanks in advance.

       

      MainSupport                    INFO  Apache Camel 1.6.1.2-fuse starting

      CamelNamespaceHandler          INFO  camel-osgi.jar not detected in classpath

      DefaultCamelContext            INFO  JMX enabled. Using InstrumentationLifecycleStrategy.

      BrokerService                  INFO  Using Persistence Adapter: MemoryPersistenceAdapter

      BrokerService                  INFO  ActiveMQ 5.2.0.2-fuse JMS Message Broker (localhost) is starting

      BrokerService                  INFO  For help or more information please see: http://activemq.apache.org/

      TransportServerThreadSupport   INFO  Listening for connections at: tcp://LSYDSMS9F65R1S:61616

      TransportConnector             INFO  Connector tcp Started

      BrokerService                  INFO  ActiveMQ JMS Message Broker (localhost, ID:LSYDSMS9F65R1S-2254-1258507197406-0:0) started

      BrokerService                  INFO  Using Persistence Adapter: MemoryPersistenceAdapter

      BrokerService                  INFO  ActiveMQ 5.2.0.2-fuse JMS Message Broker (localhost) is starting

      BrokerService                  INFO  For help or more information please see: http://activemq.apache.org/

      BrokerService                  ERROR Failed to start ActiveMQ JMS Message Broker. Reason: java.io.IOException: Failed to bind to server socket: tcp://localhost:61616 due to: java.net.BindException: Address already in use: JVM_Bind

      java.io.IOException: Failed to bind to server socket: tcp://localhost:61616 due to: java.net.BindException: Address already in use: JVM_Bind

           at org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:33)

           at org.apache.activemq.transport.tcp.TcpTransportServer.bind(TcpTransportServer.java:141)

           at org.apache.activemq.transport.tcp.TcpTransportFactory.doBind(TcpTransportFactory.java:60)

           at org.apache.activemq.transport.TransportFactory.bind(TransportFactory.java:131)

           at org.apache.activemq.broker.TransportConnector.createTransportServer(TransportConnector.java:293)

           at org.apache.activemq.broker.TransportConnector.getServer(TransportConnector.java:135)

           at org.apache.activemq.broker.TransportConnector.start(TransportConnector.java:195)

           at org.apache.activemq.broker.BrokerService.startTransportConnector(BrokerService.java:1898)

           at org.apache.activemq.broker.BrokerService.startAllConnectors(BrokerService.java:1844)

           at org.apache.activemq.broker.BrokerService.start(BrokerService.java:480)

           at org.apache.activemq.xbean.XBeanBrokerService.afterPropertiesSet(XBeanBrokerService.java:56)

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

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

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

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)

           at java.security.AccessController.doPrivileged(Native Method)

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

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

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

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

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

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

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

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

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

           at org.springframework.context.support.ClassPathXmlApplicationContext.(Unknown Source)

           at javax.net.DefaultServerSocketFactory.createServerSocket(Unknown Source)

           at org.apache.activemq.transport.tcp.TcpTransportServer.bind(TcpTransportServer.java:134)

           ... 31 more

      BrokerService                  INFO  ActiveMQ Message Broker (localhost, null) is shutting down

      TransportConnector             INFO  Connector tcp Stopped

      BrokerService                  INFO  ActiveMQ JMS Message Broker (localhost, null) stopped

      BrokerService                  INFO  ActiveMQ Message Broker (localhost, ID:LSYDSMS9F65R1S-2254-1258507197406-0:0) is shutting down

      TransportConnector             INFO  Connector tcp Stopped

      BrokerService                  INFO  ActiveMQ JMS Message Broker (localhost, ID:LSYDSMS9F65R1S-2254-1258507197406-0:0) stopped

      MainSupport                    INFO  Apache Camel 1.6.1.2-fuse stopping

      MainSupport                    ERROR Failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.activemq.xbean.XBeanBrokerService#1' defined in file : Invocation of init method failed; nested exception is java.io.IOException: Failed to bind to server socket: tcp://localhost:61616 due to: java.net.BindException: Address already in use: JVM_Bind

      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.activemq.xbean.XBeanBrokerService#1' defined in file : Invocation of init method failed; nested exception is java.io.IOException: Failed to bind to server socket: tcp://localhost:61616 due to: java.net.BindException: Address already in use: JVM_Bind

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

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

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)

           at java.security.AccessController.doPrivileged(Native Method)

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

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

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

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

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

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

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

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

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

           at org.springframework.context.support.ClassPathXmlApplicationContext.(Unknown Source)

           at javax.net.DefaultServerSocketFactory.createServerSocket(Unknown Source)

           at org.apache.activemq.transport.tcp.TcpTransportServer.bind(TcpTransportServer.java:134)

           ... 31 more

      Main$HangupInterceptor         INFO  Recieved hang up - stopping the main instance.

        • 1. Re: running camel-example-spring-jms in eclipse for debug mode
          vcheruvu1

          List of things i tried to resolve above issue :-

           

          - mvn eclipse:eclipse

          - changed port to 61619, still complains address already used.

          - I have commented out below segment from camel-server.xml, tried running activemq independently and run camel server. I didn't get the error but when I execute camel-client, there was no response from server. It prints out "Invoking the multiply with 22" and no result output after that.

           

             <broker:broker useJmx="false" persistent="false" brokerName="localhost">

                  <broker:transportConnectors>

                      <broker:transportConnector name="tcp" uri="tcp://localhost:61616"/>

                  </broker:transportConnectors>

              </broker:broker>

           

          Edited by: vcheruvu1 on Nov 18, 2009 4:28 AM

          • 2. Re: running camel-example-spring-jms in eclipse for debug mode
            vcheruvu1

            I have solved the above issue. I have added the program VM argument in the debug configuration. If I didn't   add this VM argument, this example app will use both camel-server.xml and camel-server-aop.xml to intialize beans which starts the ActiveMQ broker twice.

             

            VM Argument:

            -ac META-INF/spring/camel-server.xml

            • 3. Re: running camel-example-spring-jms in eclipse for debug mode
              njiang

              Yes , camel plugin will try to load the files in META-INF/spring if there is no ac option specified.

              So it is not surprised to see you complain