org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'entityManagerFactoryBean' defined in class path resource [app/config/JdbcConfig.class]: Unsatisfied dependency expressed through method 'entityManagerFactoryBean' parameter 0: Error creating bean with name 'dataSource' defined in class path resource [app/config/JdbcConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.NullPointerException; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [app/config/JdbcConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.NullPointerException

Stack Overflow | Hadson | 5 months ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. 0

    Transactions won't begin, NullPointerException when adding PersistenceAnnotationBeanPostProcessor Bean

    Stack Overflow | 5 months ago | Hadson
    org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'entityManagerFactoryBean' defined in class path resource [app/config/JdbcConfig.class]: Unsatisfied dependency expressed through method 'entityManagerFactoryBean' parameter 0: Error creating bean with name 'dataSource' defined in class path resource [app/config/JdbcConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.NullPointerException; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [app/config/JdbcConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.NullPointerException

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at app.config.JdbcConfig.dataSource()
    2. app.config
      JdbcConfig$$EnhancerBySpringCGLIB$$67e71733$$FastClassBySpringCGLIB$$1969e256.invoke
      1. app.config.JdbcConfig.dataSource(JdbcConfig.java:41)
      2. app.config.JdbcConfig$$EnhancerBySpringCGLIB$$67e71733.CGLIB$dataSource$1(<generated>)
      3. app.config.JdbcConfig$$EnhancerBySpringCGLIB$$67e71733$$FastClassBySpringCGLIB$$1969e256.invoke(<generated>)
      3 frames
    3. Spring Core
      MethodProxy.invokeSuper
      1. org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
      1 frame
    4. Spring Context
      ConfigurationClassEnhancer$BeanMethodInterceptor.intercept
      1. org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:356)
      1 frame
    5. app.config
      JdbcConfig$$EnhancerBySpringCGLIB$$67e71733.dataSource
      1. app.config.JdbcConfig$$EnhancerBySpringCGLIB$$67e71733.dataSource(<generated>)
      1 frame
    6. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:498)
      4 frames
    7. Spring Beans
      AbstractBeanFactory.getBean
      1. org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
      2. org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
      3. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123)
      4. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018)
      5. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
      6. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
      7. org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
      8. org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
      9. org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
      10. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
      11. org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:207)
      12. org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1214)
      13. org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1054)
      14. org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1019)
      15. org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835)
      16. org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741)
      17. org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:467)
      18. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123)
      19. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018)
      20. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
      21. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
      22. org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
      23. org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
      24. org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
      25. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
      25 frames
    8. Spring Context
      AbstractApplicationContext.refresh
      1. org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1076)
      2. org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:851)
      3. org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)
      3 frames
    9. Spring
      ContextLoaderListener.contextInitialized
      1. org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444)
      2. org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326)
      3. org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
      3 frames
    10. Glassfish Core
      HostConfig.manageApp
      1. org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4730)
      2. org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5194)
      3. org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152)
      4. org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726)
      5. org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:702)
      6. org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
      7. org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1702)
      7 frames
    11. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:498)
      4 frames
    12. Embedded GlassFish Web
      BaseModelMBean.invoke
      1. org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
      1 frame
    13. Java RT
      JmxMBeanServer.invoke
      1. com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
      2. com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
      2 frames
    14. Embedded GlassFish Web
      MBeanFactory.createStandardContext
      1. org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:482)
      2. org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:431)
      2 frames
    15. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:498)
      4 frames
    16. Embedded GlassFish Web
      BaseModelMBean.invoke
      1. org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
      1 frame
    17. Java RT
      Thread.run
      1. com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
      2. com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
      3. javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468)
      4. javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
      5. javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309)
      6. javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401)
      7. javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829)
      8. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      9. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      10. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      11. java.lang.reflect.Method.invoke(Method.java:498)
      12. sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:324)
      13. sun.rmi.transport.Transport$1.run(Transport.java:200)
      14. sun.rmi.transport.Transport$1.run(Transport.java:197)
      15. java.security.AccessController.doPrivileged(Native Method)
      16. sun.rmi.transport.Transport.serviceCall(Transport.java:196)
      17. sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
      18. sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
      19. sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
      20. java.security.AccessController.doPrivileged(Native Method)
      21. sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
      22. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      23. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      24. java.lang.Thread.run(Thread.java:745)
      24 frames