You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by fraespre <ja...@d-core.es> on 2009/10/07 00:37:51 UTC

Problems using JbossMessaging JMS queue

Hi, 

I'm using an alternate JMS provider (not ActiveMQ) with ServiceMix 4. The
jms provider is jBossMessaging 2.0.0BETA4, this provider works with Hermes
and java client whithout problems.
I'm using Spring's JEE JNDI lookup to create the Connection Factory. 
I'm getting an error when I start the JBI service assembly that contains 
the JMS service unit.


jBossMessaging configuration jbm-jms.xml

	<connection-factory name="ConnectionFactory">
		<connector-ref connector-name="netty"/>
		<entries>
			<entry name="cosimaFactory"/>
			<entry name="java:/cosimaFactory"/>
		</entries>
	</connection-factory>
	
	<queue name="cosimaJira">
		<entry name="/CosimaJira"/>
	</queue>


JMS SU xbean.xml

     <jms:endpoint service="cosi:jmsCosimaJira" endpoint="jmsCosimaJira"
                   targetService="cosi:router"
                   role="consumer" 
                   destinationStyle="queue"
                   jmsProviderDestinationName="CosimaJira"
                   connectionFactory="#connFactory"/>
                   
     <bean id="jbossJndiTemplate"
class="org.springframework.jndi.JndiTemplate">
     		<property name="environment">
     			<props>
     				<prop
key="java.naming.factory.initial">org.jboss.naming.NamingContextFactory</prop>
     				<prop key="java.naming.provider.url">jnp://localhost:1099</prop>
     				<prop
key="java.naming.factory.url.pkgs">org.jboss.naming:org.jnp.interfaces</prop>
     			</props>
     		</property>
     	</bean>
 	
 	    <bean id="connFactory"
class="org.springframework.jndi.JndiObjectFactoryBean">
   		   <property name="jndiTemplate">	
            <ref bean="jbossJndiTemplate" /> 
         </property>
   		   <property name="jndiName">	
            <value>cosimaFactory</value>  
         </property> 
   		   <property name="resourceRef" value="true"/>
 	    </bean>

The result is:
Cannot resolve reference to bean 'connFactory' while setting bean property
'connectionFactory'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'connFactory'.  Invocation of init method failed; nested exception
is javax.naming.NameNotFoundException: cosimaFactory

Note, I've also tried:
   <value>/cosimaFactory</value>  
and
   <value>java:/cosimaFactory</value>  
with the same result.


With this other JMS SU xbean.xml

      <jms:endpoint service="cosi:jmsCosimaJira" endpoint="jmsCosimaJira"
                   targetService="cosi:router"
                   role="consumer" 
                   destinationStyle="queue"
                   jndiDestinationName="CosimaJira"
                   jndiConnectionFactoryName="cosimaFactory"
                  
initialContextFactory="org.jboss.naming.NamingContextFactory"
                   jndiProviderURL="jnp://localhost:1099"   
                   defaultMep="http://www.w3.org/2004/08/wsdl/in-only" /> 

The result is:
Caused by: javax.jbi.management.DeploymentException: <component-task-result
xmlns="http://java.sun.com/xml/ns/jbi/management-message">
	<component-name>servicemix-jms</component-name>
	<component-task-result-details>
		<task-result-details>
			<task-id>init</task-id>
			<task-result>FAILED</task-result>
			<message-type>ERROR</message-type>
			<task-status-msg><msg-loc-info><loc-token/><loc-message>Unable to init
