Since you&#39;re using REST, how are you tracking the session? If don&#39;t have some way of doing that you&#39;ll end up possibly creating a new session / conversation with each request because it isn&#39;t tied to the same session.<br>

<br><div class="gmail_quote">On Mon, Jan 16, 2012 at 15:35, Ove Ranheim <span dir="ltr">&lt;<a href="mailto:oranheim@gmail.com">oranheim@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div style="word-wrap:break-word">Jason,<div><br></div><div>Thanks for your feedback and maybe this is a regression. I made an interceptor to make my test code work, but I&#39;m not sure what implication it&#39;ll have in a production environment.</div>

<div><br></div><div>Ove</div><div><br></div><div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco;color:rgb(119,119,119)">@InterceptorBinding</div>

<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco;color:rgb(22,47,202)"><span style="color:#777777">@Target</span><span style="color:#000000">({ </span>TYPE<span style="color:#000000">, </span>METHOD<span style="color:#000000"> })</span></div>

<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco"><span style="color:#777777">@Retention</span>(RetentionPolicy.<span style="color:#162fca">RUNTIME</span>)</div>

<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco;color:rgb(119,119,119)"><span style="color:#7e2b68">public</span><span style="color:#000000"> </span><span style="color:#7e2b68">@interface</span><span style="color:#000000"> </span>ConversationAware<span style="color:#000000"> {</span></div>

<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco">}</div></div><div><br></div><div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco;color:rgb(119,119,119)">

@ConversationAware<span style="color:#000000"> </span></div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco;color:rgb(119,119,119)">@Interceptor</div>

<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco"><span style="color:#7e2b68">public</span> <span style="color:#7e2b68">class</span> ConversationHandler <span style="color:#7e2b68">implements</span> Serializable {</div>

<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco;min-height:15px"><br></div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco">

    <span style="color:#7e2b68">private</span> <span style="color:#7e2b68">static</span> <span style="color:#7e2b68">final</span> <span style="color:#7e2b68">long</span> <span style="color:#162fca">serialVersionUID</span> = -6414852756277060457L;</div>

<p style="margin:0px 0px 0px 0px;font:11.0px Monaco;min-height:15.0px">    <br></p><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco">    <span style="color:#7e2b68">private</span> BoundConversationContext <span style="color:#162fca">ctx</span>;</div>

<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco">    <span style="color:#7e2b68">private</span> BoundRequest <span style="color:#162fca">request</span>;</div>

<p style="margin:0px 0px 0px 0px;font:11.0px Monaco;min-height:15.0px">    <br></p><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco">    <span style="color:#7e2b68">private</span> <span style="color:#7e2b68">void</span> createBoundConversationRequest() {</div>

<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco">        <span style="color:#162fca">request</span> = <span style="color:#7e2b68">new</span> MutableBoundRequest(<span style="color:#7e2b68">new</span> HashMap&lt;String, Object&gt;(), <span style="color:#7e2b68">new</span> HashMap&lt;String, Object&gt;());</div>

<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco">    }</div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco;min-height:15px">

<br></div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco">    <span style="color:#7e2b68">private</span> <span style="color:#7e2b68">void</span> selectBoundConversationContext() {</div>

<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco">        <span style="color:#162fca">ctx</span> = Container.instance().deploymentManager().instance().select(BoundConversationContext.<span style="color:#7e2b68">class</span>).get();</div>

<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco">        <span style="color:#162fca">ctx</span>.associate(<span style="color:#162fca">request</span>);</div>

<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco">        <span style="color:#162fca">ctx</span>.activate();</div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco">

    }</div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco;min-height:15px"><br></div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco">

    <span style="color:#7e2b68">private</span> <span style="color:#7e2b68">void</span> cleanupBoundConversation() {</div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco">

        <span style="color:#7e2b68">if</span> (<span style="color:#162fca">ctx</span> != <span style="color:#7e2b68">null</span> &amp;&amp; <span style="color:#162fca">ctx</span>.isActive()) {</div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco">

            <span style="color:#162fca">ctx</span>.deactivate();</div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco">            <span style="color:#162fca">ctx</span>.dissociate(<span style="color:#162fca">request</span>);</div>

<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco">        }</div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco">

    }    </div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco;min-height:15px"><br></div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco;color:rgb(119,119,119)">

<span style="color:#000000">    </span>@AroundInvoke</div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco">    <span style="color:#7e2b68">public</span> Object handle(InvocationContext ctx) <span style="color:#7e2b68">throws</span> Exception {</div>

<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco">        <span style="color:#7e2b68">if</span> (ctx.getMethod().isAnnotationPresent( <span style="color:#777777">ConversationAware</span>.<span style="color:#7e2b68">class</span> )) {</div>

<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco">            createBoundConversationRequest();</div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco">

            <span style="color:#7e2b68">try</span> {</div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco">                selectBoundConversationContext();</div>

<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco">                <span style="color:#7e2b68">return</span> ctx.proceed();</div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco">

            } <span style="color:#7e2b68">finally</span> {</div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco">                cleanupBoundConversation();</div>

<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco">            }</div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco">

        }</div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco">        <span style="color:#7e2b68">return</span> <span style="color:#7e2b68">null</span>;</div>

<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco">    }    </div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco">

}</div></div><div><br></div><div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco;color:rgb(119,119,119)">@GET</div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco;color:rgb(57,63,253)">

