gpt4 book ai didi

java - Tomcat 的 JAX-RS 异常

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

启动 servlet(从 eclipse)时,出现以下错误:它是 tomcat 7,servlet 是 REST。

INFO: validateJarFile(C:\beezer\WebServerWorkspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\BeezerServer\WEB-INF\lib\geronimo-j2ee_1.4_spec-1.1.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
448 [localhost-startStop-1] ERROR org.apache.wink.server.internal.servlet.RestServlet - com.test.AddressBookApplication<br />
java.lang.ClassNotFoundException: com.test.AddressBookApplication<br />
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1711)<br/>
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)<br/>
at java.lang.Class.forName0(Native Method)<br/>
at java.lang.Class.forName(Class.java:169)<br/>
at org.apache.wink.server.internal.servlet.RestServlet.getApplication(RestServlet.java:144)<br/>
at org.apache.wink.server.internal.servlet.RestServlet.createRequestProcessor(RestServlet.java:105)<br/>
at org.apache.wink.server.internal.servlet.RestServlet.init(RestServlet.java:81)<br/>
at javax.servlet.GenericServlet.init(GenericServlet.java:160)<br/>
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1266)<br/>
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1185)<br/>
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1080)<br/>
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5027)<br/>
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5314)<br/>
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)<br/>
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)<br/>
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)<br/>
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)<br/>
at java.util.concurrent.FutureTask.run(FutureTask.java:138)<br/>
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)<br/>
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)<br/>
at java.lang.Thread.run(Thread.java:662)<br/>
Aug 30, 2012 7:49:41 PM org.apache.catalina.core.ApplicationContext log<br/>
INFO: Marking servlet JAX-RS Servlet as unavailable<br/>
Aug 30, 2012 7:49:41 PM org.apache.catalina.core.StandardContext loadOnStartup<br/>
SEVERE: Servlet /BeezerServer threw load() exception<br/>
javax.servlet.UnavailableException: com.test.AddressBookApplication<br/>
at org.apache.wink.server.internal.servlet.RestServlet.init(RestServlet.java:91)<br/>
at javax.servlet.GenericServlet.init(GenericServlet.java:160)<br/>
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1266)<br/>
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1185)<br/>
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1080)<br/>
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5027)<br/>
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5314)<br/>
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)<br/>
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)<br/>
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)<br/>
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)<br/>
at java.util.concurrent.FutureTask.run(FutureTask.java:138)<br/>
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)<br/>
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)<br/>
at java.lang.Thread.run(Thread.java:662)<br/>
Aug 30, 2012 7:49:41 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]

我的 web.XML:

<?xml version="1.0" encoding="UTF-8"?><br/> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee<br/> http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
<display-name>BeezerServer</display-name>
<servlet>
<description>JAX-RS Tools Generated - Do not modify</description>
<servlet-name>JAX-RS Servlet</servlet-name>
<servlet-class>org.apache.wink.server.internal.servlet.RestServlet</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>com.test.AddressBookApplication</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>JAX-RS Servlet</servlet-name>
<url-pattern>/jaxrs/*</url-pattern>
</servlet-mapping>

有人知道吗?谢谢!

最佳答案

首先检查这个类是否真的存在。检查类名和包。属于web项目还是依赖项目?

如果一切正常,请刷新项目,然后运行 ​​Project/Clean,然后清理并重新发布 tomcat。如果它不起作用,请再次创建服务器(我的意思是在 eclipse 中)。如果它仍然不起作用,请转到 C:\beezer\WebServerWorkspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\BeezerServer\WEB-INF\classes(该路径取自您的日志)并检查类文件是否存在。

祝你好运,欢迎来到夜以继日与 eclipse 的 tomcat 插件中的错误作斗争的人们俱乐部...

关于java - Tomcat 的 JAX-RS 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12202159/

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