Results 1 to 4 of 4

Thread: Spring Data JPA Error

  1. #1
    Join Date
    Jan 2012
    Posts
    2

    Default Spring Data JPA Error

    Hi,
    I am trying to use Spring Data JPA.
    For Basic CRUD Operation everything looks good. But when I try to add custom Query like example below. I am getting error.

    @Query("select r from RefTypeLog r where r.cllgCd = ?")
    List<RefTypeLog> findByCllgCd(String cllgCd);

    I even tried without giving where clause.


    Exception

    java.lang.IllegalStateException: Failed to load ApplicationContext
    at org.springframework.test.context.TestContext.getAp plicationContext(TestContext.java:308)
    at org.springframework.test.context.support.Dependenc yInjectionTestExecutionListener.injectDependencies (DependencyInjectionTestExecutionListener.java:109 )
    at org.springframework.test.context.support.Dependenc yInjectionTestExecutionListener.prepareTestInstanc e(DependencyInjectionTestExecutionListener.java:75 )
    at org.springframework.test.context.TestContextManage r.prepareTestInstance(TestContextManager.java:333)
    at org.springframework.test.context.junit4.SpringJUni t4ClassRunner.createTest(SpringJUnit4ClassRunner.j ava:220)
    at org.springframework.test.context.junit4.SpringJUni t4ClassRunner$1.runReflectiveCall(SpringJUnit4Clas sRunner.java:301)
    at org.junit.internal.runners.model.ReflectiveCallabl e.run(ReflectiveCallable.java:15)
    at org.springframework.test.context.junit4.SpringJUni t4ClassRunner.methodBlock(SpringJUnit4ClassRunner. java:303)
    at org.springframework.test.context.junit4.SpringJUni t4ClassRunner.runChild(SpringJUnit4ClassRunner.jav a:240)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild( BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner. java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRu nner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentR unner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRu nner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRu nner.java:184)
    at org.springframework.test.context.junit4.statements .RunBeforeTestClassCallbacks.evaluate(RunBeforeTes tClassCallbacks.java:61)
    at org.springframework.test.context.junit4.statements .RunAfterTestClassCallbacks.evaluate(RunAfterTestC lassCallbacks.java:70)
    at org.junit.runners.ParentRunner.run(ParentRunner.ja va:236)
    at org.springframework.test.context.junit4.SpringJUni t4ClassRunner.run(SpringJUnit4ClassRunner.java:180 )
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestR eference.run(JUnit4TestReference.java:49)
    at org.eclipse.jdt.internal.junit.runner.TestExecutio n.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.main(RemoteTestRunner.java:197)
    Caused by: org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'refTypeLogRepository': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalAccessError: tried to access method org.springframework.core.GenericTypeResolver.getTy peVariableMap(Ljava/lang/ClassLjava/util/Map; from class org.springframework.data.util.ClassTypeInformation
    at org.springframework.beans.factory.support.FactoryB eanRegistrySupport.doGetObjectFromFactoryBean(Fact oryBeanRegistrySupport.java:149)
    at org.springframework.beans.factory.support.FactoryB eanRegistrySupport.getObjectFromFactoryBean(Factor yBeanRegistrySupport.java:102)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getObjectForBeanInstance(AbstractBeanF actory.java:1414)
    at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:302 )
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:190)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:580)
    at org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:895)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:425)
    at org.springframework.test.context.support.AbstractG enericContextLoader.loadContext(AbstractGenericCon textLoader.java:84)
    at org.springframework.test.context.support.AbstractG enericContextLoader.loadContext(AbstractGenericCon textLoader.java:1)
    at org.springframework.test.context.TestContext.loadA pplicationContext(TestContext.java:280)
    at org.springframework.test.context.TestContext.getAp plicationContext(TestContext.java:304)
    ... 24 more
    Caused by: java.lang.IllegalAccessError: tried to access method org.springframework.core.GenericTypeResolver.getTy peVariableMap(Ljava/lang/ClassLjava/util/Map; from class org.springframework.data.util.ClassTypeInformation
    at org.springframework.data.util.ClassTypeInformation .<init>(ClassTypeInformation.java:96)
    at org.springframework.data.util.ClassTypeInformation .<clinit>(ClassTypeInformation.java:42)
    at org.springframework.data.repository.core.support.A bstractRepositoryMetadata.<init>(AbstractRepositor yMetadata.java:43)
    at org.springframework.data.repository.core.support.D efaultRepositoryMetadata.<init>(DefaultRepositoryM etadata.java:41)
    at org.springframework.data.repository.core.support.R epositoryFactorySupport.getRepositoryMetadata(Repo sitoryFactorySupport.java:154)
    at org.springframework.data.repository.core.support.R epositoryFactorySupport.getRepository(RepositoryFa ctorySupport.java:125)
    at org.springframework.data.repository.core.support.R epositoryFactoryBeanSupport.getObject(RepositoryFa ctoryBeanSupport.java:114)
    at org.springframework.data.repository.core.support.R epositoryFactoryBeanSupport.getObject(RepositoryFa ctoryBeanSupport.java:38)
    at org.springframework.beans.factory.support.FactoryB eanRegistrySupport.doGetObjectFromFactoryBean(Fact oryBeanRegistrySupport.java:142)
    ... 35 more

  2. #2
    Join Date
    Aug 2006
    Location
    Arequipa-Peru / South America
    Posts
    2,796

    Default

    Hello

    Next time use code tags, is more readable for us

    About the exception

    Code:
    Caused by: org.springframework.beans.factory.BeanCreationException: 
    Error creating bean with name 'refTypeLogRepository': 
    FactoryBean threw exception on object creation; 
    nested exception is java.lang.IllegalAccessError: 
    tried to access method 
    org.springframework.core.GenericTypeResolver.getTypeVariableMap(Ljava/lang/ClassLjava/util/Map; 
    from class org.springframework.data.util.ClassTypeInformation
    at org.springframework.beans.factory.support....
    Seems you have a conflict of versions (due the red part)

    Post here the version of each Spring project used
    - Manuel Jordan

    Kill Your Pride, Share Your Knowledge With All
    The Fear Of The LORD Is The Beginning Of Knowledge, But Fools Despise Wisdom And Discipline. Proverbs 1:7

    Blog


    Technical Reviewer of Apress

    • Pro SpringSource dm Server
    • Spring Enterprise Recipes: A Problem-Solution Approach
    • Spring Recipes: A Problem-Solution Approach, 2nd Edition
    • Pro Spring Integration
    • Pro Spring Batch
    • Pro Spring 3
    • Pro Spring MVC: With Web Flow
    • Pro Spring Security

  3. #3
    Join Date
    Jan 2012
    Posts
    2

    Default Version Mismatch

    Thanks for the reply. Yes I found the issue. The issue is related to the Spring Common Data. Initially I used 1.1 version it was giving me error, I tried 1.0 it worked fine.


    Thanks

    Naveen

  4. #4
    Join Date
    Mar 2013
    Posts
    1

    Default same error

    I go to the same error.
    Seems you have a conflict of versions (due the red part)

    Post here the version of each Spring project used
    I usede spring framework 3.2.1 ,details is
    Code:
    spring-aop-3.2.1.RELEASE-javadoc.jar                                      
    spring-aop-3.2.1.RELEASE-sources.jar                                      
    spring-aop-3.2.1.RELEASE.jar                                              
    spring-aspects-3.2.1.RELEASE-javadoc.jar                                  
    spring-aspects-3.2.1.RELEASE-sources.jar                                  
    spring-aspects-3.2.1.RELEASE.jar                                          
    spring-beans-3.2.1.RELEASE-javadoc.jar                                    
    spring-beans-3.2.1.RELEASE-sources.jar                                    
    spring-beans-3.2.1.RELEASE.jar                                            
    spring-build-src-3.2.1.RELEASE.jar                                        
    spring-context-3.2.1.RELEASE-javadoc.jar                                  
    spring-context-3.2.1.RELEASE-sources.jar                                  
    spring-context-3.2.1.RELEASE.jar                                          
    spring-context-support-3.2.1.RELEASE-javadoc.jar                          
    spring-context-support-3.2.1.RELEASE-sources.jar                          
    spring-context-support-3.2.1.RELEASE.jar                                  
    spring-core-3.2.1.RELEASE-javadoc.jar                                     
    spring-core-3.2.1.RELEASE-sources.jar                                     
    spring-core-3.2.1.RELEASE.jar                                             
    spring-expression-3.2.1.RELEASE-javadoc.jar                               
    spring-expression-3.2.1.RELEASE-sources.jar                               
    spring-expression-3.2.1.RELEASE.jar                                       
    spring-instrument-3.2.1.RELEASE-javadoc.jar                               
    spring-instrument-3.2.1.RELEASE-sources.jar                               
    spring-instrument-3.2.1.RELEASE.jar                                       
    spring-instrument-tomcat-3.2.1.RELEASE-javadoc.jar                        
    spring-instrument-tomcat-3.2.1.RELEASE-sources.jar                        
    spring-instrument-tomcat-3.2.1.RELEASE.jar                                
    spring-jdbc-3.2.1.RELEASE-javadoc.jar                                     
    spring-jdbc-3.2.1.RELEASE-sources.jar                                     
    spring-jdbc-3.2.1.RELEASE.jar                                             
    spring-jms-3.2.1.RELEASE-javadoc.jar                                      
    spring-jms-3.2.1.RELEASE-sources.jar                                      
    spring-jms-3.2.1.RELEASE.jar                                              
    spring-orm-3.2.1.RELEASE-javadoc.jar                                      
    spring-orm-3.2.1.RELEASE-sources.jar                                      
    spring-orm-3.2.1.RELEASE.jar                                              
    spring-oxm-3.2.1.RELEASE-javadoc.jar                                      
    spring-oxm-3.2.1.RELEASE-sources.jar                                      
    spring-oxm-3.2.1.RELEASE.jar                                              
    spring-struts-3.2.1.RELEASE-javadoc.jar                                   
    spring-struts-3.2.1.RELEASE-sources.jar                                   
    spring-struts-3.2.1.RELEASE.jar                                           
    spring-test-3.2.1.RELEASE-javadoc.jar                                     
    spring-test-3.2.1.RELEASE-sources.jar                                     
    spring-test-3.2.1.RELEASE.jar                                             
    spring-tx-3.2.1.RELEASE-javadoc.jar                                       
    spring-tx-3.2.1.RELEASE-sources.jar                                       
    spring-tx-3.2.1.RELEASE.jar                                               
    spring-web-3.2.1.RELEASE.jar
    spring data jpa 1.3
    spring data commons 1.5
    the error is
    Code:
    Caused by: java.lang.IllegalAccessError: tried to access method org.springframework.core.GenericTypeResolver.getTypeVariableMap(Ljava/lang/Class;)Ljava/util/Map; from class org.springframework.data.util.ClassTypeInformation
    	at org.springframework.data.util.ClassTypeInformation.<init>(ClassTypeInformation.java:96)
    	at org.springframework.data.util.ClassTypeInformation.<clinit>(ClassTypeInformation.java:42)
    	at org.springframework.data.repository.core.support.AbstractRepositoryMetadata.<init>(AbstractRepositoryMetadata.java:43)
    	at org.springframework.data.repository.core.support.DefaultRepositoryMetadata.<init>(DefaultRepositoryMetadata.java:43)
    	at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepositoryMetadata(RepositoryFactorySupport.java:159)
    	at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:130)
    	at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:153)
    	at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:43)
    	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)
    	... 48 more
    Attached Images Attached Images
    • File Type: jpg 1.jpg (19.1 KB, 2 views)
    Last edited by L.D; Mar 9th, 2013 at 08:34 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •