You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Ajaykumar <va...@gmail.com> on 2008/12/24 12:07:42 UTC

Having problems Configuring beans for Remote JBoss Queue

Hi,

I have servicemix which is running on Jetty. And my MessageDrivenBean is on
JBoss. Now, I want to configure jboss queue on servicemix and send messages
to messagelistener on jboss. I tried to use JNDI configuration in xbean.xml.
It is as follows:

<jms:endpoint service="tutorial:jms" endpoint="myProvider"
		role="provider" destinationStyle="queue"
jmsProviderDestinationName="queue/myQueue"
		connectionFactory="#connectionFactory" />	

	<jms:endpoint service="tutorial:jms" endpoint="myConsumer"
		role="consumer" destinationStyle="queue"
jmsProviderDestinationName="queue/myQueue"
		connectionFactory="#connectionFactory" targetService="tutorial:jms"
		targetEndpoint="myConsumer" />

	<amq:connectionFactory id="connectionFactory" />
	
	<bean id="jbossJndiTemplate" 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://localhost:1099
				</prop>

				<prop key="java.naming.factory.url.pkgs">
				org.jnp.interfaces:org.jboss.naming
				</prop>
			</props>
		</property>
	</bean>

	<bean id="ConnectionFactory"
class="org.springframework.jndi.JndiObjectFactoryBean">
		<property name="jndiTemplate">
			<ref bean="jbossJndiTemplate" />
		</property>
		<property name="jndiName">
			<value>QueueConnectionFactory</value>
		</property>
	</bean>
</beans>

But, unfortunately Iam getting these errors

Caused by: org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'ConnectionFactory'
Caused by: javax.naming.NoInitialContextException: Cannot instantiate class:
org.jnp.interfaces.NamingContextFactory 
Caused by: java.lang.ClassNotFoundException:
org.jnp.interfaces.NamingContextFactory

Should I have to give brokerURL? If so, is this serverbindport of jboss? Iam
trying this for the past 3 days.
Please help.

Thanking you.

Regards,
Ajay

-- 
View this message in context: http://www.nabble.com/Having-problems-Configuring-beans-for-Remote-JBoss-Queue-tp21156812p21156812.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Having problems Configuring beans for Remote JBoss Queue

Posted by Ajaykumar <va...@gmail.com>.
Hello Gert,

Thank you for your reply. Now, I have added dependecy to SU's pom.xml
<dependency>
			<groupId>jboss</groupId>
			<artifactId>jnp-client</artifactId>
			<version>4.2.2.GA</version>
		</dependency>
		
		<dependency>
			<groupId>jboss</groupId>
			<artifactId>jbossall-client</artifactId>
			<version>4.2.2.GA</version>
		</dependency>
And there are no more problems regarding JNDI. 

But, my problem to send messages from Serivcemix(jetty) to
MessagesDrivenbeanListener(Jboss) did not solve. 

In Jms SU xbean.xml I added the following xml to register to queue/myQueue

<jms:endpoint service="tutorial:jms" endpoint="myProvider"
		role="provider" destinationStyle="queue"
jmsProviderDestinationName="queue/myQueue"
		connectionFactory="#connectionFactory" />
 I could also see jmsmyProvider in Jconsole. I want to use camel to send
messages to this queue. I added the following code to MyRouteBuilder.java

 from("timer://tutorial?fixedRate=true&delay=3000&period=30000")             
            .setBody(constant("<message>Hello world!</message>"))                       
           
.to("jbi:endpoint:urn:org:apache:servicemix:tutorial:camel:jms:myProvider");

My intension is to send messages to queue/myQueue. So that, my
MessagesDrivenBean Listener which is deployed on Jboss listens to this
queue/myQueue and received the message sent by the timer.But, Iam getting
the following error messages on Servicemix.

