问题
I have Jersey(JaxRS) REST service running on WebSphere Application Server Version 8.5.5.9 Liberty Profile. I am using Jersey2.25. It worked fine. Now I upgraded to Jersey 2.31 and see exceptions. I heard that from Jersey2.26 there are backward compatibility issues here: Jersey stopped working with InjectionManagerFactory not found
This is the exception I am running into
[6/15/20 17:31:40:413 CDT] 00000020 id= com.ibm.ws.http.internal.VirtualHostImpl A CWWKT0016I: Web application available (default_host): http://192.168.0.11:8080/JerseyHelloWorld/
[6/15/20 17:31:40:418 CDT] 00000020 id= com.ibm.ws.app.manager.AppMessageHelper A CWWKZ0001I: Application JerseyHelloWorld started in 0.693 seconds.
[6/15/20 17:31:40:425 CDT] 00000018 id= com.ibm.ws.kernel.feature.internal.FeatureManager A CWWKF0012I: The server installed the following features: [servlet-3.0, jsp-2.2, jndi-1.0, jdbc-4.0, beanValidation-1.0, jpa-2.0].
[6/15/20 17:31:40:426 CDT] 00000018 id= com.ibm.ws.kernel.feature.internal.FeatureManager A CWWKF0011I: The server bayerx is ready to run a smarter planet.
[6/15/20 17:32:09:697 CDT] 00000020 id= m.ibm.ws.anno.targets.internal.AnnotationTargetsImpl_Targets W CWWKC0044W: An exception occurred while scanning class and annotation data. The exception was java.lang.IllegalArgumentException
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at com.ibm.ws.anno.targets.internal.AnnotationTargetsImpl_Targets.scanClass(AnnotationTargetsImpl_Targets.java:496)
at com.ibm.ws.anno.targets.internal.AnnotationTargetsImpl_Streamer.process(AnnotationTargetsImpl_Streamer.java:89)
at com.ibm.ws.anno.classsource.internal.ClassSourceImpl_MappedContainer.process(ClassSourceImpl_MappedContainer.java:352)
at com.ibm.ws.anno.classsource.internal.ClassSourceImpl_MappedContainer.scanClasses(ClassSourceImpl_MappedContainer.java:284)
at com.ibm.ws.anno.classsource.internal.ClassSourceImpl_MappedContainer.scanClasses(ClassSourceImpl_MappedContainer.java:237)
at com.ibm.ws.anno.classsource.internal.ClassSourceImpl_MappedContainer.scanClasses(ClassSourceImpl_MappedContainer.java:237)
at com.ibm.ws.anno.classsource.internal.ClassSourceImpl_MappedContainer.scanClasses(ClassSourceImpl_MappedContainer.java:237)
at com.ibm.ws.anno.classsource.internal.ClassSourceImpl_MappedContainer.scanClasses(ClassSourceImpl_MappedContainer.java:237)
at com.ibm.ws.anno.classsource.internal.ClassSourceImpl_MappedContainer.scanClasses(ClassSourceImpl_MappedContainer.java:237)
at com.ibm.ws.anno.classsource.internal.ClassSourceImpl_MappedContainer.scanClasses(ClassSourceImpl_MappedContainer.java:237)
at com.ibm.ws.anno.classsource.internal.ClassSourceImpl_MappedContainer.scanClasses(ClassSourceImpl_MappedContainer.java:129)
at com.ibm.ws.anno.classsource.internal.ClassSourceImpl_Aggregate.scanClasses(ClassSourceImpl_Aggregate.java:370)
at com.ibm.ws.anno.targets.internal.AnnotationTargetsImpl_Scanner.scanClasses(AnnotationTargetsImpl_Scanner.java:255)
at com.ibm.ws.anno.targets.internal.AnnotationTargetsImpl_Scanner.scanDirect(AnnotationTargetsImpl_Scanner.java:217)
at com.ibm.ws.anno.targets.internal.AnnotationTargetsImpl_Targets.doScanDirectClasses(AnnotationTargetsImpl_Targets.java:380)
at com.ibm.ws.anno.targets.internal.AnnotationTargetsImpl_Targets.scanDirectClasses(AnnotationTargetsImpl_Targets.java:349)
at com.ibm.ws.anno.targets.internal.AnnotationTargetsImpl_Targets.isSeedClassName(AnnotationTargetsImpl_Targets.java:624)
at com.ibm.ws.webcontainer.webapp.WebApp.acceptAnnotationsFrom(WebApp.java:803)
at com.ibm.ws.webcontainer.osgi.webapp.WebApp.determineWhetherToAddScis(WebApp.java:876)
at com.ibm.ws.webcontainer.webapp.WebApp.initializeServletContainerInitializers(WebApp.java:2464)
at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:1038)
at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:6463)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApp(DynamicVirtualHost.java:446)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.createRunnableHandler(DynamicVirtualHost.java:248)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.createRunnableHandler(DynamicVirtualHost.java:313)
at com.ibm.ws.http.internal.VirtualHostImpl.discriminate(VirtualHostImpl.java:251)
at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.ready(HttpDispatcherLink.java:306)
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:471)
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleNewRequest(HttpInboundLink.java:405)
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.processRequest(HttpInboundLink.java:285)
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.ready(HttpInboundLink.java:256)
at com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:174)
at com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:83)
at com.ibm.ws.tcpchannel.internal.WorkQueueManager.requestComplete(WorkQueueManager.java:504)
at com.ibm.ws.tcpchannel.internal.WorkQueueManager.attemptIO(WorkQueueManager.java:574)
at com.ibm.ws.tcpchannel.internal.WorkQueueManager.workerRun(WorkQueueManager.java:929)
at com.ibm.ws.tcpchannel.internal.WorkQueueManager$Worker.run(WorkQueueManager.java:1018)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Here is my server code :
@Path("/show-on-screen")
@Produces(MediaType.APPLICATION_JSON)
public class Service
{
@GET
@Path("/{message}")
@Consumes({MediaType.TEXT_PLAIN})
public Response getMsg(@PathParam("message") String msg)
{
String output = "Message requested : " + msg;
//Simply return the parameter passed as message
return Response.status(200).entity(output).build();
}
}
Here is my web.xml
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
<servlet>
<servlet-name>jersey-serlvet</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>com.ibm.appscan.services</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>jersey-serlvet</servlet-name>
<url-pattern>/rest-points/*</url-pattern>
</servlet-mapping>
</web-app>
Here are my dependencies:
来源:https://stackoverflow.com/questions/62398291/an-exception-occurred-while-scanning-class-and-annotation-data-the-exception-wa