Announcement Announcement Module
Collapse
No announcement yet.
Spring integration with Hornetq exception Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring integration with Hornetq exception

    Hi,
    I am trying to Integrate between Spring3.1 and HornetQ(2.2.x) in a standalone enviroument.

    I followed the doc at: http://www.javacodegeeks.com/2010/06...tegration.html

    I have placed these file under my root project dir:

    hornetq-jms.xml, hornetq-users.xml, hornetq-beans.xml,hornetq-configuration.xml

    Also I have added to my libs dir those jars:


    /lib/hornetq-bootstrap.jar
    /lib/hornetq-core.jar
    /lib/hornetq-jms.jar
    /lib/hornetq-logging.jar
    /lib/jnpserver.jar
    /lib/netty.jar
    The JBoss Logging SPI library
    jboss-logging-spi-2.1.1.GA.jar



    This is my applicationContext.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.finbird.fixgw.beans">
    	</context:component-scan>
    
    
    
    	<!--	start a JMX Server 	-->
    	<bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean" />
    
    
    	<bean id="FeedListenerBean" class="com.finbird.fixgw.beans.FeedListenerBean">
    	</bean>
    
    	<bean id="TriggerBean" class="com.finbird.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.finbird.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>
    now when I try to run my app I get this error:


    Code:
    Can't stop HttpAdaptor: javax.management.InstanceNotFoundException: Server:name=HttpAdaptor
    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.finbird.fixgw.daemon.FeedDaemon.start(FeedDaemon.java:78)
    	at com.finbird.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

    What am I doing wrong?

    thanks,
    ray

  • #2
    I believe its related to jndi.properties. It should have been in your classpath which have information about NamingContextFactory. Anyways, a running example with information from above link is here.

    http://howtodoinjava.com/2013/03/24/...ation-example/

    Comment

    Working...
    X