gpt4 book ai didi

java - Jersey 多方返回 NoClassDefFoundError : org/glassfish/jersey/internal/inject/ExtractorException

转载 作者:搜寻专家 更新时间:2023-11-01 01:20:57 25 4
gpt4 key购买 nike

<分区>

我正在尝试创建一个使用/上传图像文件的 api

我已经像这样配置了我的应用程序:

资源配置文件

@ApplicationPath("api")
public class appConfig extends ResourceConfig {
public appConfig() {
// Register resources and providers using package-scanning.
packages("src.main.java.org.vaad.vaadAPI");
register(MultiPartFeature.class);
register(LoggingFilter.class);

// temp disabled for testing

}

资源文件:

@POST
@Path("/user/upload")
@Consumes(MediaType.MULTIPART_FORM_DATA)
public Response uploadFile(
@FormDataParam("file") InputStream fileInputStream,
@FormDataParam("file") FormDataContentDisposition contentDispositionHeader) {
String SERVER_UPLOAD_LOCATION_FOLDER = "C://Upload_Files/";
String filePath = SERVER_UPLOAD_LOCATION_FOLDER + contentDispositionHeader.getFileName();

// save the file to the server
// saveFile(fileInputStream, filePath);

String output = "File saved to server location : " + filePath;

return Response.status(200).build();

}

pom.xml

<dependency>
<groupId>org.glassfish.jersey.bundles</groupId>
<artifactId>jaxrs-ri</artifactId>
<version>2.13</version>
</dependency>


<dependency>
<groupId>com.paypal.sdk</groupId>
<artifactId>rest-api-sdk</artifactId>
<version>0.5.2</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver</artifactId>
<version>3.0.2</version>
</dependency>

<dependency>
<groupId>org.mongodb.morphia</groupId>
<artifactId>morphia</artifactId>
<version>1.0.1</version>
</dependency>

<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.0.1</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
<version>2.21</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
<version>2.21</version>
</dependency>


<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>2.2.3</version>
</dependency>

<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>2.21</version>
</dependency>

<!-- Jersey Multipart entity providers support module -->
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-multipart</artifactId>
<version>2.21</version>
</dependency>

但是在加载服务器时出现以下错误:

Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [133] milliseconds.
Aug 30, 2015 2:25:18 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Aug 30, 2015 2:25:21 PM org.apache.catalina.core.ApplicationContext log
SEVERE: StandardWrapper.Throwable
java.lang.NoClassDefFoundError: org/glassfish/jersey/internal/inject/ExtractorException
at org.glassfish.jersey.media.multipart.internal.FormDataParamValueFactoryProvider.createValueFactory(FormDataParamValueFactoryProvider.java:439)
at org.glassfish.jersey.server.internal.inject.AbstractValueFactoryProvider.getValueFactory(AbstractValueFactoryProvider.java:134)
at org.glassfish.jersey.server.spi.internal.ParameterValueHelper.getValueFactory(ParameterValueHelper.java:145)
at org.glassfish.jersey.server.spi.internal.ParameterValueHelper.createValueProviders(ParameterValueHelper.java:124)
at org.glassfish.jersey.server.model.Invocable.getValueProviders(Invocable.java:322)
at org.glassfish.jersey.server.model.ResourceMethodValidator.checkValueProviders(ResourceMethodValidator.java:164)
at org.glassfish.jersey.server.model.ResourceMethodValidator.checkMethod(ResourceMethodValidator.java:106)
at org.glassfish.jersey.server.model.ResourceMethodValidator.visitJaxrsResourceMethod(ResourceMethodValidator.java:102)
at org.glassfish.jersey.server.model.ResourceMethodValidator.visitResourceMethod(ResourceMethodValidator.java:92)
at org.glassfish.jersey.server.model.ResourceMethod.accept(ResourceMethod.java:854)
at org.glassfish.jersey.server.model.ComponentModelValidator.validateWithErrors(ComponentModelValidator.java:161)
at org.glassfish.jersey.server.model.ComponentModelValidator.validateWithErrors(ComponentModelValidator.java:167)
at org.glassfish.jersey.server.model.ComponentModelValidator.validateWithErrors(ComponentModelValidator.java:167)
at org.glassfish.jersey.server.model.ComponentModelValidator.validateWithErrors(ComponentModelValidator.java:167)
at org.glassfish.jersey.server.model.ComponentModelValidator.access$000(ComponentModelValidator.java:90)
at org.glassfish.jersey.server.model.ComponentModelValidator$1.run(ComponentModelValidator.java:151)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
at org.glassfish.jersey.server.model.ComponentModelValidator.validate(ComponentModelValidator.java:146)
at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:463)
at org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:163)
at org.glassfish.jersey.server.ApplicationHandler$3.run(ApplicationHandler.java:323)
at org.glassfish.jersey.internal.Errors$2.call(Errors.java:289)
at org.glassfish.jersey.internal.Errors$2.call(Errors.java:286)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:286)
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:320)
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:285)
at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:311)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:170)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:358)
at javax.servlet.GenericServlet.init(GenericServlet.java:158)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1231)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1034)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4914)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5201)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.glassfish.jersey.internal.inject.ExtractorException
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1313)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1164)
... 47 more

Aug 30, 2015 2:25:21 PM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet [appConfig] in web application [/vaad2] threw load() exception
java.lang.ClassNotFoundException: org.glassfish.jersey.internal.inject.ExtractorException
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1313)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1164)
at org.glassfish.jersey.media.multipart.internal.FormDataParamValueFactoryProvider.createValueFactory(FormDataParamValueFactoryProvider.java:439)
at org.glassfish.jersey.server.internal.inject.AbstractValueFactoryProvider.getValueFactory(AbstractValueFactoryProvider.java:134)
at org.glassfish.jersey.server.spi.internal.ParameterValueHelper.getValueFactory(ParameterValueHelper.java:145)
at org.glassfish.jersey.server.spi.internal.ParameterValueHelper.createValueProviders(ParameterValueHelper.java:124)
at org.glassfish.jersey.server.model.Invocable.getValueProviders(Invocable.java:322)
at org.glassfish.jersey.server.model.ResourceMethodValidator.checkValueProviders(ResourceMethodValidator.java:164)
at org.glassfish.jersey.server.model.ResourceMethodValidator.checkMethod(ResourceMethodValidator.java:106)
at org.glassfish.jersey.server.model.ResourceMethodValidator.visitJaxrsResourceMethod(ResourceMethodValidator.java:102)
at org.glassfish.jersey.server.model.ResourceMethodValidator.visitResourceMethod(ResourceMethodValidator.java:92)
at org.glassfish.jersey.server.model.ResourceMethod.accept(ResourceMethod.java:854)
at org.glassfish.jersey.server.model.ComponentModelValidator.validateWithErrors(ComponentModelValidator.java:161)
at org.glassfish.jersey.server.model.ComponentModelValidator.validateWithErrors(ComponentModelValidator.java:167)
at org.glassfish.jersey.server.model.ComponentModelValidator.validateWithErrors(ComponentModelValidator.java:167)
at org.glassfish.jersey.server.model.ComponentModelValidator.validateWithErrors(ComponentModelValidator.java:167)
at org.glassfish.jersey.server.model.ComponentModelValidator.access$000(ComponentModelValidator.java:90)
at org.glassfish.jersey.server.model.ComponentModelValidator$1.run(ComponentModelValidator.java:151)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
at org.glassfish.jersey.server.model.ComponentModelValidator.validate(ComponentModelValidator.java:146)
at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:463)
at org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:163)
at org.glassfish.jersey.server.ApplicationHandler$3.run(ApplicationHandler.java:323)
at org.glassfish.jersey.internal.Errors$2.call(Errors.java:289)
at org.glassfish.jersey.internal.Errors$2.call(Errors.java:286)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:286)
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:320)
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:285)
at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:311)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:170)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:358)
at javax.servlet.GenericServlet.init(GenericServlet.java:158)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1231)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1034)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4914)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5201)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Aug 30, 2015 2:25:21 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
Aug 30, 2015 2:25:21 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-nio-8009"]
Aug 30, 2015 2:25:21 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 6006 ms
Aug 30, 2015 3:32:48 PM org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name [/vaad2] has started
Aug 30, 2015 3:32:51 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Aug 30, 2015 3:32:53 PM org.apache.catalina.core.ApplicationContext log
SEVERE: StandardWrapper.Throwable
java.lang.NoClassDefFoundError: org/glassfish/jersey/internal/inject/ExtractorException
at org.glassfish.jersey.media.multipart.internal.FormDataParamValueFactoryProvider.createValueFactory(FormDataParamValueFactoryProvider.java:439)
at org.glassfish.jersey.server.internal.inject.AbstractValueFactoryProvider.getValueFactory(AbstractValueFactoryProvider.java:134)
at org.glassfish.jersey.server.spi.internal.ParameterValueHelper.getValueFactory(ParameterValueHelper.java:145)
at org.glassfish.jersey.server.spi.internal.ParameterValueHelper.createValueProviders(ParameterValueHelper.java:124)
at org.glassfish.jersey.server.model.Invocable.getValueProviders(Invocable.java:322)
at org.glassfish.jersey.server.model.ResourceMethodValidator.checkValueProviders(ResourceMethodValidator.java:164)
at org.glassfish.jersey.server.model.ResourceMethodValidator.checkMethod(ResourceMethodValidator.java:106)
at org.glassfish.jersey.server.model.ResourceMethodValidator.visitJaxrsResourceMethod(ResourceMethodValidator.java:102)
at org.glassfish.jersey.server.model.ResourceMethodValidator.visitResourceMethod(ResourceMethodValidator.java:92)
at org.glassfish.jersey.server.model.ResourceMethod.accept(ResourceMethod.java:854)
at

我找不到任何引用此异常的东西,请帮助

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