Header

Eclipse: Activator class is invalid

Hi,

well, during my resurgent interest in my Esftp plugin, I found I couldn’t compile it, I solved the original problem in my last post on eclipse, you can find it here

Eclipse and Plug-in Dependency Fun

Well, after getting past that, I was onto victory, or so I thought, I could build the plugin fine now that I knew the problem with the Filesystem and FAT32 filesystems, however when I tried to run the plugin in a debug environment, I couldnt get anything to run, I could see the basic elements, but I could not see the workspace or project preferences panels, when I tried to open them I got a dialog saying it could not create them.

I was advised on #eclipse channel to use the -consoleLog option which will output any errors that I have when I am running my plugin, upon using this option, I got a whole bunch of errors, some of them nothing to do, but this one in particular was a problem.

!ENTRY org.eclipse.osgi 2 0 2007-07-16 22:54:27.236
!MESSAGE The activator com.antimatter_studios.esftp.Activator for bundle
com.antimatter_studios.esftp is invalid
!STACK 0
org.osgi.framework.BundleException: The activator
com.antimatter_studios.esftp.Activator for bundle
com.antimatter_studios.esftp is invalid
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:141)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:970)
at
org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:346)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:260)

Caused by: java.lang.ClassNotFoundException:
com.antimatter_studios.esftp.Activator
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findClassInternal(BundleLoader.java:434)
at
Root exception:
java.lang.ClassNotFoundException: com.antimatter_studios.esftp.Activator
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findClassInternal(BundleLoader.java:434)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:369)
at

So, basically, Eclipse was telling me that the Activator class for my plugin, was invalid, but I couldn’t see anything wrong with it, it was ok to me and it followed the rules of the Hello World test plugin I created, but still, it wouldnt load properly.

Here is the solution that I found and used, now my plugin exports properly, debugs properly, etc, etc. Good work team !

ok, after talking to paul webster on IRC, I found the solution, which was that on the build tab, at the top, you have two sections under “runtime configuration”, on the left, you have add library, it usually contains “.” as the only item, or more, but “.” is usually there. On the other side, you have add Folder, there was the problem, it was empty, upon adding “src”, which is the folder containing the plugin source code, I was able to finally get the plugin to work.

so I hope that helps some people and saves them from the problem I had.

See you next time!

This entry was posted in Uncategorized

25 Responses

  • Chris – Thanks for posting this. I had the same problem and it solved by your post!

  • hi,
    I have added the “src” folder ,but it does not work.

  • obviously this isnt the sole reason for this problem, but a possible solution, it worked for me and the other commenter, sorry it didnt work for you.

    are you working with a fat32 filesystem? if so, there is another article on eclipse and fat32, maybe that would help.

    if you do solve it, please give me a thought and come back to explain it ok!

  • Hello , I get the same ploblem . adding src but doesnt work …

  • which was that on the build tab, at the top ?????

  • was a long time ago, but I believe that it was in the project properties, try in there, I can’t remember the specifics now, maybe I can look again and find out.

  • After getting some help from rcjsuen on freenode #eclipse, I found a solution when the above doesn’t completely solve things.

    Basically, you need to make sure you have the following in your bundle MANIFEST.MF:

    Bundle-ClassPath: ., (other libs)

    The . (bundle root) is the key entry here. If you don’t include it, your classes won’t be exported when you test.

  • If you are building a plugin under Eclipse Galileo, 3.5.x, your (basic) build.properties should look something like this:

    source.. = src/
    output.. = bin/
    bin.includes = plugin.xml,\
    META-INF/,\
    .,\
    icons/

    That fixed things for me at runtime when I was getting messages such as follows, when upgrading an old plugin source:

    org.osgi.framework.BundleException The activator … for bundle … is invalid … java.lang.ClassNotFoundException

  • Hey folks: Here is My solution to the problem (I am developing Bundles for Eclipse Equinox(the OSGi implementation)) :

    AND THE SOLUTION is V-E-R-Y simple -> just add -dev bin to your Program Arguments under (Run->Run Configurations->”Your_Loader”->Tab “Arguments”)

    Cheers!

  • Hey Mrj81

    thanks for the tip! sounds a very handy shortcut!

  • Mrj81′s solution works fine.
    Thank you very much for the tip!!!!!!

    Cheers!

  • It was the right solution to my problem!
    Thanks!

  • this problem might be caused by that you changed the package of the activator, since it will record with default setting.
    its really simple, in my eclipse 3.4.2, the solution is:
    click the “manifest.mf”
    in the “overview” window, on “general information” tab, you will see “activator “, then you can change the activator to the activator in your package.

  • @quanjian_wang: good job! you are the first to actually explain something that seems a solution, apart from a workaround.

    thanks mate! I’m sure lots of people will appreciate your help.

  • Hi!
    I have the same problem and i am try to solve it, but i don’t understand what means ” -dev bin”. Can You explain me?
    Thanks a lot!

  • @EK they are arguments you pass on the command line, drill down through the options that mrj81 mentioned and you’ll find where to put it.

  • This is my argyment string
    -os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog -console -dev bin
    its the same error :(

  • well, I am not sure about the solution because I’ve never tried it, but there are other solutions mentioned here, perhaps you can try one of those and see if that works better?

  • I love this site blog.chris-alex-thomas.com. Lot of great information. I am Tech guy. I have been a Desktop Technician since 1997 but have tons of other interests. In my spare time… Oh, wait I don’t have any of that (just kidding). Anyways, I have been aware of this website for quite some time and decided to join the community and contribute as well as learn a lot from others. I am excited to get started on the forum and am looking forward to a great journey together. Lots of potential friends and I look forward to meeting many online.

  • thx your my hero, saved my day!

  • Good,#7 and #8 is right. thx very very much.

  • thank you very much~~It does work

  • thank you so muck chris.alex.thomas! it worked for me! i added the .jar i wanted and then i added src folder! in my case i searched the web for two days full but nothing else worked! so thank you very much again! sharing solutions with people all over the world is the beauty of the internet!

  • @Mrj81 thankyou, super simple.. solve my problem !

  • Brett’s answer solved my problem!
    After hours of trying suggested solutions it FINALLY worked! Thank you very much. Inclusion of a simple “.,\” in my build.properties solved my ClassDefNotFound-Error that caused my “invalid Activator”.

    If everything complicated fails, alway try the simplest of things. =)



Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>