Announcement Announcement Module
No announcement yet.
nullpointer in when injecting entityManager to JpaRepository Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • nullpointer in when injecting entityManager to JpaRepository

    Hi, (first I have to thank your response first, I'm afraid you won't stay after all the exception print outs) -

    I am attempting to inject an EntityManager into the JpaRepositoryFactoryBean, and got this following exception. Here is my spring config:

    <bean id="repositoryFactoryONE" class=" port.JpaRepositoryFactoryBean">
    <property name="entityManager" ref="entityManagerFactoryONE"/>

    <jpa:repositories base-package="com.mycom.dao">

    the null pointer exception:
    Caused by: java.lang.NullPointerException
    at toryInterfaceAwareBeanPostProcessor.getClassForPro pertyValue(RepositoryInterfaceAwareBeanPostProcess
    at toryInterfaceAwareBeanPostProcessor.predictBeanTyp e( 2)
    at AutowireCapableBeanFactory.predictBeanType(Abstrac
    at BeanFactory.isFactoryBean( :1319)
    at istableBeanFactory.getBeanNamesForType(DefaultList
    at ationContext.getBeanNamesForType(AbstractApplicati
    at ationContext.registerListeners(AbstractApplication
    at ationContext.refresh(AbstractApplicationContext.ja va:422)
    at enericContextLoader.loadContext(AbstractGenericCon
    at enericContextLoader.loadContext(AbstractGenericCon
    at org.springframework.test.context.TestContext.loadA pplicationContext(
    at org.springframework.test.context.TestContext.getAp plicationContext(
    ... 29 more

    I fixed by using entity_manager_factory_ref, as indicated in the namespace of spring data jpa.
    Last edited by truthseeker; May 9th, 2011, 04:33 PM. Reason: fixed