struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Edward Song" <Edward.S...@nuhorizons.com>
Subject RE: Struts 1.3.8 Plugins initializing twice
Date Thu, 03 Jan 2008 18:28:25 GMT
Hi Paul,

Thanks for the reply, I understand that plugins apply for the entire
framework.  However, I do NOT have the ActionServlet declared twice in my
web.xml nor do I have multiple struts-config files.

Here is my web xml for the action servlet.

<servlet>
	<description>Struts Action Servlet</description>
	<servlet-name>action</servlet-name>
	
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
	<init-param>
		<param-name>config</param-name>
	
<param-value>/WEB-INF/config/struts/struts-config.xml</param-value>
	</init-param>
	<load-on-startup>0</load-on-startup>
</servlet>


Also, my struts-config.xml....

<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
	<set-property property="pathnames"
value="/WEB-INF/config/validator/validator-rules.xml,/WEB-INF/config/validat
or/validation.xml"/> 
</plug-in>

<plug-in
className="com.blah.blah.blah.plugin.ApplicationInitPlugin"></plug-in>  
	
<!-- Tiles plugin-->  
<plug-in className="org.apache.struts.tiles.TilesPlugin">
	<set-property property="definitions-config"
value="/WEB-INF/config/tiles/tiles-defs.xml" />
</plug-in>


So as far as I know, the ActionServlet.init() method should be called once.
For me it executes twice.  I'm just trying to find out why this is the case.


Edward Song 

-----Original Message-----
From: paulus.benedictus@gmail.com [mailto:paulus.benedictus@gmail.com] On
Behalf Of Paul Benedict
Sent: Thursday, January 03, 2008 1:15 PM
To: Struts Users Mailing List
Subject: Re: Struts 1.3.8 Plugins initializing twice

Struts 1.4 contains the fix not to have plug-ins initialized twice. The fact
is that there is no such thing as module plug-ins. Only plug-ins for the
entire Struts framework. If you're seeing initialization twice, it's
possible you have the plugin defined twice within the model or two modules
with the same configuration.

Paul

On Jan 3, 2008 12:09 PM, Edward Song <Edward.Song@nuhorizons.com> wrote:

> Thanks Randy for the feedback.
>
> I looked deeply into it and this is what I found....
>
> The ActionServlet's init() method is called twice.  (I don't know why, I
> guess this is what I'm trying to find out...)
>
> There is a series of method calls in the ActionServlet.init() method...
>
> initModuleMessageResources(moduleConfig);
> initModulePlugIns(moduleConfig);
> initModuleFormBeans(moduleConfig);
> initModuleForwards(moduleConfig);
> initModuleExceptionConfigs(moduleConfig);
> initModuleActions(moduleConfig);
>
> Most of these seem to have a check whether or not the module has already
> been processed.  The initModulePlugins method does not seem to have this
> check.
>
> Line 871
> initModulePlugins();
> plugIns[i].init(this, config);
> No previous check if processed.
>
>
> Where as for form-beans, in initModulePlugIns method, a
> processFormBeanExtension method is called, which checks if it has already
> been processed.
>
> Line 948-957
> if (!beanConfig.isExtensionProcessed()) {
>  if (log.isDebugEnabled()) {
>       log.debug("Processing extensions for '"
>                + beanConfig.getName() + "'");
>  }
>
>  beanConfig = processFormBeanConfigClass(beanConfig, moduleConfig);
>  beanConfig.processExtends(moduleConfig);
> }
>
>
> So it looks as though, the plugin modules, specifically, are not being
> checked if they have already been processed.
>
> I'm not sure why, but probably there is some reason.
> However, I still do not know why ActionServlet.init() is called twice.
>
>
> Edward Song
>
> -----Original Message-----
> From: Randy Burgess [mailto:RBurgess@nuvox.com]
> Sent: Thursday, January 03, 2008 11:56 AM
> To: Struts Users Mailing List
> Subject: Re: Struts 1.3.8 Plugins initializing twice
>
> This is from a Struts 1.2.8 app of mine.
>
>  <servlet>
>    <servlet-name>action</servlet-name>
>    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
>    <init-param>
>      <param-name>config</param-name>
>      <param-value>/WEB-INF/struts-config.xml</param-value>
>    </init-param>
>    <init-param>
>      <param-name>debug</param-name>
>      <param-value>3</param-value>
>    </init-param>
>    <init-param>
>      <param-name>detail</param-name>
>      <param-value>3</param-value>
>    </init-param>
>    <load-on-startup>0</load-on-startup>
>  </servlet>
>
> You don¹t need the debug params but in this case it might not hurt. I
> cannot
> remember why but I believe that load on startup should always be 0 for
> Struts 1.
>
> Regards,
> Randy Burgess
> Sr. Web Applications Developer
> Nuvox Communications
>
>
>
>
> From: Edward Song <Edward.Song@nuhorizons.com>
> Reply-To: Struts Users Mailing List <user@struts.apache.org>
> Date: Thu, 3 Jan 2008 10:56:40 -0500
> To: <user@struts.apache.org>
> Subject: Struts 1.3.8 Plugins initializing twice
>
> Hi all,
>
> Struts 1.3.8
>
> I have a single struts module and it seems as though my plugins are
> getting
> loaded twice.
> This goes for the validator, tiles, and my own written plugins.
>
> I¹ve found out that if in the web.xml I do not specify a value for
> <load-on-startup> then the ActionServlet is not initialized until it is
> requested, and when it is requested it is initialized once.
>
> Web.xml
> <servlet>
>            <description>Struts Action Servlet</description>
>            <servlet-name>action</servlet-name>
>
> <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
>            <init-param>
>                  <param-name>config</param-name>
>
> <param-value>/WEB-INF/config/struts/struts-config.xml</param-value>
>            </init-param>
>            <load-on-startup>2</load-on-startup>
>      </servlet>
>
> However, if I add a value for <load-on-startup> it seems as though struts
> is
> initialized twice as I can see that the validator and tiles plugins are
> loaded twice.  The struts manual says that the framework should be loaded
> on
> startup to ensure correct operation.
>
> Ed
>
>
>
> The information contained in this e-mail is legally privileged and
> confidential information intended only for use by the  individual or
> entity
> named above.  If the reader of this e-mail is not the intended recipient,
> you are hereby notified that any dissemination or distribution hereof is
> prohibited.  If you have received this e-mail in error, please delete the
> material from your computer and immediately notify us at   631-396-5000.
> Thank you.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>
> The information contained in this e-mail is legally privileged and
> confidential information intended only for use by the  individual or
entity
> named above.  If the reader of this e-mail is not the intended recipient,
> you are hereby notified that any dissemination or distribution hereof is
> prohibited.  If you have received this e-mail in error, please delete the
> material from your computer and immediately notify us at   631-396-5000.
>  Thank you.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



The information contained in this e-mail is legally privileged and confidential information
intended only for use by the  individual or entity named above.  If the reader of this e-mail
is not the intended recipient, you are hereby notified that any dissemination or distribution
hereof is prohibited.  If you have received this e-mail in error, please delete the material
from your computer and immediately notify us at   631-396-5000.  Thank you.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message