As per spec, only static fields of the main class are injected in a application client.
The related part of the JavaEE Platform Spec (JSR342) is here:
EE.5.2.5 Annotations and Injection
As described in the following sections, a field or method of certain container-
managed component classes may be annotated to request that an entry from the
application component’s environment be injected into the class. The specifications
for the different containers indicate which classes are considered container-managed
classes; not all classes of a given type are necessarily managed by the container.
Any of the types of resources described in this chapter may be injected.
Injection may also be requested using entries in the deployment descriptor
corresponding to each of these resource types. The field or method may have any
access qualifier ( public , private , etc.). For all classes except application client
main classes, the fields or methods must not be static . Because application
clients use the same lifecycle as Java SE applications, no instance of the
application client main class is created by the application client container. Instead,
the static main method is invoked. To support injection for the application client
main class, the fields or methods annotated for injection must be static .
A field of a class may be the target of injection. The field must not be final .
By default, the name of the field is combined with the fully qualified name of the
class and used directly as the name in the application component’s naming
context. For example, a field named myDatabase in the class MyApp in the package
com.example would correspond to the JNDI name java:comp/env/
com.example.MyApp/myDatabase . The annotation also allows the JNDI name to be
specified explicitly. When a deployment descriptor entry is used to specify
injection, the JNDI name and the field name are both specified explicitly. Note
that, by default, the JNDI name is relative to the java:comp/env naming context.
Only the main-class static attributes are supported for injection, did not noticed that on top of my head.
Thanks for the answer. I must have missed that bit. It works now.