You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Zoran Avtarovski <zo...@sparecreative.com> on 2015/07/02 07:22:01 UTC

Spring Scheduled Task is triggered multiple times

We have a struts2 based app that uses spiring scheduling to trigger a task
every morning at 6am.

The problem we have is that task in triggered multiple times,
simultaneously.

We have an Ubuntu 14.04.1 Server using the standard tomcat 7 installed using
apt-get and running on oracle java 8.

Tomcat is configured as a stand alone not a cluster and I had a look at the
servers.xml file and it only has one host.

It has to be the way we have tomcat configured, but I can¹t see what. I
changed from quartz to spring scheduling thinking the issue was quartz, but
that made no difference.

I¹d really appreciate any pointers at this stage.

Z.



Re: Spring Scheduled Task is triggered multiple times

Posted by André Warnier <aw...@ice-sa.com>.
Ok, just two more things :
1) don't top-post
2) provide the precise java and tomcat versions
and while you're at it, copy the first line of the Apache httpd error log (when it 
starts), as it gives the versions for the other things.

The information is not for me, as I have no idea about the gist of your problem.
It is for other people on this list later who might have an idea, to save them having to 
ask for it.  And the not top-posting bit, is because top-posting makes it more difficult 
for someone coming later, to figure out what you are responding to.

