0

From wildfly 10 documentation:

For example, the following jms-queue "testQueue" is bound to "java:jboss/exported/jms/queue/test" which means a remote client would look-up this {{kms-queue} using "jms/queue/test". A local client could look it up using "java:jboss/exported/jms/queue/test", "java:jms/queue/test", or more simply "jms/queue/test"

In my MDB if I use

@Resource(mappedName = "java:/jboss/exported/jms/queue/TestQ")
Queue testQ;

It works fine, But on trying out the following:

@Resource(mappedName = "java:jms/queue/TestQ")
Queue testQ;

or

@Resource(mappedName = "jms/queue/TestQ")
Queue testQ;

I get the following error while deploying the application in wildfly 10

{"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.app.app.env.\"com.example.jms.ExampleMdb\".testQ is missing [jboss.naming.context.java.jboss.java:jms.queue.TestQ]"]}

What could be the problem? and if I use java:/jboss/exported/jms/queue/TestQ will it work well with other servers other than wildfly?

Cœur
  • 37,241
  • 25
  • 195
  • 267
bavon
  • 151
  • 2
  • 14

1 Answers1

0

if you read the javadoc for Resource it says:

A product specific name that this resource should be mapped to. The name of this resource, as defined by the name element or defaulted, is a name that is local to the application component using the resource. (It's a name in the JNDI java:comp/env namespace.) Many application servers provide a way to map these local names to names of resources known to the application server. This mapped name is often a global JNDI name, but may be a name of any form.

so for mappedName you can only use a full jndi name or the name in java:comp/env.

what you probably want is:

@Resource(lookup = "queue/TestQ")
Queue testQ;

And then in your configuration set it up like this:

<jms-queue name="classReportQueue">
    <entry name="queue/TestQ"/>
    <entry name="java:jboss/exported/jms/queue/TestQ"/>
</jms-queue>
Tea Curran
  • 2,923
  • 2
  • 18
  • 22
  • Still not working: `@Resource(lookup = "jms/queue/TestQ")` and my wildfly has this entry `` and am getting the same error. – bavon Aug 08 '16 at 04:02
  • I assume you aren't putting two names under a parameter called entries right? That was just for the comment? Have you looked in the admin console or cli to make sure it's registering the jndi names you expect? – Tea Curran Aug 08 '16 at 04:18
  • It is registered and actually from standalone application i can get it using `Queue testQ = (Queue) context.lookup("jms/queue/TestQ");` my problem is why is it that with `@Resource(mappedName = "java:/jboss/exported/jms/queue/TestQ")` it is ok, while if i try the other options i get the missing dependency from wildfly – bavon Aug 08 '16 at 09:18