This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Servlets and the fly likes NullPointer at create() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "NullPointer at create()" Watch "NullPointer at create()" New topic

NullPointer at create()

steve dowdall
Ranch Hand

Joined: May 23, 2001
Posts: 36
Ok, thanks to all you guys I have the servlet calling out to the ejb from the servlet. The ejb lookup and method calls are in a processRequest method that is called from the doGet method.
Tracing it i find that it gets past the InitialContex and the lookup, It gets to the ejb.home.create() and gives a NullPointer Exception. Like this:
getting ready to create()
<Nov 14, 2001 5:16:43 PM EST> <Error> <HTTP> <[WebAppServletContext(392716,DDMWebApp)] Servlet faile
d with Exception
at com.document.DocServlet.processRequest(
at com.document.DocServlet.doGet(
at javax.servlet.http.HttpServlet.service(
at javax.servlet.http.HttpServlet.service(
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(
at weblogic.servlet.internal.ServletRequestImpl.execute(
at weblogic.kernel.ExecuteThread.execute(
Not sure why. I can hit the ejb from my java client and it works ok.
Any suggestions where to look or how to pin point it more?
steve dowdall
Ranch Hand

Joined: May 23, 2001
Posts: 36
I found the error.
It was a due to a bad try/catch block that was not allowing the remote interface to be created. After a little house keeping it works great. This is my first attempt at connecting a jsp/servlet/ejb and fully implemting the MVC architecture.
Thanks to all those who encouraged me the past week. Now on to those enhancments........
I agree. Here's the link:
subject: NullPointer at create()
It's not a secret anymore!