service unit</loc-message></msg-loc-info></task-status-msg>
			<exception-info>
				<nesting-level>1</nesting-level>
				<msg-loc-info>
					<loc-token />
					<loc-message>null</loc-message>
					<stack-trace><![CDATA[java.lang.NullPointerException


In my opinion the problem is the servicemix can´t find the jndi service
jboss. 
Any suggestions, ideas or alternative?

Thanks, 

javier


-- 
View this message in context: http://www.nabble.com/Problems-using-JbossMessaging-JMS-queue-tp25777722p25777722.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Problems using JbossMessaging JMS queue

Posted by fraespre <ja...@d-core.es>.
I've tried and still not working. I specifically made the following change:
        <property name="jndiName">	
            <value>java:/cosimaFactory</value>  
         </property>

The result is:
Cannot resolve reference to bean 'connFactory' while setting bean property
'connectionFactory'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'connFactory'. Invocation of init method failed; nested exception
is javax.naming.NotContextException: java:/cosimaFactory

I do not think the problem is JBoss Messaging because I can connect from
other clients, including Maven before packaging verifies that the connection
to the JMS provider:

[INFO] [jbi:generate-jbi-service-unit-descriptor {execution:
default-generate-jbi-service-unit-descriptor}]
[INFO] Generating jbi.xml
[INFO] Created Service Unit Analyzer
org.apache.servicemix.jms.packaging.JmsServiceUnitAnalyzer@15cd9a
2009-10-07 17:29:59,627 [main           ] INFO 
ileSystemXmlApplicationContext - Refreshing org.apache.xbean.spring.cont
ext.FileSystemXmlApplicationContext@17644c8: display name
[org.apache.xbean.spring.context.FileSystemXmlApplicationConte
xt@17644c8]; startup date [Wed Oct 07 17:29:59 CEST 2009]; root of context
hierarchy
2009-10-07 17:29:59,798 [main           ] INFO  XBeanXmlBeanDefinitionReader  
- Loading XML bean definitions from URL [
file:/C:/testEnv/esb/apache-servicemix-4.0.0/examples/cosimaJira/cosi-su-jms/src/main/resources/xbean.xml]
2009-10-07 17:30:00,423 [main           ] INFO 
ileSystemXmlApplicationContext - Bean factory for application context [o
rg.apache.xbean.spring.context.FileSystemXmlApplicationContext@17644c8]:
org.springframework.beans.factory.support.Defau
ltListableBeanFactory@101da9
2009-10-07 17:30:00,455 [main           ] INFO  DefaultListableBeanFactory    
- Pre-instantiating singletons in org.spr
ingframework.beans.factory.support.DefaultListableBeanFactory@101da9:
defining beans [org.apache.servicemix.jms.JmsEndpo
int#0,jbossJndiTemplate,connFactory]; root of factory hierarchy
[INFO] generated : consumes
[org.apache.servicemix.common.packaging.Consumes@161401f] provides []


Hermes also has no problem connecting and easily inspect the queues:

http://www.nabble.com/file/p25789533/hermes.png 


Thank you




Hi,

The issue seems to be linked to the JNDI lookup.

I think that the issue is due to a limitation of JBoss about on which 
context the name is bound.
In JBoss, a JNDI name is bound on the local context by default: 
java:comp/env) and you need to make the JNDI lookup on this context.
In your case, as you're remote from JBoss, you need to use the global 
context.
So you need to map the JNDI local name to the JNDI global name.
To do it in JBoss, you have to add a naming alias (for example in 
deploy/properties-service.xml):

<mbean code="org.jboss.naming.NamingAlias"
        name="jboss.mq:service=..."">
   <attribute name="FromName">java:comp/env/ConnectionFactory</attribute>
   <attribute name="ToName">ConnectionFactory</attribute>
</mbean>

Could you try this ?

Thanks
Regards
JB

-- 
View this message in context: http://www.nabble.com/Problems-using-JbossMessaging-JMS-queue-tp25777722p25789533.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Problems using JbossMessaging JMS queue

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,

The issue seems to be linked to the JNDI lookup.

I think that the issue is due to a limitation of JBoss about on which 
context the name is bound.
In JBoss, a JNDI name is bound on the local context by default: 
java:comp/env) and you need to make the JNDI lookup on this context.
In your case, as you're remote from JBoss, you need to use the global 
context.
So you need to map the JNDI local name to the JNDI global name.
To do it in JBoss, you have to add a naming alias (for example in 
deploy/properties-service.xml):

<mbean code="org.jboss.naming.NamingAlias"
        name="jboss.mq:service=..."">
   <attribute name="FromName">java:comp/env/ConnectionFactory</attribute>
   <attribute name="ToName">ConnectionFactory</attribute>
</mbean>

Could you try this ?

Thanks
Regards
JB

fraespre wrote:
> Hi, 
> 
> I'm using an alternate JMS provider (not ActiveMQ) with ServiceMix 4. The
> jms provider is jBossMessaging 2.0.0BETA4, this provider works with Hermes
> and java client whithout problems.
> I'm using Spring's JEE JNDI lookup to create the Connection Factory. 
> I'm getting an error when I start the JBI service assembly that contains 
> the JMS service unit.
> 
> 
> jBossMessaging configuration jbm-jms.xml
> 
> 	<connection-factory name="ConnectionFactory">
> 		<connector-ref connector-name="netty"/>
> 		<entries>
> 			<entry name="cosimaFactory"/>
> 			<entry name="java:/cosimaFactory"/>
> 		</entries>
> 	</connection-factory>
> 	
> 	<queue name="cosimaJira">
> 		<entry name="/CosimaJira"/>
> 	</queue>
> 
> 
> JMS SU xbean.xml
> 
>      <jms:endpoint service="cosi:jmsCosimaJira" endpoint="jmsCosimaJira"
>                    targetService="cosi:router"
>                    role="consumer" 
>                    destinationStyle="queue"
>                    jmsProviderDestinationName="CosimaJira"
>                    connectionFactory="#connFactory"/>
>                    
>      <bean id="jbossJndiTemplate"
> class="org.springframework.jndi.JndiTemplate">
>      		<property name="environment">
>      			<props>
>      				<prop
> key="java.naming.factory.initial">org.jboss.naming.NamingContextFactory</prop>
>      				<prop key="java.naming.provider.url">jnp://localhost:1099</prop>
>      				<prop
> key="java.naming.factory.url.pkgs">org.jboss.naming:org.jnp.interfaces</prop>
>      			</props>
>      		</property>
>      	</bean>
>  	
>  	    <bean id="connFactory"
> class="org.springframework.jndi.JndiObjectFactoryBean">
>    		   <property name="jndiTemplate">	
>             <ref bean="jbossJndiTemplate" /> 
>          </property>
>    		   <property name="jndiName">	
>             <value>cosimaFactory</value>  
>          </property> 
>    		   <property name="resourceRef" value="true"/>
>  	    </bean>
> 
> The result is:
> Cannot resolve reference to bean 'connFactory' while setting bean property
> 'connectionFactory'; nested exception is
> org.springframework.beans.factory.BeanCreationException: Error creating bean
> with name 'connFactory'.  Invocation of init method failed; nested exception
> is javax.naming.NameNotFoundException: cosimaFactory
> 
> Note, I've also tried:
>    <value>/cosimaFactory</value>  
> and
>    <value>java:/cosimaFactory</value>  
> with the same result.
> 
> 
> With this other JMS SU xbean.xml
> 
>       <jms:endpoint service="cosi:jmsCosimaJira" endpoint="jmsCosimaJira"
>                    targetService="cosi:router"
>                    role="consumer" 
>                    destinationStyle="queue"
>                    jndiDestinationName="CosimaJira"
>                    jndiConnectionFactoryName="cosimaFactory"
>                   
> initialContextFactory="org.jboss.naming.NamingContextFactory"
>                    jndiProviderURL="jnp://localhost:1099"   
>                    defaultMep="http://www.w3.org/2004/08/wsdl/in-only" /> 
> 
> The result is:
> Caused by: javax.jbi.management.DeploymentException: <component-task-result
> xmlns="http://java.sun.com/xml/ns/jbi/management-message">
> 	<component-name>servicemix-jms</component-name>
> 	<component-task-result-details>
> 		<task-result-details>
> 			<task-id>init</task-id>
> 			<task-result>FAILED</task-result>
> 			<message-type>ERROR</message-type>
> 			<task-status-msg><msg-loc-info><loc-token/><loc-message>Unable to init
> service unit</loc-message></msg-loc-info></task-status-msg>
> 			<exception-info>
> 				<nesting-level>1</nesting-level>
> 				<msg-loc-info>
> 					<loc-token />
> 					<loc-message>null</loc-message>
> 					<stack-trace><![CDATA[java.lang.NullPointerException
> 
> 
> In my opinion the problem is the servicemix can´t find the jndi service
> jboss. 
> Any suggestions, ideas or alternative?
> 
> Thanks, 
> 
> javier
> 
>