I have managed to trace it to the invokeMethod method of  
org.jboss.cache.TreeCache. It seems that the interceptor_chain variable is 
null. I am using exactly the same method to initialize the TreeCache instance 
(i.e. constructing an InputStream from a the XML resource for the configuration 
and passing it and the TreeCache instance to an instance of 
PropertyConfigurator)

When using the TreeCache outside of the Eclipse application, the 
interceptor_chain variable is initialized to an instance of 
org.jboss.cache.interceptors.CreateIfNotExistsInterceptor. When using it inside 
of an Eclipse application this initialization is not occuring. 

I enabled some additional logging trapped the following exception when starting 
the TreeCache service.

Mar 9, 2005 8:00:03 AM com.amaranth.cache.DefaultCacheFactory 
SEVERE: org.jboss.cache.DummyTransactionManagerLookup
java.lang.ClassNotFoundException: org.jboss.cache.DummyTransactionManagerLookup
        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 org.jboss.cache.TreeCache.startService(TreeCache.java:1040)
        at com.amaranth.cache.DefaultCacheFactory.(DefaultCacheFactory.java:51)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown 
Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at java.lang.Class.newInstance0(Unknown Source)
        at java.lang.Class.newInstance(Unknown Source)
        at 
org.apache.commons.discovery.tools.ClassUtils.newInstance(ClassUtils.java:157)
        at 
org.apache.commons.discovery.tools.SPInterface.newInstance(SPInterface.java:197)
        at 
org.apache.commons.discovery.tools.DiscoverClass.newInstance(DiscoverClass.java:579)
        at 
org.apache.commons.discovery.tools.DiscoverSingleton.find(DiscoverSingleton.java:418)
        at 
org.apache.commons.discovery.tools.DiscoverSingleton.find(DiscoverSingleton.java:272)
        at 
com.amaranth.commodity.factory.SimpleCommodityFactory.getCacheFactory(SimpleCommodityFactory.java:202)
        at 
com.amaranth.commodity.factory.SimpleCommodityFactory.init(SimpleCommodityFactory.java:48)
        at 
com.amaranth.commodity.factory.SimpleCommodityFactory.(SimpleCommodityFactory.java:44)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown 
Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at java.lang.Class.newInstance0(Unknown Source)
        at java.lang.Class.newInstance(Unknown Source)
        at 
org.apache.commons.discovery.tools.ClassUtils.newInstance(ClassUtils.java:157)
        at 
org.apache.commons.discovery.tools.SPInterface.newInstance(SPInterface.java:197)
        at 
org.apache.commons.discovery.tools.DiscoverClass.newInstance(DiscoverClass.java:579)
        at 
org.apache.commons.discovery.tools.DiscoverSingleton.find(DiscoverSingleton.java:418)
        at 
org.apache.commons.discovery.tools.DiscoverSingleton.find(DiscoverSingleton.java:272)
        at 
com.amaranth.energy.workbench.rcp.CommodityView$ViewContentProvider.getElements(CommodityView.java:45)
        at 
org.eclipse.jface.viewers.StructuredViewer.getRawChildren(StructuredViewer.java:766)
        at 
org.eclipse.jface.viewers.AbstractTreeViewer.getRawChildren(AbstractTreeViewer.java:747)
        at 
org.eclipse.jface.viewers.StructuredViewer.getFilteredChildren(StructuredViewer.java:708)
        at 
org.eclipse.jface.viewers.StructuredViewer.getSortedChildren(StructuredViewer.java:823)
        at 
org.eclipse.jface.viewers.AbstractTreeViewer$1.run(AbstractTreeViewer.java:381)
        at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
        at 
org.eclipse.jface.viewers.AbstractTreeViewer.createChildren(AbstractTreeViewer.java:363)
        at 
org.eclipse.jface.viewers.AbstractTreeViewer$5.run(AbstractTreeViewer.java:834)
        at 
org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1109)
        at 
org.eclipse.jface.viewers.AbstractTreeViewer.inputChanged(AbstractTreeViewer.java:824)
        at 
org.eclipse.jface.viewers.ContentViewer.setInput(ContentViewer.java:248)
        at 
org.eclipse.jface.viewers.StructuredViewer.setInput(StructuredViewer.java:1323)
        at 
com.amaranth.energy.workbench.rcp.CommodityView.createPartControl(CommodityView.java:98)
        at org.eclipse.ui.internal.PartPane$2.run(PartPane.java:148)
        at 
