Jersey REST Exception java.lang.ArrayIndexOutOfBoundsException at org.objectweb.asm.ClassReader.readInt

I am using Jersey 1.2 for building RESTful services using JDK1.5

When I test REST services, I am getting the following exception.

java.lang.ArrayIndexOutOfBoundsException: 2884779 at org.objectweb.asm.ClassReader.readInt(Unknown Source) at org.objectweb.asm.ClassReader.accept(Unknown Source) at org.objectweb.asm.ClassReader.accept(Unknown Source) at com.sun.jersey.spi.scanning.AnnotationScannerListener.onProcess (AnnotationScannerListener.java:130) at com.sun.jersey.core.spi.scanning.uri.FileSchemeScanner$1. f(FileSchemeScanner.java:83) at com.sun.jersey.core.util.Closing.f(Closing.java:68)

I have created a simple class for testing

@Path("/employee")
public class TestRest {


    @GET
    @Produces( { MediaType.TEXT_HTML })
    public String getClichedMessage() {

        return "Hello Smith";
    }
}

How can I resolve this issue?

My jar versions

jersey-server-1.2.jar
jersey-core-1.2.jar
grizzly-servlet-webserver-1.9.18-i.jar
asm-3.1.jar
jsr311-api-1.1.jar

Answer

check your annotation

  @POST
  @Produces(MediaType.TEXT_HTML) also try

Also try

you are having an incorrect version of asm.jar on your classpath. Make sure:

your deployed lib folder contains the same jars as target/app.war/WEB-INF/lib

you don’t have two versions of the asm.jar

you don’t have conflicting versions in maven

Leave a Reply

Your email address will not be published. Required fields are marked *