<span style="color:#777777">@Path</span><span style="color:#000000">(</span>&quot;/{id:[0-9][0-9]*}&quot;<span style="color:#000000">)</span></div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco;color:rgb(22,47,202)">

<span style="color:#777777">@Produces</span><span style="color:#000000">(MediaType.</span>APPLICATION_JSON<span style="color:#000000">)</span></div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco;color:rgb(119,119,119)">

@ConversationAware</div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco"><span style="color:#7e2b68">public</span> <span style="text-decoration:underline">Pojo</span> lookupPojoById(<span style="color:#777777">@PathParam</span>(<span style="color:#393ffd">&quot;id&quot;</span>) Long id) {</div>

<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco">    // do something</div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco">

}    </div></div><div><div class="h5"><div><br></div><div><br></div><div><div><div>On Jan 16, 2012, at 9:45 PM, Jason Porter wrote:</div><br><blockquote type="cite"><div bgcolor="#FFFFFF"><div>I&#39;d have to go through the seam conversation code as it is not documented. But I don&#39;t think the interceptor will work as in REST there isn&#39;t really a session to tie the conversation to. <br>

<br>Sent from my iPhone</div><div><br>On Jan 16, 2012, at 13:35, Ove Ranheim &lt;<a href="mailto:oranheim@gmail.com" target="_blank">oranheim@gmail.com</a>&gt; wrote:<br><br></div><div></div><blockquote type="cite"><div>
I have configured <span style="font-family:Monaco;font-size:11px"><span style="color:#678e91">class</span></span><span style="font-family:Monaco;font-size:11px"><span style="color:#508e92">&gt;</span></span><span style="font-family:Monaco;font-size:11px">org.jboss.seam.faces.context.conversation.ConversationBoundaryInterceptor</span><span style="font-family:Monaco;font-size:11px"><span style="color:#508e92">&lt;/</span></span><span style="font-family:Monaco;font-size:11px"><span style="color:#678e91">class</span></span><span style="font-family:Monaco;font-size:11px"><span style="color:#508e92">&gt;</span></span> in WEB-INF/beans.xml and seam-faces is used. In fact I use both JSF and REST.<div>

<br></div><div>Anything else that needs to be wired up?</div><div><br></div><div><div><div>On Jan 16, 2012, at 9:14 PM, Jason Porter wrote:</div><br><blockquote type="cite"><div>If you&#39;re using Seam Conversation and starting the conversation it will work. Out of the box, conversations don&#39;t work outside JSF. <br>

<br>Sent from my iPhone<br><br>On Jan 16, 2012, at 13:04, Ove Ranheim &lt;<a href="mailto:oranheim@gmail.com" target="_blank">oranheim@gmail.com</a>&gt; wrote:<br><br><blockquote type="cite">Hi guys,<br></blockquote><blockquote type="cite">

<br></blockquote><blockquote type="cite">I&#39;m getting a &quot;WELD-001303 No active contexts for scope type javax.enterprise.context.ConversationScoped&quot; when making a call to a REST service that invokes a ConversationScoped bean.<br>

</blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Did I miss a configuration setting, or isn&#39;t ConversationScoped supported?<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">

Ove<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">javax.ejb.EJBTransactionRolledbackException: WELD-001303 No active contexts for scope type javax.enterprise.context.ConversationScoped<br>

</blockquote><blockquote type="cite">   org.jboss.as.ejb3.tx.CMTTxInterceptor.handleInCallerTx(CMTTxInterceptor.java:133)<br></blockquote><blockquote type="cite">   org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:196)<br>

</blockquote><blockquote type="cite">   org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:286)<br></blockquote><blockquote type="cite">   org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:182)<br>

