cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ali Mahdoui <>
Subject ClassCastException for session bean
Date Thu, 10 Jun 2010 09:02:07 GMT

i am using cocoon 2.2 like this

- Block1: defines a framework for manipulating session beans
- Block2: defines an application which uses Block1
     a- Block 2 contains classes which will be used from Block 1 to manipulate the session
(lets say FromBlock1CalledClass)
     b- Block 2 contains the bean classes which will be stored in the session (lets say BeanClass)
     c- Block2 conatins a generator which uses the bean from the session (lets say BeanGenerator)
     now i have the following problem:
     after  Block1.getSession().setAttribute("bean", FromBlock1CalledClass.ManipulateBean(BeanClassInstance)),
     is called and the BeanGenerator tries to use the bean from the session:
        BeanClass bean = (BeanClass) request.getSession().getAttribute("bean");
   i get a ClassCastException: BeanClass can not be cast to BeanClass ....
   i guess that this beahviour is because each Block in Cocoon has its own classLoader (osgi).
   When this is the case how can i avoid the ClassCastException?

   On way i think it could help, is to serialize and deserialize the bean on the side of the
BeanGenerator, but i dont find this nice at all!

   Thank you for any help!!

Entdecken Sie die tollen neuen Funktionen von Hotmail!
View raw message