java.lang.IllegalStateException: Failed to load ApplicationContext

Spring JIRA | Francis Devereux | 1 year 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 am trying to set up some entities with a primary foreign key relationship: - ContentRecord is the 'master' entity. - FileRecord is the 'dependent' entity. It's primary key should be called content_id and should be a foreign key to ContentRecord.id I can start up a hibernate session *without* a repository without error. However when I introduce a CrudRepository for FileRecord I get an exception on startup: "IllegalArgumentException: This class [class com.brightinteractive.contentstorage.database.FileRecord2] does not define an IdClass". This is despite the fact that {{FileRecord2}} *does* have an {{@IdClass}} annotation. My entity annotations are based on Example 1, case (a) from section 2.4.1.3 of the JPA 2.1 spec (basically I've taken that example but removed the {{name}} field from my ID class) Code snippets and stack trace: {code} @Entity @Table(uniqueConstraints = @UniqueConstraint(columnNames={"ContentIdentifier", "ContentStoreIdentifier"})) public class ContentRecord2 { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Embedded @AttributeOverride(name="identifier", column = @Column(name="ContentStoreIdentifier")) private ContentStoreIdentifier contentStoreIdentifier; @Embedded @AttributeOverride(name="identifier", column = @Column(name="ContentIdentifier")) private ContentIdentifier contentIdentifier; {code} {code} @Entity @IdClass(FileRecordId2.class) public class FileRecord2 implements Serializable { @Id @OneToOne private ContentRecord2 content; @Column(name="Filename") private String filename; {code} {code} public class FileRecordId2 implements Serializable { private Long content; // matches name of @Id attribute and type of ContentRecord2 PK } {code} {code} import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.repository.CrudRepository; public interface FileRepository extends CrudRepository<FileRecord2, ContentRecord>, JpaSpecificationExecutor { FileRecord2 findByContent(ContentRecord contentRecord); } {code} {code} 2016/02/24 16:05:30:987 +0000 [ERROR] [main] org.springframework.test.context.TestContextManager - Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@7377781e] to prepare test instance [com.brightinteractive.contentstorage.database.FileTrackerServiceTest@b32e983] java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContext(CacheAwareContextLoaderDelegate.java:99) ~[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.springframework.test.context.DefaultTestContext.getApplicationContext(DefaultTestContext.java:101) ~[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109) ~[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75) ~[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:319) ~[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:212) [spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289) [spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [junit-4.11.jar:na] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291) [spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:232) [spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:89) [spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) [junit-4.11.jar:na] at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) [junit-4.11.jar:na] at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) [junit-4.11.jar:na] at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) [junit-4.11.jar:na] at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) [junit-4.11.jar:na] at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) [spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71) [spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.junit.runners.ParentRunner.run(ParentRunner.java:309) [junit-4.11.jar:na] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:175) [spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.junit.runner.JUnitCore.run(JUnitCore.java:160) [junit-4.11.jar:na] at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69) [junit-rt.jar:na] at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234) [junit-rt.jar:na] at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74) [junit-rt.jar:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_72] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_72] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_72] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_72] at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) [idea_rt.jar:na] Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fileRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: This class [class com.brightinteractive.contentstorage.database.FileRecord2] does not define an IdClass at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578) ~[spring-beans-4.2.2.RELEASE.jar:4.2.2.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) ~[spring-beans-4.2.2.RELEASE.jar:4.2.2.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.2.RELEASE.jar:4.2.2.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:305) ~[spring-beans-4.2.2.RELEASE.jar:4.2.2.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.2.RELEASE.jar:4.2.2.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:301) ~[spring-beans-4.2.2.RELEASE.jar:4.2.2.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196) ~[spring-beans-4.2.2.RELEASE.jar:4.2.2.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:753) ~[spring-beans-4.2.2.RELEASE.jar:4.2.2.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:835) ~[spring-context-4.2.2.RELEASE.jar:4.2.2.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537) ~[spring-context-4.2.2.RELEASE.jar:4.2.2.RELEASE] at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:121) ~[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:60) ~[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.delegateLoading(AbstractDelegatingSmartContextLoader.java:100) ~[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.loadContext(AbstractDelegatingSmartContextLoader.java:250) ~[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContextInternal(CacheAwareContextLoaderDelegate.java:64) ~[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContext(CacheAwareContextLoaderDelegate.java:91) ~[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE] ... 28 common frames omitted Caused by: java.lang.IllegalArgumentException: This class [class com.brightinteractive.contentstorage.database.FileRecord2] does not define an IdClass at org.hibernate.jpa.internal.metamodel.AbstractIdentifiableType.getIdClassAttributes(AbstractIdentifiableType.java:200) ~[hibernate-entitymanager-4.3.11.Final.jar:4.3.11.Final] at org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation$IdMetadata.<init>(JpaMetamodelEntityInformation.java:249) ~[spring-data-jpa-1.9.4.RELEASE.jar:na] at org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation.<init>(JpaMetamodelEntityInformation.java:82) ~[spring-data-jpa-1.9.4.RELEASE.jar:na] at org.springframework.data.jpa.repository.support.JpaEntityInformationSupport.getEntityInformation(JpaEntityInformationSupport.java:67) ~[spring-data-jpa-1.9.4.RELEASE.jar:na] at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getEntityInformation(JpaRepositoryFactory.java:152) ~[spring-data-jpa-1.9.4.RELEASE.jar:na] at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:99) ~[spring-data-jpa-1.9.4.RELEASE.jar:na] at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:81) ~[spring-data-jpa-1.9.4.RELEASE.jar:na] at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:185) ~[spring-data-commons-1.11.4.RELEASE.jar:na] at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.initAndReturn(RepositoryFactoryBeanSupport.java:251) ~[spring-data-commons-1.11.4.RELEASE.jar:na] at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:237) ~[spring-data-commons-1.11.4.RELEASE.jar:na] at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:92) ~[spring-data-jpa-1.9.4.RELEASE.jar:na] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637) ~[spring-beans-4.2.2.RELEASE.jar:4.2.2.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574) ~[spring-beans-4.2.2.RELEASE.jar:4.2.2.RELEASE] ... 43 common frames omitted {code}

    Spring JIRA | 1 year ago | Francis Devereux
    java.lang.IllegalStateException: Failed to load ApplicationContext
  2. 0

    I am trying to set up some entities with a primary foreign key relationship: - ContentRecord is the 'master' entity. - FileRecord is the 'dependent' entity. It's primary key should be called content_id and should be a foreign key to ContentRecord.id I can start up a hibernate session *without* a repository without error. However when I introduce a CrudRepository for FileRecord I get an exception on startup: "IllegalArgumentException: This class [class com.brightinteractive.contentstorage.database.FileRecord2] does not define an IdClass". This is despite the fact that {{FileRecord2}} *does* have an {{@IdClass}} annotation. My entity annotations are based on Example 1, case (a) from section 2.4.1.3 of the JPA 2.1 spec (basically I've taken that example but removed the {{name}} field from my ID class) Code snippets and stack trace: {code} @Entity @Table(uniqueConstraints = @UniqueConstraint(columnNames={"ContentIdentifier", "ContentStoreIdentifier"})) public class ContentRecord2 { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Embedded @AttributeOverride(name="identifier", column = @Column(name="ContentStoreIdentifier")) private ContentStoreIdentifier contentStoreIdentifier; @Embedded @AttributeOverride(name="identifier", column = @Column(name="ContentIdentifier")) private ContentIdentifier contentIdentifier; {code} {code} @Entity @IdClass(FileRecordId2.class) public class FileRecord2 implements Serializable { @Id @OneToOne private ContentRecord2 content; @Column(name="Filename") private String filename; {code} {code} public class FileRecordId2 implements Serializable { private Long content; // matches name of @Id attribute and type of ContentRecord2 PK } {code} {code} import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.repository.CrudRepository; public interface FileRepository extends CrudRepository<FileRecord2, ContentRecord>, JpaSpecificationExecutor { FileRecord2 findByContent(ContentRecord contentRecord); } {code} {code} 2016/02/24 16:05:30:987 +0000 [ERROR] [main] org.springframework.test.context.TestContextManager - Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@7377781e] to prepare test instance [com.brightinteractive.contentstorage.database.FileTrackerServiceTest@b32e983] java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContext(CacheAwareContextLoaderDelegate.java:99) ~[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.springframework.test.context.DefaultTestContext.getApplicationContext(DefaultTestContext.java:101) ~[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109) ~[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75) ~[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:319) ~[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:212) [spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289) [spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [junit-4.11.jar:na] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291) [spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:232) [spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:89) [spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) [junit-4.11.jar:na] at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) [junit-4.11.jar:na] at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) [junit-4.11.jar:na] at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) [junit-4.11.jar:na] at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) [junit-4.11.jar:na] at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) [spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71) [spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.junit.runners.ParentRunner.run(ParentRunner.java:309) [junit-4.11.jar:na] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:175) [spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.junit.runner.JUnitCore.run(JUnitCore.java:160) [junit-4.11.jar:na] at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69) [junit-rt.jar:na] at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234) [junit-rt.jar:na] at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74) [junit-rt.jar:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_72] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_72] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_72] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_72] at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) [idea_rt.jar:na] Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fileRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: This class [class com.brightinteractive.contentstorage.database.FileRecord2] does not define an IdClass at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578) ~[spring-beans-4.2.2.RELEASE.jar:4.2.2.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) ~[spring-beans-4.2.2.RELEASE.jar:4.2.2.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.2.RELEASE.jar:4.2.2.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:305) ~[spring-beans-4.2.2.RELEASE.jar:4.2.2.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.2.RELEASE.jar:4.2.2.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:301) ~[spring-beans-4.2.2.RELEASE.jar:4.2.2.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196) ~[spring-beans-4.2.2.RELEASE.jar:4.2.2.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:753) ~[spring-beans-4.2.2.RELEASE.jar:4.2.2.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:835) ~[spring-context-4.2.2.RELEASE.jar:4.2.2.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537) ~[spring-context-4.2.2.RELEASE.jar:4.2.2.RELEASE] at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:121) ~[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:60) ~[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.delegateLoading(AbstractDelegatingSmartContextLoader.java:100) ~[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.loadContext(AbstractDelegatingSmartContextLoader.java:250) ~[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContextInternal(CacheAwareContextLoaderDelegate.java:64) ~[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE] at org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContext(CacheAwareContextLoaderDelegate.java:91) ~[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE] ... 28 common frames omitted Caused by: java.lang.IllegalArgumentException: This class [class com.brightinteractive.contentstorage.database.FileRecord2] does not define an IdClass at org.hibernate.jpa.internal.metamodel.AbstractIdentifiableType.getIdClassAttributes(AbstractIdentifiableType.java:200) ~[hibernate-entitymanager-4.3.11.Final.jar:4.3.11.Final] at org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation$IdMetadata.<init>(JpaMetamodelEntityInformation.java:249) ~[spring-data-jpa-1.9.4.RELEASE.jar:na] at org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation.<init>(JpaMetamodelEntityInformation.java:82) ~[spring-data-jpa-1.9.4.RELEASE.jar:na] at org.springframework.data.jpa.repository.support.JpaEntityInformationSupport.getEntityInformation(JpaEntityInformationSupport.java:67) ~[spring-data-jpa-1.9.4.RELEASE.jar:na] at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getEntityInformation(JpaRepositoryFactory.java:152) ~[spring-data-jpa-1.9.4.RELEASE.jar:na] at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:99) ~[spring-data-jpa-1.9.4.RELEASE.jar:na] at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:81) ~[spring-data-jpa-1.9.4.RELEASE.jar:na] at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:185) ~[spring-data-commons-1.11.4.RELEASE.jar:na] at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.initAndReturn(RepositoryFactoryBeanSupport.java:251) ~[spring-data-commons-1.11.4.RELEASE.jar:na] at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:237) ~[spring-data-commons-1.11.4.RELEASE.jar:na] at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:92) ~[spring-data-jpa-1.9.4.RELEASE.jar:na] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637) ~[spring-beans-4.2.2.RELEASE.jar:4.2.2.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574) ~[spring-beans-4.2.2.RELEASE.jar:4.2.2.RELEASE] ... 43 common frames omitted {code}

    Spring JIRA | 1 year ago | Francis Devereux
    java.lang.IllegalStateException: Failed to load ApplicationContext

Root Cause Analysis

  1. java.lang.IllegalArgumentException

    This class [class com.brightinteractive.contentstorage.database.FileRecord2] does not define an IdClass

    at org.hibernate.jpa.internal.metamodel.AbstractIdentifiableType.getIdClassAttributes()
  2. org.hibernate.jpa
    AbstractIdentifiableType.getIdClassAttributes
    1. org.hibernate.jpa.internal.metamodel.AbstractIdentifiableType.getIdClassAttributes(AbstractIdentifiableType.java:200)[hibernate-entitymanager-4.3.11.Final.jar:4.3.11.Final]
    1 frame
  3. Spring Data JPA
    JpaRepositoryFactory.getTargetRepository
    1. org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation$IdMetadata.<init>(JpaMetamodelEntityInformation.java:249)[spring-data-jpa-1.9.4.RELEASE.jar:na]
    2. org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation.<init>(JpaMetamodelEntityInformation.java:82)[spring-data-jpa-1.9.4.RELEASE.jar:na]
    3. org.springframework.data.jpa.repository.support.JpaEntityInformationSupport.getEntityInformation(JpaEntityInformationSupport.java:67)[spring-data-jpa-1.9.4.RELEASE.jar:na]
    4. org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getEntityInformation(JpaRepositoryFactory.java:152)[spring-data-jpa-1.9.4.RELEASE.jar:na]
    5. org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:99)[spring-data-jpa-1.9.4.RELEASE.jar:na]
    6. org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:81)[spring-data-jpa-1.9.4.RELEASE.jar:na]
    6 frames
  4. Spring Data Core
    RepositoryFactoryBeanSupport.afterPropertiesSet
    1. org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:185)[spring-data-commons-1.11.4.RELEASE.jar:na]
    2. org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.initAndReturn(RepositoryFactoryBeanSupport.java:251)[spring-data-commons-1.11.4.RELEASE.jar:na]
    3. org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:237)[spring-data-commons-1.11.4.RELEASE.jar:na]
    3 frames
  5. Spring Data JPA
    JpaRepositoryFactoryBean.afterPropertiesSet
    1. org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:92)[spring-data-jpa-1.9.4.RELEASE.jar:na]
    1 frame
  6. Spring Beans
    DefaultListableBeanFactory.preInstantiateSingletons
    1. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)[spring-beans-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    2. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)[spring-beans-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    3. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)[spring-beans-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    4. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)[spring-beans-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    5. org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:305)[spring-beans-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    6. org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)[spring-beans-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    7. org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:301)[spring-beans-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    8. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196)[spring-beans-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    9. org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:753)[spring-beans-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    9 frames
  7. Spring Context
    AbstractApplicationContext.refresh
    1. org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:835)[spring-context-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    2. org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537)[spring-context-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    2 frames
  8. Spring TestContext
    SpringJUnit4ClassRunner$1.runReflectiveCall
    1. org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:121)[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE]
    2. org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:60)[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE]
    3. org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.delegateLoading(AbstractDelegatingSmartContextLoader.java:100)[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE]
    4. org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.loadContext(AbstractDelegatingSmartContextLoader.java:250)[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE]
    5. org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContextInternal(CacheAwareContextLoaderDelegate.java:64)[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE]
    6. org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContext(CacheAwareContextLoaderDelegate.java:91)[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE]
    7. org.springframework.test.context.DefaultTestContext.getApplicationContext(DefaultTestContext.java:101)[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE]
    8. org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE]
    9. org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE]
    10. org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:319)[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE]
    11. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:212)[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE]
    12. org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289)[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE]
    12 frames
  9. JUnit
    ReflectiveCallable.run
    1. org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)[junit-4.11.jar:na]
    1 frame
  10. Spring TestContext
    SpringJUnit4ClassRunner.runChild
    1. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291)[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE]
    2. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:232)[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE]
    3. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:89)[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE]
    3 frames
  11. JUnit
    ParentRunner$2.evaluate
    1. org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)[junit-4.11.jar:na]
    2. org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)[junit-4.11.jar:na]
    3. org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)[junit-4.11.jar:na]
    4. org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)[junit-4.11.jar:na]
    5. org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)[junit-4.11.jar:na]
    5 frames
  12. Spring TestContext
    RunAfterTestClassCallbacks.evaluate
    1. org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE]
    2. org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE]
    2 frames
  13. JUnit
    ParentRunner.run
    1. org.junit.runners.ParentRunner.run(ParentRunner.java:309)[junit-4.11.jar:na]
    1 frame
  14. Spring TestContext
    SpringJUnit4ClassRunner.run
    1. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:175)[spring-test-4.0.3.RELEASE.jar:4.0.3.RELEASE]
    1 frame
  15. JUnit
    JUnitCore.run
    1. org.junit.runner.JUnitCore.run(JUnitCore.java:160)[junit-4.11.jar:na]
    1 frame
  16. IntelliJ junit4 module
    JUnit4IdeaTestRunner.startRunnerWithArgs
    1. com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)[junit-rt.jar:na]
    1 frame
  17. IDEA
    JUnitStarter.main
    1. com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)[junit-rt.jar:na]
    2. com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)[junit-rt.jar:na]
    2 frames
  18. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[na:1.8.0_72]
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[na:1.8.0_72]
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[na:1.8.0_72]
    4. java.lang.reflect.Method.invoke(Method.java:498)[na:1.8.0_72]
    4 frames
  19. IDEA
    AppMain.main
    1. com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)[idea_rt.jar:na]
    1 frame