Zoran Avtarovski wrote:
> Sorry Andre,
> 
> I should have said that my tomcat config is pretty much standard, but here
> goes any way:
> 
> Server.xml
> <?xml version='1.0' encoding='utf-8'?>
> <Server port="8005" shutdown="SHUTDOWN">
>   <!--Initialize Jasper prior to webapps are loaded. Documentation at
> /docs/jasper-howto.html -->
>   <Listener className="org.apache.catalina.core.JasperListener" />
>   <!-- Prevent memory leaks due to use of particular java/javax APIs-->
>   <Listener 
> className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
>   <Listener 
> className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
>   <Listener 
> className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
> 
>   <GlobalNamingResources>
>     <Resource name="UserDatabase" auth="Container"
>               type="org.apache.catalina.UserDatabase"
>               description="User database that can be updated and saved"
>               factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
>               pathname="conf/tomcat-users.xml" />
>   </GlobalNamingResources>
>   <Service name="Catalina">
>     <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
>     <Engine name="Catalina" defaultHost="localhost">
>       <Realm className="org.apache.catalina.realm.LockOutRealm">
>         <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
>                resourceName="UserDatabase"/>
>       </Realm>
> 
>       <Host name="localhost"  appBase="webapps"
>             unpackWARs="true" autoDeploy="true">
>         <Valve className="org.apache.catalina.valves.AccessLogValve"
> directory="logs"
>                prefix="localhost_access_log." suffix=".txt"
>                pattern="%h %l %u %t &quot;%r&quot; %s %b" />
> 
>       </Host>
>     </Engine>
>   </Service>
> </Server>
> 
> HTTP connect via ModJK
> 
> Workers.properties file
> # Define 1 real worker using ajp13
> worker.list=pain 
> # Set properties for pain worker (ajp13)
> worker.pain.type=ajp13
> worker.pain.lbfactor=1
> worker.pain.host=localhost
> worker.pain.port=8009
> 
> Web.xml
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
>          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>          xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
>     <display-name>
>         Name
>     </display-name>
>     <description>
>         Description
>     </description>
>     <context-param>
>         <param-name>contextConfigLocation</param-name>
>         <param-value>/WEB-INF/classes/applicationContext.xml</param-value>
>     </context-param>
>     <context-param>
>         
> <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
>         
> <param-value>com.sparecreative.localisation.LocalisedMessages</param-value>
>     </context-param>
>     <filter>
>         <filter-name>UrlRewriteFilter</filter-name>
>         
> <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-cl
> ass>
>     </filter>
>     <filter>
>         <filter-name>struts-prepare</filter-name>
>         
> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter</
> filter-class>
>         <init-param>
>         	<param-name>actionPackages</param-name>
>         	<param-value>com.sparecreative</param-value>
>         </init-param>
>     </filter>
>     <filter>
>         <filter-name>struts-execute</filter-name>
>         
> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter</
> filter-class>
>     </filter>
>     <filter>
>         <filter-name>sitemesh</filter-name>
>         
> <filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-cl
> ass>
>     </filter>
>     <filter-mapping>
>         <filter-name>UrlRewriteFilter</filter-name>
>         <url-pattern>/*</url-pattern>
>         <dispatcher>REQUEST</dispatcher>
>     </filter-mapping>
>     
>     <filter-mapping>
>         <filter-name>struts-prepare</filter-name>
>         <url-pattern>/audio/*</url-pattern>
>         <dispatcher>REQUEST</dispatcher>
>         <dispatcher>FORWARD</dispatcher>
>     </filter-mapping>
>     <filter-mapping>
>         <filter-name>struts-prepare</filter-name>
>         <url-pattern>/*</url-pattern>
>         <dispatcher>REQUEST</dispatcher>
>         <dispatcher>FORWARD</dispatcher>
>     </filter-mapping>
> 
>     <filter-mapping>
>         <filter-name>sitemesh</filter-name>
>         <url-pattern>/*</url-pattern>
>         <dispatcher>FORWARD</dispatcher>
>         <dispatcher>REQUEST</dispatcher>
>     </filter-mapping>
>     
>     <filter-mapping>
>         <filter-name>struts-execute</filter-name>
>         <url-pattern>*.action</url-pattern>
>         <dispatcher>REQUEST</dispatcher>
>         <dispatcher>FORWARD</dispatcher>
>     </filter-mapping>
>     <filter-mapping>
>         <filter-name>struts-execute</filter-name>
>         <url-pattern>*.ftl</url-pattern>
>         <dispatcher>REQUEST</dispatcher>
>         <dispatcher>FORWARD</dispatcher>
>     </filter-mapping>
>     <filter-mapping>
>         <filter-name>struts-execute</filter-name>
>         <url-pattern>/struts/*</url-pattern>
>         <dispatcher>REQUEST</dispatcher>
>         <dispatcher>FORWARD</dispatcher>
>     </filter-mapping>
>     <listener>
>         
> <listener-class>org.springframework.web.context.ContextLoaderListener</list
> ener-class>
>     </listener>
>     <servlet>
>         <servlet-name>Connector</servlet-name>
>         
> <servlet-class>com.fredck.FCKeditor.connector.ConnectorServlet</servlet-cla
> ss>
>         <init-param>
>             <param-name>baseDir</param-name>
>             <param-value>/image/</param-value>
>         </init-param>
>         <load-on-startup>1</load-on-startup>
>     </servlet>
> 
>     <servlet-mapping>
>         <servlet-name>Connector</servlet-name>
>         
> <url-pattern>/fckeditor/editor/filemanager/browser/default/connectors/jsp/c
> onnector</url-pattern>
>     </servlet-mapping>
>     
>     <servlet-mapping>
>         <servlet-name>jsp</servlet-name>
>         <url-pattern>*.jsp</url-pattern>
>         <url-pattern>*.jssp</url-pattern>
>         <url-pattern>*.mp3</url-pattern>
>         <url-pattern>*.csp</url-pattern>
>         <url-pattern>*.jspx</url-pattern>
>     </servlet-mapping>
> 
>     <!-- MIME mapping -->
>     <mime-mapping>
>         <extension>css</extension>
>         <mime-type>text/css;charset=UTF-8</mime-type>
>     </mime-mapping>
>     <mime-mapping>
>         <extension>js</extension>
>         <mime-type>application/x-javascript;charset=UTF-8</mime-type>
>     </mime-mapping>
> 
>     <welcome-file-list>
>         <welcome-file>index.jsp</welcome-file>
>         <welcome-file>index.html</welcome-file>
>     </welcome-file-list>
> 
>     <security-role>
>         <description>Authorised to use the site</description>
>         <role-name>role</role-name>
>     </security-role>
> 
>     <resource-ref>
>         <description>My DB Connection</description>
>         <res-ref-name>jdbc/myDB</res-ref-name>
>         <res-type>javax.sql.DataSource</res-type>
>         <res-auth>Container</res-auth>
>     </resource-ref>
> 
>     <security-constraint>
>         <display-name>PainData</display-name>
>         <web-resource-collection>
>             <web-resource-name>Restricted Access</web-resource-name>
>             <!-- Define the context-relative URL(s) to be protected -->
>             <url-pattern>/protected/*</url-pattern>
> </web-resource-collection>
>         <auth-constraint>
>             <!-- Anyone with one of the listed roles may access this area
> -->
>             <role-name>role</role-name>
>         </auth-constraint>
>     </security-constraint>
> 
>     <!-- Default login configuration uses form-based authentication -->
>     <login-config>
>         <auth-method>FORM</auth-method>
>         <realm-name>MyApp</realm-name>
>         <form-login-config>
>             <form-login-page>/login.jsp</form-login-page>
>             <form-error-page>/login-error.jsp</form-error-page>
>         </form-login-config>
>     </login-config>
>         
> </web-app>
> 
> 
> Thanks again.
> 
> 
> Z.
> 
> On 2/07/2015 5:20 pm, "André Warnier" <aw...@ice-sa.com> wrote:
> 
>> Zoran Avtarovski wrote:
>>> We have a struts2 based app that uses spiring scheduling to trigger a
>>> task
>>> every morning at 6am.
>>>
>>> The problem we have is that task in triggered multiple times,
>>> simultaneously.
>>>
>>> We have an Ubuntu 14.04.1 Server using the standard tomcat 7 installed
>>> using
>>> apt-get and running on oracle java 8.
>>>
>>> Tomcat is configured as a stand alone not a cluster and I had a look at
>>> the
>>> servers.xml file and it only has one host.
>>>
>>> It has to be the way we have tomcat configured, but I can¹t see what. I
>>> changed from quartz to spring scheduling thinking the issue was quartz,
>>> but
>>> that made no difference.
>>>
>>> I¹d really appreciate any pointers at this stage.
>>>
>> And so would we..
>>
>> If you believe that the issue may be in the configuration, how about
>> copying that 
>> configuration file here for instance ?
>> (Remove any comments or sensitive information).
>> Also try to be a bit more precise in terms of what software you have
>> installed.
>> In the "bin" directory of Tomcat (/usr/share/tomcat7/bin), there is a
>> version.sh script.
>> Run it and copy the output here.
>>
>> (You may have a bit of trouble there under Ubuntu, because you probably
>> have to set 
>> JRE_HOME first. Do a "which java" and follow the links going through
>> /etc/alternatives,
>> until you find something with "jre/bin/java" in it. JRE_HOME is the path
>> ending in "jre/". 
>> Or find out how /etc/init.d/tomcat7 does it.)
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Spring Scheduled Task is triggered multiple times

Posted by Zoran Avtarovski <zo...@sparecreative.com>.
Sorry Andre,

I should have said that my tomcat config is pretty much standard, but here
goes any way:

Server.xml
<?xml version='1.0' encoding='utf-8'?>
<Server port="8005" shutdown="SHUTDOWN">
  <!--Initialize Jasper prior to webapps are loaded. Documentation at
/docs/jasper-howto.html -->
  <Listener className="org.apache.catalina.core.JasperListener" />
  <!-- Prevent memory leaks due to use of particular java/javax APIs-->
  <Listener 
className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
  <Listener 
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  <Listener 
className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />

  <GlobalNamingResources>
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>
  <Service name="Catalina">
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
    <Engine name="Catalina" defaultHost="localhost">
      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
               resourceName="UserDatabase"/>
      </Realm>

      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">
        <Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs"
               prefix="localhost_access_log." suffix=".txt"
               pattern="%h %l %u %t &quot;%r&quot; %s %b" />

      </Host>
    </Engine>
  </Service>
</Server>

HTTP connect via ModJK

Workers.properties file
# Define 1 real worker using ajp13
worker.list=pain 
# Set properties for pain worker (ajp13)
worker.pain.type=ajp13
worker.pain.lbfactor=1
worker.pain.host=localhost
worker.pain.port=8009

Web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    <display-name>
        Name
    </display-name>
    <description>
        Description
    </description>
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/classes/applicationContext.xml</param-value>
    </context-param>
    <context-param>
        
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
        
<param-value>com.sparecreative.localisation.LocalisedMessages</param-value>
    </context-param>
    <filter>
        <filter-name>UrlRewriteFilter</filter-name>
        
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-cl
ass>
    </filter>
    <filter>
        <filter-name>struts-prepare</filter-name>
        
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter</
filter-class>
        <init-param>
        	<param-name>actionPackages</param-name>
        	<param-value>com.sparecreative</param-value>
        </init-param>
    </filter>
    <filter>
        <filter-name>struts-execute</filter-name>
        
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter</
filter-class>
    </filter>
    <filter>
        <filter-name>sitemesh</filter-name>
        
<filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-cl
ass>
    </filter>
    <filter-mapping>
        <filter-name>UrlRewriteFilter</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
    </filter-mapping>
    
    <filter-mapping>
        <filter-name>struts-prepare</filter-name>
        <url-pattern>/audio/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>
    <filter-mapping>
        <filter-name>struts-prepare</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>

    <filter-mapping>
        <filter-name>sitemesh</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>REQUEST</dispatcher>
    </filter-mapping>
    
    <filter-mapping>
        <filter-name>struts-execute</filter-name>
        <url-pattern>*.action</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>
    <filter-mapping>
        <filter-name>struts-execute</filter-name>
        <url-pattern>*.ftl</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>
    <filter-mapping>
        <filter-name>struts-execute</filter-name>
        <url-pattern>/struts/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>
    <listener>
        
<listener-class>org.springframework.web.context.ContextLoaderListener</list
ener-class>
    </listener>
    <servlet>
        <servlet-name>Connector</servlet-name>
        
<servlet-class>com.fredck.FCKeditor.connector.ConnectorServlet</servlet-cla
ss>
        <init-param>
            <param-name>baseDir</param-name>
            <param-value>/image/</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>Connector</servlet-name>
        
<url-pattern>/fckeditor/editor/filemanager/browser/default/connectors/jsp/c
onnector</url-pattern>
    </servlet-mapping>
    
    <servlet-mapping>
        <servlet-name>jsp</servlet-name>
        <url-pattern>*.jsp</url-pattern>
        <url-pattern>*.jssp</url-pattern>
        <url-pattern>*.mp3</url-pattern>
        <url-pattern>*.csp</url-pattern>
        <url-pattern>*.jspx</url-pattern>
    </servlet-mapping>

    <!-- MIME mapping -->
    <mime-mapping>
        <extension>css</extension>
        <mime-type>text/css;charset=UTF-8</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>js</extension>
        <mime-type>application/x-javascript;charset=UTF-8</mime-type>
    </mime-mapping>

    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>

    <security-role>
        <description>Authorised to use the site</description>
        <role-name>role</role-name>
    </security-role>

    <resource-ref>
        <description>My DB Connection</description>
        <res-ref-name>jdbc/myDB</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
    </resource-ref>

    <security-constraint>
        <display-name>PainData</display-name>
        <web-resource-collection>
            <web-resource-name>Restricted Access</web-resource-name>
            <!-- Define the context-relative URL(s) to be protected -->
            <url-pattern>/protected/*</url-pattern>
</web-resource-collection>
        <auth-constraint>
            <!-- Anyone with one of the listed roles may access this area
-->
            <role-name>role</role-name>
        </auth-constraint>
    </security-constraint>

    <!-- Default login configuration uses form-based authentication -->
    <login-config>
        <auth-method>FORM</auth-method>
        <realm-name>MyApp</realm-name>
        <form-login-config>
            <form-login-page>/login.jsp</form-login-page>
            <form-error-page>/login-error.jsp</form-error-page>
        </form-login-config>
    </login-config>
        
</web-app>


Thanks again.


Z.

On 2/07/2015 5:20 pm, "André Warnier" <aw...@ice-sa.com> wrote:

>Zoran Avtarovski wrote:
>> We have a struts2 based app that uses spiring scheduling to trigger a
>>task
>> every morning at 6am.
>> 
>> The problem we have is that task in triggered multiple times,
>> simultaneously.
>> 
>> We have an Ubuntu 14.04.1 Server using the standard tomcat 7 installed
>>using
>> apt-get and running on oracle java 8.
>> 
>> Tomcat is configured as a stand alone not a cluster and I had a look at
>>the
>> servers.xml file and it only has one host.
>> 
>> It has to be the way we have tomcat configured, but I can¹t see what. I
>> changed from quartz to spring scheduling thinking the issue was quartz,
>>but
>> that made no difference.
>> 
>> I¹d really appreciate any pointers at this stage.
>> 
>
>And so would we..
>
>If you believe that the issue may be in the configuration, how about
>copying that 
>configuration file here for instance ?
>(Remove any comments or sensitive information).
>Also try to be a bit more precise in terms of what software you have
>installed.
>In the "bin" directory of Tomcat (/usr/share/tomcat7/bin), there is a
>version.sh script.
>Run it and copy the output here.
>
>(You may have a bit of trouble there under Ubuntu, because you probably
>have to set 
>JRE_HOME first. Do a "which java" and follow the links going through
>/etc/alternatives,
>until you find something with "jre/bin/java" in it. JRE_HOME is the path
>ending in "jre/". 
>Or find out how /etc/init.d/tomcat7 does it.)
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Spring Scheduled Task is triggered multiple times

Posted by André Warnier <aw...@ice-sa.com>.
Zoran Avtarovski wrote:
> We have a struts2 based app that uses spiring scheduling to trigger a task
> every morning at 6am.
> 
> The problem we have is that task in triggered multiple times,
> simultaneously.
> 
> We have an Ubuntu 14.04.1 Server using the standard tomcat 7 installed using
> apt-get and running on oracle java 8.
> 
> Tomcat is configured as a stand alone not a cluster and I had a look at the
> servers.xml file and it only has one host.
> 
> It has to be the way we have tomcat configured, but I can¹t see what. I
> changed from quartz to spring scheduling thinking the issue was quartz, but
> that made no difference.
> 
> I¹d really appreciate any pointers at this stage.
> 

And so would we..

If you believe that the issue may be in the configuration, how about copying that 
configuration file here for instance ?
(Remove any comments or sensitive information).
Also try to be a bit more precise in terms of what software you have installed.
In the "bin" directory of Tomcat (/usr/share/tomcat7/bin), there is a version.sh script. 
Run it and copy the output here.

(You may have a bit of trouble there under Ubuntu, because you probably have to set 
JRE_HOME first. Do a "which java" and follow the links going through /etc/alternatives, 
until you find something with "jre/bin/java" in it. JRE_HOME is the path ending in "jre/". 
Or find out how /etc/init.d/tomcat7 does it.)


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Spring Scheduled Task is triggered multiple times

Posted by Zoran Avtarovski <zo...@sparecreative.com>.
Neven,

You¹re a genius. The web.xml was fine but you got me thinking about spring
configuration.

We had one of our young guys run into an issue with spring. He implemented
some work around and nobody bothered checking because it was minor bit of
code on the periphery of the app.

Anyway I searched the code base and bingo there it was stuck in the
constructor, ApplicationContext context =  new
ClassPathXmlApplicationContext("applicationContext.xml²);

Each time the class was instantiated another spring context was created.
Lesson learnt, always check code you before accepting.

Code changed, tested and fixed.

Thanks again for the suggestion.

Z.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Spring Scheduled Task is triggered multiple times

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Neven Cvetkovic [mailto:neven.cvetkovic@gmail.com] 
> Subject: Re: Spring Scheduled Task is triggered multiple times

> On 3 Jul 2015 08:42, "Zoran Avtarovski" <zo...@sparecreative.com> wrote:
> >
> > I went through the logs in much greater detail today and I noticed when
> > the server starts I get multiple Spring loads in the log:
> >
> > org.apache.catalina.core.ApplicationContext.log Initializing Spring root
> > WebApplicationContext

> How are you loading your spring context? Where do you initialize it? Please
> share your web.xml, it is probably there.

I wonder if the OP erroneously placed his Spring config in Tomcat's conf/web.xml directory rather than correctly in the webapp's META-INF/web.xml.  Putting it in the global location means it's loaded by each webapp rather than just the desired one.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Spring Scheduled Task is triggered multiple times

Posted by Neven Cvetkovic <ne...@gmail.com>.
Hey Zoran,

On 3 Jul 2015 08:42, "Zoran Avtarovski" <zo...@sparecreative.com> wrote:
>
> I went through the logs in much greater detail today and I noticed when
> the server starts I get multiple Spring loads in the log:
>
> org.apache.catalina.core.ApplicationContext.log Initializing Spring root
> WebApplicationContext

How are you loading your spring context? Where do you initialize it? Please
share your web.xml, it is probably there.

Do you reference spring anywhere else, e.g. in your struts actions?

>
> And the number of times the log entry appears correlates to the number of
> executions, which makes sense.
>
> It looks like I need to find out why the spring config is loaded multiple
> times.
>
> I have a context.xml in the META-INF directory which sets up a db
> container and jndi datasource realm, could this be the issue?
>

That's not an issue. You are just configuring your datasource and security
domain/realm.

> <?xml version="1.0" encoding="UTF-8"?>
> <Context URIEncoding="UTF-8" antiResourceLocking="false" path="/pain">
>   <Resource     auth="Container"
>         driverClassName="com.mysql.jdbc.Driver"
>         logAbandoned="true"
>         testOnBorrow="true"
>         validationQuery="select count(*) from types"
>         maxActive="100"
>         maxIdle="30"
>         maxWait="10000"
>         name=“jdbc/myDB"
>         username=“xxx"
>         password=“xxxx"
>         removeAbandoned="true"
>         removeAbandonedTimeout="60"
>         type="javax.sql.DataSource"
>
url="jdbc:mysql://localhost:3306/my_data_v1?useUnicode=true&amp;characterE
> ncoding=UTF-8&amp;zeroDateTimeBehavior=convertToNull"/>
>
>   <Realm        className="org.apache.catalina.realm.DataSourceRealm"
>         dataSourceName=“jdbc/myDB"
>         debug="1"
>         localDataSource="true"
>         roleNameCol="status"
>         userCredCol="password"
>         userNameCol="user_name"
>         userRoleTable="users"
>         userTable="users"/>
> </Context>
>

Cheers
Neven

Re: Spring Scheduled Task is triggered multiple times

Posted by André Warnier <aw...@ice-sa.com>.
Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> Zoran,
> 
> On 7/3/15 2:41 AM, Zoran Avtarovski wrote:
>> I have a context.xml in the META-INF directory which sets up a db 
>> container and jndi datasource realm, could this be the issue?
>>
>> <?xml version="1.0" encoding="UTF-8"?> <Context URIEncoding="UTF-8"
>> antiResourceLocking="false" path="/pain">
> 
> 
> This is unconnected with your initial problem, but "URIEncoding" isn't
> a valid attribute for <Context>.

And as a didactic interlude, here is why :

1) the standard default character set / encoding on the WWW is (regretably) still 
ISO-8859-1 (otherwise known as iso-latin-1 or simply latin-1). So in the absence of this 
attribute, the request URI would be interpreted by the webserver as encoded in ISO-8859-1. 
  The attribute tells the webserver (Tomcat) to interpret the URI instead as being 
Unicode, UTF-8 encoded, which is not the default.

2) The webserver first has to decode the protocol and host and port part of the HTTP 
request.  That tells it (among other things) which <Host> should handle the request.

3) The mapping of the request to a webapp (also known as Context) comes later, within the 
<Host>.  And for doing that, the webserver needs to be able to decode and interpret the 
URI properly, for which it needs to know in which character set / encoding this URI is 
expressed.

At the level of the <Context> thus, this attribute would come "too late", because by then 
the mapping of the URI to a Context/webapp should already have happened.

That's why "URIEncoding" is an attribute of the <Host> entry, and not the <Context> entry. 
CQFD.

  Also, your context.xml should never
> contain a "path" attribute for <Context>.
> 

Explained in detail here : 
http://tomcat.apache.org/tomcat-8.0-doc/config/context.html#Common_Attributes
--> path

> You should remove both of these attributes from <Context>.
> 
> - -chris


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Spring Scheduled Task is triggered multiple times

Posted by Zoran Avtarovski <zo...@sparecreative.com>.
Chris, Andre,

Thanks for the tip re the context.xml file. The Weird thing is, if I
delete the path attribute, NetBeans adds it automatically using the
project name.

I suspect this is an issue with Netbeans and I¹ll have a look at how to
disable it. 

Thanks again. I really think this is one of the most informative lists.

Z.



On 6/07/2015 12:50 am, "Christopher Schultz"
<ch...@christopherschultz.net> wrote:

>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA256
>
>Zoran,
>
>On 7/3/15 2:41 AM, Zoran Avtarovski wrote:
>> I have a context.xml in the META-INF directory which sets up a db
>> container and jndi datasource realm, could this be the issue?
>> 
>> <?xml version="1.0" encoding="UTF-8"?> <Context URIEncoding="UTF-8"
>> antiResourceLocking="false" path="/pain">
>
>
>This is unconnected with your initial problem, but "URIEncoding" isn't
>a valid attribute for <Context>. Also, your context.xml should never
>contain a "path" attribute for <Context>.
>
>You should remove both of these attributes from <Context>.
>
>- -chris
>-----BEGIN PGP SIGNATURE-----
>Comment: GPGTools - http://gpgtools.org
>
>iQIcBAEBCAAGBQJVmURLAAoJEBzwKT+lPKRYlIkP/idZ2XhR9APPnma8zLXEPWDW
>V7t+4thVrd215pSG2rACJmdfW6/lvTu2buEZ7gDozFoyNp+jQBUXSn61W18BmGaf
>oRk4MotcLEeqKmZzWNRSeD5tZoTAX6R7RGoIGsmYw1ZyejBkBmlc78z5jd7wrHLU
>lwErgNhk2LuCgg/3ZMIsUxs6L5sn8lm/INtJm/2f+kWYpoc2slf9umfnZ4vZd3rM
>w6TzgW+khQ5XUWModJbqZxW9130rQ0n2E8H9HmjCtzn5kMBtyDiuidsmccOvXz30
>JVq6sH+bmqWtSTUAUVLOVhZGP3x6h2LSZVP9VmCZIOzGORy56idzw9Dc+TYHmRrd
>rWMIDEOITr2XnybvIMVlQ3s0hioLIC4+AaOKoG8XnGR3Hf6ELus8fuLQnNkzIk8A
>20MntP1+hCmG1zuLbWWRpMYEBLILesT1zOSc+VzhsH9TbhFSv/c9Vhtx2wRqOdWs
>/CImtx8aCSF4SE/vWa30b9WUS3nqsvddEF/f8lPiVpfdvATKuToPlG0V5dT7aleX
>Y2+BGZglCbWwxVqzhJwG0t4cNA5OoJC7HIpnd9CAT0k+BOMPPPgUNFLpKQup75ra
>jlUuyVUpheE0qPAdTg9RGy3yUyaZA8HCklFSkekKZRaSbMMX7n2U1FKGkZcUHqFx
>FQ1aKvpfbO+DjLPUJA3s
>=0Dtt
>-----END PGP SIGNATURE-----
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Spring Scheduled Task is triggered multiple times

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Zoran,

On 7/3/15 2:41 AM, Zoran Avtarovski wrote:
> I have a context.xml in the META-INF directory which sets up a db 
> container and jndi datasource realm, could this be the issue?
> 
> <?xml version="1.0" encoding="UTF-8"?> <Context URIEncoding="UTF-8"
> antiResourceLocking="false" path="/pain">


This is unconnected with your initial problem, but "URIEncoding" isn't
a valid attribute for <Context>. Also, your context.xml should never
contain a "path" attribute for <Context>.

You should remove both of these attributes from <Context>.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJVmURLAAoJEBzwKT+lPKRYlIkP/idZ2XhR9APPnma8zLXEPWDW
V7t+4thVrd215pSG2rACJmdfW6/lvTu2buEZ7gDozFoyNp+jQBUXSn61W18BmGaf
oRk4MotcLEeqKmZzWNRSeD5tZoTAX6R7RGoIGsmYw1ZyejBkBmlc78z5jd7wrHLU
lwErgNhk2LuCgg/3ZMIsUxs6L5sn8lm/INtJm/2f+kWYpoc2slf9umfnZ4vZd3rM
w6TzgW+khQ5XUWModJbqZxW9130rQ0n2E8H9HmjCtzn5kMBtyDiuidsmccOvXz30
JVq6sH+bmqWtSTUAUVLOVhZGP3x6h2LSZVP9VmCZIOzGORy56idzw9Dc+TYHmRrd
rWMIDEOITr2XnybvIMVlQ3s0hioLIC4+AaOKoG8XnGR3Hf6ELus8fuLQnNkzIk8A
20MntP1+hCmG1zuLbWWRpMYEBLILesT1zOSc+VzhsH9TbhFSv/c9Vhtx2wRqOdWs
/CImtx8aCSF4SE/vWa30b9WUS3nqsvddEF/f8lPiVpfdvATKuToPlG0V5dT7aleX
Y2+BGZglCbWwxVqzhJwG0t4cNA5OoJC7HIpnd9CAT0k+BOMPPPgUNFLpKQup75ra
jlUuyVUpheE0qPAdTg9RGy3yUyaZA8HCklFSkekKZRaSbMMX7n2U1FKGkZcUHqFx
FQ1aKvpfbO+DjLPUJA3s
=0Dtt
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Spring Scheduled Task is triggered multiple times

Posted by Zoran Avtarovski <zo...@sparecreative.com>.
I went through the logs in much greater detail today and I noticed when
the server starts I get multiple Spring loads in the log:

org.apache.catalina.core.ApplicationContext.log Initializing Spring root
WebApplicationContext

And the number of times the log entry appears correlates to the number of
executions, which makes sense.

It looks like I need to find out why the spring config is loaded multiple
times.

I have a context.xml in the META-INF directory which sets up a db
container and jndi datasource realm, could this be the issue?

<?xml version="1.0" encoding="UTF-8"?>
<Context URIEncoding="UTF-8" antiResourceLocking="false" path="/pain">
  <Resource     auth="Container"
	driverClassName="com.mysql.jdbc.Driver"
	logAbandoned="true"
	testOnBorrow="true"
	validationQuery="select count(*) from types"
	maxActive="100" 
	maxIdle="30" 
	maxWait="10000" 
	name=“jdbc/myDB" 
	username=“xxx"
	password=“xxxx" 
	removeAbandoned="true"
	removeAbandonedTimeout="60"
	type="javax.sql.DataSource"
	url="jdbc:mysql://localhost:3306/my_data_v1?useUnicode=true&amp;characterE
ncoding=UTF-8&amp;zeroDateTimeBehavior=convertToNull"/>

  <Realm        className="org.apache.catalina.realm.DataSourceRealm"
	dataSourceName=“jdbc/myDB"
	debug="1" 
	localDataSource="true"
	roleNameCol="status"
	userCredCol="password"
	userNameCol="user_name"
	userRoleTable="users"
	userTable="users"/>
</Context>



Z.

On 2/07/2015 3:22 pm, "Zoran Avtarovski" <zo...@sparecreative.com> wrote:

>We have a struts2 based app that uses spiring scheduling to trigger a task
>every morning at 6am.
>
>The problem we have is that task in triggered multiple times,
>simultaneously.
>
>We have an Ubuntu 14.04.1 Server using the standard tomcat 7 installed
>using
>apt-get and running on oracle java 8.
>
>Tomcat is configured as a stand alone not a cluster and I had a look at
>the
>servers.xml file and it only has one host.
>
>It has to be the way we have tomcat configured, but I can¹t see what. I
>changed from quartz to spring scheduling thinking the issue was quartz,
>but
>that made no difference.
>
>I¹d really appreciate any pointers at this stage.
>
>Z.
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Spring Scheduled Task is triggered multiple times

Posted by Zoran Avtarovski <zo...@sparecreative.com>.
Hi Andre,

On 2/07/2015 11:59 pm, "André Warnier" <aw...@ice-sa.com> wrote:

>Christopher Schultz wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA256
>> 
>> Zoran,
>> 
>> On 7/2/15 1:22 AM, Zoran Avtarovski wrote:
>>> We have a struts2 based app that uses spiring scheduling to trigger
>>> a task every morning at 6am.
>>>
>>> The problem we have is that task in triggered multiple times,
>>> simultaneously.
>> 
>> What evidence do you have that the task is triggered multiple times?
>> (I'm not saying I don't believe you, I'm just curious... it might help
>> determine WHY it's being run twice.)
>> 
>>> We have an Ubuntu 14.04.1 Server using the standard tomcat 7
>>> installed using apt-get and running on oracle java 8.
>> 
>> Ubuntu tends to be relatively up-to-date compared to other distros,
>> but do you know what version of Tomcat 7 you actually have? It won't
>> have anything to do with this problem, but upgrading to latest is
>> always recommended.
>> 
>>> Tomcat is configured as a stand alone not a cluster and I had a
>>> look at the servers.xml file and it only has one host.
>>>
>>> It has to be the way we have tomcat configured, but I can¹t see
>>> what. I changed from quartz to spring scheduling thinking the issue
>>> was quartz, but that made no difference.
>>>
>>> I¹d really appreciate any pointers at this stage.
>> 
>> At first, I was sure the issue would be multiple-deployment, triggered
>> by putting a <Context> element in your server.xml that pointed to a
>> WAR file (or exploded WAR directory) in your webapps/ folder. That
>> would do it. But you posted your server.xml elsewhere in this thread,
>> and that's not the problem.
>> 
>> But you might still have a double-deployment.
>> 
>> Do you have any files in CATALINA_BASE/conf/Catalina/localhost/? If
>> so, which ones and what do they contain?
>> 
>> What do you have in CATALINA_BASE/webapps/?
>> 
>> How do you launch Tomcat?
>> 
>
>Also, if an application is being doubly-deployed, it should be visible in
>the Tomcat 
>logfile (at the beginning, when Tomcat starts).

I can’t see any indications in the log the app is being doubly-deployed
but it looks like the spring config is loaded multiple times which is
causing spring to trigger the task multiple times. I suspect that
something that we, or our hosting provider, has done is causing the spring
issue and I just can’t see where that might be.

Z.

>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Spring Scheduled Task is triggered multiple times

Posted by André Warnier <aw...@ice-sa.com>.
Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> Zoran,
> 
> On 7/2/15 1:22 AM, Zoran Avtarovski wrote:
>> We have a struts2 based app that uses spiring scheduling to trigger
>> a task every morning at 6am.
>>
>> The problem we have is that task in triggered multiple times, 
>> simultaneously.
> 
> What evidence do you have that the task is triggered multiple times?
> (I'm not saying I don't believe you, I'm just curious... it might help
> determine WHY it's being run twice.)
> 
>> We have an Ubuntu 14.04.1 Server using the standard tomcat 7
>> installed using apt-get and running on oracle java 8.
> 
> Ubuntu tends to be relatively up-to-date compared to other distros,
> but do you know what version of Tomcat 7 you actually have? It won't
> have anything to do with this problem, but upgrading to latest is
> always recommended.
> 
>> Tomcat is configured as a stand alone not a cluster and I had a
>> look at the servers.xml file and it only has one host.
>>
>> It has to be the way we have tomcat configured, but I can¹t see
>> what. I changed from quartz to spring scheduling thinking the issue
>> was quartz, but that made no difference.
>>
>> I¹d really appreciate any pointers at this stage.
> 
> At first, I was sure the issue would be multiple-deployment, triggered
> by putting a <Context> element in your server.xml that pointed to a
> WAR file (or exploded WAR directory) in your webapps/ folder. That
> would do it. But you posted your server.xml elsewhere in this thread,
> and that's not the problem.
> 
> But you might still have a double-deployment.
> 
> Do you have any files in CATALINA_BASE/conf/Catalina/localhost/? If
> so, which ones and what do they contain?
> 
> What do you have in CATALINA_BASE/webapps/?
> 
> How do you launch Tomcat?
> 

Also, if an application is being doubly-deployed, it should be visible in the Tomcat 
logfile (at the beginning, when Tomcat starts).



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Spring Scheduled Task is triggered multiple times

Posted by Zoran Avtarovski <zo...@sparecreative.com>.
Hi Christopher,


On 2/07/2015 11:52 pm, "Christopher Schultz"
<ch...@christopherschultz.net> wrote:

>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA256
>
>Zoran,
>
>On 7/2/15 1:22 AM, Zoran Avtarovski wrote:
>> We have a struts2 based app that uses spiring scheduling to trigger
>> a task every morning at 6am.
>> 
>> The problem we have is that task in triggered multiple times,
>> simultaneously.
>
>What evidence do you have that the task is triggered multiple times?
>(I'm not saying I don't believe you, I'm just curious... it might help
>determine WHY it's being run twice.)

The task is running 6 times as I log an error message with log4j2 each
time spring triggers the task

2015-07-02 06:00:00,280 ERROR [pool-4-thread-1] service.PatientDaoService
(PatientDaoService.java:783) - Task triggered.
2015-07-02 06:00:00,287 ERROR [pool-5-thread-1] service.PatientDaoService
(PatientDaoService.java:783) - Task triggered.
2015-07-02 06:00:00,281 ERROR [pool-7-thread-1] service.PatientDaoService
(PatientDaoService.java:783) - Task triggered.
2015-07-02 06:00:00,824 ERROR [pool-3-thread-1] service.PatientDaoService
(PatientDaoService.java:783) - Task triggered.
2015-07-02 06:00:00,825 ERROR [pool-7-thread-1] service.PatientDaoService
(PatientDaoService.java:783) - Task triggered.
2015-07-02 06:00:00,869 ERROR [pool-8-thread-1] service.PatientDaoService
(PatientDaoService.java:783) - Task triggered.

You can see the task is triggered several times at the same time.

Here’s the relevant part of my spring config

<bean id="springCronTask" class="SpringCronTask">
	<property name="patientService">
		<ref bean="patientService"/>
	</property>
	<property name="localisedTextService">
		<ref bean="localisedTextService"/>
	</property>
    </bean>

<task:scheduled-tasks>
	<task:scheduled ref="springCronTask" method="sendReminders" cron="0 0 6 *
* ?" />
    </task:scheduled-tasks>




>
>> We have an Ubuntu 14.04.1 Server using the standard tomcat 7
>> installed using apt-get and running on oracle java 8.
>
>Ubuntu tends to be relatively up-to-date compared to other distros,
>but do you know what version of Tomcat 7 you actually have? It won't
>have anything to do with this problem, but upgrading to latest is
>always recommended.

Agreed and we are running Apache Tomcat/7.0.52 (Ubuntu) I figure Ubuntu
are pretty good at pushing out updates and I’m not too concerned if we’re
a little behind in releases.

Also, I don’t think it is a Tomcat issue but something in the our
configuration of either tomcat or spring.

>
>> Tomcat is configured as a stand alone not a cluster and I had a
>> look at the servers.xml file and it only has one host.
>> 
>> It has to be the way we have tomcat configured, but I can¹t see
>> what. I changed from quartz to spring scheduling thinking the issue
>> was quartz, but that made no difference.
>> 
>> I¹d really appreciate any pointers at this stage.
>
>At first, I was sure the issue would be multiple-deployment, triggered
>by putting a <Context> element in your server.xml that pointed to a
>WAR file (or exploded WAR directory) in your webapps/ folder. That
>would do it. But you posted your server.xml elsewhere in this thread,
>and that's not the problem.
>
>But you might still have a double-deployment.
>
>Do you have any files in CATALINA_BASE/conf/Catalina/localhost/? If
>so, which ones and what do they contain?

The only file here is manager.xml


>
>What do you have in CATALINA_BASE/webapps/?

A ROOT directory with a simple redirect jsp for redirect purposes
My jar file and an exploded version of the jar

>
>How do you launch Tomcat?

Using the tomcat7 Upstart script that installed in init.d on Ubuntu



>
>- -chris
>-----BEGIN PGP SIGNATURE-----
>Comment: GPGTools - http://gpgtools.org
>
>iQIcBAEBCAAGBQJVlUIoAAoJEBzwKT+lPKRYMccQAJZ1lUii5AnABhG83thkcMNr
>6eQ7FgNR9tqrwenn+DfSc4bXvTxxLNwa0hySHaopAwBlMkpxdxvUmSvWMtZlFaCI
>vAX6KaMLUnDT1oWChq4FJT9hX8GHKoE01xJnnaY8eph3mNu2F4KjEuK0VASY4b2g
>HaB1lAQgPuebW/hjBpiRkn0NKiEZbyJGGJXNKYHyCcUKf0C3Oitsv4gagcfkA1DQ
>wGhQmYGNYm55NMlQeMULUm+OeNynDhQVuVC1akKmYrO6EqVqmjajww4DU65xQpV+
>j+laTnYibidTYfI2TMQru4V/mnEKYLHJMU2avTC8B8+8uD95RCaZz+F3AI15x/Pu
>0fsMolT8hNGdF+92vP9UNZ4E1JW7YEeqkVudsfrZUQbuiwJeQF790IRp4ZE1TT44
>J/Omir3xVh3OjhZuysVWEBtF3S2tqVRVdkl8QUjeTohUfoNpsG8i+HpH6GklQSSX
>X37wxrmuQm7PUpSQ2aNEPxWKVPC1/njXcTXsr51fCAV1+Hcjojg1Fd0ky0ATPCCE
>ZuM/HQBXx2cOic4zOIHMyng+JqvWRUerTcu3yYEezXyn/G/iQOomXRLHmoZE1NAp
>u38GcW6OekhaJ3z+g+Yz3pdoN+d9q5Ajk5/NreJ/f7IRgDiy+phYR4bnrSQ4dOhz
>JoPHm92in/xmP/JEPSCX
>=Kp1E
>-----END PGP SIGNATURE-----
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>

Z.
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Spring Scheduled Task is triggered multiple times

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Zoran,

On 7/2/15 1:22 AM, Zoran Avtarovski wrote:
> We have a struts2 based app that uses spiring scheduling to trigger
> a task every morning at 6am.
> 
> The problem we have is that task in triggered multiple times, 
> simultaneously.

What evidence do you have that the task is triggered multiple times?
(I'm not saying I don't believe you, I'm just curious... it might help
determine WHY it's being run twice.)

> We have an Ubuntu 14.04.1 Server using the standard tomcat 7
> installed using apt-get and running on oracle java 8.

Ubuntu tends to be relatively up-to-date compared to other distros,
but do you know what version of Tomcat 7 you actually have? It won't
have anything to do with this problem, but upgrading to latest is
always recommended.

> Tomcat is configured as a stand alone not a cluster and I had a
> look at the servers.xml file and it only has one host.
> 
> It has to be the way we have tomcat configured, but I can¹t see
> what. I changed from quartz to spring scheduling thinking the issue
> was quartz, but that made no difference.
> 
> I¹d really appreciate any pointers at this stage.

At first, I was sure the issue would be multiple-deployment, triggered
by putting a <Context> element in your server.xml that pointed to a
WAR file (or exploded WAR directory) in your webapps/ folder. That
would do it. But you posted your server.xml elsewhere in this thread,
and that's not the problem.

But you might still have a double-deployment.

Do you have any files in CATALINA_BASE/conf/Catalina/localhost/? If
so, which ones and what do they contain?

What do you have in CATALINA_BASE/webapps/?

How do you launch Tomcat?

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJVlUIoAAoJEBzwKT+lPKRYMccQAJZ1lUii5AnABhG83thkcMNr
6eQ7FgNR9tqrwenn+DfSc4bXvTxxLNwa0hySHaopAwBlMkpxdxvUmSvWMtZlFaCI
vAX6KaMLUnDT1oWChq4FJT9hX8GHKoE01xJnnaY8eph3mNu2F4KjEuK0VASY4b2g
HaB1lAQgPuebW/hjBpiRkn0NKiEZbyJGGJXNKYHyCcUKf0C3Oitsv4gagcfkA1DQ
wGhQmYGNYm55NMlQeMULUm+OeNynDhQVuVC1akKmYrO6EqVqmjajww4DU65xQpV+
j+laTnYibidTYfI2TMQru4V/mnEKYLHJMU2avTC8B8+8uD95RCaZz+F3AI15x/Pu
0fsMolT8hNGdF+92vP9UNZ4E1JW7YEeqkVudsfrZUQbuiwJeQF790IRp4ZE1TT44
J/Omir3xVh3OjhZuysVWEBtF3S2tqVRVdkl8QUjeTohUfoNpsG8i+HpH6GklQSSX
X37wxrmuQm7PUpSQ2aNEPxWKVPC1/njXcTXsr51fCAV1+Hcjojg1Fd0ky0ATPCCE
ZuM/HQBXx2cOic4zOIHMyng+JqvWRUerTcu3yYEezXyn/G/iQOomXRLHmoZE1NAp
u38GcW6OekhaJ3z+g+Yz3pdoN+d9q5Ajk5/NreJ/f7IRgDiy+phYR4bnrSQ4dOhz
JoPHm92in/xmP/JEPSCX
=Kp1E
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org