Re: [Tomcat 7-RC1] JNDI Startup Issue

2010-04-22 Thread alvins

Full stack-trace - 

javax.naming.NameNotFoundException: Name comp is not bound in this Context
at org.apache.naming.NamingContext.lookup(NamingContext.java:774)
at org.apache.naming.NamingContext.lookup(NamingContext.java:157)
at org.apache.naming.SelectorContext.lookup(SelectorContext.java:156)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at
au.com.test.web.MyServletContextListener.contextInitialized(MyServletContextListener.java:21)
at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4221)
at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4700)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:128)
at
org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:986)
at
org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:857)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:128)
at
org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:986)
at
org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:452)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:128)
at
org.apache.catalina.core.StandardService.startInternal(StandardService.java:456)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:128)
at
org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:662)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:128)
at org.apache.catalina.startup.Catalina.startInternal(Catalina.java:564)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:128)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

I have updated the bug with a sample war file + code.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49132


Konstantin Kolinko wrote:
> 
> 2010/4/22 alvins :
>>
>> Any thoughts on this?
>>
> 
> I would like to see the Tomcat part of the exception that you are
> observing.
> That is, at what point in application lifecycle the initialization is
> performed.
> 
> If you can attach a sample application to
> https://issues.apache.org/bugzilla/show_bug.cgi?id=49132
> that would be nice. It would be a bit easier if it would be a simple one.
> 
> Best regards,
> Konstantin Kolinko
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/-Tomcat-7-RC1--JNDI-Startup-Issue-tp28279732p28327054.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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



Re: [Tomcat 7-RC1] JNDI Startup Issue

2010-04-21 Thread alvins

Any thoughts on this?


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

-- 
View this message in context: 
http://old.nabble.com/-Tomcat-7-RC1--JNDI-Startup-Issue-tp28279732p28322682.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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



Re: [Tomcat 7-RC1] JNDI Startup Issue

2010-04-18 Thread alvins


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) -

- In the war file there is web.xml with the following (excerpt) - 


contextConfigLocation

classpath:applicationContext.xml





org.springframework.web.context.ContextLoaderListener


- 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  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.


---

Re: [Tomcat 7-RC1] JNDI Startup Issue

2010-04-17 Thread alvins

btw. Mark T if you are reading - just noticed you worked for SpringSource -
my test webapp is spring based and I was using the jee:jndi-lookup tags - I
have had no luck getting these to work with Tomcat 7 RC1. Note that the
issue doesn't directly relate to the tags itself as the problem shows itself
with straight java code running during tomcat startup (e.g. via
ServletContextListener for example).

If you like I can attach a very simple web-app to show behaviour.
-- 
View this message in context: 
http://old.nabble.com/-Tomcat-7-RC1--JNDI-Startup-Issue-tp28279732p28279898.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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



[Tomcat 7-RC1] JNDI Startup Issue

2010-04-17 Thread alvins

Hi guys,

I am having problems with JNDI access during Tomcat startup. During tomcat
startup my app looks in JNDI for dataSource (sitting in context.xml) -
however I always receive a 'comp no bound' exception. The same app works
fine in Tomcat 6.x.

I ran some tests and found that the resource is available fine after startup
but during startup it looks like JNDI has not completely initialised yet. I
am guessing something has changed in terms of the order in which JNDI is
made available from Tomcat 6.x to Tomcat 7.

Looking through prev posts I have tried looking at the DataSourceRealm as to
how it gets the 'Server' context' -
http://svn.apache.org/viewvc/tomcat/tc7.0.x/tags/TOMCAT_7_0_0_RC1/java/org/apache/catalina/realm/DataSourceRealm.java?view=markup.
 

try {
389 Context context = null;
390 if (localDataSource) {
391 context = ContextBindings.getClassLoader();
392 context = (Context) context.lookup("comp/env");
393 } else {
394 context =
395
((StandardServer)getServer()).getGlobalNamingContext();
396 }

But the ServerFactory has been deleted and getServer call looks like it
would be difficult to use outside of this class.

Anybody have any ideas?
-- 
View this message in context: 
http://old.nabble.com/-Tomcat-7-RC1--JNDI-Startup-Issue-tp28279732p28279732.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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