我正在开发一个旨在在Tomcat上运行的小型webapp。 webapp在我的Windows机器(Windows 7,Java 1.8,Tomcat 7)上运行良好,但无法在我的raspberry pi 3上运行(具有最新更新的Raspian,Java 1.8,Tomcat 7)。在尝试加载登录页面之前,启动Tomcat是正常的。然后我得到了以下输出:
加载localhost时出错:8080 / Timbreuse / connection
java.lang.NullPointerException
at ch.cpnv.timbreuse.servlets.Connection.doGet(Connection.java:39)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338)
at ch.cpnv.timbreuse.filters.ConnectedFilter.doFilter(ConnectedFilter.java:39)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Message : null
java.lang.NullPointerException
at ch.cpnv.timbreuse.servlets.Connection.doGet(Connection.java:39)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338)
at ch.cpnv.timbreuse.filters.ConnectedFilter.doFilter(ConnectedFilter.java:39)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Connection.java:39
public static final String VIEW_CONNECTION = "/WEB-INF/connection.jsp";
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
this.getServletContext().getRequestDispatcher(VIEW_CONNECTION).forward(request, response);
}
。在Pi上部署.war时的文件夹架构
./student
./student/info.jsp
./display
./display/welcomeDisplay.jsp
./display/showDisplay.jsp
./WEB-INF
./WEB-INF/header.jsp
./WEB-INF/changePassword.jsp
./WEB-INF/classes
./WEB-INF/classes/ch
./WEB-INF/classes/ch/cpnv
./WEB-INF/classes/ch/cpnv/timbreuse
./WEB-INF/classes/ch/cpnv/timbreuse/automation
./WEB-INF/classes/ch/cpnv/timbreuse/automation/Automation.java
./WEB-INF/classes/ch/cpnv/timbreuse/automation/Automation.class
./WEB-INF/classes/ch/cpnv/timbreuse/automation/EndOfDay$EndOfDayTask.class
./WEB-INF/classes/ch/cpnv/timbreuse/automation/EndOfDay.class
./WEB-INF/classes/ch/cpnv/timbreuse/automation/EndOfDay.java
./WEB-INF/classes/ch/cpnv/timbreuse/forms
./WEB-INF/classes/ch/cpnv/timbreuse/forms/AddTimeStudentsForm.class
./WEB-INF/classes/ch/cpnv/timbreuse/forms/CreateStudentForm.java
./WEB-INF/classes/ch/cpnv/timbreuse/forms/ChangePasssowordForm.java
./WEB-INF/classes/ch/cpnv/timbreuse/forms/CreateStudentForm.class
./WEB-INF/classes/ch/cpnv/timbreuse/forms/StudentResearchForm.class
./WEB-INF/classes/ch/cpnv/timbreuse/forms/AddTimeStudentsForm.java
./WEB-INF/classes/ch/cpnv/timbreuse/forms/CreateAdminForm.class
./WEB-INF/classes/ch/cpnv/timbreuse/forms/DeleteStudentForm.class
./WEB-INF/classes/ch/cpnv/timbreuse/forms/ConnectionForm.java
./WEB-INF/classes/ch/cpnv/timbreuse/forms/DeleteStudentForm.java
./WEB-INF/classes/ch/cpnv/timbreuse/forms/DeleteTeacherForm.class
./WEB-INF/classes/ch/cpnv/timbreuse/forms/ChangePasssowordForm.class
./WEB-INF/classes/ch/cpnv/timbreuse/forms/StudentResearchForm.java
./WEB-INF/classes/ch/cpnv/timbreuse/forms/DeleteAdminForm.java
./WEB-INF/classes/ch/cpnv/timbreuse/forms/CreateTeacherForm.class
./WEB-INF/classes/ch/cpnv/timbreuse/forms/DeleteAdminForm.class
./WEB-INF/classes/ch/cpnv/timbreuse/forms/ConnectionForm.class
./WEB-INF/classes/ch/cpnv/timbreuse/forms/SetHolydaysForm.java
./WEB-INF/classes/ch/cpnv/timbreuse/forms/CreateAdminForm.java
./WEB-INF/classes/ch/cpnv/timbreuse/forms/CreateTeacherForm.java
./WEB-INF/classes/ch/cpnv/timbreuse/forms/SetHolydaysForm.class
./WEB-INF/classes/ch/cpnv/timbreuse/forms/DeleteTeacherForm.java
./WEB-INF/classes/ch/cpnv/timbreuse/beans
./WEB-INF/classes/ch/cpnv/timbreuse/beans/Teacher.class
./WEB-INF/classes/ch/cpnv/timbreuse/beans/Teacher.java
./WEB-INF/classes/ch/cpnv/timbreuse/beans/Student.class
./WEB-INF/classes/ch/cpnv/timbreuse/beans/Student.java
./WEB-INF/classes/ch/cpnv/timbreuse/beans/Log.class
./WEB-INF/classes/ch/cpnv/timbreuse/beans/Log.java
./WEB-INF/classes/ch/cpnv/timbreuse/beans/User.class
./WEB-INF/classes/ch/cpnv/timbreuse/beans/Holyday.java
./WEB-INF/classes/ch/cpnv/timbreuse/beans/Holyday.class
./WEB-INF/classes/ch/cpnv/timbreuse/beans/User.java
./WEB-INF/classes/ch/cpnv/timbreuse/config
./WEB-INF/classes/ch/cpnv/timbreuse/config/DAOFactoryInitialisation.class
./WEB-INF/classes/ch/cpnv/timbreuse/config/DAOFactoryInitialisation.java
./WEB-INF/classes/ch/cpnv/timbreuse/dao
./WEB-INF/classes/ch/cpnv/timbreuse/dao/DAOUtility.class
./WEB-INF/classes/ch/cpnv/timbreuse/dao/DAOImplUser.class
./WEB-INF/classes/ch/cpnv/timbreuse/dao/DAOImplTeacher.java
./WEB-INF/classes/ch/cpnv/timbreuse/dao/DAOUser.class
./WEB-INF/classes/ch/cpnv/timbreuse/dao/DAOLog.class
./WEB-INF/classes/ch/cpnv/timbreuse/dao/DAOStudent.java
./WEB-INF/classes/ch/cpnv/timbreuse/dao/DAOUtility.java
./WEB-INF/classes/ch/cpnv/timbreuse/dao/DAOTeacher.java
./WEB-INF/classes/ch/cpnv/timbreuse/dao/DAOException.java
./WEB-INF/classes/ch/cpnv/timbreuse/dao/DAOImplStudent.class
./WEB-INF/classes/ch/cpnv/timbreuse/dao/DAOImplTeacher.class
./WEB-INF/classes/ch/cpnv/timbreuse/dao/DAOImplHolyday.class
./WEB-INF/classes/ch/cpnv/timbreuse/dao/dao.properties
./WEB-INF/classes/ch/cpnv/timbreuse/dao/DAOImplUser.java
./WEB-INF/classes/ch/cpnv/timbreuse/dao/DAOImplHolyday.java
./WEB-INF/classes/ch/cpnv/timbreuse/dao/DAOFactory.java
./WEB-INF/classes/ch/cpnv/timbreuse/dao/DAOImplLog.class
./WEB-INF/classes/ch/cpnv/timbreuse/dao/DAOImplAdmin.class
./WEB-INF/classes/ch/cpnv/timbreuse/dao/DAOImplStudent.java
./WEB-INF/classes/ch/cpnv/timbreuse/dao/DAOHolyday.class
./WEB-INF/classes/ch/cpnv/timbreuse/dao/DAOFactory.class
./WEB-INF/classes/ch/cpnv/timbreuse/dao/DAOTeacher.class
./WEB-INF/classes/ch/cpnv/timbreuse/dao/DAOImplAdmin.java
./WEB-INF/classes/ch/cpnv/timbreuse/dao/DAOException.class
./WEB-INF/classes/ch/cpnv/timbreuse/dao/DAOUser.java
./WEB-INF/classes/ch/cpnv/timbreuse/dao/DAOHolyday.java
./WEB-INF/classes/ch/cpnv/timbreuse/dao/DAOLog.java
./WEB-INF/classes/ch/cpnv/timbreuse/dao/DAOStudent.class
./WEB-INF/classes/ch/cpnv/timbreuse/dao/DAOImplLog.java
./WEB-INF/classes/ch/cpnv/timbreuse/servlets
./WEB-INF/classes/ch/cpnv/timbreuse/servlets/SetTimetable.class
./WEB-INF/classes/ch/cpnv/timbreuse/servlets/AdminPanel.java
./WEB-INF/classes/ch/cpnv/timbreuse/servlets/Display.java
./WEB-INF/classes/ch/cpnv/timbreuse/servlets/Connection.java
./WEB-INF/classes/ch/cpnv/timbreuse/servlets/Logout.class
./WEB-INF/classes/ch/cpnv/timbreuse/servlets/SetTimetable.java
./WEB-INF/classes/ch/cpnv/timbreuse/servlets/ChangePassword.java
./WEB-INF/classes/ch/cpnv/timbreuse/servlets/Logout.java
./WEB-INF/classes/ch/cpnv/timbreuse/servlets/SetHolydays.class
./WEB-INF/classes/ch/cpnv/timbreuse/servlets/AdminPanel.class
./WEB-INF/classes/ch/cpnv/timbreuse/servlets/StudentInfo.java
./WEB-INF/classes/ch/cpnv/timbreuse/servlets/ChangePassword.class
./WEB-INF/classes/ch/cpnv/timbreuse/servlets/EndDay.class
./WEB-INF/classes/ch/cpnv/timbreuse/servlets/ManageStudents.java
./WEB-INF/classes/ch/cpnv/timbreuse/servlets/ManageStudents.class
./WEB-INF/classes/ch/cpnv/timbreuse/servlets/Display.class
./WEB-INF/classes/ch/cpnv/timbreuse/servlets/Connection.class
./WEB-INF/classes/ch/cpnv/timbreuse/servlets/EndDay.java
./WEB-INF/classes/ch/cpnv/timbreuse/servlets/StudentInfo.class
./WEB-INF/classes/ch/cpnv/timbreuse/servlets/SetHolydays.java
./WEB-INF/classes/ch/cpnv/timbreuse/mathTime
./WEB-INF/classes/ch/cpnv/timbreuse/mathTime/Math.class
./WEB-INF/classes/ch/cpnv/timbreuse/mathTime/Math.java
./WEB-INF/classes/ch/cpnv/timbreuse/mathTime/Date.class
./WEB-INF/classes/ch/cpnv/timbreuse/mathTime/SecondsPastMidnight.class
./WEB-INF/classes/ch/cpnv/timbreuse/mathTime/SecondsPastMidnight.java
./WEB-INF/classes/ch/cpnv/timbreuse/mathTime/Date.java
./WEB-INF/classes/ch/cpnv/timbreuse/filters
./WEB-INF/classes/ch/cpnv/timbreuse/filters/ConnectedFilter.class
./WEB-INF/classes/ch/cpnv/timbreuse/filters/ConnectionFilter.class
./WEB-INF/classes/ch/cpnv/timbreuse/filters/StudentFilter.class
./WEB-INF/classes/ch/cpnv/timbreuse/filters/TeacherFilter.java
./WEB-INF/classes/ch/cpnv/timbreuse/filters/ConnectionFilter.java
./WEB-INF/classes/ch/cpnv/timbreuse/filters/AdminFilter.java
./WEB-INF/classes/ch/cpnv/timbreuse/filters/AdminFilter.class
./WEB-INF/classes/ch/cpnv/timbreuse/filters/ConnectedFilter.java
./WEB-INF/classes/ch/cpnv/timbreuse/filters/TeacherFilter.class
./WEB-INF/classes/ch/cpnv/timbreuse/filters/StudentFilter.java
./WEB-INF/footer.jsp
./WEB-INF/.gitignore
./WEB-INF/lib
./WEB-INF/lib/bonecp-0.8.1-20131105.191813-1.jar
./WEB-INF/lib/jasypt-1.9.0.jar
./WEB-INF/lib/jstl-1.2.jar
./WEB-INF/lib/java-json.jar
./WEB-INF/lib/slf4j-api-1.6.6.jar
./WEB-INF/lib/joda-time-2.1.jar
./WEB-INF/lib/mysql-connector-java-5.1.38-bin.jar
./WEB-INF/lib/guava-13.0.1.jar
./WEB-INF/web.xml
./WEB-INF/connection.jsp
./connecting.jsp
./form.css
./META-INF
./META-INF/MANIFEST.MF
./teacher
./teacher/setTimeTable.jsp
./teacher/manageStudents.jsp
./teacher/setHolydays.jsp
./admin
./admin/adminPanel.jsp
我该如何防止这种情况?
答案 0 :(得分:0)
唯一可以为null的对象是请求和响应或调度程序。如果你不能在那里放置一个断点,我会在异常之前检查tomcat的消息/日志