Expand my Community achievements bar.

connecting to remote JMS server

Avatar

Level 1
I am running Flex2/FDS using Tomcat, and want to create a
Producer/Consumer to message via a JMS application (Sonic ESB) on a
different host. We have successfully done this with Flex 1.5 using
a java servlet, but I cannot get it to work via Flex2/FDS
messaging.



Here are (I think) the essentials:



We have the sonic jars on the server available to FDS, I also
put them in tomcat's common/lib directory



in mxml, I have:



<Producer id="p" destination="sonicDestination" />



in messaging-config.xml I have (relevant part):

...

<destination id="sonicDestination" >

<adapter ref="jms"/>

<channels>

<channel ref="my-rtmp">

</channel>



<properties>

....

<jms>

<destination-type>Queue</destination-type>


<message-type>javax.jms.TextMessage</message-type>


<connection-factory>java:comp/env/jms/connectionFactory</connection-factory>


<destination-jndi-name>java:comp/env/sonicDestination</destination-jndi-name>


<destination-name>targetSonicQueue</destination-name>

<delivery-mode>NON-PERSISTENT</delivery-mode>


<acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>

<transacted-sessions>false</transacted-sessions>

</jms>

</properties>

</destination>

...



in web-xml I have:



<resource-ref>


<res-ref-name>jms/connectionFactory</res-ref-name>

<res-type>javax.jms.ConnectionFactory</res-type>

<res-auth>Container</res-auth>

<res-sharing-scope>Shareable</res-sharing-scope>

</resource-ref>



<resource-ref>

<res-ref-name>sonicDestination</res-ref-name>

<res-type>javax.jms.Destination</res-type>

<res-auth>Container</res-auth>

<res-sharing-scope>Shareable</res-sharing-scope>

</resource-ref>





AND in context.xml I have:



<Resource name="jms/connectionFactory" auth="container"

type="progress.message.jclient.ConnectionFactory"

brokerURL="tcp:_ipaddress_:2506"

username="_username_" password="_password_"

defaultUser="_username_" defaultPassword="_password_"

/>

<Resource name="sonicDestination" auth="container"

type="progress.message.jclient.Queue"

queueName="targetSonicQueue" />





... this all seems to deploy OK... in the mxml... when I
create a message and try to have the producer send it...



I get an error on the server (which is passed back as an
exception to the client)... the relevant part of all that is:



javax.naming.NamingException: Cannot create resource instance

at
org.apache.naming.factory.ResourceFactory.getObjectInstance()

at javax.naming.spi.NamingManager.getObjectInstance()

at org.apache.naming.NamingContext.lookup()

_several layers of calling NamingContext_

at javax.naming.InitialContext.lookup()

at
flex.messaging.services.messaging.adapters.JMSProxy.getDestination()

at
flex.messaging.services.messaging.adapters.JMSQueueProducer.start()

..._more



It looks to me like it is finding Tomcat's JNDI service and
getting to the point where its trying to instantiate the

connectionFactory or the sonicDestination...

and that's failing...



do you have or know of someone who knows how to connect to
from Flex 2.0.1 / FDS via Tomcat to a Sonic MQ (7.0) server on
another host ?



Thanx much





0 Replies