org.springframework.beans.factory.BeanCreationException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • Hi, I've found something very bizarre (probably my lack of understanding, but let's see..) I've posted a mailing list question on the jetty support mail list. Here's the reference: http://www.nabble.com/JNDI-Lookups-%2B-Spring-td16048065.html But for completeness, I'll C+P here: Hi (again!) Well, here's the jip, I don't know if I should report this here on in spring...so I'll do both :-) Spring 2.5.2 Jetty 6.1.8 Java 1.5 update 6 JEE5 I have this jetty-env.xml in my WEB-INF dir (I've removed the tag braces since nabble fubars up the look) Configure class="org.mortbay.jetty.webapp.WebAppContext" New id="pmsDataSource" class="org.mortbay.jetty.plus.naming.Resource" Arg jdbc/pmsDataSource Arg Arg New class="org.apache.commons.dbcp.BasicDataSource" Set name="driverClassName">org.postgresql.Driver Set Set name="url">jdbc:postgresql://production-db/reports Set Set name="username">fu Set Set name="password">bar Set New Arg New Configure I've got this configured in my spring applicationContext.xml jee:jndi-lookup id="pmsDataSource" jndi-name="jdbc/pmsDataSource" If I switch on -DDEBUG for Jetty, I get these lines: 2008-03-14 11:54:15.595::DEBUG: parse: file:/C:/javastuff/jetty-6.1.8/webapps/root/WEB-INF/jetty-env.xml 2008-03-14 11:54:15.595::DEBUG: parsing: sid=file:/C:/javastuff/jetty-6.1.8/webapps/root/WEB-INF/jetty-env.xml,pid=null So far so good (it's found the jetty-env.xml file), continuing onwards....more debug trace from jetty... 2008-03-14 11:54:15.626::DEBUG: >>> new root context requested 2008-03-14 11:54:15.626::DEBUG: Looking up name="comp/env" 2008-03-14 11:54:15.626::DEBUG: Looking up binding for comp for context=null 2008-03-14 11:54:15.626::DEBUG: Using classloader of current org.mortbay.jetty.handler.ContextHandler 2008-03-14 11:54:15.626::DEBUG: Looking up name="env" 2008-03-14 11:54:15.626::DEBUG: Looking up binding for env for context=comp 2008-03-14 11:54:15.626::DEBUG: Looking up name="org.mortbay.jetty.plus.naming.Resource" 2008-03-14 11:54:15.626::DEBUG: Looking up binding for org.mortbay.jetty.plus.naming.Resource for context=env 2008-03-14 11:54:15.626::DEBUG: Looking up binding for org.mortbay.jetty.plus.naming.Resource for context=env 2008-03-14 11:54:15.626::DEBUG: Adding binding with key=org.mortbay.jetty.plus.naming.Resource obj=org.mortbay.naming.NamingContext@10655dd for context=env 2008-03-14 11:54:15.626::DEBUG: Subcontext org.mortbay.jetty.plus.naming.Resource created 2008-03-14 11:54:15.626::DEBUG: Looking up name="jdbc" 2008-03-14 11:54:15.626::DEBUG: Looking up binding for jdbc for context=org.mortbay.jetty.plus.naming.Resource 2008-03-14 11:54:15.626::DEBUG: Looking up binding for jdbc for context=org.mortbay.jetty.plus.naming.Resource 2008-03-14 11:54:15.626::DEBUG: Adding binding with key=jdbc obj=org.mortbay.naming.NamingContext@ef5502 for context=org.mortbay.jetty.plus.naming.Resource 2008-03-14 11:54:15.641::DEBUG: Subcontext jdbc created 2008-03-14 11:54:15.641::DEBUG: Adding binding with key=pmsDataSource obj=org.mortbay.jetty.plus.naming.Resource@b61fd1 for context=jdbc 2008-03-14 11:54:15.641::DEBUG: Bound object to pmsDataSource 2008-03-14 11:54:15.641::DEBUG: Bound java:comp/env/org.mortbay.jetty.plus.naming.Resource/jdbc/pmsDataSource 2008-03-14 11:54:15.641::DEBUG: Looking up name="jdbc" 2008-03-14 11:54:15.641::DEBUG: Looking up binding for jdbc for context=env 2008-03-14 11:54:15.641::DEBUG: Looking up binding for jdbc for context=env 2008-03-14 11:54:15.641::DEBUG: Adding binding with key=jdbc obj=org.mortbay.naming.NamingContext@e2dae9 for context=env 2008-03-14 11:54:15.641::DEBUG: Subcontext jdbc created 2008-03-14 11:54:15.641::DEBUG: Adding binding with key=pmsDataSource obj=org.apache.commons.dbcp.BasicDataSource@13c1b02 for context=jdbc 2008-03-14 11:54:15.641::DEBUG: Bound object to pmsDataSource 2008-03-14 11:54:15.641::DEBUG: Bound java:comp/env/jdbc/pmsDataSource 2008-03-14 11:54:15.641::DEBUG: parse: file:/C:/javastuff/jetty-6.1.8/webapps/root/WEB-INF/web.xml 2008-03-14 11:54:15.641::DEBUG: parsing: sid=file:/C:/javastuff/jetty-6.1.8/webapps/root/WEB-INF/web.xml,pid=null 2008-03-14 11:54:16.720::DEBUG: loaded interface javax.servlet.ServletContextListener Notice that according to Jetty, it's bound a JNDI reference jdbc/pmsDataSource, so, all good so far! However, shortly after Spring decides to complain when it tries to boot up: 2008-03-14 11:54:19,263 [main] ERROR (ContextLoader:214:initWebApplicationContext) - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pmsDataSource': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException; remaining name 'jdbc/pmsDataSource' at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1302) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:463) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:404) at java.security.AccessController.doPrivileged(Native Method) You can see that Spring is upset. Note, that I've followed the example in the Spring docs, i.e: http://static.springframework.org/spring/docs/2.5.x/reference/xsd-config.html#xsd-config-body-schemas-jee-jndi-lookup section A.2.3.1. (look at the way the jdbc datasource is bound) Now, If I change the spring applicationContext bean definition to: jee:jndi-lookup id="pmsDataSource" jndi-name="java:comp/env/jdbc/pmsDataSource" It works. It finds the JNDI reference. Now, I don't know what is going on...is it spring or is it jetty? TIA :) -=david=-
    via by David Harrigan,
  • Hi, I've found something very bizarre (probably my lack of understanding, but let's see..) I've posted a mailing list question on the jetty support mail list. Here's the reference: http://www.nabble.com/JNDI-Lookups-%2B-Spring-td16048065.html But for completeness, I'll C+P here: Hi (again!) Well, here's the jip, I don't know if I should report this here on in spring...so I'll do both :-) Spring 2.5.2 Jetty 6.1.8 Java 1.5 update 6 JEE5 I have this jetty-env.xml in my WEB-INF dir (I've removed the tag braces since nabble fubars up the look) Configure class="org.mortbay.jetty.webapp.WebAppContext" New id="pmsDataSource" class="org.mortbay.jetty.plus.naming.Resource" Arg jdbc/pmsDataSource Arg Arg New class="org.apache.commons.dbcp.BasicDataSource" Set name="driverClassName">org.postgresql.Driver Set Set name="url">jdbc:postgresql://production-db/reports Set Set name="username">fu Set Set name="password">bar Set New Arg New Configure I've got this configured in my spring applicationContext.xml jee:jndi-lookup id="pmsDataSource" jndi-name="jdbc/pmsDataSource" If I switch on -DDEBUG for Jetty, I get these lines: 2008-03-14 11:54:15.595::DEBUG: parse: file:/C:/javastuff/jetty-6.1.8/webapps/root/WEB-INF/jetty-env.xml 2008-03-14 11:54:15.595::DEBUG: parsing: sid=file:/C:/javastuff/jetty-6.1.8/webapps/root/WEB-INF/jetty-env.xml,pid=null So far so good (it's found the jetty-env.xml file), continuing onwards....more debug trace from jetty... 2008-03-14 11:54:15.626::DEBUG: >>> new root context requested 2008-03-14 11:54:15.626::DEBUG: Looking up name="comp/env" 2008-03-14 11:54:15.626::DEBUG: Looking up binding for comp for context=null 2008-03-14 11:54:15.626::DEBUG: Using classloader of current org.mortbay.jetty.handler.ContextHandler 2008-03-14 11:54:15.626::DEBUG: Looking up name="env" 2008-03-14 11:54:15.626::DEBUG: Looking up binding for env for context=comp 2008-03-14 11:54:15.626::DEBUG: Looking up name="org.mortbay.jetty.plus.naming.Resource" 2008-03-14 11:54:15.626::DEBUG: Looking up binding for org.mortbay.jetty.plus.naming.Resource for context=env 2008-03-14 11:54:15.626::DEBUG: Looking up binding for org.mortbay.jetty.plus.naming.Resource for context=env 2008-03-14 11:54:15.626::DEBUG: Adding binding with key=org.mortbay.jetty.plus.naming.Resource obj=org.mortbay.naming.NamingContext@10655dd for context=env 2008-03-14 11:54:15.626::DEBUG: Subcontext org.mortbay.jetty.plus.naming.Resource created 2008-03-14 11:54:15.626::DEBUG: Looking up name="jdbc" 2008-03-14 11:54:15.626::DEBUG: Looking up binding for jdbc for context=org.mortbay.jetty.plus.naming.Resource 2008-03-14 11:54:15.626::DEBUG: Looking up binding for jdbc for context=org.mortbay.jetty.plus.naming.Resource 2008-03-14 11:54:15.626::DEBUG: Adding binding with key=jdbc obj=org.mortbay.naming.NamingContext@ef5502 for context=org.mortbay.jetty.plus.naming.Resource 2008-03-14 11:54:15.641::DEBUG: Subcontext jdbc created 2008-03-14 11:54:15.641::DEBUG: Adding binding with key=pmsDataSource obj=org.mortbay.jetty.plus.naming.Resource@b61fd1 for context=jdbc 2008-03-14 11:54:15.641::DEBUG: Bound object to pmsDataSource 2008-03-14 11:54:15.641::DEBUG: Bound java:comp/env/org.mortbay.jetty.plus.naming.Resource/jdbc/pmsDataSource 2008-03-14 11:54:15.641::DEBUG: Looking up name="jdbc" 2008-03-14 11:54:15.641::DEBUG: Looking up binding for jdbc for context=env 2008-03-14 11:54:15.641::DEBUG: Looking up binding for jdbc for context=env 2008-03-14 11:54:15.641::DEBUG: Adding binding with key=jdbc obj=org.mortbay.naming.NamingContext@e2dae9 for context=env 2008-03-14 11:54:15.641::DEBUG: Subcontext jdbc created 2008-03-14 11:54:15.641::DEBUG: Adding binding with key=pmsDataSource obj=org.apache.commons.dbcp.BasicDataSource@13c1b02 for context=jdbc 2008-03-14 11:54:15.641::DEBUG: Bound object to pmsDataSource 2008-03-14 11:54:15.641::DEBUG: Bound java:comp/env/jdbc/pmsDataSource 2008-03-14 11:54:15.641::DEBUG: parse: file:/C:/javastuff/jetty-6.1.8/webapps/root/WEB-INF/web.xml 2008-03-14 11:54:15.641::DEBUG: parsing: sid=file:/C:/javastuff/jetty-6.1.8/webapps/root/WEB-INF/web.xml,pid=null 2008-03-14 11:54:16.720::DEBUG: loaded interface javax.servlet.ServletContextListener Notice that according to Jetty, it's bound a JNDI reference jdbc/pmsDataSource, so, all good so far! However, shortly after Spring decides to complain when it tries to boot up: 2008-03-14 11:54:19,263 [main] ERROR (ContextLoader:214:initWebApplicationContext) - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pmsDataSource': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException; remaining name 'jdbc/pmsDataSource' at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1302) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:463) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:404) at java.security.AccessController.doPrivileged(Native Method) You can see that Spring is upset. Note, that I've followed the example in the Spring docs, i.e: http://static.springframework.org/spring/docs/2.5.x/reference/xsd-config.html#xsd-config-body-schemas-jee-jndi-lookup section A.2.3.1. (look at the way the jdbc datasource is bound) Now, If I change the spring applicationContext bean definition to: jee:jndi-lookup id="pmsDataSource" jndi-name="java:comp/env/jdbc/pmsDataSource" It works. It finds the JNDI reference. Now, I don't know what is going on...is it spring or is it jetty? TIA :) -=david=-
    via by David Harrigan,
  • status 404 on login.html
    via Stack Overflow by Prashant
    ,
  • Spring Hibernate Mapping Issue
    via Stack Overflow by Diode
    ,
  • Getting error in spring RMI
    via Stack Overflow by user1906154
    ,
  • error creating bean - JpetStore example
    via by Unknown author,
    • org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pmsDataSource': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException; remaining name 'jdbc/pmsDataSource' at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1302) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:463) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:404) at java.security.AccessController.doPrivileged(Native Method)

    Users with the same issue

    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    148 more bugmates