You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Raj Rajendran <ra...@gmail.com> on 2009/09/08 19:55:24 UTC

[Orchestra] Multiple instances of beans created on every request

I am finding that multiple instances of each of the beans created in
Conversation scope are created, on every request.
See code fragments below:
I put debug lines in the Constructor to confirm this.
Go to login page, 3 instances of CaseBean, CaseActionBean, and LogBean
are created
After login, application redirects to welcome page. Another 2
instances of each of the above beans are instantiated.

Question is:
1. Why would going to a login.jsf page, which has nothing to do with
any of the beans, create these beans?
2. And why are multiple instances of these created?

<code>

  <bean class="org.springframework.beans.factory.config.CustomScopeConfigurer">
      <property name="scopes">
        <map>
          <entry key="conversation.manual">
            <bean
class="org.apache.myfaces.orchestra.conversation.spring.SpringConversationScope">
              <property name="timeout" value="480" />
            </bean>
          </entry>

          <entry key="conversation.access">
            <bean
class="org.apache.myfaces.orchestra.conversation.spring.SpringConversationScope">
              <property name="timeout" value="480" />
             <!-- <property name="advices">
                <list>
                  <ref bean="persistentContextConversationInterceptor"/>
                </list>
              </property> -->

              <property name="lifetime" value="access"/>
            </bean>
          </entry>
        </map>
      </property>
    </bean>

<bean name="caseBean" class="com.sybase.it.class2.jsf.beans.CaseBean"
scope="conversation.manual">
        <property name="siteAdminService">
        	<ref bean="siteAdminService"/>
        </property>
        <property name="contactService">
        	<ref bean="contactService"/>
        </property>
        <property name="caseService">
        	<ref bean="caseService"/>
        </property>
        <property name="productService">
        	<ref bean="productService"/>
        </property>
        <property name="userService">
        	<ref bean="userService"/>
        </property>
        <property name="preferenceService">
        	<ref bean="preferenceService"/>
        </property>
        <property name="lookupService">
        	<ref bean="lookupService"/>
        </property>
   </bean>

 <bean name="subCaseBean"
class="com.sybase.it.class2.jsf.beans.SubCaseBean"
scope="conversation.manual">
	        <property name="siteAdminService">
	        	<ref bean="siteAdminService"/>
	        </property>
	        <property name="subCaseService">
	        	<ref bean="subCaseService"/>
	        </property>	
			<property name="contactService">
				<ref bean="contactService"/>
	        </property>
		 	<property name="caseService">
		 		<ref bean="caseService"/>
		 	 </property>
	        <property name="productService">
	        	<ref bean="productService"/>
	        </property>
	        <property name="userService">
	        	<ref bean="userService"/>
	        </property>
	        <property name="preferenceService">
	        	<ref bean="preferenceService"/>
	        </property>
        <property name="lookupService">
        	<ref bean="lookupService"/>
        </property> 		
	</bean>
    <bean name="logBean"
class="com.sybase.it.class2.jsf.beans.LogBean"
scope="conversation.manual">
	 	<property name="caseService">
	 		<ref bean="caseService"/>
	 	 </property>
       <property name="logService">
       		<ref bean="logService"/>
       	</property>
		<property name="contactService">
			<ref bean="contactService"/>
      </property>
	</bean>	
	
	<bean name="caseActionBean"
class="com.sybase.it.class2.jsf.beans.CaseActionBean"
scope="conversation.manual">
	 	<property name="caseService">
	 		<ref bean="caseService"/>
	 	 </property>
       <property name="subCaseService">
       		<ref bean="subCaseService"/>
       	</property>
	</bean>	

</code>

Re: [Orchestra] Multiple instances of beans created on every request

Posted by Werner Punz <we...@gmail.com>.
Seems like a setup issue to me, do you have the conversationContext 
parameter in your urls?

Do you have the orchestra filters set in your web.xml?


Werner


