Strange errors during deploy

170 views
Skip to first unread message

Gazzille

unread,
Sep 27, 2017, 4:43:45 PM9/27/17
to Payara Forum
Hi there,
I create an enterprise application with two ejb, a war and a library. The application have some web services and sometimes I need to identify module that call a library, so, in the library I used this statement:

Context context = new InitialContext();
return context.lookup("java:module/ModuleName").toString();




I have a strange behavior during deploy phase. I get several errors like this:

Info:   2017-09-27 22:35:07,659 FATAL RedevoLog SerialContext.java 494 javax.naming.NamingException: Lookup failed for 'java:module/ModuleName' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, org.osjava.jndi.root=classpath://config, org.osjava.jndi.delimiter=/, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NamingException: Could not resolve java:module/ModuleName]
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:494) Somethings wrong in retrieving Java Modue Name: null




What is the reason that produce this kind of error during deploy phase? Why do lookup fail?



Please help me.

Thanks in advance.

Gazzille

Ondrej Mihályi

unread,
Sep 27, 2017, 5:14:31 PM9/27/17
to Gazzille, Payara Forum
Hi,

If the exception happens during deployment, then your code is probably called during application startup, e.g. from a singleton bean. At that time, modules are not probably registered yet, therefore the lookup fails.

Try moving the lookup code after application startup, maybe using a timer if you still need to execute the code when your app is started.

Also check that the module is given the name you expect. I've seen that GlasFish and Payara Server will assign the name of the JAR file as the name of an EJB module inside an EAR, ignoring any module-name specified in the ejb-jar.xml inside the JAR.

Regards,
Ondro

--
You received this message because you are subscribed to the Google Groups "Payara Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to payara-forum+unsubscribe@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/payara-forum/c53d3e67-18e9-49a0-a4e9-2ab8acc97a8e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages