0
RESTful Webアプリケーションを作成しようとしていて、エラー500に走っているIm私はいくつかの回答を見回し、役に立たなかった。HTTPステータス500 - サーブレットクラスをインスタンス化するエラー。RESTful Webアプリケーション用のTomcat 8.5
のJava Serverletコード
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";
}
}
web.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)
他に何が質問に答えるのか分かりませんが、私は喜んで提供します
クラスパスに 'jersey'がありますか? – iNan
ジャージーバンドル1.19.3.jar正しい?ええ、やりますよ。 – Georgrio
'ClassNotFoundException:> com.sun.jersey.spi.container.servlet.ServletContainer'は何かを意味しますか? –