2 Replies Latest reply on Feb 17, 2008 3:28 PM by Manoj Augustine

    seam spring tomcat without jboss

    Manoj Augustine Newbie

      Just for accademic interest I tried to integrate a spring service in seam application, just like spring example in jboss seam examples directory.I tried to run that in TOMCAT 6. I am getting the following exception

      14 févr. 2008 18:10:10 org.jboss.seam.jsf.SeamPhaseListener afterPhase
      GRAVE: uncaught exception
      java.lang.IllegalStateException: Could not commit transaction
      at org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:592)
      at org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsAfterPhase(SeamPhaseListener.java:325)
      at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:226)
      at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:184)
      at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:280)
      at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
      at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
      at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
      at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
      at java.lang.Thread.run(Thread.java:595)
      Caused by: java.lang.RuntimeException: exception invoking: getTransaction
      at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:135)
      at org.jboss.seam.Component.callComponentMethod(Component.java:2074)
      at org.jboss.seam.Component.unwrap(Component.java:2100)
      at org.jboss.seam.Component.getInstance(Component.java:1879)
      at org.jboss.seam.Component.getInstance(Component.java:1844)
      at org.jboss.seam.Component.getInstance(Component.java:1821)
      at org.jboss.seam.Component.getInstance(Component.java:1816)
      at org.jboss.seam.transaction.Transaction.instance(Transaction.java:36)
      at org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:579)
      ... 34 more
      Caused by: javax.naming.NamingException: Cannot create resource instance
      at org.apache.naming.factory.TransactionFactory.getObjectInstance(TransactionFactory.java:113)
      at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:793)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
      at org.apache.naming.SelectorContext.lookup(SelectorContext.java:137)
      at javax.naming.InitialContext.lookup(InitialContext.java:351)
      at org.jboss.seam.transaction.Transaction.getUserTransaction(Transaction.java:79)
      at org.jboss.seam.transaction.Transaction.createUTTransaction(Transaction.java:71)
      at org.jboss.seam.transaction.Transaction.getTransaction(Transaction.java:44)
      at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
      at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:125)
      ... 42 more
      14 févr. 2008 18:10:10 org.jboss.seam.jsf.SeamPhaseListener beforePhase
      GRAVE: uncaught exception
      java.lang.RuntimeException: exception invoking: getTransaction
      at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:135)
      at org.jboss.seam.Component.callComponentMethod(Component.java:2074)
      at org.jboss.seam.Component.unwrap(Component.java:2100)
      at org.jboss.seam.Component.getInstance(Component.java:1879)
      at org.jboss.seam.Component.getInstance(Component.java:1844)
      at org.jboss.seam.Component.getInstance(Component.java:1821)
      at org.jboss.seam.Component.getInstance(Component.java:1816)
      at org.jboss.seam.transaction.Transaction.instance(Transaction.java:36)
      at org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsBeforePhase(SeamPhaseListener.java:301)
      at org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:142)
      at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:116)
      at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:222)
      at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
      at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
      at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
      at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
      at java.lang.Thread.run(Thread.java:595)
      Caused by: javax.naming.NamingException: Cannot create resource instance
      at org.apache.naming.factory.TransactionFactory.getObjectInstance(TransactionFactory.java:113)
      at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:793)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
      at org.apache.naming.SelectorContext.lookup(SelectorContext.java:137)
      at javax.naming.InitialContext.lookup(InitialContext.java:351)
      at org.jboss.seam.transaction.Transaction.getUserTransaction(Transaction.java:79)
      at org.jboss.seam.transaction.Transaction.createUTTransaction(Transaction.java:71)
      at org.jboss.seam.transaction.Transaction.getTransaction(Transaction.java:44)
      at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
      at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:125)
      ... 41 more

      I f you have already come across this exception, pls help me in resolving this. My application context.xml file is exacltly like applicationcontext.xml in spring exampe of jboss seam .

      as follows







      <!-- Here we are using a spring configured EMF you can just as easily use a Seam configured EMF using
      <persistence:entity-manager-factory/> unless your project depends upon some functionality spring
      provides an EMF such as the ability to inject a dataSource.
      -->





      <!-- This example uses resource local JpaTransactionManager. You could just as easily use a JtaTransactionManager -->

      <!-- Be sure to specify the SeamManagedEntityManagerFactory since that will manage the EM that will be
      beginning and ending transactions.-->



      <tx:annotation-driven proxy-target-class="true" />

      <!-- Example using PersistenceAnnotationBeanPostProcessor for persistence -->


      <!-- Example using JpaDaoSupport for persistence -->


      <seam:component/>


      <!-- Testing out a seam scoped spring bean -->

      <!-- Testing creation time injection -->



      <seam:configure-scopes default-auto-create="true" />


      <!-- Because we have multiple EntityManagerFactories in this applicaitonContext identify the
      SeamManagedEntityManagerFactory as the default -->



      <!-- EMF that wraps a Seam Managed EM instance for use in Spring -->

      <!-- The Seam managed-persistence-context component name. -->

      <!-- Optionally provide a unit name. If not specified the default would be the persistenceContextName -->



      <!-- TaskExecutor for example use of @Asynchronous -->



      <!-- Sample Hibernate Configuration -->





      org.jboss.seam.example.spring.Hotel



















      Thanks @ Rgds
      Augba