Cannot Connect to HornetQ Connection Factory in JBoss 5 with Spring 3 -
locally, application connects fine built in netty connectionfactory , have no problems on start or sending topic messages. local box stand-alone jboss 5.1 , stand-alone hornetq.
however, when deploying our dev server (running clustered jboss 5.1 , clustered hornetq) i'm not able connect, getting following stack trace:
error [org.apache.catalina.core.containerbase.[jboss.web].[localhost].[/eshowroom]] (main) exception sending context initialized event listener instance of cla>\ss org.springframework.web.context.contextloaderlistener org.springframework.beans.factory.beancreationexception: error creating bean name 'topicconnectionfactory' defined in servletcontext resource [/web-inf/applicationcontext.xml]: invocation of init method failed; nested exception javax.naming.namenotfoundexception: connectionfactory not bound
i'm trying use default, built-in netty connector no configuration except own jms topic. i'm relatively unaware of dev server setup out of control , fairly black box me.
applicationcontext.xml (in $jboss_home/server/default/deploy/application.war/web-inf
):
<bean id="jnditemplate" class="org.springframework.jndi.jnditemplate"> <property name="environment"> <props> <prop key="java.naming.factory.initial">org.jnp.interfaces.namingcontextfactory</prop> <prop key="java.naming.provider.url">jnp://${jboss.bind.address:localhost}:1099</prop> <prop key="java.naming.factory.url.pkgs">org.jboss.naming</prop> </props> </property> </bean> <bean id="topicconnectionfactory" class="org.springframework.jndi.jndiobjectfactorybean"> <property name="jnditemplate" ref="jnditemplate"></property> <property name="jndiname" value="/connectionfactory"></property> </bean> <bean id="cachetopic" class="org.springframework.jndi.jndiobjectfactorybean"> <property name="jnditemplate" ref="jnditemplate"></property> <property name="jndiname" value="/topic/mycachetopic"></property> </bean> <bean id="jmsdestinationresolver" class="org.springframework.jms.support.destination.jndidestinationresolver"> <property name="jnditemplate" ref="jnditemplate"/> <property name="cache" value="true"/> </bean> <bean id="messagesendtemplate" class="org.springframework.jms.core.jmstemplate"> <property name="connectionfactory" ref="topicconnectionfactory"/> <property name="destinationresolver" ref="jmsdestinationresolver"/> <property name="pubsubdomain" value="true"/> </bean>
hornetq-jms.xml (in $jboss_home/server/default/deploy/hornetq.sar
)
<connection-factory name="nettyconnectionfactory"> <xa>true</xa> <connectors> <connector-ref connector-name="netty"/> </connectors> <entries> <entry name="/connectionfactory"/> <entry name="/xaconnectionfactory"/> </entries> </connection-factory> <connection-factory name="nettythroughputconnectionfactory"> <xa>true</xa> <connectors> <connector-ref connector-name="netty-throughput"/> </connectors> <entries> <entry name="/throughputconnectionfactory"/> <entry name="/xathroughputconnectionfactory"/> </entries> </connection-factory> <connection-factory name="invmconnectionfactory"> <xa>true</xa> <connectors> <connector-ref connector-name="in-vm"/> </connectors> <entries> <entry name="java:/connectionfactory"/> <entry name="java:/xaconnectionfactory"/> </entries> </connection-factory>
the difference between local , dev can spot in hornetq-configuration.xml.
dev hornetq-configuration.xml (same path hornetq-jms.xml)
<broadcast-groups> <broadcast-group name="bg-group1"> <group-address>${hornetq.broadcast.bg-group1.address:231.7.7.7}</group-address> <group-port>${hornetq.broadcast.bg-group1.port:9876}</group-port> <broadcast-period>5000</broadcast-period> <connector-ref>netty</connector-ref> </broadcast-group> </broadcast-groups> <discovery-groups> <discovery-group name="dg-group1"> <group-address>${hornetq.discovery.dg-group1.address:231.7.7.7}</group-address> <group-port>${hornetq.discovery.dg-group1.port:9876}</group-port> <refresh-timeout>10000</refresh-timeout> </discovery-group> </discovery-groups> <cluster-connections> <cluster-connection name="my-cluster"> <address>jms</address> <connector-ref>netty</connector-ref> <discovery-group-ref discovery-group-name="dg-group1"/> </cluster-connection> </cluster-connections>
so, turns out whatever reason timing issue in clustered environment. bean(s) needed connection factory forced wait until else , running before spinning up.
Comments
Post a Comment