Eclipse + GWT + spring + maven: classnotfoundexception - eclipse

I have a weird problem with my setup that I don't understand. I'm working on a maven GWT project that runs fine in a shell (i.e. mvn gwt:run is working as expected).
However, when I try to run it in Eclipse (with m2e and gwt plugin installed), I get a classnotfoundexception. The class is an entity class and the exception occurs when the entity manager is built. I checked that the class is declared in the persistence.xml and I cannot find any exclusion in the pom.xml or the eclipse build path.
On top of this, it works fine for someone else working on the exact same project.
My guess is that I have a configuration error in Eclipse but I didn't tweek anything.
Any ideas?
Eclipse 4.2
GWT 2.4
Maven 3.0.3
Spring 3.0.5
[WARN] Failed startup of context com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload#57790a{/,C:\Users\gere\Documents\netlight-workspace\NET2\target}
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManager' defined in ServletContext resource [/WEB-INF/database.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: netlight_db] class or package not found
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:543)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1220)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:513)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:468)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.handler.RequestLogHandler.doStart(RequestLogHandler.java:115)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.Server.doStart(Server.java:222)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:672)
at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:509)
at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1068)
at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:811)
at com.google.gwt.dev.DevMode.main(DevMode.java:311)
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: netlight_db] class or package not found
at org.hibernate.ejb.Ejb3Configuration.addNamedAnnotatedClasses(Ejb3Configuration.java:1386)
at org.hibernate.ejb.Ejb3Configuration.addClassesToSessionFactory(Ejb3Configuration.java:1159)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:1004)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:689)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:225)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:308)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
... 30 more
Caused by: java.lang.ClassNotFoundException: se.netlight.projectplusgui.server.dbo.BusinessArea
at java.lang.ClassLoader.findClass(ClassLoader.java:358)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:352)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:170)
at org.hibernate.ejb.Ejb3Configuration.classForName(Ejb3Configuration.java:1302)
at org.hibernate.ejb.Ejb3Configuration.addNamedAnnotatedClasses(Ejb3Configuration.java:1374)
... 38 more
[WARN] Nested in org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManager' defined in ServletContext resource [/WEB-INF/database.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: netlight_db] class or package not found:
java.lang.ClassNotFoundException: se.netlight.projectplusgui.server.dbo.BusinessArea
at java.lang.ClassLoader.findClass(ClassLoader.java:358)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:352)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:170)
at org.hibernate.ejb.Ejb3Configuration.classForName(Ejb3Configuration.java:1302)
at org.hibernate.ejb.Ejb3Configuration.addNamedAnnotatedClasses(Ejb3Configuration.java:1374)
at org.hibernate.ejb.Ejb3Configuration.addClassesToSessionFactory(Ejb3Configuration.java:1159)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:1004)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:689)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:225)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:308)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:543)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1220)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:513)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:468)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.handler.RequestLogHandler.doStart(RequestLogHandler.java:115)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.Server.doStart(Server.java:222)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:672)
at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:509)
at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1068)
at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:811)
at com.google.gwt.dev.DevMode.main(DevMode.java:311)

1) Try executing mvn clean install and then launching the hosted mode. If it works this means some classes/files need to be copied into target for your project to work.
2) If you trying to use Google GWT Webapp Launch, then check your launch folders for arguments. You should try and align it to maven's set up of target, artifact with/without version id etc
3) Check your project names to see if you have imported the maven project with versionid suffix to your project. This might be causing some classpath issues.

It could be the classloading of GWT-Eclipse. By default when running a GWT application from Eclipse all jars in the lib folder are added to the running applications classpath. In addition when Eclipse-GWT comes across any classes that are not on this classpath it searches the system classpath. If it finds the class the corresponding jar is also added to the running applications classpath. This will be logged in the console.
Generally this is okay but it does cause issues when you search the classpath. Classes won't be found unless the jar has been added to the running classpath by Eclipse. You can hack things but its not ideal (see the answer to this question).
I am guessing that with Maven all the Maven dependency jars are being added to the system classpath. When combined with Spring and JPA then there is a lot of classpath searching going on.
That doesn't explain why it works on another persons mechine - unless they have additional jars in their web app lib folder.
As to how to fix it "properly" I am not sure. I am in the same position myself - I have one application that works and one that is configured in a very similar way that doesn't. It's also the reason I found this question!

