You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Ali Mahdoui <ma...@hotmail.de> on 2010/06/10 11:02:07 UTC

ClassCastException for session bean

Hi,
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!!
   Ali 

 		 	   		  
_________________________________________________________________
http://redirect.gimas.net/?n=M1006xHm2
Entdecken Sie die tollen neuen Funktionen von Hotmail!