RAJ RAJENDRAN schrieb:
> Bump.
> 
> Can anyone please offer any advice on this?
> 
> On Tue, Sep 8, 2009 at 10:55 AM, Raj Rajendran <raj.jeeva@gmail.com 
> <ma...@gmail.com>> wrote:
> 
>     I am finding that multiple instances of each of the beans created in
>     Conversation scope are created, on every request.
>     See code fragments below:
>     I put debug lines in the Constructor to confirm this.
>     Go to login page, 3 instances of CaseBean, CaseActionBean, and LogBean
>     are created
>     After login, application redirects to welcome page. Another 2
>     instances of each of the above beans are instantiated.
> 
>     Question is:
>     1. Why would going to a login.jsf page, which has nothing to do with
>     any of the beans, create these beans?
>     2. And why are multiple instances of these created?
> 
>     <code>
> 
>      <bean
>     class="org.springframework.beans.factory.config.CustomScopeConfigurer">
>          <property name="scopes">
>            <map>
>              <entry key="conversation.manual">
>                <bean
>     class="org.apache.myfaces.orchestra.conversation.spring.SpringConversationScope">
>                  <property name="timeout" value="480" />
>                </bean>
>              </entry>
> 
>              <entry key="conversation.access">
>                <bean
>     class="org.apache.myfaces.orchestra.conversation.spring.SpringConversationScope">
>                  <property name="timeout" value="480" />
>                 <!-- <property name="advices">
>                    <list>
>                      <ref bean="persistentContextConversationInterceptor"/>
>                    </list>
>                  </property> -->
> 
>                  <property name="lifetime" value="access"/>
>                </bean>
>              </entry>
>            </map>
>          </property>
>        </bean>
> 
>     <bean name="caseBean" class="com.sybase.it.class2.jsf.beans.CaseBean"
>     scope="conversation.manual">
>            <property name="siteAdminService">
>                    <ref bean="siteAdminService"/>
>            </property>
>            <property name="contactService">
>                    <ref bean="contactService"/>
>            </property>
>            <property name="caseService">
>                    <ref bean="caseService"/>
>            </property>
>            <property name="productService">
>                    <ref bean="productService"/>
>            </property>
>            <property name="userService">
>                    <ref bean="userService"/>
>            </property>
>            <property name="preferenceService">
>                    <ref bean="preferenceService"/>
>            </property>
>            <property name="lookupService">
>                    <ref bean="lookupService"/>
>            </property>
>       </bean>
> 
>      <bean name="subCaseBean"
>     class="com.sybase.it.class2.jsf.beans.SubCaseBean"
>     scope="conversation.manual">
>                    <property name="siteAdminService">
>                            <ref bean="siteAdminService"/>
>                    </property>
>                    <property name="subCaseService">
>                            <ref bean="subCaseService"/>
>                    </property>
>                            <property name="contactService">
>                                    <ref bean="contactService"/>
>                    </property>
>                            <property name="caseService">
>                                    <ref bean="caseService"/>
>                             </property>
>                    <property name="productService">
>                            <ref bean="productService"/>
>                    </property>
>                    <property name="userService">
>                            <ref bean="userService"/>
>                    </property>
>                    <property name="preferenceService">
>                            <ref bean="preferenceService"/>
>                    </property>
>            <property name="lookupService">
>                    <ref bean="lookupService"/>
>            </property>
>            </bean>
>        <bean name="logBean"
>     class="com.sybase.it.class2.jsf.beans.LogBean"
>     scope="conversation.manual">
>                    <property name="caseService">
>                            <ref bean="caseService"/>
>                     </property>
>           <property name="logService">
>                    <ref bean="logService"/>
>            </property>
>                    <property name="contactService">
>                            <ref bean="contactService"/>
>          </property>
>            </bean>
> 
>            <bean name="caseActionBean"
>     class="com.sybase.it.class2.jsf.beans.CaseActionBean"
>     scope="conversation.manual">
>                    <property name="caseService">
>                            <ref bean="caseService"/>
>                     </property>
>           <property name="subCaseService">
>                    <ref bean="subCaseService"/>
>            </property>
>            </bean>
> 
>     </code>
> 
> 


