This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes NullPointer Exception when reading property file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "NullPointer Exception when reading property file" Watch "NullPointer Exception when reading property file" New topic
Author

NullPointer Exception when reading property file

Praveen Katti
Greenhorn

Joined: Jun 03, 2004
Posts: 12
Hi All,
I am running my application in WebSphere 3.5. I am loading one of my servlet called "NotifierServlet" at the startup.. its throwing following exception. I am attaching my code of the servlet also.

[04.08.20 08:22:59:218 EDT] 5cb5da4d WebGroup X Root Cause
java.lang.NullPointerException
at java.io.Reader.<init>(Reader.java:68)
at java.io.InputStreamReader.<init>(InputStreamReader.java:88)
at java.io.InputStreamReader.<init>(InputStreamReader.java:77)
at java.util.Properties.load(Properties.java:179)
at com.alliedholdings.dashboard.notifier.NotifierServlet.init(Unknown Source)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at com.ibm.servlet.engine.webapp.StrictServletInstance.doInit(ServletManager.java:622)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet._init(StrictLifecycleServlet.java:136)
at com.ibm.servlet.engine.webapp.PreInitializedServletState.init(StrictLifecycleServlet.java:244)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet.init(StrictLifecycleServlet.java:102)
at com.ibm.servlet.engine.webapp.ServletInstance.init(ServletManager.java:295)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at com.ibm.servlet.engine.webapp.ServletManager.addServlet(ServletManager.java:76)
at com.ibm.servlet.engine.webapp.WebAppServletManager.loadServlet(WebAppServletManager.java:115)
at com.ibm.servlet.engine.webapp.WebAppServletManager.loadAutoLoadServlets(WebAppServletManager.java:196)
at com.ibm.servlet.engine.webapp.WebApp.loadServletManager(WebApp.java:919)
at com.ibm.servlet.engine.webapp.WebApp.init(WebApp.java:93)
at com.ibm.servlet.engine.srt.WebGroup.loadWebApp(WebGroup.java:142)
at com.ibm.servlet.engine.srt.WebGroup.init(WebGroup.java:103)
at com.ibm.servlet.engine.ServletHost.addWebGroup(ServletHost.java:117)
at com.ibm.servlet.engine.ServletEngineDynamicUpdateSupport.addWebGroup(ServletEngineDynamicUpdateSupport.java:126)
at com.ibm.ejs.sm.active.ActiveServletGroup.startAction(ActiveServletGroup.java:76)
at com.ibm.ejs.sm.active.ActiveObject.startObject(ActiveObject.java:686)
at com.ibm.ejs.sm.active.ActiveObject.start(ActiveObject.java:117)
at com.ibm.ejs.sm.active.ActiveObject.operateOnContainedObjects(ActiveObject.java:588)
at com.ibm.ejs.sm.active.ActiveServletEngine.startAction(ActiveServletEngine.java:60)
at com.ibm.ejs.sm.active.ActiveObject.startObject(ActiveObject.java:686)
at com.ibm.ejs.sm.active.ActiveObject.start(ActiveObject.java:117)
at com.ibm.ejs.sm.active.ActiveObject.operateOnContainedObjects(ActiveObject.java:588)
at com.ibm.ejs.sm.active.ActiveEJBServer.startAction(ActiveEJBServer.java:99)
at com.ibm.ejs.sm.active.ActiveObject.startObject(ActiveObject.java:686)
at com.ibm.ejs.sm.active.ActiveObject.start(ActiveObject.java:117)
at java.lang.reflect.Method.invoke(Native Method)
at com.ibm.ejs.sm.agent.AdminAgentImpl.activeObjectInvocation(AdminAgentImpl.java:93)
at com.ibm.ejs.sm.agent.AdminAgentImpl.invokeActiveObject(AdminAgentImpl.java:62)
at com.ibm.ejs.sm.agent._AdminAgentImpl_Tie._invoke(_AdminAgentImpl_Tie.java:73)
at com.ibm.CORBA.iiop.ExtendedServerDelegate.dispatch(ExtendedServerDelegate.java:506)
at com.ibm.CORBA.iiop.ORB.process(ORB.java:2381)
at com.ibm.CORBA.iiop.WorkerThread.run(WorkerThread.java:195)
at com.ibm.ejs.oa.pool.ThreadPool$PooledThread.run(ThreadPool.java:535)

