Nous migrons une application de Jboss 5 vers jboss 7. Dans ce cas, nous devons changer la recherche JNDI de JMS.Jboss eap 7.0 - Comment faire une recherche JNDI pour jms dans jboss 7
Dans Jboss 5, il est fait par -
InitialContext ic = new InitialContext();
Object obj = ic.lookup(listenerName);
// listenerName has our destination queue name
En Jboss 7 nous essayons aussi -
Properties jndiProps = new Properties();
jndiProps.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
jndiProps.put(Context.PROVIDER_URL,"http-remoting://localhost:8080");
jndiProps.put("jboss.naming.client.ejb.context", new Boolean(true));
InitialContext ic = new InitialContext(jndiProps);
Object obj = ic.lookup("jms/queue/" + listenerName);
en mode autonome-full.xml nous avons ajouté la file d'attente de destination -
<jms-queue name="CORESERVICES.DEMO_QUEUE" entries="java:/jms/queue/CORESERVICES.DEMO_QUEUE"/>
Nous recevons ces erreurs -
2017-03-31 15:44:04,056 INFO [com.praval.services.core.msg.MessageRouterMDB] (Thread-16 (ActiveMQ-client-global-threads-1938238098)) PRAVAL jmsQueueName is CORESERVICES.DEMO_QUEUE
2017-03-31 15:44:04,195 INFO [org.jboss.ejb.client.remoting] (Remoting "config-based-naming-client-endpoint" task-6) EJBCLIENT000017: Received server version 2 and marshalling strategies [river]
2017-03-31 15:44:04,203 INFO [org.jboss.ejb.client.remoting] (Thread-16 (ActiveMQ-client-global-threads-1938238098)) EJBCLIENT000013: Successful version handshake completed for receiver context EJBReceiverContext{[email protected], receiver=Remoting connection EJB receiver [connection=Remoting connection <3a06c684>,channel=jboss.ejb,nodename=pravalsharma]} on channel Channel ID 45654a55 (outbound) of Remoting connection 12baae23 to localhost/127.0.0.1:8080
2017-03-31 15:44:04,302 WARNING [com.praval.services.core.msg.MessageRouterMDB] (Thread-16 (ActiveMQ-client-global-threads-1938238098)) javax.naming.NameNotFoundException: jms/queue/CORESERVICES.DEMO_QUEUE -- service jboss.naming.context.java.jboss.exported.jms.queue."CORESERVICES.DEMO_QUEUE"
at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:106)
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:207)
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:184)
at org.jboss.naming.remote.protocol.v1.Protocol$1.handleServerMessage(Protocol.java:127)
at org.jboss.naming.remote.protocol.v1.RemoteNamingServerV1$MessageReciever$1.run(RemoteNamingServerV1.java:73)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Donc, le JMS est sur le jboss que ce code est en cours d'exécution? utilisez-vous EJB ou CDI? ou quelque chose de différent? – Zeus