|
From: Matt D. <mat...@gm...> - 2014-01-31 23:30:06
|
Hi Resteasy folks, I've been trying to get my app (which currently runs on jboss 7.1) working on WIldfly 8 CR1 flush out any issues before Wildfly 8 Final is released. I hit a problem that I believe to be caused by how resteasy-cdi behaves in a CDI 1.1 environment. My app uses a third-party jax-rs library for using Gson to serialize json. One of the @Providers in this library is a final class: http://grepcode.com/file/repo1.maven.org/maven2/net.derquinse/derquinse-common-jaxrs/1.0.34/net/derquinse/common/jaxrs/ByteSourceBodyWriter.java After switching to Wildfly 8, when I attempt to make a jax-rs request to my app, the request fails with a UnproxyableResolutionException (full stacktrace below [1]), because Weld can't create a proxy for ByteSourceBodyWriter. And it's true; this class isn't proxyable, and Weld is doing the right thing by complaining about it. I determined that this error didn't occur in JBoss AS7 because in CDI 1.0, there was never a ProcessAnnotatedType event raised for ByteSourceBodyWriter. This class lived in a jar without a beans.xml file, so Weld ignored it. In CDI 1.1, however, derquinse-common-jaxrs.jar seems to be treated as an 'implicit' bean archive, and though none of its classes are annotated with scope annotations (so normally they would not be treated as CDI beans), ProcessAnnotatedType events are now raised. And resteasy-cdi is picking up these events, detecting that the Providers have no scope annotations, and adding corresponding annotations (@ApplicationScoped, in this case) by wrapping the AnnotatedType. Thus, these classes that weren't intended by the author to be CDI beans are now being treated as CDI beans. To be concrete, this log line (and several other similar lines) occur for wildfly 8, but not for jboss 7.1: 12:08:32,904 DEBUG [org.jboss.resteasy.cdi.ResteasyCdiExtension] (MSC service thread 1-11) Discovered CDI bean which is a JAX-RS provider net.derquinse.common.jaxrs.ByteSourceBodyWriter. This seems to be going against the intended behavior [2] of resteasy-cdi -- it is only supposed to modify @Providers that are definitely CDI beans, and leave non-CDI @Providers alone, letting them be managed by Resteasy. I don't know a clean way to fix this. I think resteasy-cdi needs to determine if the AnnotatedType is intended to be a CDI bean, instead of assuming that AnnotatedType events are fired only for CDI Beans. Perhaps it can use the type's classloader to determine if it comes from a jar with a beans.xml defined in it. (Though to be complete, it should also determine the bean-discovey-mode of the beans.xml, if any. This sounds like a lot of work.) Note 1: for my app, I can get around this problem by using a jboss-all.xml file [3], but I think this shouldn't be necessary. Note 2: i'm pretty sure the derquinse-common-jaxrs jar has no scope-annotated class or session beans, so I'm not sure why it's being considered as an implicit bean archive. What are your thoughts? I can create a jira for you, if you'd like. Thanks, Matt Drees [1] 6:52:56,233 ERROR [org.cru.redegg.loggedErrors] (pool-11-thread-5) error:: java.lang.RuntimeException: Unable to instantiate MessageBodyWriter at org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:1383) [resteasy-jaxrs-3.0.6.Final.jar:] at org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:1310) [resteasy-jaxrs-3.0.6.Final.jar:] at org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:1232) [resteasy-jaxrs-3.0.6.Final.jar:] at org.jboss.resteasy.spi.ResteasyDeployment.registerProvider(ResteasyDeployment.java:531) [resteasy-jaxrs-3.0.6.Final.jar:] at org.jboss.resteasy.spi.ResteasyDeployment.registration(ResteasyDeployment.java:338) [resteasy-jaxrs-3.0.6.Final.jar:] at org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:241) [resteasy-jaxrs-3.0.6.Final.jar:] at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:112) [resteasy-jaxrs-3.0.6.Final.jar:] at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36) [resteasy-jaxrs-3.0.6.Final.jar:] at io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:204) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.servlet.core.ManagedServlet.getServlet(ManagedServlet.java:147) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:86) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:130) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] at org.cru.redegg.servlet.RedEggFilter.doFilter(RedEggFilter.java:54) [red-egg-1-20140114.172822-29.jar:] at org.cru.redegg.servlet.RedEggFilter.doFilter(RedEggFilter.java:42) [red-egg-1-20140114.172822-29.jar:] at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] at org.ccci.maintenance.MaintenanceServletFilter.doFilter(MaintenanceServletFilter.java:71) [maintenance-filter-server-1-20131218.163934-17.jar:] at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] at org.ccci.servlet.LogoutFilter.doFilter(LogoutFilter.java:52) [classes:] at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:85) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:70) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.security.handlers.AuthenticationCallHandler.handleRequest(AuthenticationCallHandler.java:52) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:67) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:70) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30] 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.Beta30.jar:1.0.0.Beta30] at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.server.Connectors.executeRootHandler(Connectors.java:164) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30] at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:654) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_45] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_45] at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45] Caused by: org.jboss.weld.exceptions.UnproxyableResolutionException: WELD-001437: Normal scoped bean class net.derquinse.common.jaxrs.ByteSourceBodyWriter is not proxyable because the type is final or it contains a final method class net.derquinse.common.jaxrs.ByteSourceBodyWriter - <unknown javax.enterprise.inject.spi.Bean instance>. at org.jboss.weld.util.Proxies.getUnproxyableClassException(Proxies.java:229) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59] at org.jboss.weld.util.Proxies.getUnproxyableTypeException(Proxies.java:178) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59] at org.jboss.weld.util.Proxies.getUnproxyableTypeException(Proxies.java:140) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59] at org.jboss.weld.bean.proxy.ClientProxyProvider.getClientProxy(ClientProxyProvider.java:214) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59] at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:727) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59] at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:753) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59] at org.jboss.weld.util.ForwardingBeanManager.getReference(ForwardingBeanManager.java:61) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59] at org.jboss.weld.bean.builtin.BeanManagerProxy.getReference(BeanManagerProxy.java:80) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59] at org.jboss.resteasy.cdi.CdiConstructorInjector.construct(CdiConstructorInjector.java:64) [resteasy-cdi-3.0.6.Final.jar:] at org.jboss.resteasy.spi.ResteasyProviderFactory.createProviderInstance(ResteasyProviderFactory.java:2175) [resteasy-jaxrs-3.0.6.Final.jar:] at org.jboss.resteasy.spi.ResteasyProviderFactory.addMessageBodyWriter(ResteasyProviderFactory.java:837) [resteasy-jaxrs-3.0.6.Final.jar:] at org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:1378) [resteasy-jaxrs-3.0.6.Final.jar:] ... 45 more [2] http://docs.jboss.org/resteasy/docs/3.0.6.Final/userguide/html/CDI.html#d4e2034 [3] https://docs.jboss.org/author/display/WFLY8/CDI+Reference#CDIReference-Suppressingimplicitbeanarchives |
|
From: Bill B. <bb...@re...> - 2014-01-31 23:45:34
|
Log a JIRA and I'll forward it to the apropriate people. I don't think I have the knowledge to fix this. We made a change in wildfly that all JAX-RS instances are managed by CDI because of managed beans and such. Maybe it is just a matter of Weld making better decisions about what is and what isn't a CDI bean. On 1/31/2014 6:29 PM, Matt Drees wrote: > Hi Resteasy folks, > > I've been trying to get my app (which currently runs on jboss 7.1) > working on WIldfly 8 CR1 flush out any issues before Wildfly 8 Final is > released. > > I hit a problem that I believe to be caused by how resteasy-cdi behaves > in a CDI 1.1 environment. > > My app uses a third-party jax-rs library for using Gson to serialize > json. One of the @Providers in this library is a final class: > http://grepcode.com/file/repo1.maven.org/maven2/net.derquinse/derquinse-common-jaxrs/1.0.34/net/derquinse/common/jaxrs/ByteSourceBodyWriter.java > > After switching to Wildfly 8, when I attempt to make a jax-rs request to > my app, the request fails with a UnproxyableResolutionException (full > stacktrace below [1]), because Weld can't create a proxy for > ByteSourceBodyWriter. And it's true; this class isn't proxyable, and > Weld is doing the right thing by complaining about it. > > I determined that this error didn't occur in JBoss AS7 because in CDI > 1.0, there was never a ProcessAnnotatedType event raised for > ByteSourceBodyWriter. This class lived in a jar without a beans.xml > file, so Weld ignored it. In CDI 1.1, however, > derquinse-common-jaxrs.jar seems to be treated as an 'implicit' bean > archive, and though none of its classes are annotated with scope > annotations (so normally they would not be treated as CDI beans), > ProcessAnnotatedType events are now raised. And resteasy-cdi is > picking up these events, detecting that the Providers have no scope > annotations, and adding corresponding annotations (@ApplicationScoped, > in this case) by wrapping the AnnotatedType. Thus, these classes that > weren't intended by the author to be CDI beans are now being treated as > CDI beans. > > To be concrete, this log line (and several other similar lines) occur > for wildfly 8, but not for jboss 7.1: > > 12:08:32,904 DEBUG [org.jboss.resteasy.cdi.ResteasyCdiExtension] > (MSC service thread 1-11) Discovered CDI bean which is a JAX-RS > provider net.derquinse.common.jaxrs.ByteSourceBodyWriter. > > > > This seems to be going against the intended behavior [2] of resteasy-cdi > -- it is only supposed to modify @Providers that are definitely CDI > beans, and leave non-CDI @Providers alone, letting them be managed by > Resteasy. > > I don't know a clean way to fix this. I think resteasy-cdi needs to > determine if the AnnotatedType is intended to be a CDI bean, instead of > assuming that AnnotatedType events are fired only for CDI Beans. > Perhaps it can use the type's classloader to determine if it comes > from a jar with a beans.xml defined in it. (Though to be complete, it > should also determine the bean-discovey-mode of the beans.xml, if any. > This sounds like a lot of work.) > > Note 1: for my app, I can get around this problem by using a > jboss-all.xml file [3], but I think this shouldn't be necessary. > > Note 2: i'm pretty sure the derquinse-common-jaxrs jar has no > scope-annotated class or session beans, so I'm not sure why it's being > considered as an implicit bean archive. > > What are your thoughts? I can create a jira for you, if you'd like. > > Thanks, > Matt Drees > > > > [1] > 6:52:56,233 ERROR [org.cru.redegg.loggedErrors] (pool-11-thread-5) > error:: java.lang.RuntimeException: Unable to instantiate MessageBodyWriter > at > org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:1383) > [resteasy-jaxrs-3.0.6.Final.jar:] > at > org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:1310) > [resteasy-jaxrs-3.0.6.Final.jar:] > at > org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:1232) > [resteasy-jaxrs-3.0.6.Final.jar:] > at > org.jboss.resteasy.spi.ResteasyDeployment.registerProvider(ResteasyDeployment.java:531) > [resteasy-jaxrs-3.0.6.Final.jar:] > at > org.jboss.resteasy.spi.ResteasyDeployment.registration(ResteasyDeployment.java:338) > [resteasy-jaxrs-3.0.6.Final.jar:] > at > org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:241) > [resteasy-jaxrs-3.0.6.Final.jar:] > at > org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:112) > [resteasy-jaxrs-3.0.6.Final.jar:] > at > org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36) > [resteasy-jaxrs-3.0.6.Final.jar:] > at > io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:204) > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > at > io.undertow.servlet.core.ManagedServlet.getServlet(ManagedServlet.java:147) > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > at > io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:86) > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > at > io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:130) > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > at org.cru.redegg.servlet.RedEggFilter.doFilter(RedEggFilter.java:54) > [red-egg-1-20140114.172822-29.jar:] > at org.cru.redegg.servlet.RedEggFilter.doFilter(RedEggFilter.java:42) > [red-egg-1-20140114.172822-29.jar:] > at > io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56) > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > at > io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > at > org.ccci.maintenance.MaintenanceServletFilter.doFilter(MaintenanceServletFilter.java:71) > [maintenance-filter-server-1-20131218.163934-17.jar:] > at > io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56) > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > at > io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > at org.ccci.servlet.LogoutFilter.doFilter(LogoutFilter.java:52) [classes:] > at > io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56) > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > at > io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > at > io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:85) > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > at > io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > at > io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > at > org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:70) > at > io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) > [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30] > at > io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113) > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > at > io.undertow.security.handlers.AuthenticationCallHandler.handleRequest(AuthenticationCallHandler.java:52) > [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30] > at > io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) > [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30] > at > io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61) > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > at > io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:67) > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > at > io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:70) > [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30] > at > io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) > [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30] > 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.Beta30.jar:1.0.0.Beta30] > at > io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) > [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30] > at > io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240) > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > at > io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227) > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > at > io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73) > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > at > io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146) > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > at io.undertow.server.Connectors.executeRootHandler(Connectors.java:164) > [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30] > at > io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:654) > [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30] > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) > [rt.jar:1.7.0_45] > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) > [rt.jar:1.7.0_45] > at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45] > Caused by: org.jboss.weld.exceptions.UnproxyableResolutionException: > WELD-001437: Normal scoped bean class > net.derquinse.common.jaxrs.ByteSourceBodyWriter is not proxyable because > the type is final or it contains a final method class > net.derquinse.common.jaxrs.ByteSourceBodyWriter - <unknown > javax.enterprise.inject.spi.Bean instance>. > at > org.jboss.weld.util.Proxies.getUnproxyableClassException(Proxies.java:229) > [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59] > at > org.jboss.weld.util.Proxies.getUnproxyableTypeException(Proxies.java:178) [weld-core-impl-2.1.1.Final.jar:2013-12-03 > 09:59] > at > org.jboss.weld.util.Proxies.getUnproxyableTypeException(Proxies.java:140) [weld-core-impl-2.1.1.Final.jar:2013-12-03 > 09:59] > at > org.jboss.weld.bean.proxy.ClientProxyProvider.getClientProxy(ClientProxyProvider.java:214) > [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59] > at > org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:727) > [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59] > at > org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:753) > [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59] > at > org.jboss.weld.util.ForwardingBeanManager.getReference(ForwardingBeanManager.java:61) > [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59] > at > org.jboss.weld.bean.builtin.BeanManagerProxy.getReference(BeanManagerProxy.java:80) > [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59] > at > org.jboss.resteasy.cdi.CdiConstructorInjector.construct(CdiConstructorInjector.java:64) > [resteasy-cdi-3.0.6.Final.jar:] > at > org.jboss.resteasy.spi.ResteasyProviderFactory.createProviderInstance(ResteasyProviderFactory.java:2175) > [resteasy-jaxrs-3.0.6.Final.jar:] > at > org.jboss.resteasy.spi.ResteasyProviderFactory.addMessageBodyWriter(ResteasyProviderFactory.java:837) > [resteasy-jaxrs-3.0.6.Final.jar:] > at > org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:1378) > [resteasy-jaxrs-3.0.6.Final.jar:] > ... 45 more > > [2] > http://docs.jboss.org/resteasy/docs/3.0.6.Final/userguide/html/CDI.html#d4e2034 > [3] > https://docs.jboss.org/author/display/WFLY8/CDI+Reference#CDIReference-Suppressingimplicitbeanarchives > > > ------------------------------------------------------------------------------ > WatchGuard Dimension instantly turns raw network data into actionable > security intelligence. It gives you real-time visual feedback on key > security issues and trends. Skip the complicated setup - simply import > a virtual appliance and go from zero to informed in seconds. > http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk > > > > _______________________________________________ > Resteasy-developers mailing list > Res...@li... > https://lists.sourceforge.net/lists/listinfo/resteasy-developers > -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com |
|
From: Matt D. <mat...@gm...> - 2014-02-01 01:32:15
|
Created https://issues.jboss.org/browse/RESTEASY-1015 On Fri, Jan 31, 2014 at 4:45 PM, Bill Burke <bb...@re...> wrote: > Log a JIRA and I'll forward it to the apropriate people. I don't think > I have the knowledge to fix this. We made a change in wildfly that all > JAX-RS instances are managed by CDI because of managed beans and such. > Maybe it is just a matter of Weld making better decisions about what is > and what isn't a CDI bean. > > On 1/31/2014 6:29 PM, Matt Drees wrote: > > Hi Resteasy folks, > > > > I've been trying to get my app (which currently runs on jboss 7.1) > > working on WIldfly 8 CR1 flush out any issues before Wildfly 8 Final is > > released. > > > > I hit a problem that I believe to be caused by how resteasy-cdi behaves > > in a CDI 1.1 environment. > > > > My app uses a third-party jax-rs library for using Gson to serialize > > json. One of the @Providers in this library is a final class: > > > http://grepcode.com/file/repo1.maven.org/maven2/net.derquinse/derquinse-common-jaxrs/1.0.34/net/derquinse/common/jaxrs/ByteSourceBodyWriter.java > > > > After switching to Wildfly 8, when I attempt to make a jax-rs request to > > my app, the request fails with a UnproxyableResolutionException (full > > stacktrace below [1]), because Weld can't create a proxy for > > ByteSourceBodyWriter. And it's true; this class isn't proxyable, and > > Weld is doing the right thing by complaining about it. > > > > I determined that this error didn't occur in JBoss AS7 because in CDI > > 1.0, there was never a ProcessAnnotatedType event raised for > > ByteSourceBodyWriter. This class lived in a jar without a beans.xml > > file, so Weld ignored it. In CDI 1.1, however, > > derquinse-common-jaxrs.jar seems to be treated as an 'implicit' bean > > archive, and though none of its classes are annotated with scope > > annotations (so normally they would not be treated as CDI beans), > > ProcessAnnotatedType events are now raised. And resteasy-cdi is > > picking up these events, detecting that the Providers have no scope > > annotations, and adding corresponding annotations (@ApplicationScoped, > > in this case) by wrapping the AnnotatedType. Thus, these classes that > > weren't intended by the author to be CDI beans are now being treated as > > CDI beans. > > > > To be concrete, this log line (and several other similar lines) occur > > for wildfly 8, but not for jboss 7.1: > > > > 12:08:32,904 DEBUG [org.jboss.resteasy.cdi.ResteasyCdiExtension] > > (MSC service thread 1-11) Discovered CDI bean which is a JAX-RS > > provider net.derquinse.common.jaxrs.ByteSourceBodyWriter. > > > > > > > > This seems to be going against the intended behavior [2] of resteasy-cdi > > -- it is only supposed to modify @Providers that are definitely CDI > > beans, and leave non-CDI @Providers alone, letting them be managed by > > Resteasy. > > > > I don't know a clean way to fix this. I think resteasy-cdi needs to > > determine if the AnnotatedType is intended to be a CDI bean, instead of > > assuming that AnnotatedType events are fired only for CDI Beans. > > Perhaps it can use the type's classloader to determine if it comes > > from a jar with a beans.xml defined in it. (Though to be complete, it > > should also determine the bean-discovey-mode of the beans.xml, if any. > > This sounds like a lot of work.) > > > > Note 1: for my app, I can get around this problem by using a > > jboss-all.xml file [3], but I think this shouldn't be necessary. > > > > Note 2: i'm pretty sure the derquinse-common-jaxrs jar has no > > scope-annotated class or session beans, so I'm not sure why it's being > > considered as an implicit bean archive. > > > > What are your thoughts? I can create a jira for you, if you'd like. > > > > Thanks, > > Matt Drees > > > > > > > > [1] > > 6:52:56,233 ERROR [org.cru.redegg.loggedErrors] (pool-11-thread-5) > > error:: java.lang.RuntimeException: Unable to instantiate > MessageBodyWriter > > at > > > org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:1383) > > [resteasy-jaxrs-3.0.6.Final.jar:] > > at > > > org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:1310) > > [resteasy-jaxrs-3.0.6.Final.jar:] > > at > > > org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:1232) > > [resteasy-jaxrs-3.0.6.Final.jar:] > > at > > > org.jboss.resteasy.spi.ResteasyDeployment.registerProvider(ResteasyDeployment.java:531) > > [resteasy-jaxrs-3.0.6.Final.jar:] > > at > > > org.jboss.resteasy.spi.ResteasyDeployment.registration(ResteasyDeployment.java:338) > > [resteasy-jaxrs-3.0.6.Final.jar:] > > at > > > org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:241) > > [resteasy-jaxrs-3.0.6.Final.jar:] > > at > > > org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:112) > > [resteasy-jaxrs-3.0.6.Final.jar:] > > at > > > org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36) > > [resteasy-jaxrs-3.0.6.Final.jar:] > > at > > > io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:204) > > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > > at > > > io.undertow.servlet.core.ManagedServlet.getServlet(ManagedServlet.java:147) > > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > > at > > > io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:86) > > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > > at > > > io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:130) > > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > > at org.cru.redegg.servlet.RedEggFilter.doFilter(RedEggFilter.java:54) > > [red-egg-1-20140114.172822-29.jar:] > > at org.cru.redegg.servlet.RedEggFilter.doFilter(RedEggFilter.java:42) > > [red-egg-1-20140114.172822-29.jar:] > > at > > io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56) > > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > > at > > > io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) > > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > > at > > > org.ccci.maintenance.MaintenanceServletFilter.doFilter(MaintenanceServletFilter.java:71) > > [maintenance-filter-server-1-20131218.163934-17.jar:] > > at > > io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56) > > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > > at > > > io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) > > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > > at org.ccci.servlet.LogoutFilter.doFilter(LogoutFilter.java:52) > [classes:] > > at > > io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56) > > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > > at > > > io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) > > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > > at > > > io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:85) > > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > > at > > > io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) > > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > > at > > > io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) > > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > > at > > > org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:70) > > at > > > io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) > > [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30] > > at > > > io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113) > > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > > at > > > io.undertow.security.handlers.AuthenticationCallHandler.handleRequest(AuthenticationCallHandler.java:52) > > [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30] > > at > > > io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) > > [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30] > > at > > > io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61) > > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > > at > > > io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:67) > > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > > at > > > io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:70) > > [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30] > > at > > > io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) > > [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30] > > 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.Beta30.jar:1.0.0.Beta30] > > at > > > io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) > > [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30] > > at > > > io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240) > > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > > at > > > io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227) > > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > > at > > > io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73) > > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > > at > > > io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146) > > [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30] > > at io.undertow.server.Connectors.executeRootHandler(Connectors.java:164) > > [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30] > > at > > io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:654) > > [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30] > > at > > > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) > > [rt.jar:1.7.0_45] > > at > > > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) > > [rt.jar:1.7.0_45] > > at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45] > > Caused by: org.jboss.weld.exceptions.UnproxyableResolutionException: > > WELD-001437: Normal scoped bean class > > net.derquinse.common.jaxrs.ByteSourceBodyWriter is not proxyable because > > the type is final or it contains a final method class > > net.derquinse.common.jaxrs.ByteSourceBodyWriter - <unknown > > javax.enterprise.inject.spi.Bean instance>. > > at > > > org.jboss.weld.util.Proxies.getUnproxyableClassException(Proxies.java:229) > > [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59] > > at > > > org.jboss.weld.util.Proxies.getUnproxyableTypeException(Proxies.java:178) > [weld-core-impl-2.1.1.Final.jar:2013-12-03 > > 09:59] > > at > > > org.jboss.weld.util.Proxies.getUnproxyableTypeException(Proxies.java:140) > [weld-core-impl-2.1.1.Final.jar:2013-12-03 > > 09:59] > > at > > > org.jboss.weld.bean.proxy.ClientProxyProvider.getClientProxy(ClientProxyProvider.java:214) > > [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59] > > at > > > org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:727) > > [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59] > > at > > > org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:753) > > [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59] > > at > > > org.jboss.weld.util.ForwardingBeanManager.getReference(ForwardingBeanManager.java:61) > > [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59] > > at > > > org.jboss.weld.bean.builtin.BeanManagerProxy.getReference(BeanManagerProxy.java:80) > > [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59] > > at > > > org.jboss.resteasy.cdi.CdiConstructorInjector.construct(CdiConstructorInjector.java:64) > > [resteasy-cdi-3.0.6.Final.jar:] > > at > > > org.jboss.resteasy.spi.ResteasyProviderFactory.createProviderInstance(ResteasyProviderFactory.java:2175) > > [resteasy-jaxrs-3.0.6.Final.jar:] > > at > > > org.jboss.resteasy.spi.ResteasyProviderFactory.addMessageBodyWriter(ResteasyProviderFactory.java:837) > > [resteasy-jaxrs-3.0.6.Final.jar:] > > at > > > org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:1378) > > [resteasy-jaxrs-3.0.6.Final.jar:] > > ... 45 more > > > > [2] > > > http://docs.jboss.org/resteasy/docs/3.0.6.Final/userguide/html/CDI.html#d4e2034 > > [3] > > > https://docs.jboss.org/author/display/WFLY8/CDI+Reference#CDIReference-Suppressingimplicitbeanarchives > > > > > > > ------------------------------------------------------------------------------ > > WatchGuard Dimension instantly turns raw network data into actionable > > security intelligence. It gives you real-time visual feedback on key > > security issues and trends. Skip the complicated setup - simply import > > a virtual appliance and go from zero to informed in seconds. > > > http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk > > > > > > > > _______________________________________________ > > Resteasy-developers mailing list > > Res...@li... > > https://lists.sourceforge.net/lists/listinfo/resteasy-developers > > > > -- > Bill Burke > JBoss, a division of Red Hat > http://bill.burkecentral.com > > > ------------------------------------------------------------------------------ > WatchGuard Dimension instantly turns raw network data into actionable > security intelligence. It gives you real-time visual feedback on key > security issues and trends. Skip the complicated setup - simply import > a virtual appliance and go from zero to informed in seconds. > > http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk > _______________________________________________ > Resteasy-developers mailing list > Res...@li... > https://lists.sourceforge.net/lists/listinfo/resteasy-developers > |