1 Reply Latest reply on Nov 9, 2011 4:48 AM by asoldano

    scope=session in jbossws-cxf

    bapats

      In my jbossws-cxf configuration file, I am trying to declare a spring bean which is scope=session. In order for scope=session, I have declared RequestContextListener in the web.xml as follows:

       

         <listener>

          <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>

        </listener>

       

      When starting up JBoss with the web service deployed, I get the following exception:

      Caused by: java.lang.IllegalStateException: No Scope registered for scope 'session'

       

       

      The Spring documentation says that  - the scope 'session' is only available if you are using a web-aware Spring ApplicationContext implementation (such as XmlWebApplicationContext). If you try using these next scopes with regular Spring IoC containers such as the XmlBeanFactory or ClassPathXmlApplicationContext, you will get an IllegalStateException complaining about an unknown bean scope.

      (http://static.springsource.org/spring/docs/2.0.x/reference/beans.html#beans-factory-scopes)

       

       

      What ApplicationContext is being used by jbossws-cxf? How do I get the session scope to work? Any ideas will be greatly appreciated.

       

      I am currently using JBossWS-CXF 3.4.0.GA on JBoss 5.1.0GA.

       

      Thanks

        • 1. Re: scope=session in jbossws-cxf
          asoldano

          On JBossWS-CXF 3.4.0.GA, the JBossWSBusApplicationContext is used and that extends Apache CXF BusApplicationContext, which in turn extends ClassPathXmlApplicationContext.

          Recently on JBossWS-CXF 4.0.0-SNAPSHOT I've changed the JBossWSSpringBusFactory to work basically the same way as the vanilla CXF spring bus factory, including using a user provided ApplicationContext if any. I didn't try this scenario you're on, but if you want to, you can use jboss AS 7.1.0.Beta2-SNAPSHOT and JBossWS-CXF 4.0.0-SNAPSHOT. Soon both will be released in any case.