2
votes

I am new to Eclipse and Acceleo, and I have been trying to complete the First Generator Model Tutorial. I am using Kepler 4.3 and Acceleo 3.X. I am following the tutorial that generates java code from uml. The link is http://wiki.eclipse.org/Acceleo/Getting_Started. But when I try to run the generate.mtl file, the error log gives me the message:

Couldn't load class org.eclipse.acceleo.module.sample.main.Generate
from project org.eclipse.acceleo.module.sample

It also gives me the warning:

Couldn't load class org.eclipse.acceleo.module.sample.main.Generate. Check that its containing package is exported.

and The activator org.eclipse.acceleo.module.sample.Activator for bundle org.eclipse.acceleo.module.sample is invalid

org.osgi.framework.BundleException: The activator org.eclipse.acceleo.module.sample.Activator for bundle org.eclipse.acceleo.module.sample is invalid at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:172) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:679) at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381) at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:300) at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:478) at org.eclipse.osgi.internal.loader.BundleLoader.setLazyTrigger(BundleLoader.java:263) at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:236) at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1212) at org.eclipse.acceleo.common.internal.utils.workspace.AcceleoWorkspaceUtil.getClass(AcceleoWorkspaceUtil.java:544) at org.eclipse.acceleo.ide.ui.launching.strategy.AcceleoLaunchOperation.run(AcceleoLaunchOperation.java:103) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2345) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2327) at org.eclipse.acceleo.ide.ui.launching.strategy.AcceleoPluginLaunchingStrategy.launch(AcceleoPluginLaunchingStrategy.java:259) at org.eclipse.acceleo.ide.ui.launching.strategy.AcceleoPluginLaunchingStrategy.launch(AcceleoPluginLaunchingStrategy.java:161) at org.eclipse.acceleo.internal.ide.ui.launching.AcceleoLaunchDelegate.launch(AcceleoLaunchDelegate.java:51) at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:858) at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:707) at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1018) at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1222) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53) Caused by: java.lang.ClassNotFoundException: org.eclipse.acceleo.module.sample.Activator cannot be found by org.eclipse.acceleo.module.sample_1.0.0.qualifier 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 org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:340) at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:229) at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:165) ... 19 more Root exception: java.lang.ClassNotFoundException: org.eclipse.acceleo.module.sample.Activator cannot be found by org.eclipse.acceleo.module.sample_1.0.0.qualifier 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 org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:340) at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:229) at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:165) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:679) at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381) at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:300) at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:478) at org.eclipse.osgi.internal.loader.BundleLoader.setLazyTrigger(BundleLoader.java:263) at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:236) at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1212) at org.eclipse.acceleo.common.internal.utils.workspace.AcceleoWorkspaceUtil.getClass(AcceleoWorkspaceUtil.java:544) at org.eclipse.acceleo.ide.ui.launching.strategy.AcceleoLaunchOperation.run(AcceleoLaunchOperation.java:103) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2345) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2327) at org.eclipse.acceleo.ide.ui.launching.strategy.AcceleoPluginLaunchingStrategy.launch(AcceleoPluginLaunchingStrategy.java:259) at org.eclipse.acceleo.ide.ui.launching.strategy.AcceleoPluginLaunchingStrategy.launch(AcceleoPluginLaunchingStrategy.java:161) at org.eclipse.acceleo.internal.ide.ui.launching.AcceleoLaunchDelegate.launch(AcceleoLaunchDelegate.java:51) at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:858) at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:707) at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1018) at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1222) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)

I have put the [comment @main/] below the template line and do all the steps in the tutorial, i really have no idea what the problem is.

I would appreciate any help or feedback.

3

3 Answers

0
votes
java.lang.ClassNotFoundException: org.eclipse.acceleo.module.sample.Activator cannot be found by org.eclipse.acceleo.module.sample_1.0.0.qualifier

The most likely reason I can think of is that you have used the File > New Plug-in Project wizard and kept most of the default values, yet afterwards removed (or renamed) the "Activator" class that it created in your project.

The META-INF/MANIFEST.MF file of your project should contain a line that looks like :

Bundle-Activator: org.eclipse.acceleo.module.sample.Activator

And if it does, it most likely shows a warning or error on that line. You can either remove the line altogether or make sure you indeed have a plug-in activator with that qualified name.

0
votes

I had exactly the same problem using Acceleo 3.5.0 on a clean Kepler and a clean Luna install. In Luna Acceleo displays a warning when you select the 'Acceleo Plugin Application' for the Runner in the run configuration. If you select 'Java Application' instead it works on Kepler.

A little research led me to the following 'fixed' bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=419205 . The 'fix' I guess was to add an error message in Luna telling us this feature doesn't work. I see exactly the same problem in Kepler and in Juno too with Acceleo 3.5 so it doesn't seem Luna specific at all.

Only workarounds I've found for this are to:

  • switch back to Acceleo 3.4 or
  • use only 'Java Application' referred to as 'standalone' in the documentation as it runs outside of Eclipse.

The problem with standalone is then you lose all the great features of Acceleo's debugger and interpreter, plus you have longer wait time testing your templates.

0
votes

I corrected this error by updating the classpath in the MANIFEST.MF file :

I added the bin/ folder of the projet. It now works properly.

Etienne