org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:1015)
        at org.eclipse.core.runtime.Platform.run(Platform.java:757)
        at 
org.eclipse.ui.internal.PartPane.doCreateChildControl(PartPane.java:144)
        at 
org.eclipse.ui.internal.ViewPane.doCreateChildControl(ViewPane.java:135)
        at 
org.eclipse.ui.internal.PartPane.createChildControl(PartPane.java:349)
        at org.eclipse.ui.internal.ViewFactory$1.run(ViewFactory.java:405)
        at 
org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:1015)
        at org.eclipse.core.runtime.Platform.run(Platform.java:757)
        at 
org.eclipse.ui.internal.ViewFactory.busyRestoreView(ViewFactory.java:289)
        at org.eclipse.ui.internal.ViewFactory$2.run(ViewFactory.java:589)
        at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
        at org.eclipse.ui.internal.ViewFactory.restoreView(ViewFactory.java:586)
        at 
org.eclipse.ui.internal.ViewFactory$ViewReference.getPart(ViewFactory.java:108)
        at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:329)
        at org.eclipse.ui.internal.ViewPane.setVisible(ViewPane.java:607)
        at 
org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:126)
        at 
org.eclipse.ui.internal.presentations.newapi.PresentablePartFolder.select(PresentablePartFolder.java:266)
        at 
org.eclipse.ui.internal.presentations.newapi.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)
        at 
org.eclipse.ui.internal.presentations.newapi.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:381)
        at 
org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1051)
        at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1009)
        at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:1200)
        at org.eclipse.ui.internal.PartStack.createControl(PartStack.java:521)
        at org.eclipse.ui.internal.PartStack.createControl(PartStack.java:473)
        at 
org.eclipse.ui.internal.PartSashContainer.createControl(PartSashContainer.java:485)
        at 
org.eclipse.ui.internal.PerspectiveHelper.activate(PerspectiveHelper.java:230)
        at org.eclipse.ui.internal.Perspective.onActivate(Perspective.java:777)
        at 
org.eclipse.ui.internal.WorkbenchPage.onActivate(WorkbenchPage.java:2133)
        at 
org.eclipse.ui.internal.WorkbenchWindow$4.run(WorkbenchWindow.java:2235)
        at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
        at 
org.eclipse.ui.internal.WorkbenchWindow.setActivePage(WorkbenchWindow.java:2221)
        at 
org.eclipse.ui.internal.WorkbenchWindow.busyOpenPage(WorkbenchWindow.java:572)
        at 
org.eclipse.ui.internal.Workbench.busyOpenWorkbenchWindow(Workbench.java:587)
        at 
org.eclipse.ui.internal.Workbench.openFirstTimeWindow(Workbench.java:1209)
        at 
org.eclipse.ui.internal.WorkbenchConfigurer.openFirstTimeWindow(WorkbenchConfigurer.java:178)
        at 
org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:717)
        at org.eclipse.ui.internal.Workbench.init(Workbench.java:918)
        at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1554)
        at 
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:293)
        at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:144)
        at 
com.amaranth.energy.workbench.rcp.WorkbenchApplication.run(WorkbenchApplication.java:21)
        at 
org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:228)
        at 
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:333)
        at 
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:150)
        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.invokeFramework(Main.java:268)
        at org.eclipse.core.launcher.Main.basicRun(Main.java:260)
        at org.eclipse.core.launcher.Main.run(Main.java:887)
        at org.eclipse.core.launcher.Main.main(Main.java:871)

The Thread.currentThread().getContextClassLoader() is an instance of 
sun.misc.Launcher$AppClassLoader which is just contains the Eclipse launcher's 
jar (eclipse/startup.jar)

The class loader that should be associated with classes, and is associated with 
both the TreeCache and PropertyConfigurator instance, is an instance of 
org.eclipse.core.runtime.adaptor.EclipseClassLoader that contains the classpath 
of all of the jars in the bundled application.

I guess I'll have to dig a bit deeper into Eclipse to determine classloading 
dependencies during start-up.

In the meantime, the following code snippet around seems to work around the 
problem.

ClassLoader cl = Thread.currentThread().getContextClassLoader();
         
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
this.tc.startService();
Thread.currentThread().setContextClassLoader(cl);

Where this.tc is the TreeCache instance.


View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3869365#3869365

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3869365


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
JBoss-Development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to