• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Class Loading

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am running Tomcat 4.1.27 and am using Quartz to schedule a job at regular intervals. The task of the job is to get from the database any outstanding quotation requests, send an email to the respective parties, and then update the database to indicate that the request is no longer outstanding. I noticed that multiple emails were being sent to the same supplier for the same request, and having added some debug code, it appears that the job is running multiple times each time it is scheduled to run. I also noticed that when I added further debug information, the old version of the class ran AND so did the new version. I am assuming it is a class loading issue as the job implements StatefulJob (which is supposed to prevent concurrent running) and the delegate which the job calls is a Singleton (which is also running concurrently).

I can't understand why my job is loaded by more than one class loader - and (as you'd expect) I'd really like to avoid it. Can anybody tell me what I can do to resolve this problem?

Thanks!
Neil Richards
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you tell us a little about how you deployed your app?
Where the files are? the Quartz jars.
Any configuration changes to server.xml etc...
 
Neil Richards
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ben,

Sorry - yes. Quartz jar is in /webapps/app/WEB-INF/lib.

Server.xml changes are as follows:

Commented out<i>
<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
debug="0"/>
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
debug="0"/>
</i>
and using<i>
<Connector className="org.apache.ajp.tomcat4.Ajp13Connector"
port="8009" minProcessors="5" maxProcessors="75"
acceptCount="10" debug="0"/>
</i>
instead of <i>
<Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
port="8009" minProcessors="5" maxProcessors="75"
enableLookups="true" redirectPort="8443"
acceptCount="10" debug="0" connectionTimeout="0"
useURIValidationHack="false"
protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>
</i>
My context is<i>
<Context path="/zodiac" docBase="zodiac"
debug="5" reloadable="true" crossContext="true">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="prodn_log." suffix=".txt" timestamp="true"/>
<Resource name="jdbc/danaos"
auth="Container" type="javax.sql.DataSource"/>

<ResourceParams name="jdbc/danaos">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>

<parameter>
<name>maxActive</name>
<value>100</value>
</parameter>

<parameter>
<name>maxIdle</name>
<value>30</value>
</parameter>

<parameter>
<name>maxWait</name>
<value>10000</value>
</parameter>

<parameter>
<name>username</name>
<value>dan00</value>
</parameter>

<parameter>
<name>password</name>
<value>xxxxx</value>
</parameter>

<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>

<parameter>
<name>url</name>
<value>jdbc racle:thin:@10.1.0.3:1521 rcl</value>
</parameter>
</ResourceParams>
</Context></i>

No other unusual configuration that I can think of.

Thanks,
Neil
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where you've explicitly defined your app's context in server.xml and placed it in the root directory of the host (tomcat/webapps I assume), I wonder if Tomcat deployed it twice.

Did you shut off autoDeploy (in the Host node of server.xml)?

Try using the manager app to list all deployed apps and see if it got deployed twice. If you don't have the manager app installed, you could add a context listener that logs something when the app starts up.
 
Neil Richards
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The manager app only lists the application once. autoDeploy is set to true. The other piece of information worthy of note is that I have a handful of Quartz jobs scheduled, but this is the only one that seems to run multiple times.

The job config for this particular job is as follows:



Thanks again,
Neil
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic