Hi all,
I have written a standard Java class (not an EJB) which I have packaged as a JAR within an EAR. This Java Class will put things on a queue when requested.
Rather than perform a manual JNDI lookup for the Queue and Connection Factory, I used the @Resource annotation, and assumed that because it was within a Container (GlassFish) that this would work.
I am pretty confident that the annotation/queue/connectionfactory is set up correctly because the deployment through NetBeans fails otherwise.
However, I keep getting a NullPointerException when the code is executed, so the @Resource annotation isn't working.
Does the @Resource annotation only work in EJBs? Or is this a GlassFish quirk?
Thanks,
MG
I have written a standard Java class (not an EJB) which I have packaged as a JAR within an EAR. This Java Class will put things on a queue when requested.
Rather than perform a manual JNDI lookup for the Queue and Connection Factory, I used the @Resource annotation, and assumed that because it was within a Container (GlassFish) that this would work.
I am pretty confident that the annotation/queue/connectionfactory is set up correctly because the deployment through NetBeans fails otherwise.
However, I keep getting a NullPointerException when the code is executed, so the @Resource annotation isn't working.
Does the @Resource annotation only work in EJBs? Or is this a GlassFish quirk?
Thanks,
MG