Hey All,
I'm having a problem plugging Hibernate into my application. I'm getting a java.lang.IllegalStateException error.
It throws this when it tries to initialize my ApplicationImpl bean. Here is my ApplicationContext.xmlCode:16:04:05,032 ERROR [ContextLoader] Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'casApplication' defined in resource [/WEB-INF/applicationContext.xml] of ServletContext: Initialization of bean failed; nested exception is org.aopalliance.aop.AspectException: null java.lang.IllegalStateException: Callback Lnet/sf/cglib/proxy/MethodInterceptor; is not assignable to Lnet/sf/cglib/proxy/MethodInterceptor; at net.sf.cglib.proxy.Enhancer.validate(Enhancer.java:374) at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:399) at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:318) at org.springframework.aop.framework.Cglib2AopProxy.getProxy(Cglib2AopProxy.java:175) at org.springframework.aop.framework.Cglib2AopProxy.getProxy(Cglib2AopProxy.java:138) at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:66)
And here is my hibernate.xml configuration...Code:<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <!-- ======================= APPLICATION CONFIGURATION ==================== --> <!-- Configurer that replaces ${...} placeholders with values from properties files --> <!-- (in this case, mail and JDBC related properties) --> <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <list> <value>/WEB-INF/jdbc.properties</value> </list> </property> </bean> <!-- a parent bean definition which is a 'template' or base definition for transaction proxies. It is set as lazy-init, since it is never supposed to be instantiated itself. --> <bean id="baseTxProxy" lazy-init="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref bean="myTransactionManager"/></property> <property name="transactionAttributes"> <props> <prop key="*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!-- LockNLoad's primary business object (default implementation), as an inner bean wrapped by an outer transactional proxy. The two bean definitions could have been separate, but this is cleaner as there is no need to ever access the unwrapped object. Note that we override the transaction propagation settings from the parent 'baseTxProxy' definition --> <bean id="casApplication" parent="baseTxProxy"> <property name="target"><ref bean="casApplicationImpl"/></property> <property name="transactionAttributes"> <props> <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="find*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="load*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="store*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <bean name="casApplicationImpl" class="com.sccc.cas.domain.CasApplication"> <property name="dao"><ref bean="myDao"/></property> </bean> </beans>
Does anyone know why I might be getting this error?Code:<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <!-- ========================= RESOURCE DEFINITIONS ========================= --> <!-- Local DataSource that refers to a combined database --> <!-- The placeholders are resolved from jdbc.properties through --> <!-- the PropertyPlaceholderConfigurer in applicationContext.xml --> <bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName"><value>${jdbc.driverClassName}</value></property> <property name="url"><value>${jdbc.url}</value></property> <property name="username"><value>${jdbc.username}</value></property> <property name="password"><value>${jdbc.password}</value></property> </bean> <!-- Session Factory definition for Hibernate implementation --> <bean id="mySessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean"> <property name="dataSource"><ref bean="myDataSource"/></property> <property name="mappingResources"> <list> <value>/com/sccc/cas/hibernate/cas.hbm.xml</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">${hibernate.dialect}</prop> </props> </property> </bean> <!-- Transaction manager for a single JDBC DataSource --> <bean id="myTransactionManager" class="org.springframework.orm.hibernate.HibernateTransactionManager"> <property name="sessionFactory"><ref local="mySessionFactory"/></property> </bean> <!-- ============== DAO DEFINITIONS: HIBERNATE IMPLIMENTATIONS ============== --> <bean id="myDao" class="com.sccc.cas.dao.HibernateDao"> <property name="sessionFactory"><ref bean="mySessionFactory"/></property> </bean> </beans>
Thanks,
James


Reply With Quote