java.lang.ExceptionInInitializerError

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • I'm using the AbstractTransactionalDataSourceSpringContextTests to create an integration test. Below is the context file: <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="location"> <value>classpath:jdbc.properties</value> </property> </bean> <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="url"><value>${jdbc.url}</value></property> <property name="driverClassName"><value>${jdbc.driver}</value></property> <property name="username"><value>${jdbc.user}</value></property> <property name="password"><value>${jdbc.password}</value></property> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"><ref local="dataSource"/></property> <property name="mappingLocations"> <list> <value>classpath:com/foo/resource/domain/ResourceGroup.hbm.xml</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop> <prop key="hibernate.show_sql">true</prop> </props> </property> </bean> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory"> <ref local="sessionFactory"/> </property> </bean> <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate"> <property name="sessionFactory"> <ref local="sessionFactory"/> </property> </bean> <bean id="transactionAttributeSource" class="org.springframework.transaction.interceptor.MatchAlwaysTransactionAttributeSource"> </bean> <bean id="autoproxy" class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"> </bean> <bean id="transactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <property name="transactionManager"> <ref local="transactionManager"/> </property> <property name="transactionAttributeSource"> <ref local="transactionAttributeSource"/> </property> </bean> <bean id="transactionAdvisor" class="org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor"> <constructor-arg> <ref local="transactionInterceptor"/> </constructor-arg> </bean> <bean id="resourceGroupDAO" class="com.foo.resource.persistence.ResourceGroupDAO"> <property name="hibernateTemplate"> <ref bean="hibernateTemplate"/> </property> </bean> Here is the code. It's very simple. public class ResourceGroupDAOTest extends AbstractTransactionalDataSourceSpringContextTests { private DAO dao; public void testCRUD() throws Exception { // Create a new one ResourceGroup group = new ResourceGroup(); group.setName("New Group"); group.setCompanyId(new Integer(1)); group.setEvaluationStatusId(new Integer(1)); group.setCreateTimestamp(new Timestamp(System.currentTimeMillis())); this.dao.insert(group); assertNotNull(group.getId()); // Read new group; ResourceGroup readGroup = (ResourceGroup) this.dao.read(group.getId(), ResourceGroup.class); assertEquals(group.getName(), readGroup.getName()); assertEquals(group.getCompanyId(), readGroup.getCompanyId()); assertEquals(group.getEvaluationStatusId(), readGroup.getEvaluationStatusId()); // Update group group.setName("Updated Group"); this.dao.update(group); // Read updated group; ResourceGroup updatedGroup = (ResourceGroup) this.dao.read(group.getId(), ResourceGroup.class); assertEquals(group.getName(), updatedGroup.getName()); // Delete group this.dao.delete(updatedGroup); } public void setResourceGroupDAO(DAO dao) { this.dao = dao; } protected String[] getConfigLocations() { return AppContext.CONTEXT_FILES; } } Here is the exception I'm getting. Any guidance would be appreciated. java.lang.ExceptionInInitializerError at com.foo.resource.persistence.ResourceGroupDAOTest.getConfigLocations(ResourceGroupDAOTest.java:51) at org.springframework.test.AbstractDependencyInjectionSpringContextTests.contextKey(AbstractDependencyInjectionSpringContextTests.java:156) at org.springframework.test.AbstractDependencyInjectionSpringContextTests.setUp(AbstractDependencyInjectionSpringContextTests.java:129) at junit.framework.TestCase.runBare(TestCase.java:125) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'resourceGroupDAO' defined in class path resource [applicationContext-setup.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyAccessExceptionsException: PropertyAccessExceptionsException (1 errors); nested propertyAccessExceptions are: [org.springframework.beans.TypeMismatchException: Failed to convert property value of type [$Proxy1] to required type [org.springframework.orm.hibernate3.HibernateTemplate] for property 'hibernateTemplate'] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1031) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:823) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:345) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:275) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:318) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:81) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:66) at com.foo.framework.context.AppContext.<clinit>(AppContext.java:10) ... 13 more Caused by: PropertyAccessExceptionsException (1 errors) at org.springframework.beans.BeanWrapperImpl.setPropertyValues(BeanWrapperImpl.java:934) at org.springframework.beans.BeanWrapperImpl.setPropertyValues(BeanWrapperImpl.java:906) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1022) ... 22 more
    via by Brent Trimmer,
  • I'm using the AbstractTransactionalDataSourceSpringContextTests to create an integration test. Below is the context file: <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="location"> <value>classpath:jdbc.properties</value> </property> </bean> <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="url"><value>${jdbc.url}</value></property> <property name="driverClassName"><value>${jdbc.driver}</value></property> <property name="username"><value>${jdbc.user}</value></property> <property name="password"><value>${jdbc.password}</value></property> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"><ref local="dataSource"/></property> <property name="mappingLocations"> <list> <value>classpath:com/foo/resource/domain/ResourceGroup.hbm.xml</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop> <prop key="hibernate.show_sql">true</prop> </props> </property> </bean> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory"> <ref local="sessionFactory"/> </property> </bean> <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate"> <property name="sessionFactory"> <ref local="sessionFactory"/> </property> </bean> <bean id="transactionAttributeSource" class="org.springframework.transaction.interceptor.MatchAlwaysTransactionAttributeSource"> </bean> <bean id="autoproxy" class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"> </bean> <bean id="transactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <property name="transactionManager"> <ref local="transactionManager"/> </property> <property name="transactionAttributeSource"> <ref local="transactionAttributeSource"/> </property> </bean> <bean id="transactionAdvisor" class="org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor"> <constructor-arg> <ref local="transactionInterceptor"/> </constructor-arg> </bean> <bean id="resourceGroupDAO" class="com.foo.resource.persistence.ResourceGroupDAO"> <property name="hibernateTemplate"> <ref bean="hibernateTemplate"/> </property> </bean> Here is the code. It's very simple. public class ResourceGroupDAOTest extends AbstractTransactionalDataSourceSpringContextTests { private DAO dao; public void testCRUD() throws Exception { // Create a new one ResourceGroup group = new ResourceGroup(); group.setName("New Group"); group.setCompanyId(new Integer(1)); group.setEvaluationStatusId(new Integer(1)); group.setCreateTimestamp(new Timestamp(System.currentTimeMillis())); this.dao.insert(group); assertNotNull(group.getId()); // Read new group; ResourceGroup readGroup = (ResourceGroup) this.dao.read(group.getId(), ResourceGroup.class); assertEquals(group.getName(), readGroup.getName()); assertEquals(group.getCompanyId(), readGroup.getCompanyId()); assertEquals(group.getEvaluationStatusId(), readGroup.getEvaluationStatusId()); // Update group group.setName("Updated Group"); this.dao.update(group); // Read updated group; ResourceGroup updatedGroup = (ResourceGroup) this.dao.read(group.getId(), ResourceGroup.class); assertEquals(group.getName(), updatedGroup.getName()); // Delete group this.dao.delete(updatedGroup); } public void setResourceGroupDAO(DAO dao) { this.dao = dao; } protected String[] getConfigLocations() { return AppContext.CONTEXT_FILES; } } Here is the exception I'm getting. Any guidance would be appreciated. java.lang.ExceptionInInitializerError at com.foo.resource.persistence.ResourceGroupDAOTest.getConfigLocations(ResourceGroupDAOTest.java:51) at org.springframework.test.AbstractDependencyInjectionSpringContextTests.contextKey(AbstractDependencyInjectionSpringContextTests.java:156) at org.springframework.test.AbstractDependencyInjectionSpringContextTests.setUp(AbstractDependencyInjectionSpringContextTests.java:129) at junit.framework.TestCase.runBare(TestCase.java:125) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'resourceGroupDAO' defined in class path resource [applicationContext-setup.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyAccessExceptionsException: PropertyAccessExceptionsException (1 errors); nested propertyAccessExceptions are: [org.springframework.beans.TypeMismatchException: Failed to convert property value of type [$Proxy1] to required type [org.springframework.orm.hibernate3.HibernateTemplate] for property 'hibernateTemplate'] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1031) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:823) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:345) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:275) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:318) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:81) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:66) at com.foo.framework.context.AppContext.<clinit>(AppContext.java:10) ... 13 more Caused by: PropertyAccessExceptionsException (1 errors) at org.springframework.beans.BeanWrapperImpl.setPropertyValues(BeanWrapperImpl.java:934) at org.springframework.beans.BeanWrapperImpl.setPropertyValues(BeanWrapperImpl.java:906) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1022) ... 22 more
    via by Brent Trimmer,
  • MongoDB with Repositories
    via by Unknown author,
    • java.lang.ExceptionInInitializerError at com.foo.resource.persistence.ResourceGroupDAOTest.getConfigLocations(ResourceGroupDAOTest.java:51) at org.springframework.test.AbstractDependencyInjectionSpringContextTests.contextKey(AbstractDependencyInjectionSpringContextTests.java:156) at org.springframework.test.AbstractDependencyInjectionSpringContextTests.setUp(AbstractDependencyInjectionSpringContextTests.java:129) at junit.framework.TestCase.runBare(TestCase.java:125) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'resourceGroupDAO' defined in class path resource [applicationContext-setup.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyAccessExceptionsException: PropertyAccessExceptionsException (1 errors); nested propertyAccessExceptions are: [org.springframework.beans.TypeMismatchException: Failed to convert property value of type [$Proxy1] to required type [org.springframework.orm.hibernate3.HibernateTemplate] for property 'hibernateTemplate'] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1031) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:823) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:345) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:275) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:318) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:81) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:66) at com.foo.framework.context.AppContext.<clinit>(AppContext.java:10) ... 13 more

    Users with the same issue

    Unknown visitor1 times, last one,
    batwalrus76
    1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    238 more bugmates