1 Reply Latest reply: Apr 22, 2012 4:25 AM by Stephen Coy RSS

RestEasy - UnsupportedClassVersionError

Steve Jagels Newbie

I am trying to set up an example RestEasy application.  In web.xml I have restEasy scan turned off and am using the javax.ws.rs.Application:

 

<listener>

  <listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>

</listener>

<servlet>

  <servlet-name>Resteasy</servlet-name>

  <servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>

  <init-param>

    <param-name>javax.ws.rs.Application</param-name>

    <param-value>com.mbh.esln.restdemo.action.HelloWorldApplication</param-value>

  </init-param>

</servlet>

 

Then I have the class to deal with the singletons:

 

package com.mbh.esln.restdemo.action;

 

import java.util.HashSet;

import java.util.Set;

import javax.ws.rs.core.Application;

 

import com.mbh.esln.restdemo.action.CustomersResource;

 

public class HelloWorldApplication extends Application{

    private Set<Object> singletons = new HashSet();

    private Set<Class<?>> empty = new HashSet();

 

    public HelloWorldApplication() {

        // ADD YOUR RESTFUL RESOURCES HERE

        this.singletons.add(new CustomersResource());

        this.singletons.add(new Customer());

        this.singletons.add(new GeoNames());

//        this.singletons.add(new GeoNamesService());

        this.singletons.add(new GeoCode());

        this.singletons.add(new RESTFulWSClientNoParam());

    }

 

    public Set<Class<?>> getClasses(){

        return this.empty;

    }

 

    public Set<Object> getSingletons(){

        return this.singletons;

    }

}

 

But I still get this error when starting up jboss:

 

10:59:03,771 INFO  [TomcatDeployer] deploy, ctxPath=/testRestEasyWS, warUrl=.../deploy/testRestEasyWS.war/

10:59:04,099 ERROR [MainDeployer] Could not create deployment: file:/C:/Java/jboss-4.3.0.GA_CP03/jboss-as/server/default/deploy/testrestdemo.war/

java.lang.UnsupportedClassVersionError: Bad version number in .class file

 

I am using:

 

jboss: 4.3.0.GA_CP03

jdk: 1.5.0_17

eclipse: 3.4

 

Any idea how to prevent this startup error?