[seam-dev] producing non-serializable beans from producers with passivating scope

Tihomir Surdilovic tsurdilo at redhat.com
Mon Apr 19 20:54:51 EDT 2010


Hi all, I ran into an issue with producing Drools 
StatefulKnowledgeSession beans from my producers. Basically I need to 
make sure that each produced session is in Conversation scope which is 
passivating..but StatefulKnowledgeSession is not serializable which ends 
up with exception:

org.jboss.weld.exceptions.IllegalProductException: WELD-000053 Producers 
cannot declare passivating scope and return a non-serializable class

One idea was to declare the manager bean which includes the producer 
method(s) in Conversation scope and make the producers request scoped 
with a check for example:

if(ksession != null) { return ksession;} else { //create a new one and 
save }

but my problem is that since I am specializing producer methods in the 
module beans.xml (and so can the user in their beans.xml) I do not know 
all possible specialized producer methods at runtime.

Any input on this is much appreciated as currently the following 
injections for example:

@Inject @MySession StatefulKnowledgeSession ksession1;
and
@Inject @MySession StatefulKnowledgeSession ksession2;

end up being two different beans because dependent scope producer method 
gets called twice.

Thanks.




More information about the seam-dev mailing list