2015-03-03 121 views
0

我試圖在JSP頁面上顯示一些數據庫記錄。在我的項目中,我需要像index.html和studentDeatils.jsp這樣的頁面。我設置requestDispather從索引頁面進入studentDetails頁面。當我嘗試顯示JSP頁面時如何解決錯誤?

當我嘗試顯示JSP時,我的瀏覽器頁面出現以下錯誤。

錯誤:

HTTP Status 500 - Servlet execution threw an exception 

type Exception report 

message Servlet execution threw an exception 

description The server encountered an internal error that prevented it from fulfilling this request. 

exception 

javax.servlet.ServletException: Servlet execution threw an exception 
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 
root cause 

java.lang.LinkageError: loader constraint violation: loader (instance of org/apache/catalina/loader/WebappClassLoader) previously initiated loading for a different type with name "javax/servlet/RequestDispatcher" 
    java.lang.ClassLoader.defineClass1(Native Method) 
    java.lang.ClassLoader.defineClass(Unknown Source) 
    java.security.SecureClassLoader.defineClass(Unknown Source) 
    java.net.URLClassLoader.defineClass(Unknown Source) 
    java.net.URLClassLoader.access$100(Unknown Source) 
    java.net.URLClassLoader$1.run(Unknown Source) 
    java.net.URLClassLoader$1.run(Unknown Source) 
    java.security.AccessController.doPrivileged(Native Method) 
    java.net.URLClassLoader.findClass(Unknown Source) 
    org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:894) 
    org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1298) 
    org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1175) 
    com.mine.servlet.TestClass.doGet(TestClass.java:23) 
    javax.servlet.http.HttpServlet.service(HttpServlet.java:618) 
    javax.servlet.http.HttpServlet.service(HttpServlet.java:725) 
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 
note The full stack trace of the root cause is available in the Apache Tomcat/8.0.5 logs. 

這是我的文件夾結構: Web內容 - > index.html,然後stucentDetails.jsp

日誌文件:tomcat8-stdout.2015-03-03

2015-03-03 12:17:10 Commons Daemon procrun stdout initialized 
reqType = next 
Inside if() reqType = next 
ID :: 101 First Name :: Kavi Last Name :: Arasu 
ID :: 102 First Name :: Sathis Last Name :: Kumar 
ArrayList = [[email protected]] 

錯誤文件:tomcat8-stderr.2015-03-03

2015-03-03 12:17:10 Commons Daemon procrun stderr initialized 
03-Mar-2015 12:17:14.535 INFO [main] org.apache.catalina.core.AprLifecycleListener.init The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Apache Software Foundation\Tomcat 8.0\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\egurkha\bin;C:\egurkha\lib;C:\egurkha\JAVA\JDK\bin;C:\egurkha\lib\tt;C:\egurkha\bin\tt;C:\Program Files\Common Files\Microsoft Shared\Microsoft Online Services;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\apache-ant-1.9.4\bin;C:\Program Files\Java\jdk1.7.0_17\bin ;C:\egurkha\manager\tomcat\bin;. 
03-Mar-2015 12:17:15.941 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"] 
03-Mar-2015 12:17:16.113 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read 
03-Mar-2015 12:17:16.129 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"] 
03-Mar-2015 12:17:16.145 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read 
03-Mar-2015 12:17:16.145 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 2763 ms 
03-Mar-2015 12:17:16.270 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina 
03-Mar-2015 12:17:16.270 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.5 
03-Mar-2015 12:17:16.316 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive C:\Program Files\Apache Software Foundation\Tomcat 8.0\webapps\egtomcat.war 
03-Mar-2015 12:17:17.004 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. 
03-Mar-2015 12:17:17.238 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive C:\Program Files\Apache Software Foundation\Tomcat 8.0\webapps\Learning.war 
03-Mar-2015 12:17:17.410 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. 
03-Mar-2015 12:17:17.410 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\Program Files\Apache Software Foundation\Tomcat 8.0\webapps\docs 
03-Mar-2015 12:17:17.457 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\Program Files\Apache Software Foundation\Tomcat 8.0\webapps\manager 
03-Mar-2015 12:17:17.551 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\Program Files\Apache Software Foundation\Tomcat 8.0\webapps\ROOT 
03-Mar-2015 12:17:17.598 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"] 
03-Mar-2015 12:17:17.598 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"] 
03-Mar-2015 12:17:17.613 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 1468 ms 

請分享你的想法。

+0

您可以顯示您的Apache Tomcat/8.0.5日誌 – shikjohari 2015-03-03 07:02:36

+0

顯示服務器日誌中的完整堆棧。 – Jens 2015-03-03 07:02:45

+0

我已經添加stdout和stderr文件... – 2015-03-03 07:09:01

回答

0

WAR文件中的罐子包含servlet-api.jarjavaee-api.jar。它捆綁在你的tomcat安裝中。如果您使用這些罐子添加任何庫,它們會發生衝突

+0

我已經添加了javax.servlet.jar和jtds.jar(用於數據庫) – 2015-03-03 07:13:37

+0

嘗試刪除javax.servlet.jar,並試一試 - 因爲它也有'javax。 servlet.RequestDispatcher.class'。對於數據庫'jtds'就足夠了,如果我沒有錯 – shikjohari 2015-03-03 07:15:24

相關問題