org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in org.baeldung.config.PersistenceJNDIConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean]: Factory method 'entityManagerFactory' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in org.baeldung.config.PersistenceJNDIConfig: 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.IllegalArgumentException: Error looking up JNDI datasource

  1. 0

    Caused by: javax.naming.NameNotFoundException: Name [jdbc/BaeldungDatabase] is not bound in this Context. Unable to find [jdbc]

    Stack Overflow | 3 months ago | javatechnology
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in org.baeldung.config.PersistenceJNDIConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean]: Factory method 'entityManagerFactory' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in org.baeldung.config.PersistenceJNDIConfig: 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.IllegalArgumentException: Error looking up JNDI datasource
  2. 0

    No JTA UserTransaction available - specify either 'userTransaction' or 'userTransactionName' in tomcat 7

    Stack Overflow | 7 months ago | Sardar Waqas Ahmed
    javax.naming.NameNotFoundException: Name [TransactionManager] is not bound in this Context. Unable to find [TransactionManager].
  3. 0

    NameNotFound Exception - Spring Boot (LATEST), Embedded Tomcat, JNDI

    Stack Overflow | 1 year ago | Matt Rkiouak
    org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    DBConnectionFactory: error getting dbconnection jdbc/dotCMSPool

    Stack Overflow | 2 years ago
    javax.naming.NameNotFoundException: Name [jdbc/dotCMSPool] is not bound in this Context. Unable to find [jdbc].
  6. 0

    please assist : Unable to start kie-wb on tomcat 7 server

    Google Groups | 3 months ago | dheeraj gaba
    java.lang.RuntimeException: Unable to create EntityManagerFactory due to [PersistenceUnit: org.jbpm.domain] Unable to build EntityManagerFactory
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. javax.naming.NameNotFoundException

    Name [jdbc/BaeldungDatabase] is not bound in this Context. Unable to find [jdbc].

    at org.apache.naming.NamingContext.lookup()
  2. Web Container Naming Utilities
    SelectorContext.lookup
    1. org.apache.naming.NamingContext.lookup(NamingContext.java:818)
    2. org.apache.naming.NamingContext.lookup(NamingContext.java:152)
    3. org.apache.naming.NamingContext.lookup(NamingContext.java:829)
    4. org.apache.naming.NamingContext.lookup(NamingContext.java:152)
    5. org.apache.naming.NamingContext.lookup(NamingContext.java:829)
    6. org.apache.naming.NamingContext.lookup(NamingContext.java:166)
    7. org.apache.naming.SelectorContext.lookup(SelectorContext.java:157)
    7 frames
  3. Java RT
    InitialContext.lookup
    1. javax.naming.InitialContext.lookup(InitialContext.java:417)
    1 frame
  4. Spring Context
    JndiTemplate.lookup
    1. org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:155)
    2. org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:87)
    3. org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152)
    3 frames
  5. org.baeldung.config
    PersistenceJNDIConfig$$EnhancerBySpringCGLIB$$1af1b295$$FastClassBySpringCGLIB$$7dc66a0e.invoke
    1. org.baeldung.config.PersistenceJNDIConfig.dataSource(PersistenceJNDIConfig.java:51)
    2. org.baeldung.config.PersistenceJNDIConfig$$EnhancerBySpringCGLIB$$1af1b295.CGLIB$dataSource$3(<generated>)
    3. org.baeldung.config.PersistenceJNDIConfig$$EnhancerBySpringCGLIB$$1af1b295$$FastClassBySpringCGLIB$$7dc66a0e.invoke(<generated>)
    3 frames
  6. Spring Core
    MethodProxy.invokeSuper
    1. org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    1 frame
  7. Spring Context
    ConfigurationClassEnhancer$BeanMethodInterceptor.intercept
    1. org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:356)
    1 frame
  8. org.baeldung.config
    PersistenceJNDIConfig$$EnhancerBySpringCGLIB$$1af1b295.dataSource
    1. org.baeldung.config.PersistenceJNDIConfig$$EnhancerBySpringCGLIB$$1af1b295.dataSource(<generated>)
    1 frame
  9. 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
  10. 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:197)
    10 frames
  11. Spring Context
    ConfigurationClassEnhancer$BeanMethodInterceptor.intercept
    1. org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:381)
    1 frame
  12. org.baeldung.config
    PersistenceJNDIConfig$$EnhancerBySpringCGLIB$$1af1b295$$FastClassBySpringCGLIB$$7dc66a0e.invoke
    1. org.baeldung.config.PersistenceJNDIConfig$$EnhancerBySpringCGLIB$$1af1b295.dataSource(<generated>)
    2. org.baeldung.config.PersistenceJNDIConfig.entityManagerFactory(PersistenceJNDIConfig.java:41)
    3. org.baeldung.config.PersistenceJNDIConfig$$EnhancerBySpringCGLIB$$1af1b295.CGLIB$entityManagerFactory$0(<generated>)
    4. org.baeldung.config.PersistenceJNDIConfig$$EnhancerBySpringCGLIB$$1af1b295$$FastClassBySpringCGLIB$$7dc66a0e.invoke(<generated>)
    4 frames
  13. Spring Core
    MethodProxy.invokeSuper
    1. org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    1 frame
  14. Spring Context
    ConfigurationClassEnhancer$BeanMethodInterceptor.intercept
    1. org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:356)
    1 frame
  15. org.baeldung.config
    PersistenceJNDIConfig$$EnhancerBySpringCGLIB$$1af1b295.entityManagerFactory
    1. org.baeldung.config.PersistenceJNDIConfig$$EnhancerBySpringCGLIB$$1af1b295.entityManagerFactory(<generated>)
    1 frame
  16. 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
  17. 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:197)
    10 frames
  18. 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
  19. 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
  20. Glassfish Core
    ContainerBase$StartChild.call
    1. org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4840)
    2. org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5303)
    3. org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
    4. org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1407)
    5. org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1397)
    5 frames
  21. Java RT
    Thread.run
    1. java.util.concurrent.FutureTask.run(FutureTask.java:266)
    2. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    3. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    4. java.lang.Thread.run(Thread.java:745)
    4 frames