karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Justin Nichols (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (KARAF-3445) JNDI can not init in web application
Date Tue, 02 Jun 2015 15:27:25 GMT

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

Mime
View raw message