I'm not sure if this is supposed to work, but i'm trying to write a JMS producer with cdi with wildfly and stuck at injecting resources into a cdi managed bean:
public class CdiProducer {
@Resource(name = "java:jboss/DefaultJMSConnectionFactory")
@Produces
QueueConnectionFactory qcf;
@Resource(name = "java:/queue/HELLOWORLDMDBQueue")
@Produces
@Hello
Queue helloWordQueue;
Running this I'm getting the following error:
JBAS016076: Error injecting resource into CDI managed bean. Can't find a resource named ...
What is very strange however is, when i copy&paste the resources into a enterprise bean, everything works!
@Stateless
public class QueueSender {
@Resource(name="java:jboss/DefaultJMSConnectionFactory")
QueueConnectionFactory qcf;
@Resource(name="java:/queue/HELLOWORLDMDBQueue")
Queue helloWordQueue;
Queue is defined as:
<jms-destinations>
<jms-queue name="HelloWorldQueue">
<entry name="/queue/HELLOWORLDMDBQueue"/>
<entry name="java:jboss/exported/queue/HELLOWORLDMDBQueue"/>
</jms-queue>
</jms-destinations>
Is this supposed to work this way? Or is a bug in wildfly?