Hello Ashwin,
Thank you very much for your reply. I tried to use
java:QueueConnectionFactory and it works fine.So, now I dont have any
problem to create SA. But this lead again to the very first Exceptions. When
I deploy this SA on ServiceMix(Jetty). Iam getting the same Exception as
before.
Trace:
INFO - AutoDeploymentService - Directory: hotdeploy: Finished
installation of archive: tutorial-sa-1.0-SNAPSHOT.jar
ERROR - JmsComponent - Error processing exchange InOnly[
id: ID:172.25.35.156-11e8ce90b50-7:18
status: Active
role: provider
service: {http://intra.agfanet}jms
endpoint: myQueue
in: <?xml version="1.0" encoding="UTF-8"?><note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
]
java.lang.NullPointerException
at
org.apache.servicemix.jms.DefaultJmsMarshaler.toJMS(DefaultJmsMarshaler.java:83)
at
org.apache.servicemix.jms.DefaultJmsMarshaler.toJMS(DefaultJmsMarshaler.java:107)
at
org.apache.servicemix.jms.AbstractJmsProcessor.fromNMS(AbstractJmsProcessor.java:216)
at
org.apache.servicemix.jms.AbstractJmsProcessor.createMessageFromExchange(AbstractJmsProcessor.java:263)
at
org.apache.servicemix.jms.multiplexing.MultiplexingProviderProcessor.process(MultiplexingProviderProcessor.java:110)
at
org.apache.servicemix.soap.SoapEndpoint.process(SoapEndpoint.java:367)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:600)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:554)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.onMessageExchange(AsyncBaseLifeCycle.java:510)
at
org.apache.servicemix.common.SyncLifeCycleWrapper.onMessageExchange(SyncLifeCycleWrapper.java:60)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:620)
at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:168)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
WARN - FileComponent - Message in file
C:\BPEFileReader\sample.xml could not be handled successfully: null
java.lang.NullPointerException
at
org.apache.servicemix.jms.DefaultJmsMarshaler.toJMS(DefaultJmsMarshaler.java:83)
at
org.apache.servicemix.jms.DefaultJmsMarshaler.toJMS(DefaultJmsMarshaler.java:107)
at
org.apache.servicemix.jms.AbstractJmsProcessor.fromNMS(AbstractJmsProcessor.java:216)
at
org.apache.servicemix.jms.AbstractJmsProcessor.createMessageFromExchange(AbstractJmsProcessor.java:263)
at
org.apache.servicemix.jms.multiplexing.MultiplexingProviderProcessor.process(MultiplexingProviderProcessor.java:110)
at
org.apache.servicemix.soap.SoapEndpoint.process(SoapEndpoint.java:367)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:600)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:554)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.onMessageExchange(AsyncBaseLifeCycle.java:510)
at
org.apache.servicemix.common.SyncLifeCycleWrapper.onMessageExchange(SyncLifeCycleWrapper.java:60)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:620)
at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:168)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
In between, I wrote a small client as you suggested.
QueueConnection cnn = null;
QueueSender sender = null;
QueueSession session = null;
try {
Properties props = new Properties();
props.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
props.setProperty(Context.URL_PKG_PREFIXES,
"org.jboss.naming.client");
props.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099");
props.setProperty("j2ee.clientName", "MDBClient");
InitialContext ctx = new InitialContext(props);
Queue queue = (Queue) ctx.lookup("queue/myQueue");
QueueConnectionFactory factory = (QueueConnectionFactory)
ctx.lookup("QueueConnectionFactory");
cnn = factory.createQueueConnection();
session = cnn.createQueueSession(false,
QueueSession.AUTO_ACKNOWLEDGE);
System.out.println("Enter the message to send to queue.");
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
String str = br.readLine();
TextMessage msg = session.createTextMessage(str);
sender = session.createSender(queue);
sender.send(msg);
System.out.println(msg + "Message sent successfully to remote
queue.");
} catch (NamingException nme) {
System.out.println(nme);
}
I could successfully send the messages to my MDB listener deployed on JBoss.
But the problem to use (ServiceMix)EIP on Jboss JMS queue did not solve.
Please give me some more hints.
Thanking you.
Best Regards,
Ajay
Ashwin Karpe wrote:
>
> Hi Ajay,
>
> Ok, looks like QueueConnectionFactory is set up in JNDI directly under
> root (i.e. not under java:comp/env). Have you tried
> java:QueueConnectionFactory as value of property JNDIName.
>
> In any case if that does not work either, I would think that there is some
> problem with the QueueConnectionFactory and its ability to create
> connection objects with links to queue/MyQueue.
>
> Can you please verify whether the QueueConnectionFactory does return valid
> connection handles that can write to the JBoss Queue using a simple JAVA
> mainline class.
>
> Cheers,
>
> Ashwin...
>
>
> Ajaykumar wrote:
>>
>> Hi Ashwin,
>>
>> Thank you for your reply. I did the following as per your
>> recommendations.
>>
>> Jms SU xbean.xml
>>
>> <beans xmlns:jms="http://servicemix.apache.org/jms/1.0"
>> xmlns:tut="http://intra.agfanet"
>> xmlns:amq="http://activemq.org/config/1.0">
>> <jms:endpoint service="tut:jms"
>> endpoint="myQueue"
>> role="provider"
>> destinationStyle="queue"
>> jmsProviderDestinationName="queue/myQueue"
>> connectionFactory="#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.jboss.naming:org.jnp.interfaces
>> </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>
>> <property name="resourceRef" value="true"/>
>> </bean>
>> </beans>
>>
>> But when I use mvn install for creating SA, Iam getting this exceptions.
>>
>> org.springframework.beans.factory.BeanCreationException: Error creating
>> bean with name 'org.apache.servicemix.jms.JmsEndpoint' defined in URL
>> [file:/D:/SampleJMSExample1/tutorial-jms-su/src/main/resources/xbean.xml]:
>> Cannot resolve reference to bean 'connectionFactory' while setting bean
>> property 'connectionFactory'; nested exception is
>> org.springframework.beans.factory.BeanCreationException: Error creating
>> bean with name 'connectionFactory' defined in URL
>> [file:/D:/SampleJMSExample1/tutorial-jms-su/src/main/resources/xbean.xml]:
>> Invocation of init method failed;
>> nested exception is javax.naming.NameNotFoundException: comp not bound
>>
>> I checked the jmx-console of jboss. There I could find under jboss.jms,
>> there is a JNDIName->QueueConnectionFactory.
>>
>> I dont know what might be the problem. But when I run the jboss, I have
>> this information.
>>
>> [ConnectionFactoryBindingService] Bound ConnectionManager
>> 'jboss.jca:service=DataSourceBinding,name=HSQL_DefaultDS' to JNDI name
>> 'java:HSQL_DefaultDS'
>> [ConnectionFactoryBindingService] Bound ConnectionManager
>> 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name
>> 'java:JmsXA'
>> [ConnectionFactoryBindingService] Bound ConnectionManager
>> 'jboss.jca:service=DataSourceBinding,name=DefaultDS' to JNDI name
>> 'java:DefaultDS
>>
>> So, I request to give some hints what might be the problem. All I want is
>> to create a Jboss JMS queue using Spring beans.
>>
>> Thanking you.
>>
>> Best Regards,
>> Ajay
>>
>>
>>
>> Ashwin Karpe wrote:
>>>
>>> Hi Ajay,
>>>
>>> It seems that the JNDI Name you are using is set to
>>> QueueConnectionFactory. I wonder whether this has been created in JBOSS
>>> as java:comp/env/QueueConnectionFactory. Note that the setter will
>>> automatically append java:comp/env only if resourceRef is set to "true".
>>>
>>> If so then the lookup will fail...
>>>
>>> Can you please verify whether this is the case. Note that the reason
>>> this may be working in your ActiveMQ connectionfactory is that there is
>>> no JNDI related activity.
>>>
>>> Cheers,
>>>
>>> Ashwin...
>>>
>>>
>>> Ajaykumar wrote:
>>>>
>>>> Hi,
>>>>
>>>> Iam having problem using EIP example. I have the following SU's
>>>> configuration.
>>>>
>>>> File SU xbean.xml
>>>>
>>>> <beans xmlns:file="http://servicemix.apache.org/file/1.0"
>>>> xmlns:tut="http://intra.agfanet">
>>>> <!-- add the poller endpoint here -->
>>>> <file:poller service="tut:file" endpoint="poller"
>>>> file="file:C:/BPEFileReader" targetService="tut:wiretap">
>>>> <property name="filter">
>>>> <bean
>>>> class="org.apache.commons.io.filefilter.WildcardFilter">
>>>> <constructor-arg value="sample.xml" />
>>>> </bean>
>>>> </property>
>>>> </file:poller>
>>>> <!-- add the sender endpoint here -->
>>>> <file:sender service="tut:file" endpoint="sender"
>>>> directory="file:C:/BPEFileWriter" />
>>>> </beans>
>>>>
>>>> JMS SU xbean.xml
>>>>
>>>> <beans xmlns:jms="http://servicemix.apache.org/jms/1.0"
>>>> xmlns:tut="http://intra.agfanet"
>>>> xmlns:amq="http://activemq.org/config/1.0">
>>>> <jms:endpoint service="tut:jms"
>>>> endpoint="myQueue"
>>>> role="provider"
>>>> destinationStyle="queue"
>>>> jmsProviderDestinationName="queue/myQueue"
>>>> connectionFactory="#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.jboss.naming:org.jnp.interfaces
>>>> </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>
>>>>
>>>> EIP SU xbean.xml
>>>>
>>>> <beans xmlns:eip="http://servicemix.apache.org/eip/1.0"
>>>> xmlns:tut="http://intra.agfanet">
>>>>
>>>> <eip:wire-tap service="tut:wiretap" endpoint="endpoint">
>>>> <eip:target>
>>>> <eip:exchange-target service="tut:jms" />
>>>> </eip:target>
>>>> <eip:inListener>
>>>> <eip:exchange-target service="tut:file" endpoint="sender" />
>>>> </eip:inListener>
>>>> </eip:wire-tap>
>>>> </beans>
>>>>
>>>> When I use mvn install I dont get any problems. But when I deploy the
>>>> SA on servicemix running on jetty, I have to following exceptions.
>>>>
>>>> ERROR - JmsComponent - Error processing exchange
>>>> InOnly[
>>>> id: ID:172.25.35.156-11e876aa483-7:100
>>>> status: Active
>>>> role: provider
>>>> service: {http://intra.agfanet}jms
>>>> endpoint: myQueue
>>>> java.lang.NullPointerException
>>>> at
>>>> org.apache.servicemix.jms.DefaultJmsMarshaler.toJMS(DefaultJmsMarshaler.java:83)
>>>> at
>>>> org.apache.servicemix.jms.DefaultJmsMarshaler.toJMS(DefaultJmsMarshaler.java:107)
>>>> WARN - FileComponent - Message in file
>>>> C:\BPEFileReader\sample.xml could not be handled successfully: null
>>>> java.lang.NullPointerException
>>>>
>>>> Iam newbie for servicemix. Could some one please help me.
>>>>
>>>> Thanking you.
>>>>
>>>> Best Regards,
>>>> Ajay
>>>>
>>>
>>>
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/Problems-with-EIP-when-using-Jboss-JMS-queue-tp21215924p21230719.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.