Related

NPE when building OSGi bundles with Maven Tycho

I have several OSGi-bundles that I want to build using Maven Tycho. While the dependencies of the first 4 bundles can be resolved without problem, Tycho quits with the following cryptic exception at the 5th:
[INFO] Resolving dependencies of MavenProject: my.parent:my.module:0.0.1-SNAPSHOT # D:\Path\To\Project\pom.xml
[WARNING] The following locally built units have been used to resolve project dependencies:
[WARNING] my-other-module/0.0.1.201407011334
[INFO] Resolving class path of MavenProject: my.parent:my.module:0.0.1-SNAPSHOT # D:\Path\To\Project\pom.xml
[ERROR] Internal error: java.lang.NullPointerException -> [Help 1]
org.apache.maven.InternalErrorException: Internal error: java.lang.NullPointerException
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:167)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
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 org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: java.lang.NullPointerException
at org.eclipse.tycho.core.osgitools.OsgiBundleProject.resolveClassPath(OsgiBundleProject.java:187)
at org.eclipse.tycho.core.resolver.DefaultTychoDependencyResolver.resolveProject(DefaultTychoDependencyResolver.java:122)
at org.eclipse.tycho.core.maven.TychoMavenLifecycleParticipant.afterProjectsRead(TychoMavenLifecycleParticipant.java:75)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
... 11 more
Following is the MANIFEST.MF of that bundle (Import-Package section):
Import-Package: my.other.module.package;version="[0.0,1)",
org.apache.commons.lang3.builder;version="[3.3,4)",
org.dozer;version="[5.5,6)",
org.osgi.service.blueprint;version="[1.0.0,2.0.0)"
Resolving the dependencies from the repository shouldn't be a problem, as launching the bundles from within eclipse works fine.
Interesting aspect: I'm working on Windows 7x64. On my coworker's pc with Linux it runs fine.
I'm not really sure where to start finding the error - the exception doesn't really give a hint, so I'd appreciate every tip. If you need further information, I'd be happy to clarify.

Can't generate java from UML using Acceleo in Eclipse

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.
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.
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.
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

JBoss7 and Beans - required jars appear not to be used

We are trying to create a functional example with Hibernate, JBoss7, Beans and Servlets using Eclipse as an IDE.
In other example project we were able to make functional Servlets, and we were able to use Hibernate.
We created two eclipse projects:
A Dynamic web project, an Enterprise Java Beans (EJB) project and a EAR project connecting both.
Running a simple test.java file which uses hibernate (and worked on other projects), we the get errors:
Initial SessionFactory creation failed.org.hibernate.cfg.beanvalidation.IntegrationException: Error activating Bean Validation integration
Exception in thread "main" java.lang.ExceptionInInitializerError
at exercicio.SessionFactoryUtil.<clinit>(SessionFactoryUtil.java:20)
at exercicio.DataBaseInterface.<init>(DataBaseInterface.java:17)
at exercicio.Test.main(Test.java:9)
Caused by: org.hibernate.cfg.beanvalidation.IntegrationException: Error activating Bean Validation integration
at org.hibernate.cfg.beanvalidation.BeanValidationIntegrator.integrate(BeanValidationIntegrator.java:156)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:303)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1750)
at exercicio.SessionFactoryUtil.configureSessionFactory(SessionFactoryUtil.java:32)
at exercicio.SessionFactoryUtil.<clinit>(SessionFactoryUtil.java:17)
... 2 more
Caused by: java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at org.hibernate.validator.util.LoggerFactory.make(LoggerFactory.java:29)
at org.hibernate.validator.util.Version.<clinit>(Version.java:24)
at org.hibernate.validator.engine.ConfigurationImpl.<clinit>(ConfigurationImpl.java:59)
at org.hibernate.validator.HibernateValidator.createGenericConfiguration(HibernateValidator.java:41)
at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:269)
at javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)
at org.hibernate.cfg.beanvalidation.TypeSafeActivator.getValidatorFactory(TypeSafeActivator.java:445)
at org.hibernate.cfg.beanvalidation.TypeSafeActivator.activate(TypeSafeActivator.java:96)
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.hibernate.cfg.beanvalidation.BeanValidationIntegrator.integrate(BeanValidationIntegrator.java:150)
... 6 more
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 19 more
The problem now seems to be around the jars that we included using project Properties > Java Build Path > Add External Jars for the EJB project:
We added the slf4j-jdk14-1.7.5.jar and hibernate jars but the exception log appears to be indicating that we are still missing some jar.
If we remove the jars from the Java Build Path, the exception log is the same. So we think that the jars are not being deployed correctly, or some extra configuration is required... even thought they appear in the /lib folder inside the EJB project deployment folder.
Is there any procedure we are missing, or any probable causes to investigate? I'll add more info if needed. Thanks.
When using JBoss7 not all Jars are available to the application by default (for example slf4j). You have to specify which modules should be included in the classpath of the application by putting this information into a file in your application.
I always do it by adding jboss-deployment-structure.xml into my application (the EAR in your case).
Here's how https://docs.jboss.org/author/display/AS7/Class+Loading+in+AS7.
(The name of the module in your case would be org.slf4j)
Throwing slf4j jar in the libs folder can create a conflict with the slf4j module already included in JB7 by default... you have to add the dependency to your jboss-deployment-structure.xml
But if your hibernate jars are in the libs folder, they could fail resolve the dependency as well too... the way to go in JB7 would be to make a module for Hibernate too, the Nightie builds of JB7 already include an hibernate module, you could just copy the module from there, then add it to your jboss-deployment-structure.xml

