Search code examples
jsfwebspherecdi

javax.enterprise.inject.UnsatisfiedResolutionException on Websphere


We have an application developed in JSF and we are converting it to use CDI. During this process we made tests in Wildfly and we were able to have it up and running as it was before the conversion. Problems came up when we deployed it on Websphere!

Our app has two parts, for simplicity Part 1 and Part 2, where the resulting jar from Part 1 is included in Part 2, meaning that the war file deployed in Websphere already contains the jar file from Part 1.

Now, when the app starts up in Websphere the following error is thrown

[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)

We have searched for a possible solution, but no luck so far. During our search we found this page. We did add a Class-Path on MANIFEST.MF mentioning Part 1, but nothing changed.

Did any of you face a similar problem? Is there any special configuration we may need to do on Websphere to make this work as it is on Wildfly?


Solution

  • It's likely you used a different CDI or EE spec level in Wildfly.

    You didn't specify any versions nor what class is supposed to satisfy that dependency nor where it's stored. But you likely need a beans.xml in the jar containing the class meant to satisfy that dependency.