Hi,
I'm having a little problem with JMS/MDB in JBOSS.
I have a local client that send messages to a remote server (jboss),
where I have deployed a MDB who receives these messages.
All messages are sent and received correcty, but when a try to
send a reply message to the client, i can't
lookup the "ConnectionFactory".
The external contexts "java:/external/serverJBoss" and
"java:external/clientJBoss" had been configured in jms-ds.xmls files
My client look like this:
try {
initialContext = new InitialContext();
remoteContext =
(Context)initialContext.lookup("java:external/serverJBoss");
topicConnectionFactory =
(TopicConnectionFactory)remoteContext.lookup("java:external/serverJBoss/ConnectionFactory");
}catch(NamingException ne) {
System.err.println(" Class: NetSyncClient");
System.err.println(" Method: Save()");
System.err.println(" Error: JNDI API lookup failed" +
ne.toString());
}
try {
mytTopic =
(Topic)remoteContext.lookup("java:external/serverJBoss/topic/myTopic");
tConnection = topicConnectionFactory.createTopicConnection();
tSession = tConnection.createTopicSession(false,
Message.DEFAULT_DELIVERY_MODE);
mytTopicTemporaryTopic = tSession.createTemporaryTopic();
netSyncSubscriber =
tSession.createSubscriber(myTopicTemporaryTopic);
netSyncSubscriber.setMessageListener(new EmpresasListener());
tConnection.start();
tPublisher = tSession.createPublisher(myTopic);
message = tSession.createMapMessage();
message.setJMSMessageID(
String.valueOf(empresasData.getIdEmpresa()));
message.setJMSDeliveryMode(DeliveryMode.NON_PERSISTENT);
//message.setJMSExpiration(0L);
message.setJMSReplyTo(netSyncTopic);
message.setInt("id", 1);
message.setString("description", "Grupo American");
tPublisher.publish(message);
} catch (Exception e) {
System.err.println(" Class: NetSyncClient");
System.err.println(" Method: Save()");
System.err.println(" Error: " + "Exception: " + e.toString());
} finally {
if (tSession != null) {
try {
tSession.close();
} catch (Exception e) {
System.err.println("ClientAction: " + "Close session
exception: " + e.toString());
}
}
if (tConnection != null) {
try {
tConnection.close();
} catch (Exception e) {
System.err.println("ClientAction: " + "Close connection
exception: " + e.toString());
}
}
}
The client works just fine and the MDB on remote server receives the message,
and when a try to lookup the "ConnectionFactory" of the client (to send a reply
message)
i receive a "ConnectionFactory Not Bound" error.
My MDB look like this:
try{
this.initialContext = new InitialContext();
this.remoteContext = (Context)
initialContext.lookup("java:external/clientJBoss");
this.messageDrivenContext = messageDrivenContext;
//ConnectionFactory Not Bound error
topicConnectionFactory = (TopicConnectionFactory)
remoteContext.lookup("java:external/clientJBoss/ConnectionFactory");
}catch (NamingException ne) {
System.err.println(" Class: EmpresasMDB");
System.err.println(" Method: setMessageDrivenContext()");
System.err .println(" Error: JNDI API lookup failed" +
ne.toString());
}
Some help ?!
Thanks.
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user