Friday, May 25, 2018

Deploying maven project on glassfish using deploy command

Leave a Comment

I have a java ee application with maven, when i build the project then deploy the ear generated on target folder, i try to signup to the application so i have to call a locale EJB Session (UserService) , i get the following error:

javax.naming.NamingException: Lookup failed for 'java:global/myproject-ear/myproject-ejb-1.0/UserFacade!myproject.service.UserFacade' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, 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.NameNotFoundException: myproject-ear] at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:518) at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:455) at javax.naming.InitialContext.lookup(InitialContext.java:411) at javax.naming.InitialContext.lookup(InitialContext.java:411) at org.apache.jsp.index_jsp._jspService(index_jsp.java:79) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111) at javax.servlet.http.HttpServlet.service(HttpServlet.java:770) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:411) at   

I tried deploying using the command call asadmin --host localhost --user admin deploy --force "C:\myproject\target\myproject-ear-1.0.ear" an tried deploying from glassfish administration console, but the problem persist.

It works fine when i deploy from netbeans, knowing that the project is structured in the pom file like this:

  <modules>     <module>myproject-ear</module>     <module>myproject-ejb</module>     <module>myproject-web</module>   </modules> 

This is the jsp page :

ConfigUser configUser = (ConfigUser) c.lookup("java:global/myproject-ear/myproject-ejb-1.0/ConfigUser!myproject.service.ConfigUser"); 

0 Answers

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment