REST APIs Issue when Migrating from JBoss-6.1-EAP to JBoss-7.2-EAP

Posted on

Hello, we're migrating from JBoss 6.1 EAP to JBoss 7.2 EAP. After running the migration DB scripts and starting the server, we're unable to successfully execute our custom REST APIs.

  1. We were using old Resteasy jar version in JBoss 6.1 EAP. But the Resteasy version supported by JBoss 7.2 EAP is 3.6.1. What are
    the other Jars that need to be updated? We've updated the jar (jaxrs-api-1.2.1.GA.jar to jaxrs-api-2.0.jar). Is it required?

  2. We've the below code in web.xml. I.e. before migration.

    resteasy.scan
    true

    We believe that the above one needs to be commented out/removed out, as we saw a warning in the server startup that "resteasy.scan has been deprecated, Use a 3.0 servlet container and ResteasyServletInitializer". Do we need to do anything w.r.t. this?

    RESTfulServletContainer
    com.xyz.rest.frameworks.resteasy.XyzHttpServletDispatcher

    RESTfulServletContainer
    /rest/*

    org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap

    XyzHttpServletDispatcher does not have much customization.

  3. I tried to create a custom class (MyRestApplication) extending javax.ws.rs.core.Application with an ApplicationPath ("/rest/*"), but it didn't work.
    import javax.ws.rs.core.Application;
    import javax.ws.rs.ApplicationPath;
    import com.rest.resources.shop.ShopResource;

@ApplicationPath("/rest/*")
public class MyRestApplication extends Application {
private Set singletons = new HashSet();
private Set<Class<?>> empty = new HashSet>();
public MyRestApplication() {
singletons.add(new ShopResource());
}
@Override
public Set<Class<?>> getClasses() {
return empty;
}
@Override
public Set getSingletons() {
return singletons;
}
}
I ge the below exception:
07:43:30,281 ERROR [io.undertow.request] (default task-1) UT005023: Exception handling request to /myapp/rest/shop/v1/carts: java.lang.ClassCastException: com.myapp.poc.rest.webservice.service.MyRestApplication cannot be cast to javax.ws.rs.core.Application

For some trials, I didn't see any exception as above, but the REST API did not execute and returned 404 error.

Could you please help me in this.

Thanks,
Venkatesh

Responses