users@glassfish.java.net

Re: Writing a Swing-EJB Client (with Netbeans 6.0)

From: <glassfish_at_javadesktop.org>
Date: Thu, 06 Mar 2008 08:58:58 PST

Hi Jan,

Java EE environment annotations and injection only work within certain kinds of managed classes. The Application Client main class is one example, but your NewJFrame is not, so the @EJB annotation is ignored in that case. You can move the @EJB to the main class and then pass the injected reference to your NewJFrame.

You can also directly lookup the global JNDI name of the target EJB instead of using an EJB dependency in java:comp/env. This gives up some portability but will allow you to access the EJB reference without defining a static EJB dependency. You can find more info about global JNDI names in our EJB FAQ :

https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html

 --ken
[Message sent by forum member 'ksak' (ksak)]

http://forums.java.net/jive/thread.jspa?messageID=262679