users@glassfish.java.net

Re: _at_Inject a stateless session bean

From: Dominik Dorn <dominik.dorn_at_gmail.com>
Date: Sat, 24 Apr 2010 00:35:16 +0200

try making the property you like to inject transient.
That way, CDI does not try to serialize the ejb (which it probably
can't as its a proxy).

@Inject
transient SomeEJB ejb;

kr,
dominik

On Fri, Apr 23, 2010 at 7:18 PM, <glassfish_at_javadesktop.org> wrote:
> I have a local stateless session bean that I am attempting to @Inject into a Weld SessionScoped Managed Bean.
>
> When I inject with @EJB, everything works fine.  When I change from @EJB to @Inject I get an UnserializableDependencyException.
>
> When I remove @Stateless from my bean and just make it a plain @Named bean, the inject occurs without the serialization error.
>
> I want to use @Inject so I take advantage of the @Alternative functionality of Weld for testing purposed.
>
> I have using Glassfish v3.  If this a defect or am I missing something?
> [Message sent by forum member 'choicegh']
>
> http://forums.java.net/jive/thread.jspa?messageID=398705
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>



-- 
Dominik Dorn
http://dominikdorn.com
http://twitter.com/domdorn
Tausche Deine Lernunterlagen auf http://www.studyguru.eu !