mercredi 8 juillet 2015

Wildfly 9 @Resource lookup stopped working

I have a webapp which uses a JMS queue, and this worked fine on Wildfly 8.2. But on Wildfly 9.0 I am getting naming exceptions.

As per the example in the guide: http://ift.tt/1MgbQwk

A local client could look it up using "java:jboss/exported/jms/queue/test", "java:jms/queue/test", or more simply "jms/queue/test":

standalone.xml:

<subsystem xmlns="urn:jboss:domain:messaging:2.0">
   <hornetq-server>
      [...]
      <jms-destinations>
         <jms-queue name="testQueue">
             <entry name="jms/queue/test"/>
             <entry name="java:jboss/exported/jms/queue/test"/>
         </jms-queue>
      </jms-destinations>
   </hornetq-server>
</subsystem>

Java class:

@Inject
private JMSContext context;

@Resource(lookup="java:jboss/exported/jms/queue/test")
private Destination queueDestination;

...
private void foo() {
        JMSConsumer consumer = context.createConsumer(queueDestination);
}

After I upgraded to Wildfly to 9.0 Final, I get the following exception on context.createConsumer:

 java.lang.RuntimeException: javax.naming.NameNotFoundException: DefaultJMSConnectionFactory -- service jboss.naming.context.java.module.AAA.AAA.DefaultJMSConnectionFactory

I tried changing the @Resource lookup to "java:jms/queue/test" or "jms/queue/test"

nothing seems to work.

Thanks

Aucun commentaire:

Enregistrer un commentaire