tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Zoran Avtarovski <zo...@sparecreative.com>
Subject Re: Spring Scheduled Task is triggered multiple times
Date Thu, 02 Jul 2015 08:05:32 GMT
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


Mime
View raw message