java.lang.ExceptionInInitializerError

Spring JIRA | Brent Trimmer | 1 decade ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  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

    " org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.jdbc.datasource

    Stack Overflow | 2 years ago | Ashvin Ranpariya
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 't' defined in class path resource [resources/spring.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'URL' of bean class [beans.Test]: Bean property 'URL' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Getting error while dynamically providing input,output path

    Stack Overflow | 10 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
  6. 0

    Issues in serializers config

    GitHub | 4 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>()
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