gpt4 book ai didi

java - Tomcat 8.0.36 : WebappClassLoaderBase elusive nullpointerexception

转载 作者:行者123 更新时间:2023-11-28 22:11:32 26 4
gpt4 key购买 nike

问题:

问题是我在 Tomcat 的 WebappClassLoaderBase 中得到了一个 NullPointerException,但没有过多解释为什么会发生这种情况。据我所知,它从 8.0.35 版开始发生......

异常跟踪:

java.lang.NullPointerException
org.apache.catalina.loader.WebappClassLoaderBase.binaryNameToPath(WebappClassLoaderBase.java:2562)
org.apache.catalina.loader.WebappClassLoaderBase.findLoadedClass0(WebappClassLoaderBase.java:2730)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1208)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1166)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1099)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:670)
org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2508)
org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2497)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Thread.java:745)

产生问题的web.xml:

<?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>FirstServlet</servlet-name>
<async-supported>true</async-supported>
</servlet>

<servlet>
<servlet-name>SecondServlet</servlet-name>
<enabled>false</enabled>
</servlet>

<session-config>
<session-timeout>7</session-timeout>
<cookie-config>
<http-only>true</http-only>
<secure>true</secure>
</cookie-config>
</session-config>

<security-constraint>
<display-name>HTTPS</display-name>
<web-resource-collection>
<web-resource-name>HTTPS Constraint</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
<!-- IMPORTED web.xml MODULES END -->

</web-app>

最佳答案

我通过添加 <servlet-class> 解决了这个问题web.xml 中的标签文件。

AFAICT 我不需要这样做,因为在我的代码中我有 @WebServlet应该已经在 Tomcat 中注册了类名的注解。

关于java - Tomcat 8.0.36 : WebappClassLoaderBase elusive nullpointerexception,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38264293/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com