And you are sure the lookup happens post-deployment? Is it the same result with the other JNDI names?
1 of 1 people found this helpful
I'm not sure whether this will work.
Is it not possible to use a non static approach and injection?
At least the given piece of code is executed after the server logs tell about the EJB's JNDI bindings (as written above). I also tried the other JNDI names given (java:global, ...), they also don't work.
For testing purposes I've configured a datasource in standalone-full.xml and performed a JNDI lookup on the datasource in the above given static code block: this succeeds.
Using injection is unfortunately not an option. Maybe I should try with a non-static approach.
That code won't work without proper dependencies. Injection is one way of implicitly adding a dependency. Is that a random class from where you are doing a lookup? Why not do that lookup from some container managed component like servlet, EJB etc...?