gpt4 book ai didi

javax.servlet.UnavailableException : No class in holder on deployed application with jsp

转载 作者:行者123 更新时间:2023-12-03 13:31:32 25 4
gpt4 key购买 nike

我在实现以下目标时遇到了一些问题:

我希望我的后端在一些定义的路径上返回我的 index.html 页面,因为它是一个角度应用程序。

在我的 web.xml 中我写了:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">

<!--my servlets-->

<!--HTML5-->
<servlet>
<servlet-name>html5Servlet</servlet-name>
<jsp-file>/index.html</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>html5Servlet</servlet-name>
<url-pattern>/</url-pattern>
<url-pattern>/home</url-pattern>
<url-pattern>/wp-users</url-pattern>
<url-pattern>/wp-groups</url-pattern>
</servlet-mapping>
<!--HTML5-->

<security-constraint>
<web-resource-collection>
<web-resource-name>all</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>

</web-app>

该应用程序在本地运行良好,但是我在调​​用我的 servlet 时在已部署的应用程序上收到以下错误:

javax.servlet.ServletContext log: unavailable
javax.servlet.UnavailableException: No class in holder html5Servlet@830ae0fb==null,jsp=/index.html,order=-1,inst=false
at org.eclipse.jetty.servlet.BaseHolder.doStart(BaseHolder.java:88)
at org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:363)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:891)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:349)
at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1406)
at com.google.apphosting.runtime.jetty9.AppEngineWebAppContext.startWebapp(AppEngineWebAppContext.java:159)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1368)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:778)
at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:262)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:522)
at com.google.apphosting.runtime.jetty9.AppEngineWebAppContext.doStart(AppEngineWebAppContext.java:116)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at com.google.apphosting.runtime.jetty9.AppVersionHandlerMap.createHandler(AppVersionHandlerMap.java:244)
at com.google.apphosting.runtime.jetty9.AppVersionHandlerMap.getHandler(AppVersionHandlerMap.java:182)
at com.google.apphosting.runtime.jetty9.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:109)
at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.dispatchServletRequest(JavaRuntime.java:693)
at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.dispatchRequest(JavaRuntime.java:655)
at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.run(JavaRuntime.java:625)
at com.google.apphosting.runtime.JavaRuntime$NullSandboxRequestRunnable.run(JavaRuntime.java:819)
at com.google.apphosting.runtime.ThreadGroupPool$PoolEntry.run(ThreadGroupPool.java:274)
at java.lang.Thread.run(Thread.java:745)

缺课的时候没看懂。我也尝试过使用 jsp 文件而不是 html 文件,但它不起作用。有人有任何线索吗?

最佳答案

*.html不是公认的 servlet <url-pattern>用于 JSP。

切换到index.jspJettyJspServlet应该开始将其识别为 JSP 文件。

关于javax.servlet.UnavailableException : No class in holder on deployed application with jsp,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52119635/

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