Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration with RESTeasy broken with 2.3 #41

Closed
cowtowncoder opened this issue Jan 30, 2014 · 14 comments
Closed

Integration with RESTeasy broken with 2.3 #41

cowtowncoder opened this issue Jan 30, 2014 · 14 comments

Comments

@cowtowncoder
Copy link
Member

Looks like changes made in ProviderBase for 2.3 broke integration by RESTeasy, by removing call used by its jackson-based provider:

https://github.com/resteasy/Resteasy/blob/e30b28d6cdd2cdfaaa90e94c471ae88d6b813bbe/jaxrs/providers/jackson2/src/main/java/org/jboss/resteasy/plugins/providers/jackson/ResteasyJackson2Provider.java#L107

as reported by @tbroyer.

Beyond fixing the immediate issue, it would be great if we could figure out a way to add tests for downstream dependencies, simple sanity checks to at least ensure that up-to-date versions compile with new Jackson JAX-RS provider implementations (and better yet, work to some degree). Something like this actually works with Jersey, since there are small tests we use for integration tests.

@cowtowncoder
Copy link
Member Author

Specific issue should be fixed, but what I really want to do is figure out a way to guard against basic integration issues if possible.

@tbroyer
Copy link

tbroyer commented Feb 1, 2014

There are several tools that can help:

@cowtowncoder
Copy link
Member Author

Thanks.

@cowtowncoder
Copy link
Member Author

Immediate issue resolved.

@night199uk
Copy link

Is this in 2.3.2?
I'm trying to upgrade my wildfly 8 server modules to 2.3.2 to work around this, by replacing the modules for jackson-jaxrs with the 2.3.2 variants but I still see the same issue no matter what I do.
I need jackson-datatype-hibernate4 for lazy initialization handling and wildfly uses hibernate 4.3, which only seems to be supported by jackson-datatype-hibernate4:2.3+.
Link to the relevant Wildfly issue:
https://issues.jboss.org/browse/WFLY-2959

@cowtowncoder
Copy link
Member Author

@night199uk Fix should be in 2.3.2; deprecated methods were added back. Can you provide exception for failure? Perhaps there is some other compatibility issue that causes problems.

@night199uk
Copy link

17:49:51,096 ERROR [io.undertow.request](default task-1) UT005023: Exception handling request to /x.x.x.x-x-0.0.1-SNAPSHOT/rest/y/y: java.lang.NoSuchMethodError: org.jboss.resteasy.plugins.providers.jackson.ResteasyJackson2Provider._configForWriting(Lcom/fasterxml/jackson/databind/ObjectMapper;[Ljava/lang/annotation/Annotation;)Lcom/fasterxml/jackson/jaxrs/json/JsonEndpointConfig;
at org.jboss.resteasy.plugins.providers.jackson.ResteasyJackson2Provider.writeTo(ResteasyJackson2Provider.java:137) [resteasy-jackson2-provider-3.0.6.Final.jar:]
at org.jboss.resteasy.core.interception.AbstractWriterInterceptorContext.writeTo(AbstractWriterInterceptorContext.java:129) [resteasy-jaxrs-3.0.6.Final.jar:]
at org.jboss.resteasy.core.interception.ServerWriterInterceptorContext.writeTo(ServerWriterInterceptorContext.java:62) [resteasy-jaxrs-3.0.6.Final.jar:]
at org.jboss.resteasy.core.interception.AbstractWriterInterceptorContext.proceed(AbstractWriterInterceptorContext.java:118) [resteasy-jaxrs-3.0.6.Final.jar:]
at org.jboss.resteasy.security.doseta.DigitalSigningInterceptor.aroundWriteTo(DigitalSigningInterceptor.java:143) [resteasy-crypto-3.0.6.Final.jar:]
at org.jboss.resteasy.core.interception.AbstractWriterInterceptorContext.proceed(AbstractWriterInterceptorContext.java:122) [resteasy-jaxrs-3.0.6.Final.jar:]
at org.jboss.resteasy.plugins.interceptors.encoding.GZIPEncodingInterceptor.aroundWriteTo(GZIPEncodingInterceptor.java:100) [resteasy-jaxrs-3.0.6.Final.jar:]
at org.jboss.resteasy.core.interception.AbstractWriterInterceptorContext.proceed(AbstractWriterInterceptorContext.java:122) [resteasy-jaxrs-3.0.6.Final.jar:]
at org.jboss.resteasy.plugins.interceptors.encoding.ServerContentEncodingAnnotationFilter.aroundWriteTo(ServerContentEncodingAnnotationFilter.java:60) [resteasy-jaxrs-3.0.6.Final.jar:]
at org.jboss.resteasy.core.interception.AbstractWriterInterceptorContext.proceed(AbstractWriterInterceptorContext.java:122) [resteasy-jaxrs-3.0.6.Final.jar:]
at org.jboss.resteasy.core.ServerResponseWriter.writeNomapResponse(ServerResponseWriter.java:99) [resteasy-jaxrs-3.0.6.Final.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.writeResponse(SynchronousDispatcher.java:427) [resteasy-jaxrs-3.0.6.Final.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:376) [resteasy-jaxrs-3.0.6.Final.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:179) [resteasy-jaxrs-3.0.6.Final.jar:]
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:220) [resteasy-jaxrs-3.0.6.Final.jar:]
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56) [resteasy-jaxrs-3.0.6.Final.jar:]
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51) [resteasy-jaxrs-3.0.6.Final.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.security.handlers.AuthenticationCallHandler.handleRequest(AuthenticationCallHandler.java:52) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:168) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:687) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.7.0_07]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_07]
at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_07]