[Fatal Error] :-1:-1: Premature end of file.
JmsComponent                   - Error processing exchange InOnly[
Unable to display: javax.xml.transform.TransformerException:
org.xml.sax.SAXParseException: Premature end of file.
ERROR - DeadLetterChannel              - Failed delivery for exchangeId:
ID-trrw0104/3099-1230559136380/0-0. On delivery attempt: 0 caught:
java.lang.NullPointerException

I dont know where Iam doing wrong. Any hints, will be of great help to me.

Thanking you.

Best Regards,
Ajay

Gert Vanthienen wrote:
> 
> L.S.,
> 
> I suppose you have ServiceMix deployed as a WAR file on a stand-alone 
> jetty, right?  You need to add the JBoss JNDI classes to your JMS SU 
> then.  You can do this by adding a <dependency/> for the JBoss JNDI 
> library JAR file to your SU's pom.xml.
> 
> Regards,
> 
> Gert
> 
> Ajaykumar wrote:
>> Hi,
>>
>> I have servicemix which is running on Jetty. And my MessageDrivenBean is
>> on
>> JBoss. Now, I want to configure jboss queue on servicemix and send
>> messages
>> to messagelistener on jboss. I tried to use JNDI configuration in
>> xbean.xml.
>> It is as follows:
>>
>> <jms:endpoint service="tutorial:jms" endpoint="myProvider"
>> 		role="provider" destinationStyle="queue"
>> jmsProviderDestinationName="queue/myQueue"
>> 		connectionFactory="#connectionFactory" />	
>>
>> 	<jms:endpoint service="tutorial:jms" endpoint="myConsumer"
>> 		role="consumer" destinationStyle="queue"
>> jmsProviderDestinationName="queue/myQueue"
>> 		connectionFactory="#connectionFactory" targetService="tutorial:jms"
>> 		targetEndpoint="myConsumer" />
>>
>> 	<amq:connectionFactory id="connectionFactory" />
>> 	
>> 	<bean id="jbossJndiTemplate"
>> 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://localhost:1099
>> 				</prop>
>>
>> 				<prop key="java.naming.factory.url.pkgs">
>> 				org.jnp.interfaces:org.jboss.naming
>> 				</prop>
>> 			</props>
>> 		</property>
>> 	</bean>
>>
>> 	<bean id="ConnectionFactory"
>> class="org.springframework.jndi.JndiObjectFactoryBean">
>> 		<property name="jndiTemplate">
>> 			<ref bean="jbossJndiTemplate" />
>> 		</property>
>> 		<property name="jndiName">
>> 			<value>QueueConnectionFactory</value>
>> 		</property>
>> 	</bean>
>> </beans>
>>
>> But, unfortunately Iam getting these errors
>>
>> Caused by: org.springframework.beans.factory.BeanCreationException: Error
>> creating bean with name 'ConnectionFactory'
>> Caused by: javax.naming.NoInitialContextException: Cannot instantiate
>> class:
>> org.jnp.interfaces.NamingContextFactory 
> 
>> Caused by: java.lang.ClassNotFoundException:
>> org.jnp.interfaces.NamingContextFactory
>>
>> Should I have to give brokerURL? If so, is this serverbindport of jboss?
>> Iam
>> trying this for the past 3 days.
>> Please help.
>>
>> Thanking you.
>>
>> Regards,
>> Ajay
>>
>>   
> 
> 
> 
> -----
> ---
> Gert Vanthienen
> http://gertvanthienen.blogspot.com
> 

-- 
View this message in context: http://www.nabble.com/Having-problems-Configuring-beans-for-Remote-JBoss-Queue-tp21156812p21203917.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Having problems Configuring beans for Remote JBoss Queue

Posted by Gert Vanthienen <ge...@skynet.be>.
L.S.,

I suppose you have ServiceMix deployed as a WAR file on a stand-alone 
jetty, right?  You need to add the JBoss JNDI classes to your JMS SU 
then.  You can do this by adding a <dependency/> for the JBoss JNDI 
library JAR file to your SU's pom.xml.

Regards,

Gert

Ajaykumar wrote:
> Hi,
>
> I have servicemix which is running on Jetty. And my MessageDrivenBean is on
> JBoss. Now, I want to configure jboss queue on servicemix and send messages
> to messagelistener on jboss. I tried to use JNDI configuration in xbean.xml.
> It is as follows:
>
> <jms:endpoint service="tutorial:jms" endpoint="myProvider"
> 		role="provider" destinationStyle="queue"
> jmsProviderDestinationName="queue/myQueue"
> 		connectionFactory="#connectionFactory" />	
>
> 	<jms:endpoint service="tutorial:jms" endpoint="myConsumer"
> 		role="consumer" destinationStyle="queue"
> jmsProviderDestinationName="queue/myQueue"
> 		connectionFactory="#connectionFactory" targetService="tutorial:jms"
> 		targetEndpoint="myConsumer" />
>
> 	<amq:connectionFactory id="connectionFactory" />
> 	
> 	<bean id="jbossJndiTemplate" 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://localhost:1099
> 				</prop>
>
> 				<prop key="java.naming.factory.url.pkgs">
> 				org.jnp.interfaces:org.jboss.naming
> 				</prop>
> 			</props>
> 		</property>
> 	</bean>
>
> 	<bean id="ConnectionFactory"
> class="org.springframework.jndi.JndiObjectFactoryBean">
> 		<property name="jndiTemplate">
> 			<ref bean="jbossJndiTemplate" />
> 		</property>
> 		<property name="jndiName">
> 			<value>QueueConnectionFactory</value>
> 		</property>
> 	</bean>
> </beans>
>
> But, unfortunately Iam getting these errors
>
> Caused by: org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'ConnectionFactory'
> Caused by: javax.naming.NoInitialContextException: Cannot instantiate class:
> org.jnp.interfaces.NamingContextFactory 
> Caused by: java.lang.ClassNotFoundException:
> org.jnp.interfaces.NamingContextFactory
>
> Should I have to give brokerURL? If so, is this serverbindport of jboss? Iam
> trying this for the past 3 days.
> Please help.
>
> Thanking you.
>
> Regards,
> Ajay
>
>