3

This is the ManagedBean

@ManagedBean @ViewScoped public class DetailItem {
    private static final long serialVersionUID = -7647929779133437125L;
    @ManagedProperty(value = "#{itemServiceImpl}")
    private ItemService servItem;

This is the Service

@Service("itemServiceImpl") @Transactional(value = "transactionManagerLocal") public class ItemServiceImpl implements ItemService {
    private static final long serialVersionUID = 1L;
    @Autowired
    @Qualifier("itemDaoImpl")
    private ItemDAO dao;

but when I try to access to the page that used 'DetailItem', I have the following exception:

java.io.NotSerializableException: org.springframework.dao.support.PersistenceExceptionTranslationInterceptor    java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1164)   java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)

To fix that I do the servItem transient and obtain it from the applicationContext. But I understand that it is not the correct solution and I dont find any other. Which is the proper way to do that?

I don“t have the exception with sessionscoped or requestscoped.

dsblanco
  • 31
  • 3

1 Answers1

1

Sounds like a similar problem like Serialization of ManagedProperty

Does ItemService implement Serializable and are all members of ItemServiceImpl serializable themselves?

Community
  • 1
  • 1
tasel
  • 629
  • 5
  • 15