First, I create a class, and inject some fields using @Inject,

public class Client{


private User user1;
private User user2;
private User user3


@Inject
@new(User.class) 
Instance<User> user;

private User getUser(Instance<User> user){
    return user.get();
}

public Client(){

}


@PostConstruct
private void init(){

    user1 = getUser(user);
    user2 = getUser(user);
    user3 = getUser(user);

}

}

Now, it happened following error messge:

SEVERE: An error occurred while executing [@PostConstruct.] 
javax.enterprise.inject.UnsatisfiedResolutionException: Api type
[com.test.User] is not found with the qualifiers 
Qualifiers: [@javax.enterprise.inject.New(value=class com.test.User)] 
        at
org.apache.webbeans.util.InjectionExceptionUtils.throwUnsatisfiedResolutionException(InjectionExceptionUtils.java:77)
 
        at
org.apache.webbeans.container.ResolutionUtil.checkResolvedBeans(ResolutionUtil.java:75)
 
        at
org.apache.webbeans.inject.instance.InstanceImpl.get(InstanceImpl.java:110) 
        at
com.rockwell.perfmgr.ui.setup.view.datacollectionconfig.DataCollectionConfigViewImpl.createCard(DataCollectionConfigViewImpl.java:106)
 
        at
com.rockwell.perfmgr.ui.setup.view.datacollectionconfig.DataCollectionConfigViewImpl.initCards(DataCollectionConfigViewImpl.java:693)
 
        at
com.rockwell.perfmgr.ui.setup.view.datacollectionconfig.DataCollectionConfigViewImpl._init(DataCollectionConfigViewImpl.java:708)
 
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 
        at java.lang.reflect.Method.invoke(Method.java:601) 


So, please help me to solve it.

Thank you very much!

Evan Yang





--
View this message in context: 
http://openejb.979440.n4.nabble.com/There-is-a-problem-of-CDI-in-TomEE1-5-2-tp4664313.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.

Reply via email to