tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alvins <alvins1...@hotmail.com>
Subject Re: [Tomcat 7-RC1] JNDI Startup Issue
Date Sun, 18 Apr 2010 13:46:08 GMT


markt-2 wrote:
> 
> Define "during startup". What exactly are you doing?
> 

- I have a war-file sitting on FS
- I have a context file - server/conf/Catalina/ROOT.xml. In this I have
defined a dataSource. Context file references the war file.
- In the war file there is a spring xml file with the following (excerpt) -
<jee:jndi-lookup id="dataSource" jndi-name="java:comp/env/jdbc/dataSource"
/>
- In the war file there is web.xml with the following (excerpt) - 

        <context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>
			classpath:applicationContext.xml
		</param-value>
	</context-param>
	
	<listener>
	
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
	</listener>

- Tomcat is not running. I startup tomcat via
/usr/local/tomcat7/bin/startup.sh

Tomcat 'during startup' (i.e. before the following log message 'INFO: Server
startup in XXXX ms') will initialise Spring - Spring will then try and
lookup the dataSource in JNDI but fails. Works fine in Tomcat 6.x.

As I mentioned it's not specifically to do with Spring - same error occurs
with non-Spring lookup. Stack-trace below.

Caused by: org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'dataSource': Invocation of init method failed;
nested exception is javax.naming.NameNotFoundException: Name comp is not
bound in this Context
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1412)
[spring-beans-3.0.2.RELEASE.jar:3.0.2.RELEASE]
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
[spring-beans-3.0.2.RELEASE.jar:3.0.2.RELEASE]
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
[spring-beans-3.0.2.RELEASE.jar:3.0.2.RELEASE]
	at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
[spring-beans-3.0.2.RELEASE.jar:3.0.2.RELEASE]
	at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
[spring-beans-3.0.2.RELEASE.jar:3.0.2.RELEASE]
	at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
[spring-beans-3.0.2.RELEASE.jar:3.0.2.RELEASE]
	at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
[spring-beans-3.0.2.RELEASE.jar:3.0.2.RELEASE]
	at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
[spring-beans-3.0.2.RELEASE.jar:3.0.2.RELEASE]
	... 49 common frames omitted
Caused by: javax.naming.NameNotFoundException: Name comp is not bound in
this Context
	at org.apache.naming.NamingContext.lookup(NamingContext.java:774)
[catalina.jar:7.0.0-RC1]
	at org.apache.naming.NamingContext.lookup(NamingContext.java:157)
[catalina.jar:7.0.0-RC1]
	at org.apache.naming.SelectorContext.lookup(SelectorContext.java:156)
[catalina.jar:7.0.0-RC1]
	at javax.naming.InitialContext.lookup(InitialContext.java:392)
[na:1.6.0_17]
	at
org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:154)
[spring-context-3.0.2.RELEASE.jar:3.0.2.RELEASE]
	at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:87)
[spring-context-3.0.2.RELEASE.jar:3.0.2.RELEASE]
	at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152)
[spring-context-3.0.2.RELEASE.jar:3.0.2.RELEASE]
	at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178)
[spring-context-3.0.2.RELEASE.jar:3.0.2.RELEASE]
	at
org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95)
[spring-context-3.0.2.RELEASE.jar:3.0.2.RELEASE]
	at
org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105)
[spring-context-3.0.2.RELEASE.jar:3.0.2.RELEASE]
	at
org.springframework.jndi.JndiObjectFactoryBean.lookupWithFallback(JndiObjectFactoryBean.java:201)
[spring-context-3.0.2.RELEASE.jar:3.0.2.RELEASE]
	at
org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:187)
[spring-context-3.0.2.RELEASE.jar:3.0.2.RELEASE]
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1469)
[spring-beans-3.0.2.RELEASE.jar:3.0.2.RELEASE]
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1409)
[spring-beans-3.0.2.RELEASE.jar:3.0.2.RELEASE]
	... 56 common frames omitted
-- 
View this message in context: http://old.nabble.com/-Tomcat-7-RC1--JNDI-Startup-Issue-tp28279732p28282342.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message