Resteasy @Form annotation does not work in Glassfish 4.1

Asked

Viewed 101 times

0

I am trying to make a legacy web java application that is packaged within an EAR and that was written for Jboss 7 to work on Glassfish 4.1. The application is not built with Maven nor with Gradle (so please don’t post answers about Maven dependencies, and I can’t encourage or graduate this application at the moment). Its dependencies are just a bunch of Jars located in a folder lib.

My problem is that some JAX-RS methods have parameters annotated with org.jboss.resteasy.annotations.Form. But the application does not declare any dependency on the Resteasy packages, so I think they were somewhere inside Jboss or maybe in some classpath endorsed. I don’t have access to the original Jboss, and you can’t look there and see what it was like.

When removing the methods that have the parameters annotated with @Form and deploy, the JAX-RS part works. However, these methods are very important to the application and cannot be removed.

I tried to add the following Jars:

  • resteasy-jaxrs-3.0.13.Final.jar
  • resteasy-atom-provider-3.0.13.Final.jar
  • resteasy-cdi-3.0.13.Final.jar
  • resteasy-crypto-3.0.13.Final.jar
  • resteasy-jackson2-provider-3.0.13.Final.jar
  • resteasy-jaxb-provider-3.0.13.Final.jar
  • resteasy-jaxrs-3.0.13.Final.jar
  • resteasy-jsapi-3.0.13.Final.jar
  • resteasy-multipart-provider-3.0.13.Final.jar
  • resteasy-servlet-initializer-3.0.13.Final.jar
  • async-http-servlet-3.0-3.0.13.Final.jar

The best I’ve got so far is this:

Grave:   ContainerBase.addChild: start: 
org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: java.lang.NullPointerException
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:5954)
    at com.sun.enterprise.web.WebModule.start(WebModule.java:691)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1041)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:1024)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:747)
    at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2286)
    at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1932)
    at com.sun.enterprise.web.WebApplication.start(WebApplication.java:139)
    at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122)
    at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:291)
    at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:352)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:500)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
    at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:360)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:360)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722)
    at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
    at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
    at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:189)
    at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)
    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
    at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.catalina.LifecycleException: java.lang.NullPointerException
    at org.apache.catalina.core.StandardContext.callServletContainerInitializers(StandardContext.java:6037)
    at com.sun.enterprise.web.WebModule.callServletContainerInitializers(WebModule.java:774)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:5929)
    ... 49 more
Caused by: java.lang.NullPointerException
    at org.jboss.resteasy.plugins.servlet.ResteasyServletInitializer.register(ResteasyServletInitializer.java:108)
    at org.jboss.resteasy.plugins.servlet.ResteasyServletInitializer.onStartup(ResteasyServletInitializer.java:79)
    at org.apache.catalina.core.StandardContext.callServletContainerInitializers(StandardContext.java:6031)
    ... 51 more

What dependencies might be missing? I still can’t create a minimal, complete, verifiable example, but I intend to work on it if no one knows the answer.

By the way, I don’t know if it’s important, but anyway: The application was built in Eclipse (I don’t know which version). I am now using Netbeans 8.0.2.

If it matters, the JAX-RS controllers look something like this (note that this is also an EJB):

@Stateless
@LocalBean
@Path("/foo")
public class FooController {

    @PUT
    @Path("/bar")
    public Response someMethod(@Form SomeBean bean, @CookieParam("blahblah") String someCookieValue) throws SomeBusinessException {
        // ...
    }
}

Posted also in https://stackoverflow.com/q/33375822/540552

1 answer

1


As the application was made for Jboss, to run on glassfish not only the migration of the Rest service will be a challenge. It is not trivial to run Jersey on Jboss or Resteasy on Glassfish. To perform, go step by step. The first is to run the application on Jboss 7. Then build a Rest service on Glassfish. So try migrating the code built in Jboss to Glassfish. Thus, you will have the services running on each application server and you can compare them to see if it is possible to migrate faster to other services of the same type.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.