Following situation:
At work we have an own plugin that extends some JDT features and builds some helper functions for our own framework. So far so good.
The plugin includes following class:
public class MoxLogFactory extends org.apache.commons.logging.LogFactory {
...
}
(I left out the concrete implementation because it's really comprehensive)
Now I added the WindowBuilder-Plugin to my eclipse installation. I can create new projects and classes with the wizards included. But the main feature - the editor himself - isn't working. It comes out, that the WindowBuilder tries to load the class "MoxLogFactory" from our plugin! I attached the stacktrace which comes up if I open the editor:
java.lang.ClassNotFoundException: org.dreamox.moxanos.log.MoxLogFactory
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.apache.commons.logging.LogFactory.createFactory(LogFactory.java:1261)
at org.apache.commons.logging.LogFactory$2.run(LogFactory.java:1065)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.commons.logging.LogFactory.newFactory(LogFactory.java:1062)
at org.apache.commons.logging.LogFactory.getFactory(LogFactory.java:497)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:704)
at org.apache.commons.digester.Digester.<init>(Digester.java:340)
at org.eclipse.wb.internal.core.model.description.helpers.ComponentDescriptionHelper.getDescription0(ComponentDescriptionHelper.java:375)
at org.eclipse.wb.internal.core.model.description.helpers.ComponentDescriptionHelper.getDescription0(ComponentDescriptionHelper.java:289)
at org.eclipse.wb.internal.core.model.description.helpers.ComponentDescriptionHelper.getDescription(ComponentDescriptionHelper.java:258)
at org.eclipse.wb.internal.core.model.JavaInfoUtils.createJavaInfo(JavaInfoUtils.java:386)
at org.eclipse.wb.internal.rcp.parser.ParseFactory.getRootContext(ParseFactory.java:184)
at org.eclipse.wb.internal.core.parser.JavaInfoParser.prepareParseContext(JavaInfoParser.java:1185)
at org.eclipse.wb.internal.core.parser.JavaInfoParser.parse(JavaInfoParser.java:244)
at org.eclipse.wb.internal.core.parser.JavaInfoParser.access$9(JavaInfoParser.java:240)
at org.eclipse.wb.internal.core.parser.JavaInfoParser$1.runObject(JavaInfoParser.java:153)
at org.eclipse.wb.internal.core.parser.JavaInfoParser$1.runObject(JavaInfoParser.java:1)
at org.eclipse.wb.internal.core.utils.execution.ExecutionUtils.runDesignTime(ExecutionUtils.java:153)
at org.eclipse.wb.internal.core.parser.JavaInfoParser.parse(JavaInfoParser.java:151)
at org.eclipse.wb.internal.core.editor.DesignPage.internal_refreshGEF(DesignPage.java:522)
at org.eclipse.wb.internal.core.editor.DesignPage.access$9(DesignPage.java:510)
at org.eclipse.wb.internal.core.editor.DesignPage$8$1.run(DesignPage.java:437)
at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:180)
at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
at org.eclipse.swt.widgets.Display.syncExec(Display.java:4683)
at org.eclipse.wb.internal.core.editor.DesignPage$8.run(DesignPage.java:434)
at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464)
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372)
at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:507)
at org.eclipse.wb.internal.core.editor.DesignPage.internal_refreshGEF_withProgress(DesignPage.java:453)
at org.eclipse.wb.internal.core.editor.DesignPage.internal_refreshGEF(DesignPage.java:403)
at org.eclipse.wb.internal.core.editor.UndoManager.refreshDesignerEditor(UndoManager.java:381)
at org.eclipse.wb.internal.core.editor.UndoManager.activate(UndoManager.java:90)
at org.eclipse.wb.internal.core.editor.DesignPage.handleActiveState_True(DesignPage.java:251)
at org.eclipse.wb.internal.core.editor.DesignPage.handleActiveState(DesignPage.java:229)
at org.eclipse.wb.internal.core.editor.multi.DefaultMultiMode.showPage(DefaultMultiMode.java:125)
at org.eclipse.wb.internal.core.editor.multi.DefaultMultiMode$1.widgetSelected(DefaultMultiMode.java:63)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:240)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:774)
at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:2746)
at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:1433)
at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:257)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:999)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:893)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:85)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:579)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:534)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:352)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
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.equinox.launcher.Main.invokeFramework(Main.java:624)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:579)
at org.eclipse.equinox.launcher.Main.run(Main.java:1433)
at org.eclipse.equinox.launcher.Main.main(Main.java:1409)
Our plugin doesn't export anything, so why is the WindowBuilder trying to load a class from it? Where do it gets the information to load this class? If I uninstall our plugin the WindowBuilder works fine, but I need both plugins to work efficiently.
I found, that in MoxLogFactory in one static method there is a line
System.setProperty("org.apache.commons.logging.LogFactory","org.dreamox.moxanos.log.MoxLogFactory");
I thought every plugin runs in a sandbox and so this isn't really a problem, but when I see the stacktrace, it seems, that this system property is "global in eclipse". The MoxLogFactory class is also used in our application server framework so this code is needed - the plugin uses the framework itself to work.
I don't know how to solve this problem and would appreciate any hint or idea.
Here are some options:
Remove that static initialization of the JVM level system property and replace it by a command line option only when needed
In your static initializer, test Eclipse execution context by asking the ClassLoader for org.eclipse.equinox.launcher.Main class for instance, and if so, do not set the logfactory property
System properties belong to the JVM, not to a class loader. By setting your logger as a System property, presumably so that it will be loaded automatically, you have told the entire system to use it. When the other plugin loads and attempts to initialize its logging (which appears to also use Apache Commons Logging), it reads the System property, attempts to load the class found therein, and promptly fails because it cannot see into your plugin.
Related
I am developing a plugin for Eclipse Kepler. Adding #RunWith(JMockit.class) to my test class causes the following error:
JMockit: Reinitializing under custom class loader org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader#b7ccec1[com.mypackage.myclass:2.3.9.201508161221(id=1)]
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:382)
at sun.instrument.InstrumentationImpl.loadClassAndCallAgentmain(InstrumentationImpl.java:407)
Caused by: java.lang.VerifyError
at sun.instrument.InstrumentationImpl.redefineClasses0(Native Method)
at sun.instrument.InstrumentationImpl.redefineClasses(InstrumentationImpl.java:170)
at mockit.internal.startup.Startup.redefineMethods(Startup.java:242)
at mockit.internal.startup.Startup.redefineMethods(Startup.java:236)
at mockit.internal.mockups.MockClassSetup.applyClassModifications(MockClassSetup.java:134)
at mockit.internal.mockups.MockClassSetup.redefineMethodsInClassHierarchy(MockClassSetup.java:91)
at mockit.internal.mockups.MockClassSetup.redefineMethods(MockClassSetup.java:76)
at mockit.MockUp.redefineMethods(MockUp.java:240)
at mockit.MockUp.redefineClassOrImplementInterface(MockUp.java:222)
at mockit.MockUp.<init>(MockUp.java:131)
at mockit.integration.junit4.internal.RunNotifierDecorator.<init>(RunNotifierDecorator.java:21)
at mockit.internal.startup.JMockitInitialization.loadInternalStartupMocksForJUnitIntegration(JMockitInitialization.java:42)
at mockit.internal.startup.JMockitInitialization.initialize(JMockitInitialization.java:27)
at mockit.internal.startup.Startup.applyStartupMocks(Startup.java:72)
at mockit.internal.startup.Startup.reapplyStartupMocks(Startup.java:124)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at mockit.internal.util.MethodReflection.invoke(MethodReflection.java:94)
at mockit.internal.util.MethodReflection.invoke(MethodReflection.java:159)
at mockit.internal.startup.Startup.reinitializeJMockitUnderCustomClassLoader(Startup.java:118)
at mockit.internal.startup.Startup.agentmain(Startup.java:101)
... 6 more
java.lang.IllegalStateException: com.sun.tools.attach.AgentInitializationException: Agent JAR loaded but agent failed to initialize
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:262)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray2(ReflectionUtils.java:208)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:156)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:82)
at org.eclipse.tycho.surefire.osgibooter.OsgiSurefireBooter.run(OsgiSurefireBooter.java:91)
at org.eclipse.tycho.surefire.osgibooter.AbstractUITestApplication$1.run(AbstractUITestApplication.java:35)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4145)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3762)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:140)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:611)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
at org.eclipse.tycho.surefire.osgibooter.UITestApplication.runApplication(UITestApplication.java:31)
at org.eclipse.tycho.surefire.osgibooter.AbstractUITestApplication.run(AbstractUITestApplication.java:120)
at org.eclipse.tycho.surefire.osgibooter.UITestApplication.start(UITestApplication.java:37)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
Caused by: com.sun.tools.attach.AgentInitializationException: Agent JAR loaded but agent failed to initialize
... 39 more
Am I doing something wrong or it is a JMockIt bug? I am using version JMockIt 1.18, JUnit 4.12
I would expect that #RunWith(JMockit.class) should have taken care of this problem.
In any case, from JMockit tutorial here, there are some notes that you should check, in case these resolve your issue. In particular, these two seem to be most relevant:
(Note for Eclipse users: when specifying the order of jars in the >classpath, make sure to use the "Order and Export" tab of the "Java Build >Path" window. Also, make sure the Eclipse project uses the JRE from a JDK >installation instead of a "plain" JRE, since the latter lacks the >"attach" native library.)
In other situations (like running on JDK implementations other than >the Oracle JDKs), you may need to pass "-javaagent:path>/jmockit.jar" as a JVM initialization parameter. This can be done in >the "Run/Debug Configuration" for both Eclipse and IntelliJ IDEA, or with >build tools such as Ant and Maven.
Right click your project in Package Explorer
click Properties.
go to Java Build Path.
Libraries tab.
click on 'Add Library' button select JUnit click Next.
You should be able to handle it from there.
After that if you use coverage as : you will be able to see the coverage.
pass the following paramter through the VM args.
-javaagent:<path>/jmockit.jar
I am making a GWT application that involves users being able to upload files. My question is...
What is wrong with GWT?? It seems like every time I try to include a jar file in my project, it doesn't like it. I am using Eclipse. Everything compiles fine, but during runtime, UmbrellaExceptions happen, which get traced back to some ClassNotFoundException eventually (relating to whatever new jarrified class I just tried to use).
I read something about this somewhere else, but I can't remember exactly what the deal is; for whatever reason GWT just isn't compatible with some libraries..? Like java.io, for example. Pretty much everything in that package causes this to happen. Like, I can't even use FileNotFoundException for simple File I/O.
Again, just to clarify: everything imports and compiles fine, but GWT doesn't want to load certain classes for some reason.
My latest problem is trying to use Apache's Tika stuff for file validation. Attempting to instantiate any of their classes such as
Metadata metadata = new Metadata();
causes
java.lang.ClassNotFoundException: org.apache.tika.metadata.Metadata
at com.google.gwt.dev.shell.CompilingClassLoader.findClass(CompilingClassLoader.java:1061)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at gwtupload.client.Uploader$10.onSubmit(Uploader.java:454)
at com.google.gwt.user.client.ui.FormPanel$SubmitEvent.dispatch(FormPanel.java:178)
at com.google.gwt.user.client.ui.FormPanel$SubmitEvent.dispatch(FormPanel.java:1)
at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
at com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40)
at com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193)
at com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88)
at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127)
at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:129)
at com.google.gwt.user.client.ui.FormPanel.fireSubmitEvent(FormPanel.java:618)
at com.google.gwt.user.client.ui.FormPanel.submit(FormPanel.java:556)
at gwtupload.client.Uploader.submit(Uploader.java:1051)
at gwtupload.client.SingleUploader$1.onClick(SingleUploader.java:141)
at com.google.gwt.event.dom.client.ClickEvent.dispatch(ClickEvent.java:54)
at com.google.gwt.event.dom.client.ClickEvent.dispatch(ClickEvent.java:1)
at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
at com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40)
at com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193)
at com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88)
at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127)
at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:129)
at com.google.gwt.event.dom.client.DomEvent.fireNativeEvent(DomEvent.java:116)
at com.google.gwt.user.client.ui.Widget.onBrowserEvent(Widget.java:177)
at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1351)
at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1307)
at sun.reflect.GeneratedMethodAccessor33.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337)
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:213)
at sun.reflect.GeneratedMethodAccessor27.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
at java.lang.Thread.run(Unknown Source)
GWT compiles your code to Javascript, which runs in the web browser. You cannot use java.io to do simple file I/O, because Javascript in the browser is not allowed to do file I/O. Almost any interesting library will access classes that are not emulated by the GWT runtime.
Further to this, the GWT runtime will not automatically include a JAR file when compiling to Javascript. You need the source code available, and you need to write the XML descriptor to include the library source in Javascript generation.
See this thread and this tutorial on extending GWT.
This is because due to the way it works, GWT has to emulate classes of the JRE.
If you want to use another class in GWT, you'll have to derive it from GWT's base classes. A few libraries exist out there which extend GWT on the client side.
On the server side, however, any library can be used.
I have plugin A which depends on Plugin B, I am trying to load a class defined in Plugin B from plugin A. And I am sure the class is in the exported packages. but I got ClassNotFoundException, did I miss any thing ?
page = (IPage) Class.forName(pageClass).newInstance();
error messages :
java.lang.ClassNotFoundException: amarsoft.dbmp.credit.web.dataobject.DOListPage
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at amarsoft.rcp.base.widgets.DefaultPageRegistry.findPage(DefaultPageRegistry.java:27)
at amarsoft.rcp.base.widgets.AbstractPageControler.showPage(AbstractPageControler.java:27)
at amarsoft.rcp.base.widgets.AbstractPageControler.showPage(AbstractPageControler.java:37)
at amarsoft.dbmp.function.ui.FunctionListPage$3.linkActivated(FunctionListPage.java:261)
at org.eclipse.ui.forms.widgets.AbstractHyperlink.handleActivate(AbstractHyperlink.java:233)
at org.eclipse.ui.forms.widgets.AbstractHyperlink.handleMouseUp(AbstractHyperlink.java:327)
at org.eclipse.ui.forms.widgets.AbstractHyperlink.access$2(AbstractHyperlink.java:311)
at org.eclipse.ui.forms.widgets.AbstractHyperlink$4.handleEvent(AbstractHyperlink.java:125)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at amarsoft.adt.rcp.ADTApplication.start(ADTApplication.java:29)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
If you Require-Bundle; pluginB from pluginA, then a Class.forName(*) should have worked. Although I'll point out that using PageClass class = new PageClass(); would also work. Why are you trying to use reflection when you can just depend on that class directly?
For the common pattern where you provide a framework behaviour that other plugins should extend by providing implementations, eclipse provides the notion of Extension Points/Extensions.
Plugin A would provide an extension point. Plugin B would list an extension for that extension point, and provide an implementation class. In this case, Plugin B requires Plugin A, not the other way around.
Then Plugin A uses org.eclipse.core.runtime.IExtensionRegistry.getConfigurationElementsFor(String) to read all of the extension contributed and org.eclipse.core.runtime.IConfigurationElement.createExecutableExtension(String) to instantiate the contributed implementations (the registry takes care of making sure the class can be instantiated).
I'm using Eclipse Helios and for every refactoring that spans multiple files it plainly fails! Nothing happens. On examining the logs here's the error that I see:
!ENTRY org.eclipse.ltk.ui.refactoring 4 10000 2011-03-13 14:15:31.842
!MESSAGE Internal Error
!STACK 0
java.lang.reflect.InvocationTargetException
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:421)
at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.run(RefactoringWizardDialog2.java:330)
at org.eclipse.ltk.ui.refactoring.RefactoringWizard.internalPerformFinish(RefactoringWizard.java:573)
at org.eclipse.ltk.ui.refactoring.UserInputWizardPage.performFinish(UserInputWizardPage.java:153)
at org.eclipse.jdt.internal.ui.refactoring.reorg.RenameTypeWizardInputPage.performFinish(RenameTypeWizardInputPage.java:144)
at org.eclipse.ltk.ui.refactoring.RefactoringWizard.performFinish(RefactoringWizard.java:646)
at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.okPressed(RefactoringWizardDialog2.java:454)
at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:472)
at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:234)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
at org.eclipse.jface.window.Window.open(Window.java:801)
at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation$1.run(RefactoringWizardOpenOperation.java:180)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.run(RefactoringWizardOpenOperation.java:192)
at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.run(RefactoringWizardOpenOperation.java:115)
at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate(RefactoringStarter.java:38)
at org.eclipse.jdt.internal.ui.refactoring.UserInterfaceStarter.activate(UserInterfaceStarter.java:62)
at org.eclipse.jdt.internal.ui.refactoring.reorg.RenameUserInterfaceStarter.activate(RenameUserInterfaceStarter.java:31)
at org.eclipse.jdt.ui.refactoring.RenameSupport.openDialog(RenameSupport.java:159)
at org.eclipse.jdt.ui.refactoring.RenameSupport.openDialog(RenameSupport.java:116)
at org.eclipse.jdt.internal.corext.refactoring.RefactoringExecutionStarter.startRenameRefactoring(RefactoringExecutionStarter.java:438)
at org.eclipse.jdt.internal.ui.refactoring.actions.RenameJavaElementAction.run(RenameJavaElementAction.java:203)
at org.eclipse.jdt.internal.ui.refactoring.actions.RenameJavaElementAction.run(RenameJavaElementAction.java:101)
at org.eclipse.jdt.ui.actions.RenameAction.run(RenameAction.java:108)
at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:274)
at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:250)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
Caused by: java.lang.NoClassDefFoundError: org/eclipse/jst/jsp/core/internal/java/search/JSPIndexManager
at org.eclipse.jst.jsp.core.internal.java.search.JSPSearchSupport.searchRunnable(JSPSearchSupport.java:424)
at org.eclipse.jst.jsp.core.internal.java.search.JSPSearchSupport.searchRunnable(JSPSearchSupport.java:349)
at org.eclipse.jst.jsp.ui.internal.java.refactoring.JSPRenameParticipant.createChangesFor(JSPRenameParticipant.java:215)
at org.eclipse.jst.jsp.ui.internal.java.refactoring.JSPRenameParticipant.createChange(JSPRenameParticipant.java:153)
at org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring.createChange(ProcessorBasedRefactoring.java:308)
at org.eclipse.ltk.core.refactoring.CreateChangeOperation.run(CreateChangeOperation.java:124)
at org.eclipse.ltk.core.refactoring.PerformChangeOperation.run(PerformChangeOperation.java:209)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
at org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:87)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Root exception:
java.lang.NoClassDefFoundError: org/eclipse/jst/jsp/core/internal/java/search/JSPIndexManager
at org.eclipse.jst.jsp.core.internal.java.search.JSPSearchSupport.searchRunnable(JSPSearchSupport.java:424)
at org.eclipse.jst.jsp.core.internal.java.search.JSPSearchSupport.searchRunnable(JSPSearchSupport.java:349)
at org.eclipse.jst.jsp.ui.internal.java.refactoring.JSPRenameParticipant.createChangesFor(JSPRenameParticipant.java:215)
at org.eclipse.jst.jsp.ui.internal.java.refactoring.JSPRenameParticipant.createChange(JSPRenameParticipant.java:153)
at org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring.createChange(ProcessorBasedRefactoring.java:308)
at org.eclipse.ltk.core.refactoring.CreateChangeOperation.run(CreateChangeOperation.java:124)
at org.eclipse.ltk.core.refactoring.PerformChangeOperation.run(PerformChangeOperation.java:209)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
at org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:87)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
This error doesn't make much sense for me to be able to navigate around and even 'try' fixing it. For refactorings that are 'local' to the file/methods it seems to work fine. I've tried figuring this one out but just aghast! I tend to use the refactor feature A LOT. I'm working with J2EE + Glassfish v3. I have JARs for freemarker, restlet and that for DBUtils on the build path.
Any ideas? Has anyone encountered (and fixed :) this problem??
Thanks in advance!
Looks like a plugin issue. The root exception is,
Caused by: java.lang.NoClassDefFoundError: org/eclipse/jst/jsp/core/internal/java/search/JSPIndexManager
Meaning some class that should exist can't be found. Have you recently installed/removed plugins? You might have to reinstall eclipse.
Since I only had 2 plugins it was easy to figure out the problem. It seems there is a dependency conflict between JBoss and Glassfish Plugins (says so on update). Removing the JBoss Plugin (Help > Eclipse MarketPlace > Installed - select a plugin, click 'uninstall' and select all the components in it and click Next/Finish).
That seemed to fix the refactoring without reinstalling. Thanks to user654801 for pointing it out as a plug-in issue. It'd have been difficult to nail it down otherwise!
I have the same problem. I solve it similarly to Nupul.
I disabled the J2EE standard tools sience i don't need them:
Eclipse Europa:
Help -> Sowtware Updates -> Manage Configuration
disable J2EE Standard Tools (JST) Project SDK
I am trying to use the freemarker editor in eclipse 3.5 Galileo and found the exception :
java.lang.IllegalArgumentException: Argument not valid
at org.eclipse.swt.SWT.error(SWT.java:3865)
at org.eclipse.swt.SWT.error(SWT.java:3799)
at org.eclipse.swt.SWT.error(SWT.java:3770)
at org.eclipse.swt.custom.StyledText.setStyleRanges(StyledText.java:9029)
at org.eclipse.swt.custom.StyledText.setStyleRanges(StyledText.java:9123)
at org.eclipse.jface.text.TextViewer.applyTextPresentation(TextViewer.java:4801)
at org.eclipse.jface.text.TextViewer.changeTextPresentation(TextViewer.java:4853)
at org.eclipse.jface.text.presentation.PresentationReconciler.applyTextRegionCollection(PresentationReconciler.java:579)
at org.eclipse.jface.text.presentation.PresentationReconciler.processDamage(PresentationReconciler.java:568)
at org.eclipse.jface.text.presentation.PresentationReconciler.access$3(PresentationReconciler.java:564)
at org.eclipse.jface.text.presentation.PresentationReconciler$InternalListener.inputDocumentChanged(PresentationReconciler.java:119)
at org.eclipse.jface.text.TextViewer.fireInputDocumentChanged(TextViewer.java:2870)
at org.eclipse.jface.text.TextViewer.setDocument(TextViewer.java:2919)
at org.eclipse.jface.text.source.SourceViewer.setDocument(SourceViewer.java:545)
at org.eclipse.jface.text.source.SourceViewer.setDocument(SourceViewer.java:500)
at org.eclipse.ui.texteditor.AbstractTextEditor.initializeSourceViewer(AbstractTextEditor.java:3951)
at org.eclipse.ui.texteditor.AbstractTextEditor.createPartControl(AbstractTextEditor.java:3466)
at org.eclipse.ui.texteditor.StatusTextEditor.createPartControl(StatusTextEditor.java:53)
at org.eclipse.ui.texteditor.AbstractDecoratedTextEditor.createPartControl(AbstractDecoratedTextEditor.java:427)
at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:662)
at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:462)
at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
at org.eclipse.ui.internal.EditorReference.getEditor(EditorReference.java:286)
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2857)
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2762)
at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2754)
at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2705)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2701)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2685)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2676)
at org.eclipse.ui.ide.IDE.openEditor(IDE.java:651)
at org.eclipse.ui.ide.IDE.openEditor(IDE.java:610)
at org.eclipse.ui.internal.ide.handlers.OpenResourceHandler.execute(OpenResourceHandler.java:129)
at org.eclipse.ui.internal.ide.handlers.OpenResourceHandler.run(OpenResourceHandler.java:181)
at org.eclipse.ui.internal.handlers.ActionDelegateHandlerProxy.execute(ActionDelegateHandlerProxy.java:289)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:470)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:824)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:880)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:569)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:510)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:125)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1191)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1002)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1027)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1012)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1040)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1036)
at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1368)
at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:4053)
at org.eclipse.swt.widgets.Canvas.WM_CHAR(Canvas.java:346)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:3946)
at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:342)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4589)
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2410)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3471)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
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.equinox.launcher.Main.invokeFramework(Main.java:559)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
I replaced the freemarker jar in plugin directory and I am using clean option also .. but couldn't find anything...
FreeMarker is a bit old (latest release in December 2008).
Can you check you reproduce the problem with eclipse Ganymede 3.4(.x), that is older version, or eclipse 3.5.1 (more recent)?
SWT might have evolve in non-compatible way since then. Or it might just be an old bug still un-resolved (like the 115253 one, or the 287886, which should have been fixed in 282218, but for Mac and probably only in 3.5.1).
There's no mention of Freemarker classes in the above stack trace. What editor are you using?
I have Eclipse 3.5.20090621-0832 and Freemarker IDE 1.1.0.M1-N200906060434-H241 and both are working fine. Freemarker IDE is part of JBoss Tools.
You can get the latest development milestone (stable releases only support Eclipse 3.4.2) - note that it requires Eclipse 3.5.1 / Galileo SR1.
Or, if you're using Eclipse's built-in package management, update site is here along with installation instructions
Just encountered the same problem and tracked it down to:
<style type="text/css">
<?php ?>
Basically, it seems like, this Exception is thrown b/c the parser is confused by certain combinations of HTML and PHP.
I can have this Exception thrown just by creating a new PHP-file and fill it with something like that. But the odd thing is it seems like after playing around with it a while makes the Exception disappear. So maybe it's a Unicode-thing neutralized by my editing after a while.
Anyway, there you go.
Best
Raffael