gpt4 book ai didi

java - HTTP 状态 500 - 为 RESTful Web 应用程序实例化 servlet 类 Tomcat 8.5 时出错

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

我正在尝试创建一个 RESTful 网络应用程序,但我遇到了错误 500 我查看了一些答案并尝试了无济于事的解决方案。

Java 服务器小程序代码

package org.some.package.tohere;
import java.util.List;

import javax.ws.rs.FormParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;

@Path("/somepath")
public class Analysis {
@POST
public String ClassName(@FormParam("inputArray[]") List<String> datalist) {
// Results results=Send to other
// ResultstoFirebase
return "Woooooo";

}
}

网络.xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">


<display-name>Project Name</display-name>
<welcome-file-list>
<welcome-file>test.html</welcome-file>
</welcome-file-list>


<servlet>
<servlet-name>Name</servlet-name>
<servlet-class>>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>org.some.package.tohere;</param-value>
</init-param>
</servlet>

<servlet-mapping>
<servlet-name>ProjectName</servlet-name>
<url-pattern>/analysis/* </url-pattern>
</servlet-mapping>
</web-app>

Javascript

function callGeneSpotService(inputArray)
{

var location =window.location.href+"analysis/somepath"
//Results should be the encrypted job id to be able to access the results on the web page.
var results = $.post(location,{inputArray:inputArray},function(response){
})
.done(function(results)
{
alert(results);
//alert("Now Processing, please check back in the results section with your job id in a few moments: "+ results);
})
.fail(function(results)
{
alert("Something went wrong please contact the systems administrator for help");
})

}

错误栈

javax.servlet.ServletException: Error instantiating servlet class >com.sun.jersey.spi.container.servlet.ServletContainer
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
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:783)
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:789)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455)
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
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)
root cause

java.lang.ClassNotFoundException: >com.sun.jersey.spi.container.servlet.ServletContainer
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1285)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
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:783)
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:789)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455)
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
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)

不确定还有什么可以帮助回答这个问题,但我很乐意提供

最佳答案

对于那些正在看这个的人来说,上面的答案对同一个问题很好,但我的问题是我的 web.xml 中有一个额外的 '>' 就像一个 dingus

关于java - HTTP 状态 500 - 为 RESTful Web 应用程序实例化 servlet 类 Tomcat 8.5 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40922054/

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