Running JUnit Test cases for Maven Project in Eclipse

I imported Maven project using maven eclipse plugins (m2e) and everything is fine.
But when I am running JUnit Test cases, I am getting below errors
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'be.belgacom.rosy.betty.manager.impl.ReservationManagerImplTest': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests.setDataSource(javax.sql.DataSource); nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [javax.sql.DataSource] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1074)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:374)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:110)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:321)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:220)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:301)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:303)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:240)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:180)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests.setDataSource(javax.sql.DataSource); nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [javax.sql.DataSource] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:589)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:282)
... 26 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [javax.sql.DataSource] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:920)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:789)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:703)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:547)
... 28 more
I am sure you might be suggesting to look at properties and other xml files configurations are correct or not.
If I import the same project into Eclipse as normal project, I am able to run the JUnit tests.
When I Import as Maven Projects, it's giving such errors.
Any idea, how do i solve this.
Your question lacks a lot of context. Have you ever run this from the command line with Maven? For example, have you run "mvn test" on the command line? Try this first then let us know if you receive the same error messages.
Your problem suggests that your POM doesn't contain the appropriate dependencies.

java.lang.NoClassDefFoundError in eclipse and tomcat however WAR is working in standalone tomcat

I am trying to deploy maven generated war file into tomcat server in eclipse.. but I get java.lang.NoClassDefFoundError on a jar file. I verified multiple times, jar is in .war and corresponding class file is also available in jar.
I can copy the war from generated location in eclipse and deploy into webapps of tomcat (using the same server as installed server in eclipse) successfully.
I am not sure what else to check in configuration apart from deployment assembly (which has jar listed) and Java Build path ( jar is available in Maven Dependencies). I am using JRE --> Alternate JRE pointing to JDK 1.6
Complete ERROR LOG:
2012-05-24 16:43:09,379 [main] ERROR org.springframework.web.context.ContextLoader - Context initialization failed
java.lang.NoClassDefFoundError: Lcom/att/cso/uss/client/ws/CciClientImpl;
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2291)
at java.lang.Class.getDeclaredFields(Class.java:1743)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:373)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(PersistenceAnnotationBeanPostProcessor.java:321)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:830)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:493)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:593)
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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.ClassNotFoundException: com.att.cso.uss.client.ws.CciClientImpl
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1484)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1329)
... 33 more
Please advise.
Using server instance is not same as deploying WAR in tomcat. The servers view integration of tomcat 'hot' deploys the source folder. I suggest you check you Java Build path settings because those are used when you 'deploy' the source project into the server in servers view. How are you creating the war? I am assuming you are using maven for it.. If you are using maven (I have personal dislike for it), it should be managing the dependencies for you. You might have to replicate settings of maven in java or may be use maven plugin for eclipse. [http://www.eclipse.org/m2e/]