Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Eric Devlin
jboss has wrapped SessionFactory in a proxy throwing cce
February 19, 2008 7:49 AM
Answer

Eric Devlin

Rank: Regular Member

Posts: 154

Join Date: February 19, 2008

Recent Posts

The session factory seems to have been wrapped in a jboss proxy class leading to a cce. I'm using lr 4.2.2 bundled with jboss. I followed the directions in the http://wiki.liferay.com/index.php/Connecting_to_Another_Datasource/Database. That seemed to work pretty well when the second data source was from the same provider and on the same machine. I'm having issues with a different provider on a different machine. I did have to modify the ejb-jar.xml by hand to reference the other datasources. Any thoughts would be appreciated.
Thanks
Eric

CODE
session = HibernateUtil.openSession( "jDEdwardsCommonSessionFactory" );
LOG
java.lang.ClassCastException: $Proxy437
at com.liferay.portal.spring.hibernate.HibernateUtil.getSessionFactory(HibernateUtil.java:128)
at com.liferay.portal.spring.hibernate.HibernateUtil.openSession(HibernateUtil.java:148)
Eric Devlin
RE: jboss has wrapped SessionFactory in a proxy throwing cce
February 21, 2008 8:37 AM
Answer

Eric Devlin

Rank: Regular Member

Posts: 154

Join Date: February 19, 2008

Recent Posts

This ended up working.

import org.hibernate.SessionFactory;
..
..
SessionFactory jDEdwardsCommonSessionFactory = (SessionFactory)BeanLocatorUtil.locate( "jDEdwardsCommonSessionFactory" );

Another possible patch might be in com.liferay.portal.spring.hibernate.HibernateUtil to modify the getSessionFactory to check on the class being returned by BeanLocatorUtil.