[04.08.20 08:22:59:312 EDT] 5cb5da4d WebApp X Failed.to.initialize.webapp.{0}
"dashboard"
javax.servlet.ServletException
at com.ibm.servlet.engine.webapp.StrictServletInstance.doInit(ServletManager.java:635)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet._init(StrictLifecycleServlet.java:136)
at com.ibm.servlet.engine.webapp.PreInitializedServletState.init(StrictLifecycleServlet.java:244)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet.init(StrictLifecycleServlet.java:102)
at com.ibm.servlet.engine.webapp.ServletInstance.init(ServletManager.java:295)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at com.ibm.servlet.engine.webapp.ServletManager.addServlet(ServletManager.java:76)
at com.ibm.servlet.engine.webapp.WebAppServletManager.loadServlet(WebAppServletManager.java:115)
at com.ibm.servlet.engine.webapp.WebAppServletManager.loadAutoLoadServlets(WebAppServletManager.java:196)
at com.ibm.servlet.engine.webapp.WebApp.loadServletManager(WebApp.java:919)
at com.ibm.servlet.engine.webapp.WebApp.init(WebApp.java:93)
at com.ibm.servlet.engine.srt.WebGroup.loadWebApp(WebGroup.java:142)
at com.ibm.servlet.engine.srt.WebGroup.init(WebGroup.java:103)
at com.ibm.servlet.engine.ServletHost.addWebGroup(ServletHost.java:117)
at com.ibm.servlet.engine.ServletEngineDynamicUpdateSupport.addWebGroup(ServletEngineDynamicUpdateSupport.java:126)
at com.ibm.ejs.sm.active.ActiveServletGroup.startAction(ActiveServletGroup.java:76)
at com.ibm.ejs.sm.active.ActiveObject.startObject(ActiveObject.java:686)
at com.ibm.ejs.sm.active.ActiveObject.start(ActiveObject.java:117)
at com.ibm.ejs.sm.active.ActiveObject.operateOnContainedObjects(ActiveObject.java:588)
at com.ibm.ejs.sm.active.ActiveServletEngine.startAction(ActiveServletEngine.java:60)
at com.ibm.ejs.sm.active.ActiveObject.startObject(ActiveObject.java:686)
at com.ibm.ejs.sm.active.ActiveObject.start(ActiveObject.java:117)
at com.ibm.ejs.sm.active.ActiveObject.operateOnContainedObjects(ActiveObject.java:588)
at com.ibm.ejs.sm.active.ActiveEJBServer.startAction(ActiveEJBServer.java:99)
at com.ibm.ejs.sm.active.ActiveObject.startObject(ActiveObject.java:686)
at com.ibm.ejs.sm.active.ActiveObject.start(ActiveObject.java:117)
at java.lang.reflect.Method.invoke(Native Method)
at com.ibm.ejs.sm.agent.AdminAgentImpl.activeObjectInvocation(AdminAgentImpl.java:93)
at com.ibm.ejs.sm.agent.AdminAgentImpl.invokeActiveObject(AdminAgentImpl.java:62)
at com.ibm.ejs.sm.agent._AdminAgentImpl_Tie._invoke(_AdminAgentImpl_Tie.java:73)
at com.ibm.CORBA.iiop.ExtendedServerDelegate.dispatch(ExtendedServerDelegate.java:506)
at com.ibm.CORBA.iiop.ORB.process(ORB.java:2381)
at com.ibm.CORBA.iiop.WorkerThread.run(WorkerThread.java:195)
at com.ibm.ejs.oa.pool.ThreadPool$PooledThread.run(ThreadPool.java:535)

Following is my Servlet code..

I have placed the property file in the proper directory.
I am trying to resolve this issue from last 2 days, but was not able to get through.. . Help is needed..
Thanks in advance..
Praveen.
[ August 23, 2004: Message edited by: Praveen Katti ]

Thanks,<br />Praveen K
Steve Grant
Ranch Hand

Joined: Nov 24, 2003
Posts: 106
Hi ,

Can u show me dir structure. its seems to be classpath problem.


thx,
steve


SCJP1.4<br />IBM Certified System Administrator -- WebSphere Application Server V5.0 (340)
Praveen Katti
Greenhorn

Joined: Jun 03, 2004
Posts: 12
Steve,
Thanks for the reply. Following is my directory where my servlet is there.

D:\WebSphere\AppServer\hosts\default_host\dashboard\servlets\com\alliedholdings\dashboard\notifier

I have my property file in following directory
D:\WebSphere\AppServer\hosts\default_host\dashboard\servlets

Following is my commande line arguments in WebSphere 3.5.6

-Xms512M -Xmx1024M -Djava.compiler=NONE -classpath D:\dashboard\lib\xalan.jar;D:\dashboard\lib\xercesImpl.jar;D:\dashboard\lib\xml-apis.jar;D:\orajdbc\classes12.zip;D:\dashboard\lib\jfreechart-0.9.8.jar;D:\dashboard\lib\jcommon-0.8.0.jar;D:\dashboard\lib\activation.jar;D:\dashboard\lib\mail.jar
 
jQuery in Action, 2nd edition
 
subject: NullPointer Exception when reading property file
 
Similar Threads
WebSphere 3.5 and DB2 UDB 8
Unable to Configure struts-example app for WAS3.5 Fix Pack2
SimpleThreadPool - Classcast exception
Cocoon and WebSphere
Getting init() exception