The @Form annotation of RestEasy does not work in Glassfish 4.1

0

I'm trying to make a legacy web java application that is bundled inside an EAR and that was written for JBoss 7 to work on Glassfish 4.1. The application is not built with maven or gradle (so please do not post answers about maven dependencies, and I can not mavenize or gradient > this application at the moment). Its dependencies are just a bunch of JARs located in a lib folder.

My problem is that some JAX-RS methods have parameters annotated with org.jboss.resteasy.annotations.Form . But the application declares no dependency on the RestEasy packages, so I think they were somewhere inside JBoss or maybe on some endorsed classpath. I do not have access to the original JBoss, and you can not look there and see what it was like.

When you remove the methods that have the parameters written with @Form and deploy them, the JAX-RS part works. However, these methods are very important to the application and can not be removed.

I've tried adding 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 achieved 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 may be missing? I still can not create a minimal, complete, and verifiable example, but I plan to work on it if no one knows the answer.

By the way, I do not know if it's important, but anyway: The application was built in Eclipse (I do not know which version). I'm now using Netbeans 8.0.2.

If this matters, the JAX-RS controllers look 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 {
        // ...
    }
}

Also posted on link     

asked by anonymous 27.10.2015 / 19:56

1 answer

1

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

    
28.10.2015 / 18:44