這是什麼原因造成的?這似乎是一個非常comn錯誤與無數的原因。來自org.apache.catalina.loader.WebappClassLoaderBase.loadClass的java.lang.NullPointerException
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error that prevented it from fulfilling this request.
exception
java.lang.NullPointerException
java.util.concurrent.ConcurrentHashMap.putVal(Unknown Source)
java.util.concurrent.ConcurrentHashMap.putIfAbsent(Unknown Source)
java.lang.ClassLoader.getClassLoadingLock(Unknown Source)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1149)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1116)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:510)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:1110)
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:785)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1425)
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Unknown Source)
note The full stack trace of the root cause is available in the Apache Tomcat/8.5.3 logs.
下面是包括:
import java.util.Set;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Application;
添加的web.xml 請注意:我已經試過了url-pattern的多個值和所有它似乎做的是改變的URI上,我得到錯誤。 'Hello'是java源代碼中的類名。
<?xml version="1.0" encoding="UTF-8"?>
<web-app
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
<servlet>
<servlet-name>HelloWorldTomcatService</servlet-name>
<init-param>
<param-name>com.package.from.java.file</param-name>
<param-value>Hello</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>HelloWorldTomcatService</servlet-name>
<url-pattern></url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
從第一次看起來,我覺得在servlet或webapp配置中有一個錯誤,但如果不知道更多,很難說。查看'catalina.out'日誌文件併發布完整的堆棧跟蹤,並且webapp的'web.xml'文件也會有所幫助。 –
我認爲您需要提供:注意根源的完整堆棧跟蹤在Apache Tomcat/8.5.3日誌中可用。 –
@RomainHippeau我無法在任何日誌文件中找到更多的detailes stacktrace。也許有一些設置可以實現它,但是我終於無法理解。 – user1958756