All Wildfly jackson libs under modules/ were replaced with their respective 2.3.2 variants. I'm now sure how to dump the classloader to check what wildfly is actually using, and annoyingly the jackson versions are not in the stacktrace, but the 2.3.0 libs were removed from the filesystem so I'm basically certain wildfly is using 2.3.2. Eclipse recognizes the method as deprecated from the 2.3.2 source included via maven in my pom.xml so I don't see any issues there. If there is a class loader issue loading the wrong jackson libs, I can't figure it out.

@night199uk
Copy link

I uploaded a simple test project to the wildfly issue here:
https://issues.jboss.org/browse/WFLY-2959
You can deploy the second version of that directly on Wildfly 8 to test.

@cowtowncoder
Copy link
Member Author

Thanks.

@cowtowncoder
Copy link
Member Author

Hmmh. There seems to be some discrepancy between naming here; error message is missing leading underscore? However since ResteasyJackson2Provider uses name with leading underscore, maybe this is not the actual problem.

Looking at method definitions (2.2 vs 2.3), this might be something else: maybe it's linkage problem. If so, the problem is that while I added back protected EP_CONFIG _configForWriting(MAPPER mapper, Annotation[] annotations), it is in ProviderBase; but 2.2 had it defined in JacksonJsonProvider.java.
So perhaps it is source compatible but NOT binary compatible, because class in which method is declared has changed (that is: JacksonJsonProvider does not have that method, its super-class has). I am not 100% sure about this, but I think byte code does store references this way (method name and class/interface it is defined in, to resolve during loading of class).

I will go ahead and add an override, just in case.

cowtowncoder added a commit that referenced this issue Mar 6, 2014
@cowtowncoder
Copy link
Member Author

Added explicit overrides for sub-classes, hoping this resolves remaining problem.
Will try to see if I can reproduce the fix now.

@cowtowncoder
Copy link
Member Author

Hmmh. I am not 100% sure how to use the referenced test project; it also does not seem use explicit Jackson version override.

@night199uk
Copy link

Can you provide me a package of test jars somehow and I can probably test tonight for you?

@cowtowncoder
Copy link
Member Author

What you can do is build jars locally using 'mvn deploy', and that will give you local 2.3.3-SNAPSHOT versions. If you build with Maven, you can add those as dependencies.
If not, they can be from local Maven cache, which on linux/macos would be under ~/.m2/repository/com/fasterxml/jackson/jaxrs/ (and something similar on windows).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants