WELD-001437 Normal scoped bean class org.glassfish.jersey.server.ResourceConfig is not proxyable
mperdikeas-1 Dec 27, 2016 5:11 PMI have a Jersey-based JAX-RS application (WAR) which I am trying to deploy to a JBoss EAP 6.2. For what it matters, my application is service-oriented (a bunch of REST APIs), no presentation.
The application works fine when deployed to Tomcat 7 but when I try to deploy to JBoss (after solving the problem described in http://stackoverflow.com/q/6953516/274677), I am stuck at trace that I append at the end of this post.
Apparently, this is about class `org.glassfish.jersey.server.ResourceConfig` not being proxyable. There are two related questions in this forum:
https://developer.jboss.org/search.jspa?q=WELD-001437+is+not+proxyable
... but the solutions discussed do not apply to my case as I don't control class org.glassfish.jersey.server.ResourceConfig which obviously a dependency I get over the network. Further another question I have is why I am getting this error given that `ResourceConfig` is not a bean nor do I inject it anywhere. My own class that extends ResourceConfig is neither final nor does it have any final methods:
import org.glassfish.jersey.server.ResourceConfig;
public class Application extends ResourceConfig {
public Application () {
register(mjb44.searchapp.filters.CORSFilter.class);
}
}
How to fix this problem and succeed in deploying a Jersey JAX-RS application to JBoss AEP 6.2?
---%<---------------------------------
16:24:10,142 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC000001: Failed to start service jboss.deployment.unit."search-rest.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."search-rest.war".WeldStartService: Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_111]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_111]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_111]
Caused by: org.jboss.weld.exceptions.UnproxyableResolutionException: WELD-001437 Normal scoped bean class org.glassfish.jersey.server.ResourceConfig is not proxyable because the type is final or it contains a final method public final org.glassfish.jersey.server.ResourceConfig org.glassfish.jersey.server.ResourceConfig.setClassLoader(java.lang.ClassLoader) - Managed Bean [class mjb44.searchapp.rest.Application] with qualifiers [@Default @Any].
at org.jboss.weld.util.Proxies.getUnproxyableClassException(Proxies.java:229)
at org.jboss.weld.util.Proxies.getUnproxyableTypeException(Proxies.java:180)
at org.jboss.weld.util.Proxies.getUnproxyableTypesExceptionInt(Proxies.java:195)
at org.jboss.weld.util.Proxies.getUnproxyableTypesException(Proxies.java:169)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:148)
at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:164)
at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:383)
at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:368)
at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:379)
at org.jboss.as.weld.WeldStartService.start(WeldStartService.java:64)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
... 3 more
16:24:10,350 ERROR [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "search-rest.war" was rolled back with the following failure message:
{"JBAS014671: Failed services" => {"jboss.deployment.unit.\"search-rest.war\".WeldStartService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"search-rest.war\".WeldStartService: Failed to start service
Caused by: org.jboss.weld.exceptions.UnproxyableResolutionException: WELD-001437 Normal scoped bean class org.glassfish.jersey.server.ResourceConfig is not proxyable because the type is final or it contains a final method public final org.glassfish.jersey.server.ResourceConfig org.glassfish.jersey.server.ResourceConfig.setClassLoader(java.lang.ClassLoader) - Managed Bean [class mjb44.searchapp.rest.Application] with qualifiers [@Default @Any]."}}
--------------------------------->%---