I am new to Jboss server. I am migrating the J2ee application from Weblogic 10.2 to JBoss EAP 6.1.0. While migrating I am getting the below error message. Kindly assist if anyone knows the solution.
The Application successfully gets deployed on the server but when i try to access the application through localhost, it throws a NullPointerException.
ERROR MESSAGE:
17:34:16,811 ERROR [stderr] (http-localhost/127.0.0.1:8080-2) java.lang.NullPointerException
17:34:16,811 ERROR [stderr] (http-localhost/127.0.0.1:8080-2) at javax.naming.NameImpl.(NameImpl.java:264)
17:34:16,811 ERROR [stderr] (http-localhost/127.0.0.1:8080-2) at javax.naming.CompositeName.(CompositeName.java:214)
17:34:16,811 ERROR [stderr] (http-localhost/127.0.0.1:8080-2) at org.jboss.as.naming.util.NameParser.parse(NameParser.java:49)
17:34:16,811 ERROR [stderr] (http-localhost/127.0.0.1:8080-2) at org.jboss.as.naming.NamingContext.parseName(NamingContext.java:491)
17:34:16,811 ERROR [stderr] (http-localhost/127.0.0.1:8080-2) at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:183)
17:34:16,811 ERROR [stderr] (http-localhost/127.0.0.1:8080-2) at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:179)
17:34:16,811 ERROR [stderr] (http-localhost/127.0.0.1:8080-2) at javax.naming.InitialContext.lookup(InitialContext.java:392)
17:34:16,811 ERROR [stderr] (http-localhost/127.0.0.1:8080-2) at com.trifecta.pfizer.dao.UserProfileDAO.populate(UserProfileDAO.java:51)
17:34:16,811 ERROR [stderr] (http-localhost/127.0.0.1:8080-2) at com.trifecta.pfizer.servlet.PfizerSiteController.doFilter(PfizerSiteController.java:394)
17:34:16,811 ERROR [stderr] (http-localhost/127.0.0.1:8080-2) at com.trifecta.pfizer.servlet.PfizerSiteController.performTask(PfizerSiteController.java:163)
17:34:16,811 ERROR [stderr] (http-localhost/127.0.0.1:8080-2) at com.trifecta.pfizer.servlet.PfizerSiteController.doPost(PfizerSiteController.java:546)
17:34:16,811 ERROR [stderr] (http-localhost/127.0.0.1:8080-2) at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
17:34:16,811 ERROR [stderr] (http-localhost/127.0.0.1:8080-2) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
17:34:16,811 ERROR [stderr] (http-localhost/127.0.0.1:8080-2) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295)
17:34:16,811 ERROR [stderr] (http-localhost/127.0.0.1:8080-2) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
17:34:16,811 ERROR [stderr] (http-localhost/127.0.0.1:8080-2) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
17:34:16,811 ERROR [stderr] (http-localhost/127.0.0.1:8080-2) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149)
17:34:16,811 ERROR [stderr] (http-localhost/127.0.0.1:8080-2) at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169)
17:34:16,811 ERROR [stderr] (http-localhost/127.0.0.1:8080-2) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145)
17:34:16,811 ERROR [stderr] (http-localhost/127.0.0.1:8080-2) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97)
17:34:16,811 ERROR [stderr] (http-localhost/127.0.0.1:8080-2) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102)
17:34:16,811 ERROR [stderr] (http-localhost/127.0.0.1:8080-2) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336)
17:34:16,811 ERROR [stderr] (http-localhost/127.0.0.1:8080-2) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
17:34:16,811 ERROR [stderr] (http-localhost/127.0.0.1:8080-2) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653)
17:34:16,811 ERROR [stderr] (http-localhost/127.0.0.1:8080-2) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920)
17:34:16,811 ERROR [stderr] (http-localhost/127.0.0.1:8080-2) at java.lang.Thread.run(Thread.java:619)
please help me in resolving the issue?
CODE:
try
{
if(sqlHome == null)
{
/* Properties jndiProps = new Properties();
jndiProps.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
jndiProps.put(Context.PROVIDER_URL,"jnp://localhost:9990");
jndiProps.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
*/ // create a context passing these properties
Context ctx = new InitialContext();
System.out.println("check1...");
//Object obj = ctx.lookup("SQLHelperSFOHome");
//java:app/SQLHelperSFO
System.out.println("check2...");
//sqlHome=(SQLHelperSFOHome)PortableRemoteObject.narrow(obj,SQLHelperSFOHome.class);
//System.out.println(PortableRemoteObject.narrow(ctx.lookup("SQLHelperSFOHome"),SQLHelperSFOHome.class).toString()+"2");
sqlHome = (SQLHelperSFOHome)PortableRemoteObject.narrow(ctx.lookup("SQLHelperSFOHome"),SQLHelperSFOHome.class);
}
sqlsfo = sqlHome.create();
sqlsfo.initialize(DATASOURCE_JNDINAME);
}
catch(Exception e)
{
e.printStackTrace();
throw new DataAccessException("UserProfileDAO","populate",e.getMessage());
}
I tried changing the initial context in the following manner:
Properties jndiProps = new Properties();
jndiProps.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
jndiProps.put(Context.PROVIDER_URL,"jnp://localhost:9990");
jndiProps.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
Context ctx = new InitialContext(jndiProps);
Also, The sysout statements used in this method are not displayed on the console.
Instead of using
ctx.lookup("EJBclassName");
we used :
ctx.lookup("java:global/EARname/EJBprojectName/EJBclassName!AbsoluteNameOfEJBClass");
it worked.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.