On 14/12/2010 01:28, Dale Ogilvie wrote:
>
> The thing is that the code is working fine now, without the fully
> qualified jndi-name. Then an app redeployment and it stopped working.
> Then an apache restart and it started working again...
That does sound like a bug. Let me see if I can re-create it...
Mark
>
> I found something on Google about having apache jars in WEB-INF/lib, but
> I don't think this was/is the case for our app.
>
> http://java.ittoolbox.com/groups/technical-functional/jsp-l/javaxnamingn
> amenotfoundexception-name-javacomp-is-not-bound-in-this-context-3603504
>
>
> -----Original Message-----
> From: Mark Eggers [mailto:its_toasted@yahoo.com]
> Sent: Tuesday, 14 December 2010 12:46 p.m.
> To: Tomcat Users List
> Subject: Re: jndi-lookup fails, cured by tomcat restart
>
> Dale,
>
> What happens if you try changing the jndi-name to its fully qualified
> version?
>
> java:comp/env/propertiesFileName
>
> Then change the context.xml file name to propertiesFileName (no leading
> slash)?
>
> I'm basing these comments on some similar issues I've seen in the Spring
> forums, and similar configuration issues when using Hibernate with
> Tomcat.
>
> Don't ask me to explain why this worked for a long time, and then all of
> a suddenly decided not to work.
>
> Hope this helps.
>
> . . . . just a guess.
>
> /mde/
>
>
> ----- Original Message ----
> From: Dale Ogilvie <Dale.Ogilvie@trimble.co.nz>
> To: Tomcat Users List <users@tomcat.apache.org>
> Sent: Mon, December 13, 2010 2:52:09 PM
> Subject: RE: jndi-lookup fails, cured by tomcat restart
>
>
> propsFileName is the name of the bean, which should be initialized with
> the string value from the JNDI entry "propertiesFileName" defined in
> $CATALINA_HOME/conf/context.xml
>
> This was working, stopped working until a tomcat restart, and is working
> again now. My concern is that this may be a bug in tomcat
>
> So what happens is that tomcat startup creates a JNDI environment entry
> in the "cross-application" context called "propertiesFileName".
>
> <Environment name="/propertiesFileName"
> value="classpath:test-application.properties" type="java.lang.String"
> override="true"/>
>
> When each spring app starts, the code <jee:jndi-lookup
> id="propsFileName" jndi-name="propertiesFileName"/> in the application
> context takes the JNDI environment entry and initializes a bean using
> the id "propsFileName" with it.
>
> Finally a spring PropertyPlaceholderConfigurer is created using the
> propsFileName bean for the location of the properties file. We use this
> to
>
> <bean
> class="org.springframework.beans.factory.config.PropertyPlaceholderConfi
> gurer">
> <property name="location" ref="propsFileName"/>
> </bean>
>
> Looking more closely at the debug log, this line looks quite suspicious
> "Name comp is not bound". comp is the root of the environment hierarchy,
> why would that be missing?
>
> 2010-12-08 19:29:11,161 DEBUG ** Converted JNDI name
> [java:comp/env/propertiesFileName] not found - trying original name
> [propertiesFileName]. javax.naming.NameNotFoundException: Name comp is
> not bound in this Context **
> org.springframework.jndi.JndiObjectFactoryBean
>
> Log context follows:
>
> 2010-12-08 19:29:11,108 DEBUG ** Creating instance of bean
> 'propsFileName' **
> org.springframework.beans.factory.support.DefaultListableBeanFactory
> 2010-12-08 19:29:11,116 DEBUG ** Eagerly caching bean 'propsFileName' to
> allow for resolving potential circular references **
> org.springframework.beans.factory.support.DefaultListableBeanFactory
> 2010-12-08 19:29:11,158 DEBUG ** Invoking afterPropertiesSet() on bean
> with name 'propsFileName' **
> org.springframework.beans.factory.support.DefaultListableBeanFactory
> 2010-12-08 19:29:11,158 DEBUG ** Looking up JNDI object with name
> [java:comp/env/propertiesFileName] **
> org.springframework.jndi.JndiTemplate
> 2010-12-08 19:29:11,161 DEBUG ** Converted JNDI name
> [java:comp/env/propertiesFileName] not found - trying original name
> [propertiesFileName]. javax.naming.NameNotFoundException: Name comp is
> not bound in this Context **
> org.springframework.jndi.JndiObjectFactoryBean
> 2010-12-08 19:29:11,161 DEBUG ** Looking up JNDI object with name
> [propertiesFileName] ** org.springframework.jndi.JndiTemplate
> 2010-12-08 19:29:11,164 INFO ** Destroying singletons in
> org.springframework.beans.factory.support.DefaultListableBeanFactory@493
> 02473: defining beans
> [propsFileName,org.springframework.beans.factory.config.PropertyPlacehol
> derConfigure
> 2010-12-08 19:29:11,165 ERROR ** Context initialization failed **
> org.springframework.web.context.ContextLoader
>
> -----Original Message-----
> From: Christopher Schultz [mailto:chris@christopherschultz.net]
> Sent: Tuesday, 14 December 2010 9:46 a.m.
> To: Tomcat Users List
> Subject: Re: jndi-lookup fails, cured by tomcat restart
>
> Dale,
>
> On 12/13/2010 3:08 PM, Dale Ogilvie wrote:
>> We are using a spring jndi-lookup to pull the name of a context file
>> from the global "environment" in our apps. We have set this up in
>> tomcat
>> 6.0.29 like so:
>
>> $CATALINA_HOME/conf/context.xml
>
> Technically speaking, I think that's the default local environment, not
> the global environment. You can define <Environment> entries at the
> <Server> level in server.xml which would be truly "global". It's all
> semantics for this discussion and shouldn't impact this case.
>
>> <Environment name="/propertiesFileName"
>> value="classpath:test-application.properties" type="java.lang.String"
>> override="true"/>
>
>> This has worked fine for lots of applications, but last week it
>> started failing for one application when it was redeployed. This
>> results in the application failing to start.
>
>> The error message below suggests that the environment value cannot be
>> found.
>
>> Tomcat 6.0.29 log output:
>
>> 2010-12-08 19:27:24,674 DEBUG ** Invoking afterPropertiesSet() on bean
>
>> with name 'propsFileName' **
>
> 'propsFileName' != 'propertiesFileName'
>
> Are you sure you're looking at the right configuration file?
>
>> org.springframework.beans.factory.BeanCreationException: Error
>> creating bean with name 'propsFileName': Invocation of init method
>> failed; nested exception is javax.naming.NameNotFoundException: Name
>> propertiesFileName is not bound in this Context
>
> Perhaps propsFileName is bound, but not propertiesFileName.
>
>> Spring application web.xml
>
>> <context-param>
>> <param-name>contextConfigLocation</param-name>
>> <param-value>
>> classpath:applicationContext-shared.xml
>> </param-value>
>> </context-param>
>
>> <listener>
>
>> <listener-class>org.springframework.web.context.ContextLoaderListener<
>> /l
>> istener-class>
>> </listener>
>
>> applicationContext-Shared.xml
>
>> <jee:jndi-lookup id="propsFileName" jndi-name="propertiesFileName"
>> />
>
>> <bean
>> class="org.springframework.beans.factory.config.PropertyPlaceholderCon
>> fi
>> gurer">
>> <property name="location" ref="propsFileName"/>
>> </bean>
>
> I don't see where the data is ultimately defined... I just see a bunch
> of references that don't point to anything. propertiesFileName ->
> propsFileName -> ???
>
> -chris
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
|