具有参数化bean类的托管bean必须为@Dependent:类org.apache.cxf.jaxrs.provider.DataSourceProvider

时间:2019-01-07 16:24:26

标签: java jboss jax-rs wildfly apache-tika

我正在设置一个新服务器JBoss EAP 7.1,尝试进行第一个成功的部署时遇到了麻烦。我的堆栈跟踪如下所示:

ERROR [org.jboss.msc.service.fail] (MSC service thread 1-6) MSC000001: Failed to start service jboss.deployment.unit."foo.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."foo.war".WeldStartService: Failed to start service
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1978)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: org.jboss.weld.exceptions.DefinitionException: WELD-000071: Managed bean with a parameterized bean class must be @Dependent: class org.apache.cxf.jaxrs.provider.DataSourceProvider
    at org.jboss.weld.bean.ManagedBean.checkType(ManagedBean.java:208)
    at org.jboss.weld.bean.AbstractBean.initializeAfterBeanDiscovery(AbstractBean.java:107)
    at org.jboss.weld.bean.ManagedBean.initializeAfterBeanDiscovery(ManagedBean.java:122)
    at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$AfterBeanDiscoveryInitializerFactory.doWork(ConcurrentBeanDeployer.java:132)
    at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$AfterBeanDiscoveryInitializerFactory.doWork(ConcurrentBeanDeployer.java:123)
    at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:62)
    at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:55)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    at org.jboss.threads.JBossThread.run(JBossThread.java:320)

ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "foo.war")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"foo.war\".WeldStartService" => "Failed to start service
    Caused by: org.jboss.weld.exceptions.DefinitionException: WELD-000071: Managed bean with a parameterized bean class must be @Dependent: class org.apache.cxf.jaxrs.provider.DataSourceProvider"}}

我看了一个可能有用的question asked in the past,但是我一直无法将其转换为用例,可能是因为我的项目没有使用Spring。我与上一个问题的共同点是,尽管我使用的是Apache Tika。

我希望当我运行JBoss standalone.sh脚本时,看到的大部分是清晰的INFO日志。但是,我看到的是大量的堆栈跟踪日志,这些日志表明我对jaxrs依赖而不是@Dependent的bean类有问题。

1 个答案:

答案 0 :(得分:0)

我认为pom.xml中的T​​ika解析器依赖关系存在问题

<dependency>
            <groupId>org.apache.tika</groupId>
            <artifactId>tika-parsers</artifactId>
            <version>1.20</version>
            <exclusions>
                    <!--
                            Exclude otherwise the following error is thrown:
                                    WELD-000071: Managed bean with a parameterized bean class 
                                    must be @Dependent: class org.apache.cxf.jaxrs.provider.XPathProvider 
                     -->
                    <exclusion>
                            <artifactId>cxf-rt-rs-client</artifactId>
                            <groupId>org.apache.cxf</groupId>
                    </exclusion>
                    <!--
                            Exclude otherwise the following error is thrown:
                                    java.lang.NoSuchMethodException: org.objectweb.asm.MethodWriter.visitLabel(org.objectweb.asm.Label) 
                     -->
                    <exclusion>
                            <artifactId>asm</artifactId>
                            <groupId>org.ow2.asm</groupId>
                    </exclusion>
            </exclusions>
    </dependency>

您可以拥有原始问题there