Search code examples
seam

Seam @In attribute requires non-null value


I am working on seam and trying to inject a seam component by using

@Name("myBeanClass")         
@Scope(ScopeType.CONVERSATION)
public class MyBeanClass {
    start();
}

and trying to use the above start() by using below code from another class

@In(create = true, required = false, value = "myBeanClass")
protected MyBeanClass myBeanClass
public Class TestClass {
    public void start() {    
        myBeanClass.start();
    }
}

I even tried by changing the scope type in MyBeanClass to sesson etc, still it is giving me the same eception

12:34:43,233 WARN  [org.jboss.seam.Component] [http-localhost%2F127.0.0.1-8080-2] Cannot create Seam component, scope is not active: favoriteManager(PAGE)
12:34:43,240 WARN  [org.jboss.seam.Component] [http-localhost%2F127.0.0.1-8080-2] Cannot create Seam component, scope is not active: favoriteManager(PAGE)
12:34:53,081 ERROR [org.jboss.aspects.tx.TxPolicy] [http-localhost%2F127.0.0.1-8080-2] javax.ejb.EJBTransactionRolledbackException: @In attribute requires non-null value: myBeanClass.favoriteManager
12:34:53,093 ERROR [STDERR] [http-localhost%2F127.0.0.1-8080-2] 

    javax.ejb.EJBTransactionRolledbackException: @In attribute requires non-null value: orgUnitUpdateManager.favoriteManager
    12:34:53,094 ERROR [STDERR] [http-localhost%2F127.0.0.1-8080-2]     at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:115)
    12:34:53,094 ERROR [STDERR] [http-localhost%2F127.0.0.1-8080-2]     at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
    12:34:53,094 ERROR [STDERR] [http-localhost%2F127.0.0.1-8080-2]     at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:194)
    12:34:53,140 ERROR [STDERR] [http-localhost%2F127.0.0.1-8080-2]     at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
    12:34:53,140 ERROR [STDERR] [http-localhost%2F127.0.0.1-8080-2]     at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
    12:34:53,140 ERROR [STDERR] [http-localhost%2F127.0.0.1-8080-2]     at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
    12:34:53,140 ERROR [STDERR] [http-localhost%2F127.0.0.1-8080-2]     at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)

And also I am able to inject other class from the Same class and I was failing only in case of injecting myBeanClass

Can any one suggest if I have missed any thing?

And I am sure that the bean name and variable name are same


Solution

  • I resolved the above problem. Here there is no problem with injection, but the problem is in MyBeanClass. We are injecting one more bean called MyBeanManager in MyBeanClass, to which seam is not able to inject, I resolved the above issue in two ways:

    1) By removing the injection of FavoriteManager (If it is not using in your bean)

    2) Earlier I was injected FavoriteManager as

    @In(create = true)    
    private MyBeanManager favoriteManager;  
    

    changed to

    @In(create = true,required = false, value = "favoriteManager")    
    private MyBeanManager favoriteManager;