Connect RCP application to JBoss JNDI server errors. [message #205743] |
Thu, 04 March 2004 01:35  |
Eclipse User |
|
|
|
Originally posted by: scttu.hotmail.com
I get the class not found exception whenever i try to connect to JBoss JNDI
server from my RCP application. Can someone show me how to do it correctly.
Any helps are very much appreciated.
Thanks
Regards,
Stephen
private Context getContext() throws NamingException{
Context ctx = null;
try{
Properties props = new Properties();
props.setProperty(Context.PROVIDER_URL,"jnp://172.16.0.112:1099" );
props.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
props.setProperty(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfa
ces");
ctx = new InitialContext(props);
}catch(NamingException e){
throw e;
}
return ctx;
}
in my plugin.xml descriptor file i have the following entry
<runtime>
<library name="sy-rcp.jar">
<export name="*"/>
</library>
<library name="lib/jbossall-client.jar/>
<library name="lib/jnp-client.jar">
<export name="*"/>
</library>
<library name="lib/commons-lang.jar"/>
<library name="lib/commons-beanutils.jar"/>
<library name="lib/commons-logging.jar"/>
<library name="lib/j2ee.jar"/>
</runtime>
javax.naming.NoInitialContextException: Cannot instantiate class:
org.jnp.interfaces.NamingContextFactory [Root exception is
java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.init(Unknown Source)
at javax.naming.InitialContext.<init>(Unknown Source)
at
my.com.shinyang.ui.views.LogReceivingSearchView.getContext(L ogReceivingSearc
hView.java:111)
at
my.com.shinyang.ui.views.LogReceivingSearchView.access$0(Log ReceivingSearchV
iew.java:100)
at
my.com.shinyang.ui.views.LogReceivingSearchView$2.run(LogRec eivingSearchView
..java:64)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:881 )
at
org.eclipse.ui.actions.RetargetAction.runWithEvent(RetargetA ction.java:212)
at
org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(Action
ContributionItem.java:538)
at
org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionI
tem.java:490)
at
org.eclipse.jface.action.ActionContributionItem$6.handleEven t(ActionContribu
tionItem.java:462)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :82)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:833)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:2348)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2029)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1550)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1526)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:265)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:139)
at my.com.shinyang.ui.MainWindow.run(MainWindow.java:26)
at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.
java:257)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:104)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.core.launcher.Main.basicRun(Main.java:279)
at org.eclipse.core.launcher.Main.run(Main.java:742)
at org.eclipse.core.launcher.Main.main(Main.java:581)
Caused by: java.lang.ClassNotFoundException:
org.jnp.interfaces.NamingContextFactory
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)
.... 30 more
|
|
|
Re: Connect RCP application to JBoss JNDI server errors. [message #206522 is a reply to message #205743] |
Fri, 05 March 2004 08:57  |
Eclipse User |
|
|
|
Originally posted by: ifedorenko.rogers.com
Stephen,
Set thread context classloader to your plugin classloader using
something like:
ClassLoader orig = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setConextClassLoader(YourPlugin.class .getCLassLoader());
... do your JDNI things here
} finally
Thread.currentThread().setConextClassLoader(orig);
}
Stephen wrote:
> I get the class not found exception whenever i try to connect to JBoss JNDI
> server from my RCP application. Can someone show me how to do it correctly.
>
> Any helps are very much appreciated.
>
> Thanks
>
> Regards,
> Stephen
>
> private Context getContext() throws NamingException{
> Context ctx = null;
> try{
> Properties props = new Properties();
> props.setProperty(Context.PROVIDER_URL,"jnp://172.16.0.112:1099" );
> props.setProperty(Context.INITIAL_CONTEXT_FACTORY,
> "org.jnp.interfaces.NamingContextFactory");
>
> props.setProperty(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfa
> ces");
> ctx = new InitialContext(props);
> }catch(NamingException e){
> throw e;
> }
> return ctx;
> }
>
> in my plugin.xml descriptor file i have the following entry
>
> <runtime>
> <library name="sy-rcp.jar">
> <export name="*"/>
> </library>
> <library name="lib/jbossall-client.jar/>
> <library name="lib/jnp-client.jar">
> <export name="*"/>
> </library>
>
> <library name="lib/commons-lang.jar"/>
> <library name="lib/commons-beanutils.jar"/>
> <library name="lib/commons-logging.jar"/>
> <library name="lib/j2ee.jar"/>
> </runtime>
>
>
> javax.naming.NoInitialContextException: Cannot instantiate class:
> org.jnp.interfaces.NamingContextFactory [Root exception is
> java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]
> at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
> at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
> at javax.naming.InitialContext.init(Unknown Source)
> at javax.naming.InitialContext.<init>(Unknown Source)
> at
> my.com.shinyang.ui.views.LogReceivingSearchView.getContext(L ogReceivingSearc
> hView.java:111)
> at
> my.com.shinyang.ui.views.LogReceivingSearchView.access$0(Log ReceivingSearchV
> iew.java:100)
> at
> my.com.shinyang.ui.views.LogReceivingSearchView$2.run(LogRec eivingSearchView
> .java:64)
> at org.eclipse.jface.action.Action.runWithEvent(Action.java:881 )
> at
> org.eclipse.ui.actions.RetargetAction.runWithEvent(RetargetA ction.java:212)
> at
> org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(Action
> ContributionItem.java:538)
> at
> org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionI
> tem.java:490)
> at
> org.eclipse.jface.action.ActionContributionItem$6.handleEven t(ActionContribu
> tionItem.java:462)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :82)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:833)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:2348)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2029)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1550)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1526)
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:265)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:139)
> at my.com.shinyang.ui.MainWindow.run(MainWindow.java:26)
> at
> org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.
> java:257)
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:104)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at org.eclipse.core.launcher.Main.basicRun(Main.java:279)
> at org.eclipse.core.launcher.Main.run(Main.java:742)
> at org.eclipse.core.launcher.Main.main(Main.java:581)
> Caused by: java.lang.ClassNotFoundException:
> org.jnp.interfaces.NamingContextFactory
> at java.net.URLClassLoader$1.run(Unknown Source)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(Unknown Source)
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at java.lang.ClassLoader.loadClassInternal(Unknown Source)
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Unknown Source)
> at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)
> ... 30 more
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.04078 seconds