2 Replies Latest reply on Oct 20, 2011 10:29 AM by piklos

    Seam Remoting and ViewScope

    piklos

      Hello,
      I am trying to add seam remoting to my application, that i am working on. It already has seam-faces 3.0.2, and solder 3.0.0, and seam config 3.0.0 (and other stuff which is not relevant atm.). I use tomcat 7.
      I enocuntered a problem with deplyment, because seam-remoting 3.0.0.Final has a dependency on seam-conversation-spi.jar version CR1. It contains a beans.xml with just




      </beans>



      Which causes seam configuration module to throw an exception on loading. The exception is:



      org.jboss.seam.config.xml.util.XmlConfigurationException: 
      Wrong root namespace for XML config file, 
      expected:urn:java:ee or http://java.sun.com/xml/ns/javaee found: at jar:file:/E:/.../WEB-INF/lib/seam-conversation-spi-3.0.0.CR1.jar!/META-INF/beans.xml:19
      



      I resolved that by excluding the seam-conversation-spi-3.0.0.CR1.jar from remoting dependency in maven pom file, and manually adding dependency for seam-conversation-spi-3.0.0.CR2.jar.


      seam-conversation-spi-3.0.0.CR2.jar seems to have a good namespace in its beans.xml. So that problem is fixed.


      The problem that i can't solve for now, is that remoting works for request scoped beans, sessionscoped beans, converstion scoped beans, but it doesn't seem to work for ViewScoped beans.


      Now because seam-faces are configured in my project ViewScoped works everywhere but the remoting part.


      What happens is the ajax call is being fired and that is ok, but the response is this:




      <envelope><header><context><callId>0</callId></context></header><body><result><exception><message><str>WELD-001303%20No%20active%20contexts%20for%20scope%20type%20javax.faces.bean.ViewScoped</str></message></exception></result></body></envelope>



      I get WELD-001303 no active contexts for ViewScoped. This is not true, because i can confirm that the rest of the stuff that dependes on the view scope works, so only remoting call fails to cope with ViewScoped.( I tried RenderScope it also fail with the exact same exception).
      I 've read the documentation but i couldn't find anything about view scope in seam remoting. If i change the scope of that particular beans to any built in CDI scope it works.


      Can you please fill me up, on how to use seam remoting together with ViewScope. (ViewScope is the most convinient scope for ajax behaviour on my pages. I use ViewScope in 50% of the presentation beans, if it cannot work with seam-remoting, that seam-remoting is a no go for me).


      Thanks in advance.





        • 1. Re: Seam Remoting and ViewScope
          shane.bryzak

          Well, of course there is no view scope because remoting works outside of the JSF lifecycle.  Is there something stopping you from putting your business logic into request or conversation-scoped beans, and then calling those from your view-scoped beans?

          • 2. Re: Seam Remoting and ViewScope
            piklos

            Well yeah, you are right, ViewScope is connected to JSF lifecycle, I don't know what i was thinking.


            I can reimplemnt it with other scopes but it will just complicate things a bit.


            Thanks.