Quantcast
Channel: GlassFish Related Items on Java.net
Viewing all articles
Browse latest Browse all 1091

Glassfish junit test - jndi lookup "fails"

$
0
0

Hello,

I'm writing a junit test using Glassfish 4. The code that is being tested accesses a REST endpoint, but when using the embeddable container, the JNDI lookup for the REST endpoint is returning null, so the test bombs when the code tries to operate on the null REST endpoint object.

Example:

EJBContainer container = javax.ejb.embeddable.EJBContainer.createEJBContainer();

Component component = (Component).containter.getContext().lookup("java:global/classes/Component");
MetricFaceREST metric = (MetricFaceREST).containter.getContext().lookup("java:global/classes/MetricFaceREST ");

etc

Within component, the code is attempting a JNDI lookup on MetricFacadeREST. So, any ideas on how to instantiate MetricFacadeREST so that the JNDI lookup "works", or where to tell the container to find that class, are greatly appreciated!

Mike W


Viewing all articles
Browse latest Browse all 1091

Trending Articles