Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WELD-000072 Managed bean declaring a passivating scope must be passivation capable

I wrote a simple program in java web forms but i am receiving the following error:

WELD-000072 Managed bean declaring a passivating scope must be passivation capable. Bean: Managed Bean [class BeanPakage.DemoBeans] with qualifiers [@Any @Default @Named]

Can anyone tell me where this error comes from?

import javax.enterprise.context.SessionScoped; import javax.inject.Named;   @Named("DemoBeans") @SessionScoped public class DemoBeans {      private String name;      public String getName() {         return name;     }      public void setName(String name) {         this.name = name;     } } 
like image 902
christina Avatar asked Mar 18 '12 17:03

christina


2 Answers

You can make your bean passivation capable by implementing the Serializable interface:

public class DemoBean implements Serializable { ... } 

Note that there are more requirements for being passivation capable. Refer to the Weld documentation for more information.

like image 188
Matt Handy Avatar answered Oct 11 '22 08:10

Matt Handy


The error might remain even though the CDI bean is serializable:

WELD-000072 Managed bean declaring a passivating scope must be passivation capable 

Example class:

@Named @ConversationScoped public class TransactionMatchController implements Serializable {     ... } 

Make sure that all @Interceptors are seializable as well:

@Interceptor @Transactional public class TransactionInterceptor implements Serializable {     ... } 
like image 33
Tim Avatar answered Oct 11 '22 07:10

Tim