Announcement Announcement Module
Collapse
No announcement yet.
Error creating bean with name 'scopedTarget Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error creating bean with name 'scopedTarget

    I know this is a fairly common question, but it's arising out of somewhat unusual circumstances.

    I have a spring-ws application that is trying to access a spring non-ws application with the following structure:

    scopedSessionBean->singletonBean->ws-singletonBean

    The ws-singletonBean has no problem accessing the singletonBean, but as soon as singletonBean accesses the scopedSessionBean, I get the following error:

    Code:
    Error creating bean with name 'scopedTarget.myBusServiceProxy': Scope 'session' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton
    Here are the relevant snippets of config files....

    scopedSessionBean
    Code:
    	<bean id="myBusServiceProxy" class="com.abc.MyBusinessServiceProxy" scope="session">
    		.... properties here.....
    		<aop:scoped-proxy/>
    	</bean>
    singletonBean
    Code:
        <bean id="locationBizService" class="com.abc.location.LocationBizService">
            <property name="factory">
                <bean id="locationSearchFactory" 
                    class="com.abc.location.LocationSearchFactory"/>
            </property>
            <property name="locationQueryBizProxy">
                <ref bean="locationQueryBizProxy"/>
            </property>
        </bean>
        
        <bean id="locationQueryBizProxy" class="com.abc.biz.BaseBizServiceMethod">
            <property name="businessServiceName">
                <value>Level3 Location Handling Service</value>
            </property>
            <property name="methodName">
                <value>Location Query All Results</value>
            </property>
            <property name="proxy">
                <ref bean="myBusServiceProxy"/>
            </property>
        </bean>
    ws-singletonBean
    Code:
        <bean id="locationServiceEndpoint" class="com.abc.endpoint.LocationServiceEndpoint">
            <property name="marshaller" ref="castorMarshaller" />
            <property name="unmarshaller" ref="castorMarshaller" />
            <property name="locSvc" ref="locationBizService" />
        </bean>
    
    ........
    Does anyone have any ideas what I might be doing wrong?

    Thanks!

    Don

  • #2
    RE: Error creating bean...

    Never mind all, the docs are not quite clear on this, but I resolved it with adding the RequestContextListener to my web.xml. The docs say "When using a Servlet 2.4+ web container, with requests processed outside of Spring's DispatcherServlet (e.g. when using JSF or Struts), you need to add the following javax.servlet.ServletRequestListener to the declarations in your web application's 'web.xml' file", but since my application was within a DispatcherServlet, it didn't seem necessary. In fact, it appears to be necessary. Perhaps a little clearing up in the documentation is necessary

    Comment

    Working...
    X