[jboss-user] [JBoss Seam] - Re: Design question with Rich GWT Ajax Client
I have a working solution in my ContextualHttpRequest, I call the same code as in SeamPhaseListener for JSF. before proceeding the request : anonymous wrote : |void begin() |{ | try | { | if ( !Transaction.instance().isActiveOrMarkedRollback() ) | { | //log.debug("beginning transaction prior to phase: " + phaseId); | Transaction.instance().begin(); | } | } | catch (Exception e) | { | throw new IllegalStateException("Could not start transaction", e); | } |} | at the end : anonymous wrote : |void commitOrRollback() |{ | try | { | if ( Transaction.instance().isActive() ) | { | //log.debug("committing transaction after phase: " + phaseId); | Transaction.instance().commit(); | } | else if ( Transaction.instance().isRolledBackOrMarkedRollback() ) | { | //log.debug("rolling back transaction after phase: " + phaseId); | Transaction.instance().rollback(); | } | } | catch (Exception e) | { | throw new IllegalStateException("Could not commit transaction", e); | } |} | | I'm sure there are issue with this solution but it works for the begining ... View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4118567#4118567 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4118567 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Design question with Rich GWT Ajax Client
It seems that SeamPhaseListener does lots of stuff for transaction on the with JSF. When the entitymanager is injected on my SessionBean. If we are on a JSF request the entityManager look like : anonymous wrote : | em = EntityManagerProxy | em.delegate = EmtityManagerImpl | | em.delegate.tx = TransactionImpl | em.delegate.tx.tx = JDBCTransaction | However, if a receive a request an create a ContextualHttpRequest on my custom servlet, the injected entityManager looks like : anonymous wrote : | em = EntityManagerProxy | em.delegate = EmtityManagerImpl | | em.delegate.tx = TransactionImpl | em.delegate.tx.tx = null | The underlying transaction is null ! Think that info can be usefull. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4118412#4118412 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4118412 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Design question with Rich GWT Ajax Client
Could anyone simply tell me if i do something wrong or stupid ? Cheers, View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4117731#4117731 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4117731 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Design question with Rich GWT Ajax Client
For info, I've got this on JBoss log when I start the Application : | | 10:04:50,874 WARN [SessionFactoryObjectFactory] InitialContext did not implement EventContext | | 10:04:51,112 WARN [SessionFactoryImpl] JTASessionContext being used with JDBCTransactionFactory; auto-flush will not operate correctly with getCurrentSession() | | View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4116971#4116971 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4116971 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Design question with Rich GWT Ajax Client
Any idea ? View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4116386#4116386 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4116386 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Design question with Rich GWT Ajax Client
I tried on the same application using the same config and the same EJB's. t works as expected when using JSF. However, when I do the same from my "hand made" Servlet using either ContextualHttpRequest or manualy start Seam context as in the SoapHandler It Does not work and I have the above exception. Any idea ? View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4116157#4116157 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4116157 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Design question with Rich GWT Ajax Client
Actually, I have the following problem when I try to use ContextHttpServletRequest or write the same code as in SOAPRequestHandler in my Servlet (which parses the JSON mesage and call the Seam component). I'm working with Seam Manager Persistence Context and Seam Managed Transaction. I therefore use @In EntityManager em; here is the code of my SFSB : | | import java.util.Collection; | | import javax.ejb.Remove; | import javax.ejb.Stateful; | import javax.persistence.EntityManager; | | import org.jboss.seam.annotations.Begin; | import org.jboss.seam.annotations.End; | import org.jboss.seam.annotations.FlushModeType; | import org.jboss.seam.annotations.In; | import org.jboss.seam.annotations.Logger; | import org.jboss.seam.annotations.Name; | import org.jboss.seam.core.Manager; | import org.jboss.seam.log.Log; | | @Stateful | @Name("SprintaService") | public class SprintaServiceBean implements SprintaService { | | @Logger | private Log log; | | @In EntityManager em; | | @Begin(join =true,flushMode = FlushModeType.MANUAL) | public void begin () { | this.log.info("Begin Conversation id : " + Manager.instance().getCurrentConversationId()); | } | | public Person createPerson(Person person) { | this.log.info("Continuing Conversation id : " + Manager.instance().getCurrentConversationId()); | this.em.persist(person); | return person; | } | | | @End | public void end() { | this.log.info("Ending Conversation id : " + Manager.instance().getCurrentConversationId()); | this.em.flush(); | } | | @Remove | public void remove () { | | } | | } | If I call the "createPerson" only, it works and commits the transaction. If I call the begin method then the createPerson, I have an Exception, but, after the Servlet complete. Here is the exception : anonymous wrote : | 12:27:51,056 INFO [CachedConnectionManager] Closing a connection for you. Please close them yourself: [EMAIL PROTECTED] | java.lang.Throwable: STACKTRACE | at org.jboss.resource.connectionmanager.CachedConnectionManager.registerConnection(CachedConnectionManager.java:290) | at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:417) | at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:842) | at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:88) | at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:69) | at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423) | at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144) | at org.hibernate.jdbc.AbstractBatcher.prepareSelectStatement(AbstractBatcher.java:123) | at org.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:73) | at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:99) | at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131) | at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87) | at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38) | at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:618) | at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592) | at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596) | at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:212) | at org.jboss.seam.persistence.EntityManagerProxy.persist(EntityManagerProxy.java:135) | at com.mycompany.sprinta.service.SprintaServiceBean.createPerson(SprintaServiceBean.java:50) | 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:585) | at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112) | at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166) | at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:44) | at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56) | at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46) | at org.jboss.seam.intercept.Se
[jboss-user] [JBoss Seam] - Re: Design question with Rich GWT Ajax Client
"[EMAIL PROTECTED]" wrote : Wrap your calls to Seam components in an ContextHttpServletRequest. Make sure the conversationId is in the request parameter map you pass in. Can I put the conversation id into the JSON Message and, in that case, do the same logic as in "SOAPRequestHandler" then without wrapping my code in ContextHttpServletRequest which need the request param ? What SOAPRequestHandler does for each request is : | | ServletLifecycle.beginRequest(request); | | ServletContexts.instance().setRequest(request); | | String conversationId = //I extract my cid here | ConversationPropagation.instance().setConversationId( conversationId ); | Manager.instance().restoreConversation(); | | ServletLifecycle.resumeConversation(request); and after the request completion : | String conversationId = Manager.instance().getCurrentConversationId(); | if (conversationId != null) | { | //put the cid in my JSON response | } | Manager.instance().endRequest( new ServletRequestSessionMap(request) ); Is that enough to use the Seam-managed persistence context and Seam managed transaction ? Tks View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4116056#4116056 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4116056 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Design question with Rich GWT Ajax Client
Wrap your calls to Seam components in an ContextHttpServletRequest. Make sure the conversationId is in the request parameter map you pass in. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4115332#4115332 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4115332 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Design question with Rich GWT Ajax Client
Those examples are very interesting, However, in my case, I'm not using GWT's RCP mechanism but simply JSON over HTTP. So, let's say, I have a Controller Servlet handling request and calling different session bean depending on the content of the message. there is where I don't know how to integrate Seam in the business. Tks. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4115295#4115295 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4115295 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Design question with Rich GWT Ajax Client
"[EMAIL PROTECTED]" wrote : There are two examples of GWT integration with Seam I know of, both of which take different approaches. The gwt example distributed with Seam in examples/remoting/gwt and the gwt stuff from Rob Jellinghaus http://unrealities.com/seamgwt/article_0.2.html. | | I suspect the remoting/gwt example approach may be more interesting for you... Excellent, I'm gonna have a look ! Tks. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4115285#4115285 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4115285 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Design question with Rich GWT Ajax Client
There are two examples of GWT integration with Seam I know of, both of which take different approaches. The gwt example distributed with Seam in examples/remoting/gwt and the gwt stuff from Rob Jellinghaus http://unrealities.com/seamgwt/article_0.2.html. I suspect the remoting/gwt example approach may be more interesting for you... View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4115283#4115283 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4115283 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Design question with Rich GWT Ajax Client
of course, I have the ability to add information to each JSON Message. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4115281#4115281 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4115281 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user