By W.ZH Sept 2011
When I use the Configuration.createRootApplicationModule to access the ADF-BC Application module client method. I get this kind of exception:
java.lang.ClassCastException: oracle.jbo.common.DefaultSessionContextImpl cannot be cast to oracle.jbo.SessionContext.
This exception happens only after several times client code running fine. As my code is a EJB timer, I can see it runs very good to open the AM method at the first several times timer call, but then get this exception and the timer just does not work anymore.
Please refer to this link: https://cn.forums.oracle.com/forums/thread.jspa?threadID=995384 . It gives some background knowledge and where to look for solution. The fusion dev guide 11gR1 chapter “40 Application State Management”, have all the things you might need to understand.
For my specific case, what I do to solve this issue on my AM :
Go to MYAM —> Configuration–>Edit MYAMLocal (DS settings for AM) –>Pooling and Scalability–>Disconnect Application Module Upon Release. I check this option for my AM, redeploy my application and this issue disappears.