0 Replies Latest reply on Mar 23, 2011 8:52 AM by MIklos Piklos

    Problem with persitane and jetty with maven

    MIklos Piklos Newbie
      Hello I was using seam 2 for two years now, together with ant. I decided it is time to move on to seam 3 with weld. I have a problem due to my maven noobness.

      I generated a project using the archetype:
      jboss-jsf-weld-servlet-webapp

      It works with jetty:run.
      But after i tried to add persistance as specified in the documentation ..i added this to my pom

            <dependency>
                         <groupId>org.jboss.seam.persistence</groupId>
                         <artifactId>seam-persistence-api</artifactId>
                         <version>3.0.0.CR3</version>
                      </dependency>

                      <dependency>
                         <groupId>org.jboss.seam.persistence</groupId>
                         <artifactId>seam-persistence-impl</artifactId>
                         <version>3.0.0.CR3</version>
                         <scope>runtime</scope>
                      </dependency>

              <dependency>
               <groupId>org.jboss.seam.solder</groupId>
               <artifactId>seam-solder</artifactId>
               <version>3.0.0.CR3</version>
           </dependency>

      And i added this to my beans.xml
        <t:SeSynchronizations>
           <s:modifies/>
        </t:SeSynchronizations>

        <t:EntityTransaction>
          <s:modifies />     
        </t:EntityTransaction>

      I also added persitance.xml to my src\main\resources\META-INF directory.
      But now jetty:run fails with this exception:


      INFO: WELD-000900 1.1.0 (Final)
      2011-03-23 13:46:39.115:INFO::No Transaction manager found - if your webapp requires one, please configure one.
      Mar 23, 2011 1:46:39 PM org.jboss.weld.bootstrap.WeldBootstrap startContainer
      INFO: WELD-000101 Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously.
      Mar 23, 2011 1:46:39 PM org.jboss.seam.solder.core.CoreExtension beforeBeanDiscovery
      INFO: Seam Solder 3.0.0.CR3 (build id: 3.0.0.CR3)
      2011-03-23 13:46:39.664:WARN::Failed startup of context org.mortbay.jetty.plugin.Jetty6PluginWebAppContext@84f566{/bla.bla,D:\svasta\jee6\bla.bla\src\main\webapp}
      org.jboss.weld.exceptions.DefinitionException: Exception List with 1 exceptions:|Exception 0 :|javax.enterprise.event.ObserverException<|?at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)<|?at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)<|?at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)<|?at java.lang.reflect.Constructor.newInstance(Unknown Source)<|?at java.lang.Class.newInstance0(Unknown Source)<|?at java.lang.Class.newInstance(Unknown Source)<|?at org.jboss.weld.util.reflection.SecureReflections$16.work(SecureReflections.java:395)<|?at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)<|?at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInstantiation(SecureReflectionAccess.java:216)<|?at org.jboss.weld.util.reflection.SecureReflections.newInstance(SecureReflections.java:390)<|?at org.jboss.weld.injection.Exceptions.rethrowException(Exceptions.java:40)<|?at org.jboss.weld.injection.Exceptions.rethrowException(Exceptions.java:92)<|?at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:214)<|?at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:270)<|?at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:253)<|?at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:222)<|?at org.jboss.weld.bootstrap.events.AbstractContainerEvent.fire(AbstractContainerEvent.java:88)<|?at org.jboss.weld.bootstrap.events.AbstractDefinitionContainerEvent.fire(AbstractDefinitionContainerEvent.java:52)<|?at org.jboss.weld.bootstrap.events.BeforeBeanDiscoveryImpl.fire(BeforeBeanDiscoveryImpl.java:48)<|?at org.jboss.weld.bootstrap.WeldBootstrap.startInitialization(WeldBootstrap.java:345)<|?at org.jboss.weld.environment.servlet.Listener.contextInitialized(Listener.java:174)<|?at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:549)<|?at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)<|?at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1282)<|?at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:518)<|?at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:499)<|?at org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart(Jetty6PluginWebAppContext.java:115)<|?at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)<|?at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)<|?at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156)<|?at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)<|?at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)<|?at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)<|?at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)<|?at org.mortbay.jetty.Server.doStart(Server.java:224)<|?at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)<|?at org.mortbay.jetty.plugin.Jetty6PluginServer.start(Jetty6PluginServer.java:132)<|?at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:454)<|?at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:396)<|?at org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute(AbstractJettyRunMojo.java:210)<|?at org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:184)<|?at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)<|?at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)<|?at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)<|?at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)<|?at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)<|?at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)<|?at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)<|?at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)<|?at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)<|?at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)<|?at org.apache.maven.cli.MavenCli.execute(MavenCli.java:534)<|?at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)<|?at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)<|?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.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)<|?at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)<|?at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)<|?at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)<|Caused by: java.lang.NoClassDefFoundError: javax/persistence/OptimisticLockException<|?at org.jboss.seam.persistence.ManagedPersistenceContextExtension.beforeBeanDiscovery(ManagedPersistenceContextExtension.java:113)<|?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.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:305)<|?at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)<|?at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163)<|?at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:299)<|?at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:188)<|?at org.jboss.weld.introspector.ForwardingWeldMethod.invokeOnInstance(ForwardingWeldMethod.java:59)<|?at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:198)<|?... 49 more<|Caused by: java.lang.ClassNotFoundException: javax.persistence.OptimisticLockException<|?at java.net.URLClassLoader$1.run(Unknown Source)<|?at java.security.AccessController.doPrivileged(Native Method)<|?at java.net.URLClassLoader.findClass(Unknown Source)<|?at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:392)<|?at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:363)<|?... 61 more<|
              at org.jboss.weld.bootstrap.events.AbstractDefinitionContainerEvent.fire(AbstractDefinitionContainerEvent.java:55)
              at org.jboss.weld.bootstrap.events.BeforeBeanDiscoveryImpl.fire(BeforeBeanDiscoveryImpl.java:48)
              at org.jboss.weld.bootstrap.WeldBootstrap.startInitialization(WeldBootstrap.java:345)
              at org.jboss.weld.environment.servlet.Listener.contextInitialized(Listener.java:174)
              at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:549)
              at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
              at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1282)
              at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:518)
              at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:499)
              at org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart(Jetty6PluginWebAppContext.java:115)
              at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
              at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
              at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156)
              at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
              at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
              at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
              at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
              at org.mortbay.jetty.Server.doStart(Server.java:224)
              at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
              at org.mortbay.jetty.plugin.Jetty6PluginServer.start(Jetty6PluginServer.java:132)
              at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:454)
              at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:396)
              at org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute(AbstractJettyRunMojo.java:210)
              at org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:184)
              at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)
              at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
              at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
              at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
              at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
              at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
              at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
              at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
              at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
              at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
              at org.apache.maven.cli.MavenCli.execute(MavenCli.java:534)
              at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
              at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
              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.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
              at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
              at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
              at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
      I have not touched to code, so no entitymanager is added anywhere.
      I messed arorund with it, and i found out, that if i only add seam solder everything work. But as soon as i add dependencies to seam persistance, this exceptions occur.

      Any help would be greatly appreciated.