[weld-dev] JSF + CDI: @Named diff behaviour than @ManagedBean
Sebastian E. Ovide
sebastian.ovide at gmail.com
Mon Dec 20 19:43:02 EST 2010
no. It is javax.faces.bean.SessionScoped
if I use javax.enterprise.context.SessionScoped I get this exception:
SEVERE: Exception while loading the app
org.glassfish.deployment.common.DeploymentException: WELD-000072 Managed
bean declaring a passivating scope must be passivation capable. Bean:
org.jboss.weld.bean-/home/sebas/dev/java/sebas/target/sebas/-ManagedBean-class
ovide.beans.Todos
at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:167)
at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:125)
at
org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:224)
at
com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:338)
at
com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:183)
at
org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:272)
at
com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:305)
at
com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:320)
at
com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1176)
at
com.sun.enterprise.v3.admin.CommandRunnerImpl.access$900(CommandRunnerImpl.java:83)
at
com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1235)
at
com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1224)
at
com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:365)
at
com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:204)
at
com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:166)
at
com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:100)
at
com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:245)
at
com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at
com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at
com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at
com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at
com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at
com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at
com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at
com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at
com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.jboss.weld.exceptions.DefinitionException: WELD-000072
Managed bean declaring a passivating scope must be passivation capable.
Bean:
org.jboss.weld.bean-/home/sebas/dev/java/sebas/target/sebas/-ManagedBean-class
ovide.beans.Todos
at org.jboss.weld.bean.ManagedBean.checkType(ManagedBean.java:472)
at
org.jboss.weld.bean.AbstractBean.initializeAfterBeanDiscovery(AbstractBean.java:136)
at
org.jboss.weld.bean.AbstractClassBean.initializeAfterBeanDiscovery(AbstractClassBean.java:191)
at
org.jboss.weld.bean.ManagedBean.initializeAfterBeanDiscovery(ManagedBean.java:415)
at
org.jboss.weld.bootstrap.BeanDeployment.doAfterBeanDiscovery(BeanDeployment.java:167)
at
org.jboss.weld.bootstrap.BeanDeployment.afterBeanDiscovery(BeanDeployment.java:156)
at
org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:382)
at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:165)
... 30 more
On Tue, Dec 21, 2010 at 12:23 AM, Raphael Lacerda <lacerdaph at gmail.com>wrote:
> is the SessionScoped annotation from javax.enterprise.context ?
>
> On Mon, Dec 20, 2010 at 10:05 PM, Sebastian E. Ovide <
> sebastian.ovide at gmail.com> wrote:
>
>> Hi All,
>>
>> I have just started a new project using the maven archetype
>> weld-jsf-jee-minimal
>>
>> I have a Bean which has a property:
>>
>> @Inject @TodoInotherway private TodoSrv todoService;
>>
>> If I annotate the bean with @ManagedBean the injection fails
>> and todoService will be always null.. If I annotate the Bean with @Named,
>> the property is injected correctly but the Bean is instantiated several
>> times for each request even if it is annotated as @SessionScoped and
>> therefore all it's properties are recreated... (with @ManageBean it saves
>> the properties for the whole session)
>>
>> Is it a bug ?
>>
>> any ideas ?
>>
>>
>>
>> --
>> Sebastian E. Ovide
>>
>>
>>
>>
>> _______________________________________________
>> weld-dev mailing list
>> weld-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/weld-dev
>>
>
>
>
> --
> Raphael Lacerda
> (61) - 8148-6737
>
> raphael.lacerda at caelum.com.br
> Caelum Brasília - (61) 3039-4222
> Caelum | Ensino e Inovação
> http://www.caelum.com.br/
>
--
Sebastian E. Ovide
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20101221/5d86d015/attachment.html
More information about the weld-dev
mailing list