You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Justin Nichols (JIRA)" <ji...@apache.org> on 2015/06/02 17:27:25 UTC

[jira] [Comment Edited] (KARAF-3445) JNDI can not init in web application

    [ https://issues.apache.org/jira/browse/KARAF-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14569263#comment-14569263 ] 

Justin Nichols edited comment on KARAF-3445 at 6/2/15 3:27 PM:
---------------------------------------------------------------

Here is a workaround:

http://mail-archives.apache.org/mod_mbox/karaf-user/201408.mbox/%3C1407791611830-4034697.post@n3.nabble.com%3E

{code:java}
ClassLoader cl = Thread.currentThread().getContextClassLoader();

Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
try {
    cxt = new InitialContext();
}
finally {
    Thread.currentThread().setContextClassLoader(cl);
}
{code}


was (Author: ulkesh):
Here is a workaround:

http://mail-archives.apache.org/mod_mbox/karaf-user/201408.mbox/%3C1407791611830-4034697.post@n3.nabble.com%3E

                 ClassLoader cl = Thread.currentThread().getContextClassLoader();
               
                Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
                try {
                    cxt = new InitialContext();
                }
                finally {
                    Thread.currentThread().setContextClassLoader(cl);
                }

> JNDI can not init in web application
> ------------------------------------
>
>                 Key: KARAF-3445
>                 URL: https://issues.apache.org/jira/browse/KARAF-3445
>             Project: Karaf
>          Issue Type: Bug
>    Affects Versions: 3.0.2
>         Environment: web application
>            Reporter: mathews ma
>            Priority: Critical
>
> please check the log:
> javax.naming.NoInitialContextException: Unable to find the InitialContextFactory org.eclipse.jetty.jndi.InitialContextFactory.
> 	at org.apache.aries.jndi.ContextHelper.getInitialContext(ContextHelper.java:148)
> 	at org.apache.aries.jndi.OSGiInitialContextFactoryBuilder.getInitialContext(OSGiInitialContextFactoryBuilder.java:49)
> 	at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
> 	at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)[:1.6.0_37]
> 	at javax.naming.InitialContext.init(InitialContext.java:223)[:1.6.0_37]
> 	at javax.naming.InitialContext.<init>(InitialContext.java:175)[:1.6.0_37]



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)