将Jersey JAX-RS WAR部署到JBoss:ResourceConfig不可代理

时间:2016-12-27 21:42:36

标签: jboss jersey jax-rs

我有一个基于Jersey的Web应用程序(基本上只是REST服务,没有演示文稿),我希望将其部署到JBoss EAP 6.2服务器。我首先遇到了here描述的问题,我可以使用问题的accepted answer解决这个问题。但是,然后我遇到了JBoss在部署WAR时抛出的以下异常:

  

16:24:10,142 ERROR [org.jboss.msc.service.fail](MSC服务主题1-3)MSC000001:无法启动服务jboss.deployment.unit。" search-rest.war&# 34; .eldStartService:服务jboss.deployment.unit中的org.jboss.msc.service.StartException。" search-rest.war" .WeldStartService:无法启动服务       在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]       在java.lang.Thread.run(Thread.java:745)[rt.jar:1.8.0_111]   引起:org.jboss.weld.exceptions.UnproxyableResolutionException:WELD-001437正常范围的bean类org.glassfish.jersey.server.ResourceConfig不可代理,因为类型是final或者包含最终方法public final org.glassfish.jersey .server.ResourceConfig org.glassfish.jersey.server.ResourceConfig.setClassLoader(java.lang.ClassLoader) - 带有限定符[@Default @Any]的Managed Bean [类mjb44.searchapp.rest.Application]。       在org.jboss.weld.util.Proxies.getUnproxyableClassException(Proxies.java:229)       在org.jboss.weld.util.Proxies.getUnproxyableTypeException(Proxies.java:180)       在org.jboss.weld.util.Proxies.getUnproxyableTypesExceptionInt(Proxies.java:195)       在org.jboss.weld.util.Proxies.getUnproxyableTypesException(Proxies.java:169)       在org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:148)       在org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:164)       在org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:383)       在org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:368)       在org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:379)       在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个

     

16:24:10,350 ERROR [org.jboss.as.server](DeploymentScanner-threads - 2)JBAS015870:部署部署" search-rest.war"回滚时出现以下失败消息:   {" JBAS014671:服务失败" => {" jboss.deployment.unit \"搜索rest.war \" .WeldStartService" => "服务中的org.jboss.msc.service.StartException jboss.deployment.unit。\" search-rest.war \" .WeldStartService:无法启动服务       引起:org.jboss.weld.exceptions.UnproxyableResolutionException:WELD-001437正常范围的bean类org.glassfish.jersey.server.ResourceConfig不可代理,因为类型是final或者包含最终方法public final org.glassfish.jersey .server.ResourceConfig org.glassfish.jersey.server.ResourceConfig.setClassLoader(java.lang.ClassLoader) - 带有限定符[@Default @Any]的Managed Bean [class mjb44.searchapp.rest.Application]。"}}

我的应用程序简单定义为:

import org.glassfish.jersey.server.ResourceConfig;
public class Application extends ResourceConfig {
    public Application () {
        register(mjb44.searchapp.filters.CORSFilter.class);
    }
}

......所以它既不是最终的,也不包含任何最终的方法。因此,问题显然与org.glassfish.jersey.server.ResourceConfig有关,但是我无法控制。我还在JBoss论坛here开始讨论。

1 个答案:

答案 0 :(得分:0)

仅仅是为了记录,我到目前为止从JBoss论坛收到的唯一回复就是:

  

我担心EAP支持的唯一JAX-RS实现是RESTEasy。

...这似乎很奇怪,因为我想如果我在WAR myApp.controller('demoCtrl', function($scope) { $scope.features = { featureX: false, feature1: false, feature2: false, feature3: false }; $scope.calculatePrice = function() { $scope.price = 0; $scope.price = $scope.features.feature1 === true ? $scope.price + 5 : $scope.price; $scope.price = $scope.features.feature2 === true ? $scope.price + 25 : $scope.price; $scope.price = $scope.features.feature3 === true ? $scope.price + 50 : $scope.price; $scope.price = $scope.features.featureX === true ? $scope.price + 10 : $scope.price; return $scope.price; }; }); 中提供JAX-RS实现,那么任何Web容器都应该没问题。