Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » java.lang.InstantiationException in plugin
java.lang.InstantiationException in plugin [message #99448] Mon, 08 October 2007 17:46 Go to next message
Eclipse UserFriend
Originally posted by: slider161.hotmail.com

I trying to activate a plugin that runs a JUnit test suite using an Ant script. However I keep getting an error



"The activator org.eclipse.core.runtime.Plugin for bundle com.propylon.core.Test is invalid"



"Caused by: java.lang.InstantiationException"



Thrown when an application tries to create an instance of a class using the newInstance method in class Class, but the specified class object cannot be instantiated because it is an interface or is an abstract class.



Somewhere the Class.newInstance() method is being invoked on Plugin (the abstract class) rather than Activator (the non-abstract one), why?



I created the plugin project using the eclispe wizard this its the Activator class it generated



package com.propylon.core.test;



import org.eclipse.core.runtime.Plugin;

import org.osgi.framework.BundleContext;



/**

* The activator class controls the plug-in life cycle

*/

public class Activator extends Plugin {



// The plug-in ID

public static final String PLUGIN_ID = "com.propylon.core.Test";



// The shared instance

private static Activator plugin;



/**

* The constructor

*/

public Activator() {

}



/*

* (non-Javadoc)

* @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.Bu ndleContext)

*/

public void start(BundleContext context) throws Exception {

super.start(context);

plugin = this;

}



/*

* (non-Javadoc)

* @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.Bund leContext)

*/

public void stop(BundleContext context) throws Exception {

plugin = null;

super.stop(context);

}



/**

* Returns the shared instance

*

* @return the shared instance

*/

public static Activator getDefault() {

return plugin;

}



}



below is the stack trance:



java-test:

[echo] Running com.propylon.core.tests.testcase.AllTests. Result file: C:/eclipse3.3/results/com.propylon.core.tests.testcase.AllTe sts.xml.

[java] org.osgi.framework.BundleException: The activator org.eclipse.core.runtime.Plugin for bundle com.propylon.core.Test is invalid

[java] at org.eclipse.osgi.framework.internal.core.AbstractBundle.load BundleActivator(AbstractBundle.java:141)

[java] at org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:970)

[java] at org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:346)

[java] at org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:260)

[java] at org.eclipse.osgi.framework.util.SecureAction.start(SecureAct ion.java:400)

[java] at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter .postFindLocalClass(EclipseLazyStarter.java:111)

[java] at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLoc alClass(ClasspathManager.java:417)

[java] at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.fin dLocalClass(DefaultClassLoader.java:189)

[java] at org.eclipse.osgi.framework.internal.core.BundleLoader.findLo calClass(BundleLoader.java:340)

[java] at org.eclipse.osgi.framework.internal.core.BundleLoader.findCl assInternal(BundleLoader.java:408)

[java] at org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:369)

[java] at org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:357)

[java] at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultClassLoader.java:83)

[java] at java.lang.ClassLoader.loadClass(Unknown Source)

[java] at org.eclipse.osgi.framework.internal.core.BundleLoader.loadCl ass(BundleLoader.java:289)

[java] at org.eclipse.osgi.framework.internal.core.BundleHost.loadClas s(BundleHost.java:227)

[java] at org.eclipse.osgi.framework.internal.core.AbstractBundle.load Class(AbstractBundle.java:1269)

[java] at org.eclipse.test.EclipseTestRunner.loadSuiteClass(EclipseTes tRunner.java:302)

[java] at org.eclipse.test.EclipseTestRunner.getTest(EclipseTestRunner .java:233)

[java] at org.eclipse.test.EclipseTestRunner.<init>(EclipseTestRunner.java:216)

[java] at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.jav a:200)

[java] at org.eclipse.test.CoreTestApplication.runTests(CoreTestApplic ation.java:35)

[java] at org.eclipse.test.CoreTestApplication.run(CoreTestApplication .java:31)

[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

[java] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

[java] at java.lang.reflect.Method.invoke(Unknown Source)

[java] at org.eclipse.equinox.internal.app.EclipseAppContainer.callMet hod(EclipseAppContainer.java:533)

[java] at org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:155)

[java] at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:106)

[java] at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:76)

[java] at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:363)

[java] at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:176)

[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

[java] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

[java] at java.lang.reflect.Method.invoke(Unknown Source)

[java] at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 504)

[java] at org.eclipse.equinox.launcher.Main.basicRun(Main.java:443)

[java] at org.eclipse.equinox.launcher.Main.run(Main.java:1169)

[java] at org.eclipse.equinox.launcher.Main.main(Main.java:1144)

[java] at org.eclipse.core.launcher.Main.main(Main.java:30)

[java] Caused by: java.lang.InstantiationException

[java] at sun.reflect.InstantiationExceptionConstructorAccessorImpl.ne wInstance(Unknown Source)

[java] at java.lang.reflect.Constructor.newInstance(Unknown Source)

[java] at java.lang.Class.newInstance0(Unknown Source)

[java] at java.lang.Class.newInstance(Unknown Source)

[java] at org.eclipse.osgi.framework.internal.core.AbstractBundle.load BundleActivator(AbstractBundle.java:136)

[java] ... 41 more

[java] Java Result: 2



Has anyone come across this problem before? Do I need to change some setting in eclipse or modify may activator class?



Thank you for your time



slider
Re: java.lang.InstantiationException in plugin [message #99917 is a reply to message #99448] Tue, 16 October 2007 22:02 Go to previous message
Thomas Watson is currently offline Thomas WatsonFriend
Messages: 503
Registered: July 2009
Senior Member
What is the value of the Bundle-Activator header in your bundle's
manifest file (META-INF/MANIFEST.MF). Does it specify your activator
class? I recommend you open a bug against PDE-UI with the steps you
used to generate the activator class.

Tom
Previous Topic:debug servlet activator
Next Topic:Ordering of results from ObjectClassDefinition.getAttributeDefinitions()?
Goto Forum:
  


Current Time: Fri Apr 19 03:57:50 GMT 2024

Powered by FUDForum. Page generated in 0.01829 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top