Use this task to troubleshoot errors related to Contexts and Dependency Injection (CDI) for the Java Platform, Enterprise Edition (Java EE) applications.
When you use a CDI implementation, you might experience errors during application deployment or when CDI interacts with other Java EE components. You might also experience problems with producers, interceptors and decorators or diagnostic trace. Use this task to fix these errors that might occur.
An ambiguous dependency, or javax.enterprise.inject.AmbiguousResolutionException exception, occurs when the container resolves an injection points type and qualifiers to more than one managed bean, producer method, or producer field.
javax.enterprise.inject.AmbiguousResolutionException: There is more than one api type with : com.ibm.websphere.samples.AppObject with qualifiers : Qualifiers: [@com.ibm.websphere.samples.MyQualifier()] for injection into Field Injection Point, field name : loginCheck, Bean Owner : [Name:loginBean,WebBeans Type:MANAGED,API Types:[java.lang. Object,com.ibm.websphere.samples.LoginBean], Qualifiers:[javax.enterprise.inject.Any,javax.enterprise.inject. Default,javax.inject.Named]] found beans: Name:newObject,WebBeans Type:PRODUCERMETHOD, API Types:[com.ibm.websphere. samples.AppObject,java.lang.Object], Qualifiers:[javax.enterprise.inject. Any,com.ibm.websphere.samples.MyQualifier,javax.inject.Named] Name:newObject2,WebBeans Type:PRODUCERMETHOD, API Types:[com.ibm.websphere. samples.AppObject,java.lang.Object], Qualifiers:[javax.enterprise.inject. Any,com.ibm.websphere.samples.MyQualifier,javax.inject.Named]To resolve the error complete one of the following actions:
javax.enterprise.inject.UnsatisfiedResolutionException: Api type [com.ibm.websphere.samples.myType] is not found with the qualifiers Qualifiers: [@javax.enterprise.inject.Default()] for injection into Field Injection Point, field name : loginCheck, Bean Owner : [Name:loginBean,WebBeans Type:MANAGED, API Types:[java.lang.Object,com.ibm.websphere.samples.LoginBean], Qualifiers:[javax.enterprise.inject.Any,javax.enterprise. inject.Default,javax.inject.Named]]
Caused by: org.apache.webbeans.exception.WebBeansConfigurationException: Passivation scoped defined bean must be passivation capable, but bean : Name:myCDIBean,WebBeans Type:MANAGED,API Types:[com.ibm.websphere.samples.myCDIBean java.io.Serializable,java.lang. Object,com.ibm.websphere.samples.myLocalIface], Qualifiers:[javax.enterprise.inject.Any,javax.enterprise.inject. Default,javax.inject.Named] is not passivation capable
The @Inject annotation provides an additional type of Java EE dependency injection. Its relation to injection that is defined in Java EE 5 is as follows:
org.apache.webbeans.exception.definition.DuplicateDefinitionException: PassivationCapable bean id is not unique: PRODUCERFIELD#class#com.ibm.websphere.samples.AppObject# @javax.enterprise.inject.Any(),@com.ibm.websphere.samples.AppScopeBinding2 (),@javax.inject.Named(value=), bean:Name:a2b,WebBeans Type:PRODUCERFIELD,API Types:[java.lang.Object, com.ibm.websphere.samples.AppObject], Qualifiers:[javax.enterprise.inject.Any,com.ibm.websphere.samples .AppScopeBinding2,javax.inject.Named]
Each injection point for a given managed bean receives a new client proxy that calls the default constructor of the underlying bean class, in addition to the actual bean instance that might be created when using the proxy. Additionally, because dependency injections occur after the constructor completes, constructors cannot use injected dependencies. See the @PostConstruct annotation life cycle callback for a place to put post-injection logic that runs in the underlying instance only.
In this information ...Related concepts
Related tasks
Related information
| IBM Redbooks, demos, education, and more(Index) Use IBM Suggests to retrieve related content from ibm.com and beyond, identified for your convenience. This feature requires Internet access. Most of the following links will take you to information that is not part of the formal product documentation and is provided "as is." Some of these links go to non-IBM Web sites and are provided for your convenience only and do not in any manner serve as an endorsement by IBM of those Web sites, the material thereon, or the owner thereof. |