java.lang.ExceptionInInitializerError

Spring JIRA | Brent Trimmer | 1 decade ago
  1. 0

    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

    Spring JIRA | 1 decade ago | Brent Trimmer
    java.lang.ExceptionInInitializerError
  2. 0

    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

    Spring JIRA | 1 decade ago | Brent Trimmer
    java.lang.ExceptionInInitializerError
  3. 0

    Getting error while dynamically providing input,output path

    Stack Overflow | 8 months ago | Varun Maurya
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'step1': Cannot resolve reference to bean 'itemReader' while setting bean property 'itemReader'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'itemReader' defined in class path resource [spring/config/process-config.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type [com.sun.proxy.$Proxy11 implementing org.springframework.batch.item.ItemStreamReader,org.springframework.batch.item.ItemStream,org.springframework.aop.scope.ScopedObject,java.io.Serializable,org.springframework.aop.framework.AopInfrastructureBean,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [org.springframework.batch.item.file.MultiResourceItemReader] for property 'multiReader'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [com.sun.proxy.$Proxy11 implementing org.springframework.batch.item.ItemStreamReader,org.springframework.batch.item.ItemStream,org.springframework.aop.scope.ScopedObject,java.io.Serializable,org.springframework.aop.framework.AopInfrastructureBean,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [org.springframework.batch.item.file.MultiResourceItemReader] for property 'multiReader': no matching editors or conversion strategy found
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Issues in serializers config

    GitHub | 3 years ago | dsukhoroslov
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hzInstance': Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public static com.hazelcast.core.HazelcastInstance com.hazelcast.instance.HazelcastInstanceFactory.newHazelcastInstance(com.hazelcast.config.Config)] threw exception; nested exception is com.hazelcast.nio.serialization.HazelcastSerializationException: java.lang.NoSuchMethodException: com.hazelcast.nio.serialization.PortableSerializer.<init>()
  6. 0

    'circle' defined in class path resource [Spring.xml]: Initialization of bean failed; nested exception is java.lang.IllegalAccessError

    Stack Overflow | 3 years ago | user2681868
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'circle' defined in class path resource [Spring.xml]: Initialization of bean failed; nested exception is java.lang.IllegalAccessError

  1. rlovtangen 2 times, last 2 weeks ago
  2. tvrmsmith 6 times, last 2 weeks ago
  3. kjhdofjosvs 1 times, last 3 weeks ago
  4. Andreas Häber 2 times, last 4 weeks ago
  5. Gatgeagent 4 times, last 2 months ago
22 more registered users
73 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. 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()
  2. Spring Beans
    DefaultListableBeanFactory.preInstantiateSingletons
    1. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1031)
    2. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:823)
    3. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:345)
    4. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226)
    5. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
    6. org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:275)
    6 frames
  3. Spring Context
    ClassPathXmlApplicationContext.<init>
    1. org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:318)
    2. org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:81)
    3. org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:66)
    3 frames
  4. com.foo.framework
    AppContext.<clinit>
    1. com.foo.framework.context.AppContext.<clinit>(AppContext.java:10)
    1 frame
  5. com.foo.resource
    ResourceGroupDAOTest.getConfigLocations
    1. com.foo.resource.persistence.ResourceGroupDAOTest.getConfigLocations(ResourceGroupDAOTest.java:51)
    1 frame
  6. Spring TestContext
    AbstractDependencyInjectionSpringContextTests.setUp
    1. org.springframework.test.AbstractDependencyInjectionSpringContextTests.contextKey(AbstractDependencyInjectionSpringContextTests.java:156)
    2. org.springframework.test.AbstractDependencyInjectionSpringContextTests.setUp(AbstractDependencyInjectionSpringContextTests.java:129)
    2 frames
  7. JUnit
    TestSuite.run
    1. junit.framework.TestCase.runBare(TestCase.java:125)
    2. junit.framework.TestResult$1.protect(TestResult.java:106)
    3. junit.framework.TestResult.runProtected(TestResult.java:124)
    4. junit.framework.TestResult.run(TestResult.java:109)
    5. junit.framework.TestCase.run(TestCase.java:118)
    6. junit.framework.TestSuite.runTest(TestSuite.java:208)
    7. junit.framework.TestSuite.run(TestSuite.java:203)
    7 frames
  8. JUnit3 Runner
    RemoteTestRunner.main
    1. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
    2. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
    3. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
    3 frames