History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: QUARTZ-562
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: James House
Reporter: Dallas Hopewell
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Quartz Scheduler

Remove dependency on jta.jar for non-J2EE environments

Created: 12/Feb/07 10:04 AM   Updated: 29/May/07 12:56 PM
Component/s: Core
Affects Version/s: 1.6
Fix Version/s: 1.6.1

File Attachments: 1. Text File QUARTZ-562.patch (0.6 kb)

Environment: Non-J2EE application server environments, e.g. Apache Tomcat servlet container
Issue Links:
Duplicate
 
This issue is duplicated by:
QUARTZ-585 QuartzInitializerListener not working... Major Closed


 Description  « Hide
Quartz version 1.6 has introduced a runtime dependency on the javax.comp.UserTransaction class due to static class method UserTransactionHelper.setUserTxLocation(String) being invoked whenever StdSchedulerFactory instantiates a Scheduler. This change to StdSchedulerFactory.java was for QUARTZ-339.

In a non-application server environment, trying to use Quartz leads to the following stacktrace: -

Exception in thread "main" java.lang.NoClassDefFoundError: javax/transaction/UserTransaction
at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:1104)
at org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1355)

The workaround is to add jta.jar to the classpath; however avoiding use of the UserTransactionHelper class when JTA is not used would prevent this runtime dependency for non-JTA environments, as is the case with Quartz 1.5.x

Could StdSchedulerJobFactory.java line 1104 be amended as follows :-

old: -

        UserTransactionHelper.setUserTxLocation(userTXLocation);

new: -

        if (userTXLocation != null) {
            UserTransactionHelper.setUserTxLocation(userTXLocation);
        }

Otherwise the UserTransactionHelper class is intialized even if the property org.quartz.scheduler.wrapJobExecutionInUserTransaction is false.

 All   Comments   Change History      Sort Order:
Henri Yandell - [05/Mar/07 04:07 PM ]
Patch for this change. I've tested it and it does indeed move jta.jar from being required to being optional.

Henri Yandell - [19/Mar/07 12:50 AM ]
 svn ci -m "Applying the fix patch from QUARTZ-562 - Remove dependency on jta.jar for non-J2EE environments. The test was external to Quartz's unit test system. " src/

Sending src/java/org/quartz/impl/StdSchedulerFactory.java
Transmitting file data .
Committed revision 667.