1 Reply Latest reply on Jul 4, 2012 3:34 AM by raymanf

    Integrate HornetQ2.2.14 with Spring3.1

    raymanf Newbie

      Hi,


      I am using Spring3.1 in standalone application env.


      I am trying to integrate Hornetq2.2.14 with Spring3.1.


      i am based on the tutorial at: http://www.javacodegeeks.com/2010/06...tegration.html


      I am getting the exception: NoSuchMethodError.


      I know for sure that I have the exact lib iam looking for in my classpath(jnpserver.jar)


      I also make sure that the method its looking for is exist by doing reverse engineering.


      Could be that while Spring initiate my bean that specific jar havnt loaded just yet?


      this is my applicationContext:


       

      Code:

       

      2012-07-03 14:38:05,025 org.springframework.beans.factory.support.DisposableBeanAdapter [DEBUG]

      Invoking destroy() on bean with name 'mbeanServer' org.springframework.beans.factory.BeanCreationException:

      Error creating bean with name 'namingServerImpl' defined in class path resource [applicationContext.xml]:

      Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.jnp.interfaces.NamingContext.getLocal()

      Lorg/jnp/interfaces/Naming; at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455) at

      org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)

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

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

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

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

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

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

      at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)

      at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)

      at com.fixgw.daemon.FeedDaemon.start(FeedDaemon.java:78) at com.fixgw.daemon.FeedDaemon.main(FeedDaemon.java:97)

      Caused by: java.lang.NoSuchMethodError: org.jnp.interfaces.NamingContext.getLocal()Lorg/jnp/interfaces/Naming;

      at org.jnp.server.NamingBeanImpl.start(NamingBeanImpl.java:136) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

      at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1581)

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

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452) ... 13 more


      thats my applicationServer.xml


       

      Code:

       

       

      <?xml version="1.0" encoding="UTF-8"?>
      <beans xmlns="http://www.springframework.org/schema/beans"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
                xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"
      
      
      
      
                xsi:schemaLocation="http://www.springframework.org/schema/beans 
                http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                http://www.springframework.org/schema/context
          http://www.springframework.org/schema/context/spring-context-3.0.xsd
          http://www.springframework.org/schema/aop 
          http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
      
      
                <!-- Must for auto wiring 
                <context:annotation-config />
                -->
      
      
                <context:component-scan base-package="com.fixgw.beans">
                </context:component-scan>
      
      
      
      
      
      
                <!--          start a JMX Server           -->
                <bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean" />
      
      
      
      
                <bean id="FeedListenerBean" class="com.fixgw.beans.FeedListenerBean">
                </bean>
      
      
                <bean id="TriggerBean" class="com.fixgw.test.TriggerBean">
                </bean>
      
      
      
      
      
      
      
      
      
      
                <bean id="exporter" class="org.springframework.jmx.export.MBeanExporter">
                          <property name="beans">
                                    <map>
                                              <entry key="Server:name=HttpAdaptor">
                                                        <bean class="mx4j.tools.adaptor.http.HttpAdaptor">
                                                                  <property name="port" value="8000" />
                                                                  <property name="host" value="0.0.0.0" />
                                                                  <property name="processor">
                                                                            <bean class="mx4j.tools.adaptor.http.XSLTProcessor" />
                                                                  </property>
                                                        </bean>
                                              </entry>
                                              <entry key="bean:name=TriggerBean" value-ref="TriggerBean" />
      
      
                                    </map>
                          </property>
                          <property name="listeners">
                                    <list>
                                              <!--
                                                        let the HttpAdapter be started after it is registered in the
                                                        MBeanServer
                                              -->
                                              <bean class="com.fixgw.jmx.HttpAdaptorMgr">
                                                        <property name="mbeanServer" ref="mbeanServer" />
                                              </bean>
                                    </list>
                          </property>
                </bean>
      
      
      
      
                <bean name="namingServerImpl" class="org.jnp.server.NamingBeanImpl"
                          init-method="start" destroy-method="stop" />
      
      
                <bean name="namingServer" class="org.jnp.server.Main" init-method="start"
                          destroy-method="stop">
                          <property name="namingInfo" ref="namingServerImpl" />
                          <property name="port" value="1099" />
                          <property name="bindAddress" value="localhost" />
                          <property name="rmiPort" value="1098" />
                          <property name="rmiBindAddress" value="localhost" />
                </bean>
      
      
        
      
      
                <bean name="fileConfiguration" class="org.hornetq.core.config.impl.FileConfiguration"
                          init-method="start" destroy-method="stop" />
      
      
                <bean name="hornetQSecurityManagerImpl"
                          class="org.hornetq.spi.core.security.HornetQSecurityManagerImpl" />
      
      
                <!-- The core server -->
                <bean name="hornetQServerImpl" class="org.hornetq.core.server.impl.HornetQServerImpl">
                          <constructor-arg ref="fileConfiguration" />
                          <constructor-arg ref="mbeanServer" />
                          <constructor-arg ref="hornetQSecurityManagerImpl" />
                </bean>
      
      
                <!-- The JMS server -->
                <bean name="jmsServerManagerImpl" class="org.hornetq.jms.server.impl.JMSServerManagerImpl"
                          init-method="start" destroy-method="stop" depends-on="namingServer">
                          <constructor-arg ref="hornetQServerImpl" />
                </bean>
      
      
      
      
      
      
      
      
                <bean name="connectionFactory" class="org.hornetq.jms.client.HornetQConnectionFactory">
                          <constructor-arg>
                                    <bean class="org.hornetq.api.core.TransportConfiguration">
                                              <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" class="org.springframework.jms.core.JmsTemplate">
                          <property name="connectionFactory" ref="connectionFactory"></property>
                </bean>
      
      
      
      
      </beans>
      
      

      I am talking about namingServerImpl bean.

       

      If you have other suggestations for intergration between the two please past me some example I am chasing this for long time now


      thanks,

      ray.