</blockquote><blockquote type="cite">   org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)<br></blockquote><blockquote type="cite">   org.jboss.as.ejb3.component.session.SessionInvocationContextInterceptor.processInvocation(SessionInvocationContextInterceptor.java:71)<br>

</blockquote><blockquote type="cite">   org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)<br></blockquote><blockquote type="cite">   org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)<br>

</blockquote><blockquote type="cite">   org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:146)<br></blockquote><blockquote type="cite">   org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)<br>

</blockquote><blockquote type="cite">   org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)<br></blockquote><blockquote type="cite">   org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:76)<br>

</blockquote><blockquote type="cite">   com.parts.apartment.management.ApartmentService$$$view2.listApartmentUnits(Unknown Source)<br></blockquote><blockquote type="cite">   sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br>

</blockquote><blockquote type="cite">   sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)<br></blockquote><blockquote type="cite">   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br>

</blockquote><blockquote type="cite">   java.lang.reflect.Method.invoke(Method.java:597)<br></blockquote><blockquote type="cite">   org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:305)<br>
</blockquote>
<blockquote type="cite">   org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)<br></blockquote><blockquote type="cite">   org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163)<br>

</blockquote><blockquote type="cite">   org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:299)<br></blockquote><blockquote type="cite">   org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler.invoke(EnterpriseBeanProxyMethodHandler.java:125)<br>

</blockquote><blockquote type="cite">   org.jboss.weld.bean.proxy.EnterpriseTargetBeanInstance.invoke(EnterpriseTargetBeanInstance.java:62)<br></blockquote><blockquote type="cite">   org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:125)<br>

</blockquote><blockquote type="cite">   com.parts.apartment.management.ApartmentService$Proxy$_$$_Weld$Proxy$.listApartmentUnits(ApartmentService$Proxy$_$$_Weld$Proxy$.java)<br></blockquote><blockquote type="cite">   com.parts.apartment.management.ApartmentService$Proxy$_$$_WeldClientProxy.listApartmentUnits(ApartmentService$Proxy$_$$_WeldClientProxy.java)<br>

</blockquote><blockquote type="cite">   sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br></blockquote><blockquote type="cite">   sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)<br>

</blockquote><blockquote type="cite">   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br></blockquote><blockquote type="cite">   java.lang.reflect.Method.invoke(Method.java:597)<br>

</blockquote><blockquote type="cite">   org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:140)<br></blockquote><blockquote type="cite">   org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:255)<br>

</blockquote><blockquote type="cite">   org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:220)<br></blockquote><blockquote type="cite">   org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:209)<br>

</blockquote><blockquote type="cite">   org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:519)<br></blockquote><blockquote type="cite">   org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:496)<br>

</blockquote><blockquote type="cite">   org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119)<br></blockquote><blockquote type="cite">   org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)<br>

</blockquote><blockquote type="cite">   org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)<br></blockquote><blockquote type="cite">   org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)<br>

</blockquote><blockquote type="cite">   javax.servlet.http.HttpServlet.service(HttpServlet.java:847)<br></blockquote><blockquote type="cite">   org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:67)<br>

</blockquote><blockquote type="cite">   org.jboss.solder.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:65)<br></blockquote><blockquote type="cite">   org.jboss.solder.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:74)<br>

</blockquote><blockquote type="cite">   com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:126)<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">

<br></blockquote><blockquote type="cite">_______________________________________________<br></blockquote><blockquote type="cite">seam-dev mailing list<br></blockquote><blockquote type="cite"><a href="mailto:seam-dev@lists.jboss.org" target="_blank">seam-dev@lists.jboss.org</a><br>

</blockquote><blockquote type="cite"><a href="https://lists.jboss.org/mailman/listinfo/seam-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/seam-dev</a><br></blockquote></div></blockquote></div><br></div></div>

</blockquote></div></blockquote></div><br></div></div></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Jason Porter<br><a href="http://lightguard-jp.blogspot.com" target="_blank">http://lightguard-jp.blogspot.com</a><br>

<a href="http://twitter.com/lightguardjp" target="_blank">http://twitter.com/lightguardjp</a><br><br>Software Engineer<br>Open Source Advocate<br>Author of Seam Catch - Next Generation Java Exception Handling<br><br>PGP key id: 926CCFF5<br>

PGP key available at: <a href="http://keyserver.net" target="_blank">keyserver.net</a>, <a href="http://pgp.mit.edu" target="_blank">pgp.mit.edu</a><br>