0

我準備.war文件並將其部署到我的topmcat服務器上,但servlet存在問題。問題在Tomcat 5上部署.war(空指針異常)

大家平常遇到的問題是ClassNotFoundException,但是這個是NullPointerException,我找不到原因。謝謝你的幫助。

我使用的是JDK 1.5,我的項目是GWT 2.3.0和Tomcat是Tomcat的5

在Properties.java第365行是inLimit = inStream.read(inBuf);其中inStream中(InputStream)是輸入參數的構造函數LineReader。方法readLine()引發異常。

這裏的堆棧跟蹤:

- Marking servlet generalService as unavailable 
- Allocate exception for servlet generalService 
java.lang.NullPointerException 
     at java.util.Properties$LineReader.readLine(Properties.java:365) 
     at java.util.Properties.load(Properties.java:293) 
     at com.cs.eyeks.gwt.core.EyeksGwtConf.<init>(EyeksGwtConf.java:17) 
     at com.cs.eyeks.gwt.core.EyeksGwtConf.getConfiguration(EyeksGwtConf.java 
:29) 
     at com.cs.eyeks.gwt.EyeksGwtRemoteServiceServlet.<init>(EyeksGwtRemoteSe 
rviceServlet.java:28) 
     at tr.gov.gib.mhdb.vimer.vimerapp.server.GeneralServiceImpl.<init>(Gener 
alServiceImpl.java:64) 
     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 

     at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct 
orAccessorImpl.java:39) 
     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC 
onstructorAccessorImpl.java:27) 
     at java.lang.reflect.Constructor.newInstance(Constructor.java:501) 
     at java.lang.Class.newInstance0(Class.java:350) 
     at java.lang.Class.newInstance(Class.java:303) 
     at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper. 
java:1089) 
     at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.jav 
a:791) 
     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV 
alve.java:127) 
     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV 
alve.java:174) 
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j 
ava:127) 
     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j 
ava:117) 
     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal 
ve.java:108) 
     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav 
a:151) 
     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java 
:870) 
     at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.p 
rocessConnection(Http11BaseProtocol.java:665) 
     at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpo 
int.java:528) 
     at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFol 
lowerWorkerThread.java:81) 
     at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP 
ool.java:685) 
     at java.lang.Thread.run(Thread.java:595) 
+0

似乎屬性文件丟失,你可以檢查屬性文件的源代碼在'Properties.java:365' –

+0

也許你可以看看或添加到'Properties.java'的問題行365,因爲那是錯誤的地方發生。 (我知道它在JDK中,但你可以從中獲得源代碼。) –

+0

你的意思是jdk可能會導致問題?我使用jdk 1.5,我的項目是GWT 2.3.0,而tomcat是Tomcat 5. – Halo

回答

2

EyeksGwtConf.java 17行嘗試加載一個不存在的配置文件,或屬性的文件名是空的。

+0

謝謝,它幫助了很多定位問題 – Halo