You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by padma T <pa...@gmail.com> on 2016/11/04 10:45:52 UTC

JNDI lookup failure with tomcat 8.5.6

Hi,

Getting ,JNDI lookup failed exception while starting tomcat 8.

While debugging it was found that getInitialContext()
of org.apache.naming.java.javaURLContextFactory class returns NamingContext
context instead of the custom ContextClassLoader set by our application
 and the reason is "ContextBindings.isClassLoaderBound()"  return false for
application's custom ContextClassLoader.

Code to set custom contextloader :

Thread.currentThread().setContextClassLoader(classLoader);


Please let me know if i have to do any configurations for tomcat 8, to
resolve this issue .


Note : Our application start fine with tomcat 7.

Re: JNDI lookup failure with tomcat 8.5.6

Posted by padma T <pa...@gmail.com>.
Hi,

Is there a way to add our application's contextclassloader to the list of
tomcat's " Bindings class loader list "  so that
"ContextBindings.isClassLoaderBound()"
returns true?

Please correct me if i'm wrong in understanding the problem!!

Thanks,
Padma

On Fri, Nov 4, 2016 at 4:16 PM, Mark Thomas <ma...@apache.org> wrote:

> On 04/11/2016 10:45, padma T wrote:
> > Hi,
> >
> > Getting ,JNDI lookup failed exception while starting tomcat 8.
> >
> > While debugging it was found that getInitialContext()
> > of org.apache.naming.java.javaURLContextFactory class returns
> NamingContext
> > context instead of the custom ContextClassLoader set by our application
> >  and the reason is "ContextBindings.isClassLoaderBound()"  return false
> for
> > application's custom ContextClassLoader.
> >
> > Code to set custom contextloader :
> >
> > Thread.currentThread().setContextClassLoader(classLoader);
> >
> >
> > Please let me know if i have to do any configurations for tomcat 8, to
> > resolve this issue .
>
> Any custom class loader needs to have the web application class loader
> as a parent to pick up JNDI resources.
>
> Mark
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: JNDI lookup failure with tomcat 8.5.6

Posted by padma T <pa...@gmail.com>.
Hi Mark,

Thanks for your quick reply .

Sorry to bug you , I didn't get you. Will you please explain a bit on how
to make the custom loader as parent (any configuration changes )?

Thanks & Regards,
Padma


On Fri, Nov 4, 2016 at 4:16 PM, Mark Thomas <ma...@apache.org> wrote:

> On 04/11/2016 10:45, padma T wrote:
> > Hi,
> >
> > Getting ,JNDI lookup failed exception while starting tomcat 8.
> >
> > While debugging it was found that getInitialContext()
> > of org.apache.naming.java.javaURLContextFactory class returns
> NamingContext
> > context instead of the custom ContextClassLoader set by our application
> >  and the reason is "ContextBindings.isClassLoaderBound()"  return false
> for
> > application's custom ContextClassLoader.
> >
> > Code to set custom contextloader :
> >
> > Thread.currentThread().setContextClassLoader(classLoader);
> >
> >
> > Please let me know if i have to do any configurations for tomcat 8, to
> > resolve this issue .
>
> Any custom class loader needs to have the web application class loader
> as a parent to pick up JNDI resources.
>
> Mark
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: JNDI lookup failure with tomcat 8.5.6

Posted by Mark Thomas <ma...@apache.org>.
On 04/11/2016 10:45, padma T wrote:
> Hi,
> 
> Getting ,JNDI lookup failed exception while starting tomcat 8.
> 
> While debugging it was found that getInitialContext()
> of org.apache.naming.java.javaURLContextFactory class returns NamingContext
> context instead of the custom ContextClassLoader set by our application
>  and the reason is "ContextBindings.isClassLoaderBound()"  return false for
> application's custom ContextClassLoader.
> 
> Code to set custom contextloader :
> 
> Thread.currentThread().setContextClassLoader(classLoader);
> 
> 
> Please let me know if i have to do any configurations for tomcat 8, to
> resolve this issue .

Any custom class loader needs to have the web application class loader
as a parent to pick up JNDI resources.

Mark


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