JNDI within Plugins? [message #247263] |
Sat, 29 May 2004 16:56  |
Eclipse User |
|
|
|
Originally posted by: hani.naguib.info
Hi I am creating a plugin to administer a J2EE server and am running
into some classpath issues which I am findind hard to resolve. I hope
someone here may be able to help me. Thanks in advance.
My J2EE application is running under Weblogic and has a session bean
called MyServerBean
I have a class in my plugin which is meant to act as a model to this
bean calles MyServerModel. To initialize itself it has to talk to my
bean and get some information, here is where I am having problems.
I get access to the bean through a JNDI lookup:
Hashtable props = new Hashtable();
props.put("java.naming.factory.initial","weblogic.jndi.WLInitialContextFactory ");
props.put("java.naming.provider.url","t3://localhost:7001/");
InitialContext ctx = new InitialContext(props);
But when I try to do this I get a:
----
javax.naming.NoInitialContextException:
Cannot instantiate class:
weblogic.jndi.WLInitialContextFactory
----
BUT
1- I have placed Weblogic's client library in the plugin
2- Tried putting it in my machines CLASSPATH
2- I can even do this:
Class.forName("weblogic.jndi.WLInitialContextFactory");
So the class is there, but I suspect that JNDI looks it up in a strange way.
Has anyone run into this problem? Am I missing something trivial?
Thanks everyone
Hani
|
|
|
Re: JNDI within Plugins? [message #247268 is a reply to message #247263] |
Sat, 29 May 2004 17:20  |
Eclipse User |
|
|
|
Originally posted by: hani.naguib.info
Ok I found the solution, actually presented on another thread
by Igor Fedorento (Re: Connect RCP application to JBoss JNDI server errors)
Basically when I do the look up I need to set the current thread's classloader to
that of my plugin
hani@naguib.info wrote:
> Hi I am creating a plugin to administer a J2EE server and am running
> into some classpath issues which I am findind hard to resolve. I hope
> someone here may be able to help me. Thanks in advance.
>
> My J2EE application is running under Weblogic and has a session bean
> called MyServerBean
>
> I have a class in my plugin which is meant to act as a model to this
> bean calles MyServerModel. To initialize itself it has to talk to my
> bean and get some information, here is where I am having problems.
>
> I get access to the bean through a JNDI lookup:
> Hashtable props = new Hashtable();
> props.put("java.naming.factory.initial","weblogic.jndi.WLInitialContextFactory ");
>
> props.put("java.naming.provider.url","t3://localhost:7001/");
> InitialContext ctx = new InitialContext(props);
>
> But when I try to do this I get a:
> ----
> javax.naming.NoInitialContextException:
> Cannot instantiate class:
> weblogic.jndi.WLInitialContextFactory
> ----
>
> BUT
> 1- I have placed Weblogic's client library in the plugin
> 2- Tried putting it in my machines CLASSPATH
> 2- I can even do this:
> Class.forName("weblogic.jndi.WLInitialContextFactory");
> So the class is there, but I suspect that JNDI looks it up in a strange
> way.
>
> Has anyone run into this problem? Am I missing something trivial?
>
> Thanks everyone
> Hani
|
|
|
Powered by
FUDForum. Page generated in 0.02966 seconds