[plugin] problem creating javax.naming.InitialContext in a plubin [message #39524] |
Wed, 26 December 2001 18:01 |
Eclipse User |
|
|
|
Originally posted by: mirko.tonia.ch
i'm trying to access a openjms server from within a eclipse plugin.
the code for initializing a TopicSubscriber works fine in a standalone app
but fails
within the plugin.
in my class "JmsView" (extends ViewPart) (implements MessageListener)
i init the jms connection with the following code
....
static final String url = "rmi://www.zilch.ch:1099/JndiServer";
static final String modeType =
"org.exolab.jms.jndi.rmi.RmiJndiInitialContextFactory";
//static final String modeType =
"org.exolab.jms.jndi.http.HttpJndiInitialContextFactory";
static final String FACTORY = "JmsTopicConnectionFactory";
static final String TOPIC = "imgserv";
TopicConnectionFactory tcf = null;
TopicConnection tconnection = null;
TopicSession tsession = null;
TopicSubscriber tsubscriber = null;
public void init(IViewSite site) throws PartInitException {
super.init(site);
msg = "jms view";
try {
Hashtable props = new Hashtable();
props.put(Context.PROVIDER_URL, url);
props.put(Context.INITIAL_CONTEXT_FACTORY, modeType);
Context context = new InitialContext(props);
tcf = (TopicConnectionFactory)context.lookup(FACTORY);
System.out.println(tcf);
tconnection = tcf.createTopicConnection();
tsession = tconnection.createTopicSession(false,
Session.AUTO_ACKNOWLEDGE);
Topic topic = (Topic)context.lookup(TOPIC);
tsubscriber = tsession.createSubscriber(topic);
tsubscriber.setMessageListener(this);
tconnection.start();
} catch (Exception e) {
e.printStackTrace();
throw new PartInitException("jms not inited", e);
}
}
i added the following main method for testing and it works fine
public static void main(String[] args) throws Exception {
JmsView jv = new JmsView();
j v.init(null);
System.out.println(jv);
}
but wenn i run in runtime-workbench i get the following stacktrace form the
e.printStackTrace() above
the mentioned class "org.exolab.jms.jndi.rmi.RmiJndiInitialContextFactory"
is in the classpath of the plugin (i added the
corresponging jar file in plugin.xml with
<library name="exolabcore-0.3.3.jar">
<export name="*" />
</library>
<library name="jms_1.0.2a.jar">
<export name="*" />
</library>
<library name="openjms-client-0.7.3.1.jar">
<export name="*" />
</library>
<library name="openjms-rmi-0.7.3.1.jar">
<export name="*" />
</library>
javax.naming.NoInitialContextException: Cannot instantiate class:
org.exolab.jms.jndi.rmi.RmiJndiInitialContextFactory. Root exception is
java.lang.ClassNotFoundException:
org.exolab.jms.jndi.rmi.RmiJndiInitialContextFactory
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)
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 ch.zilch.eclipse.hello2.views.JmsView.init(JmsView.java:52)
at org.eclipse.ui.part.ViewPart.init(ViewPart.java:78)
at org.eclipse.ui.internal.ViewFactory$2.run(ViewFactory.java:1 24)
at
org.eclipse.core.internal.runtime.InternalPlatform.run(Inter nalPlatform.java
:852)
at org.eclipse.core.runtime.Platform.run(Platform.java:413)
at org.eclipse.ui.internal.ViewFactory.busyRestoreView(ViewFact ory.java:93)
at org.eclipse.ui.internal.ViewFactory$1.run(ViewFactory.java:7 7)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:65)
at org.eclipse.ui.internal.ViewFactory.restoreView(ViewFactory. java:73)
at org.eclipse.ui.internal.Perspective.showView(Perspective.jav a:1348)
at
org.eclipse.ui.internal.WorkbenchPage.busyShowView(Workbench Page.java:579)
at org.eclipse.ui.internal.WorkbenchPage.access$8(WorkbenchPage .java:558)
at org.eclipse.ui.internal.WorkbenchPage$12.run(WorkbenchPage.j ava:2540)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:65)
at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage .java:2537)
at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage .java:2527)
at org.eclipse.ui.internal.ShowViewMenu.showOther(ShowViewMenu. java:181)
at org.eclipse.ui.internal.ShowViewMenu.access$2(ShowViewMenu.j ava:167)
at org.eclipse.ui.internal.ShowViewMenu$2.run(ShowViewMenu.java :41)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:769 )
at
org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(Action
ContributionItem.java:411)
at
org.eclipse.jface.action.ActionContributionItem.handleWidget Event(ActionCont
ributionItem.java:365)
at
org.eclipse.jface.action.ActionContributionItem.access$0(Act ionContributionI
tem.java:356)
at
org.eclipse.jface.action.ActionContributionItem$ActionListen er.handleEvent(A
ctionContributionItem.java:48)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :77)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:825)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:1692)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :1410)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1446)
at org.eclipse.ui.internal.Workbench.run(Workbench.java:1429)
at
org.eclipse.core.internal.boot.InternalBootLoader.run(Intern alBootLoader.jav
a:845)
at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462)
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:247)
at org.eclipse.core.launcher.Main.run(Main.java:703)
at org.eclipse.core.launcher.Main.main(Main.java:539)
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04260 seconds