Re: [Orchestra] Multiple instances of beans created on every request

Posted by RAJ RAJENDRAN <ra...@gmail.com>.
Bump.
Can anyone please offer any advice on this?

On Tue, Sep 8, 2009 at 10:55 AM, Raj Rajendran <ra...@gmail.com> wrote:

> I am finding that multiple instances of each of the beans created in
> Conversation scope are created, on every request.
> See code fragments below:
> I put debug lines in the Constructor to confirm this.
> Go to login page, 3 instances of CaseBean, CaseActionBean, and LogBean
> are created
> After login, application redirects to welcome page. Another 2
> instances of each of the above beans are instantiated.
>
> Question is:
> 1. Why would going to a login.jsf page, which has nothing to do with
> any of the beans, create these beans?
> 2. And why are multiple instances of these created?
>
> <code>
>
>  <bean
> class="org.springframework.beans.factory.config.CustomScopeConfigurer">
>      <property name="scopes">
>        <map>
>          <entry key="conversation.manual">
>            <bean
>
> class="org.apache.myfaces.orchestra.conversation.spring.SpringConversationScope">
>              <property name="timeout" value="480" />
>            </bean>
>          </entry>
>
>          <entry key="conversation.access">
>            <bean
>
> class="org.apache.myfaces.orchestra.conversation.spring.SpringConversationScope">
>              <property name="timeout" value="480" />
>             <!-- <property name="advices">
>                <list>
>                  <ref bean="persistentContextConversationInterceptor"/>
>                </list>
>              </property> -->
>
>              <property name="lifetime" value="access"/>
>            </bean>
>          </entry>
>        </map>
>      </property>
>    </bean>
>
> <bean name="caseBean" class="com.sybase.it.class2.jsf.beans.CaseBean"
> scope="conversation.manual">
>        <property name="siteAdminService">
>                <ref bean="siteAdminService"/>
>        </property>
>        <property name="contactService">
>                <ref bean="contactService"/>
>        </property>
>        <property name="caseService">
>                <ref bean="caseService"/>
>        </property>
>        <property name="productService">
>                <ref bean="productService"/>
>        </property>
>        <property name="userService">
>                <ref bean="userService"/>
>        </property>
>        <property name="preferenceService">
>                <ref bean="preferenceService"/>
>        </property>
>        <property name="lookupService">
>                <ref bean="lookupService"/>
>        </property>
>   </bean>
>
>  <bean name="subCaseBean"
> class="com.sybase.it.class2.jsf.beans.SubCaseBean"
> scope="conversation.manual">
>                <property name="siteAdminService">
>                        <ref bean="siteAdminService"/>
>                </property>
>                <property name="subCaseService">
>                        <ref bean="subCaseService"/>
>                </property>
>                        <property name="contactService">
>                                <ref bean="contactService"/>
>                </property>
>                        <property name="caseService">
>                                <ref bean="caseService"/>
>                         </property>
>                <property name="productService">
>                        <ref bean="productService"/>
>                </property>
>                <property name="userService">
>                        <ref bean="userService"/>
>                </property>
>                <property name="preferenceService">
>                        <ref bean="preferenceService"/>
>                </property>
>        <property name="lookupService">
>                <ref bean="lookupService"/>
>        </property>
>        </bean>
>    <bean name="logBean"
> class="com.sybase.it.class2.jsf.beans.LogBean"
> scope="conversation.manual">
>                <property name="caseService">
>                        <ref bean="caseService"/>
>                 </property>
>       <property name="logService">
>                <ref bean="logService"/>
>        </property>
>                <property name="contactService">
>                        <ref bean="contactService"/>
>      </property>
>        </bean>
>
>        <bean name="caseActionBean"
> class="com.sybase.it.class2.jsf.beans.CaseActionBean"
> scope="conversation.manual">
>                <property name="caseService">
>                        <ref bean="caseService"/>
>                 </property>
>       <property name="subCaseService">
>                <ref bean="subCaseService"/>
>        </property>
>        </bean>
>
> </code>
>