【发布时间】:2017-05-02 08:56:28
【问题描述】:
我们有一个用 JSF 开发的应用程序,我们正在将其转换为使用 CDI。在此过程中,我们在 Wildfly 中进行了测试,并且能够像转换前一样启动并运行它。 当我们在 Websphere 上部署它时出现了问题!
为了简单起见,我们的应用程序有两个部分,第 1 部分和第 2 部分,其中第 1 部分生成的 jar 包含在第 2 部分中,这意味着 Websphere 中部署的 war 文件已经包含第 1 部分中的 jar 文件。
现在,当应用在 Websphere 中启动时,会引发以下错误
[4/28/17 16:35:54:107 CEST] 00000083 BeansDeployer E BeansDeployer deploy
javax.enterprise.inject.UnsatisfiedResolutionException: Api type [web.frmwrk.mgbean.WebSession] is not found with the qualifiers
Qualifiers: [@javax.enterprise.inject.Default()]
for injection into
Field Injection Point, field : protected web.frmwrk.mgbean.WebSession web.frmwrk.FacesBean.ws, Bean Owner : [-2102135427,Name:dealerLink,WebBeans Type:MANAGED,API Types:[web.mgbean.dealer.Link,web.frmwrk.FacesBean,java.lang.Object,java.io.Serializable],Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any,javax.inject.Named]]
InjectionType : [class web.frmwrk.mgbean.WebSession]
Annotated : [Annotated Field,Base Type : class web.frmwrk.mgbean.WebSession,Type Closures : [class web.frmwrk.mgbean.WebSession, class web.frmwrk.FacesBean, class java.lang.Object, interface java.io.Serializable],Annotations : [@javax.inject.Inject()],Java Member Name : ws]
Qualifiers : [[@javax.enterprise.inject.Default()]]
at org.apache.webbeans.util.InjectionExceptionUtils.throwUnsatisfiedResolutionException(InjectionExceptionUtils.java:92)
我们已经寻找了可能的解决方案,但到目前为止还没有运气。在我们的搜索过程中,我们发现了这个page。我们确实在 MANIFEST.MF 上添加了一个 Class-Path,提到了第 1 部分,但没有任何改变。
你们中有人遇到过类似的问题吗?是否需要在 Websphere 上进行任何特殊配置才能像在 Wildfly 上那样工作?
【问题讨论】:
-
Wildfly Weld(CDI 参考实现)。而 Websphere 曾经使用替代实现 - OpenWebBeans(最新版本也使用 Weld)。这两者有很多已知的差异,你可能已经碰到了一些。我对 OWB 了解不多,但也看看发生了什么,请按原样发布您的部署结构。尤其是当我们谈论 EAR 或共享库等时......这些是这些 impl 经常不同的领域。