Wildfly上的Websphere代码

时间:2017-06-30 16:30:11

标签: java wildfly weld

我正在尝试将一个库合并到我在Wildfly上运行的JSF2应用程序中。该库是由使用websphere的团队在内部开发的。他们不支持野生蝇,只支持websphere。我真的想使用他们的库,因为它允许我通过我的Java应用程序本地访问数据。

当我将所需的库添加到我的POM并部署应用程序时,我收到了这些错误

07:41:28,672 INFO  [org.jboss.weld.Bootstrap] (Weld Thread Pool -- 1) WELD-001125: Illegal bean type javax.ws.rs.ext.MessageBodyWriter<javax.ws.rs.core.MultivaluedMap<java.lang.String, ?>> ignored on [EnhancedAnnotatedTypeImpl] public @ApplicationScoped @Consumes @Provider @Produces class org.apache.wink.common.internal.providers.entity.FormMultivaluedMapProvider
07:41:28,672 INFO  [org.jboss.weld.Bootstrap] (Weld Thread Pool -- 2) WELD-001125: Illegal bean type javax.ws.rs.ext.MessageBodyReader<javax.xml.bind.JAXBElement<?>> ignored on [EnhancedAnnotatedTypeImpl] public @ApplicationScoped @Consumes @Provider @Produces class org.apache.wink.common.internal.providers.entity.xml.JAXBElementXmlProvider
07:41:28,672 INFO  [org.jboss.weld.Bootstrap] (Weld Thread Pool -- 2) WELD-001125: Illegal bean type javax.ws.rs.ext.MessageBodyWriter<javax.xml.bind.JAXBElement<?>> ignored on [EnhancedAnnotatedTypeImpl] public @ApplicationScoped @Consumes @Provider @Produces class org.apache.wink.common.internal.providers.entity.xml.JAXBElementXmlProvider
07:41:29,000 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.deployment.unit."ond4.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."ond4.war".WeldStartService: Failed to start service
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.jboss.weld.exceptions.DefinitionException: WELD-000071: Managed bean with a parameterized bean class must be @Dependent: class org.apache.wink.common.internal.providers.entity.csv.CsvDeserializerProvider
    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:136)
    at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$AfterBeanDiscoveryInitializerFactory.doWork(ConcurrentBeanDeployer.java:127)
    at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:63)
    at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:56)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
    at org.jboss.threads.JBossThread.run(JBossThread.java:320)

我不知道这意味着什么,或者我是否有希望能够解决它。谁能指出我正确的方向?或者只是告诉我忘记能够做这项工作?

1 个答案:

答案 0 :(得分:1)

查看异常,

  

引起:org.jboss.weld.exceptions.DefinitionException:WELD-000071:带有参数化bean类的托管bean必须是@Dependent:class org.apache.wink.common.internal.providers.entity.csv.CsvDeserializerProvider

有一个参数化bean(例如const editor = this.reactQuillRef.getEditor(); const index = editor.getSelection().index || 0; editor.insertEmbed(index, 'video', '^video_url^'); ),其范围不是Foo<Bar>。这违反了规范要求。

引自chapter 3.1 in CDI specification

  

如果托管bean类是泛型类型,则它必须具有范围@Dependent。如果具有参数化bean类的托管bean声明除@Dependent之外的任何作用域,则容器会自动检测问题并将其视为定义错误。

现在,如果这个bean来自库,他们可能一直在使用旧版本的WebSphere,这意味着有OWB作为CDI impl(在较新版本和除TomEE之外的所有其他AS上都有Weld)。 OWB 可能有一些不可移植的配置允许这个(纯猜测),但从CDI的角度来看,这只是简单的错误设置,不应该工作。

如果它是您的bean,您应该将其设为@Dependent,这会使错误消失。

作为一个最后,hacky,度假胜地,你理论上可以添加一个扩展并用依赖的扩展覆盖它们的范围,但在这种情况下你很可能会破坏整个库。