we implemented Drools having excel files as rules, working fine for low traffic but experiencing OutOfMemoryErrors in production (> 100 req/sec).
Any suggestion/help is appreciated.
Error stack trace:
Stack 0: start=0x513d000, end=0x5161000, guards=0x5142000 (ok), forbidden=0x5140000
Thread Stack Trace:
at jniExceptionCheck+7()#0xf7df37a7
at cmgrGenerateCode+260()#0xf7d77aa4
at generate_code2+937()#0xf7e5f7b9
at generate_code+97()#0xf7e5fa31
at get_runnable_codeinfo2+275()#0xf7e5ffe3
at get_runnable_codeinfo+25()#0xf7e60059
at RJNI_jrockit_vm_RNI_generateVirtualCode+185()#0xf7e60129
-- Java stack --
at jrockit/vm/RNI.generateVirtualCode(Ljava/lang/Object;II)I(Native Method)
at com/xxx/www/framework/drools/Rule_Name_10809963762DefaultConsequenceInvoker.setConsequence(Lorg/drools/core/spi/Consequence;)V(Unknown Source)
at org/drools/core/rule/builder/dialect/asm/ConsequenceGenerator.generate(ConsequenceGenerator.java:142)
at com/xxx/www/framework/drools/Rule_Name_10809963762DefaultConsequenceInvoker.evaluate(Lorg/drools/core/spi/KnowledgeHelper;Lorg/drools/core/WorkingMemory;)V(Unknown Source)
^-- Holding lock: com/xxx/www/framework/drools/Rule_Name_10809963762DefaultConsequenceInvoker#0x78d77348[biased lock]
at org/drools/core/common/DefaultAgenda.fireActivation(DefaultAgenda.java:1018)
^-- Holding lock: org/drools/core/common/DefaultAgenda#0x799cb318[biased lock]
at org/drools/core/phreak/RuleExecutor.fire(RuleExecutor.java:128)
at org/drools/core/phreak/RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:70)
^-- Holding lock: org/drools/core/phreak/RuleExecutor#0x5b00b628[biased lock]
at org/drools/core/common/DefaultAgenda.fireNextItem(DefaultAgenda.java:937)
at org/drools/core/common/DefaultAgenda.fireAllRules(DefaultAgenda.java:1201)
at org/drools/core/common/AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:958)
at org/drools/core/common/AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:932)
at org/drools/core/impl/StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:256)
at com/xxx/www/framework/drools/impl/MyDroolsRulesEngine.runRules(MyDroolsRulesEngine.java:163)
at com/xxx/www/framework/drools/impl/MyDroolsRulesEngine.processXLS(MyDroolsRulesEngine.java:88)
at com/xxx/www/framework/drools/MyDroolsRuleEngineHelper.processRule(MyDroolsRuleEngineHelper.java:74)
Implementation:
public abstract class MyDroolsRulesEngine{
private KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
private KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
/*calling drools by passing excel rules as inputstream and inputFact*/
public Object processXLS(InputStream inputStream, Object inputFact) {
if(inputStream!=null){
DecisionTableConfiguration dtableconfiguration = getDesisionTableConfiguration();
kbuilder.add(ResourceFactory.newInputStreamResource(inputStream), ResourceType.DTABLE, dtableconfiguration);
runRules(inputFact); /* calling drools to trigger rule execution */
return inputFact;
}
return null;
}
private void runRules(Object inputFact){
try {
if ( kbuilder.hasErrors() ) {
System.err.println( kbuilder.getErrors().toString() );
}
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
knowledgeSession = kbase.newStatefulKnowledgeSession(); /* new statefullsession for each web session */
knowledgeSession.insert(inputFact); /* inputFact has only 2-3 variables/values to validate in rule condition */
knowledgeSession.fireAllRules();
knowledgeSession.dispose(); /* disposing statefullsession after execution */
} catch (Exception e) {
LOG.error("Exception :", null, e);
}
}
DecisionTable excel rule
RuleTable Rule Name
CONDITION CONDITION ACTION
input: InputFact
var1 >= $1, var1 <= $2 var2 input.setResponse("$param");
0,5 test 02
Related
I am using CloseableHttpAsyncClient for downloading image with socketreadtimemout of 10 sec , connect timeout 5sec and doing a retry if it fails with sockettimeout and Timeout exception.
Now when the url is not accessible(404) then instead of resource not found exception it is failing with socket timeout and doing a retry again.So in my case for this invalid url also we are trying again and it adds up to the latency(~10+10=20 sec).
Below is the code snippet
Future<HttpResponse> httpResponseFuture = asyncCloseableHttpClient.execute(httpUriRequest, null);
try {
return httpResponseFuture.get(10000, TimeUnit.MILLISECONDS);
} catch (ExecutionException e) {
Throwable cause = e.getCause() != null ? e.getCause() : e;
if (cause instanceof ConnectException) {
throw new DownloadConnectionException("ConnectionException " + cause, DOWNLOAD_FAILED, cause);
}
if (cause instanceof SocketTimeoutException) {
throw new DownloadTimeoutException(DOWNLOAD_TIMEOUT_EXCEPTION);
}
if (cause instanceof ConnectionClosedException) {
throw new DownloadConnectionClosedException("ConnectionClosedException " + DOWNLOAD_FAILED, cause);
}
if(cause instanceof UnsupportedCharsetException) {
throw new BadRequestException("Image download failed with UnsupportedCharsetException " + cause,
INVALID_CONTENT_TYPE_EXCEPTION, cause);
}
} catch (TimeoutException e) {
throw new DownloadTimeoutException(DOWNLOAD_TIMEOUT_EXCEPTION);
}
This the config values for CloseableHttpAsyncClient
RequestConfig config = RequestConfig.custom()
.setSocketTimeout(10000)
.setConnectTimeout(5000)
.setRedirectsEnabled(true)
.setMaxRedirects(3)
.setStaleConnectionCheckEnabled(false) // never set this to true, 30 ms extra per request
.setProxyPreferredAuthSchemes(Arrays.asList(AuthSchemes.BASIC))
.build();
This is retry config
RetryConfig.custom().maxAttempts(downloadAttempts).retryOnException(e -> ( e instanceof DownloadTimeoutException) ) .waitDuration(Duration.ofMillis(30)).build();
To give more context why I am setting the socketreadtimemout of 10 sec because let's say for some bigger image download it may fail 1st time,so in that case retry is valid scenario but not in the resource not found case.
Can we do anything to make resource not found/invalid url fail fast so that it wont fail with sockettimeout exception.
I'm writing an application that should retranslate some data received from Bluetooth LE device to all TCP clients connected to it. The platform is Windows 10. For now it is console application with C++/CX enable as Bluetooth LE API is only available from WinRT. The BLE part is ready but I cannot make proper TCP server using WinRT.
I'm creating TCP socket server using StreamSocketListener and store all StreamSocket objects in std::vector. In a loop iterate the vector and send the data to all connected clients. Everything is working fine at this point. But should one client disconnect and the server crashes as it tries to send a data to disconnected socket and throws COMException and I cannot catch it.
Visual Studio 2015 crash message: Exception thrown at 0x752ADAE8 in SensoCLI.exe: Microsoft C++ exception: Platform::COMException ^ at memory location 0x02EFE1C0. Call stack points to auto sent = writeTask.get();
Below is the minimal listing of my app that corresponds to the problem:
#include "pch.h"
#using <platform.winmd>
#using <Windows.winmd>
using namespace std;
using namespace Windows::Foundation;
using namespace Platform;
using namespace concurrency;
namespace WFC = Windows::Foundation::Collections;
namespace WNS = Windows::Networking::Sockets;
namespace WSS = Windows::Storage::Streams;
bool shouldStop = false;
// TCP socket server
WNS::StreamSocketListener ^tcpListener;
vector<WNS::StreamSocket ^> *tcpClients;
void OnSocketConnectionReceived(WNS::StreamSocketListener ^aListener, WNS::StreamSocketListenerConnectionReceivedEventArgs ^args);
int main(Array<String ^> ^args)
{
tcpClients = new vector<WNS::StreamSocket ^>();
tcpListener = ref new WNS::StreamSocketListener();
tcpListener->ConnectionReceived += ref new TypedEventHandler<WNS::StreamSocketListener ^, WNS::StreamSocketListenerConnectionReceivedEventArgs ^>(&OnSocketConnectionReceived);
auto listenTask = create_task(tcpListener->BindServiceNameAsync("53450"));
listenTask.wait();
while (!shouldStop)
{
if (tcpClients->size() > 0)
{
auto netDataStream = ref new WSS::InMemoryRandomAccessStream();
auto writer = ref new WSS::DataWriter(netDataStream);
auto reader = ref new WSS::DataReader(netDataStream->GetInputStreamAt(0));
String^ stringToSend("Hello");
writer->WriteUInt32(writer->MeasureString(stringToSend));
writer->WriteString(stringToSend);
auto aTask = create_task(writer->StoreAsync());
unsigned int bytesStored = aTask.get();
aTask = create_task(reader->LoadAsync(bytesStored));
aTask.wait();
auto netData = reader->ReadBuffer(bytesStored);
for (auto iter = tcpClients->begin(); iter != tcpClients->end(); ++iter)
{
create_task((*iter)->OutputStream->WriteAsync(netData)).then([](task<unsigned int> writeTask) {
try
{
// Try getting an exception.
auto sent = writeTask.get();
wcout << L"Sent: " << sent << endl;
}
catch (Exception^ exception)
{
wcout << L"Send failed with error: " << exception->Message->Data() << " " << endl;
}
});
}
Sleep(1000);
}
}
}
void OnSocketConnectionReceived(WNS::StreamSocketListener ^aListener, WNS::StreamSocketListenerConnectionReceivedEventArgs ^args)
{
auto sock = args->Socket;
tcpClients->push_back(sock);
}
How do I properly catch the exception and handle disconnected StreamSocket?
I have this class, that reads rule files, insert facts and run rules.
public class RuleRunner {
private KieServices kieServices = KieServices.Factory.get();
public enum RuleType {
XLS,
DRL;
}
private void prepareSession(String ruleResource, RuleType type) {
KieFileSystem kieFileSystem = kieServices.newKieFileSystem();
Resource resource = kieServices.getResources().newClassPathResource(ruleResource);
switch(type) {
case XLS: {
resource.setResourceType(ResourceType.DTABLE);
break;
}
case DRL: {
resource.setResourceType(ResourceType.DRL);
break;
}
}
kieFileSystem.write(resource);
KieBuilder kieBuilder = kieServices.newKieBuilder(kieFileSystem);
kieBuilder.buildAll();
if (hasErrors(kieBuilder)) {
System.out.println("Failed to build!");
return;
}
}
private boolean hasErrors(KieBuilder builder) {
if (builder.getResults().getMessages().size() > 0) {
return true;
}
return false;
}
public void runRules(Object[] facts, GlobalVariable[] variables, String ruleResource, RuleType type) {
prepareSession(ruleResource, type);
KieContainer kieContainer = kieServices.newKieContainer(kieServices.getRepository().getDefaultReleaseId());
KieSession kieSession = kieContainer.newKieSession();
for (GlobalVariable variable: variables) {
kieSession.setGlobal(variable.getVariableName(), variable);
}
for(Object fact: facts) {
kieSession.insert(fact);
}
kieSession.fireAllRules();
kieSession.dispose();
}
}
And I have this rule
package com.pack.drools.apps;
import com.pack.drools.apps.domain.Person;
import com.pack.drools.apps.domain.GlobalVariable;
global GlobalVariable result
rule "if person has less that 10 cash then hes poor"
when
$person:Person(cash < 10)
then
result.setResult(-1);
end
rule "if person has more than 90 cash then hes rich"
when
$person:Person(cash > 90)
then
result.setResult(-2);
end
rule "if person has more than 10 and less than 90 then hes average"
when
$person:Person(cash >= 10 && cash <= 90)
then
result.setResult(-3);
end
However when I try to run my application
package pack.rup.drools.apps;
import pack.rup.drools.apps.core.RuleRunner;
import pack.rup.drools.apps.core.RuleRunner.RuleType;
import pack.rup.drools.apps.domain.GlobalVariable;
import pack.rup.drools.apps.domain.Person;
public class Main {
private static final String DEFAULT_PACKAGE = "pack/rup/drools/apps/";
private static final String XLS_FILE = DEFAULT_PACKAGE + "rule.xls";
private static final String DRL_FILE = DEFAULT_PACKAGE + "rule.drl";
public static void main(String[] args) {
RuleRunner ruleRunner = new RuleRunner();
// build fact
Person person = new Person();
person.setName("John");
person.setCash(100);
GlobalVariable result = new GlobalVariable();
result.setVariableName("result");
// ruleRunner.runRules(new Object[] { person }, new GlobalVariable[] { result }, XLS_FILE, RuleType.XLS);
ruleRunner.runRules(new Object[] { person }, new GlobalVariable[] { result }, DRL_FILE, RuleType.DRL);
System.out.println("Rule result: " + result.getResult());
}
}
my log looks like this
10:13:00.974 [main] INFO o.d.c.k.b.impl.KieRepositoryImpl - KieModule was added: MemoryKieModule[releaseId=org.default:arti
fact:1.0.0-SNAPSHOT]
10:13:00.982 [main] INFO o.d.c.k.b.impl.ClasspathKieProject - Found kmodule: file:/D:/workTestProjects/simpleDroolsApps/sda
-core/build/resources/main/META-INF/kmodule.xml
10:13:00.982 [main] DEBUG o.d.c.k.b.impl.ClasspathKieProject - KieModule URL type=file url=/D:/workTestProjects/simpleDrools
Apps/sda-core/build/resources/main
10:13:01.026 [main] WARN o.d.c.k.b.impl.ClasspathKieProject - Unable to find pom.properties in /D:/workTestProjects/simpleD
roolsApps/sda-core/build/resources/main
10:13:01.027 [main] WARN o.d.c.k.b.impl.ClasspathKieProject - As folder project tried to fall back to pom.xml, but could no
t find one for null
10:13:01.027 [main] WARN o.d.c.k.b.impl.ClasspathKieProject - Unable to load pom.properties from/D:/workTestProjects/simple
DroolsApps/sda-core/build/resources/main
10:13:01.027 [main] WARN o.d.c.k.b.impl.ClasspathKieProject - Cannot find maven pom properties for this project. Using the
container's default ReleaseId
10:13:01.027 [main] DEBUG o.d.c.k.b.impl.ClasspathKieProject - Discovered classpath module org.default:artifact:1.0.0-SNAPSH
OT
10:13:01.028 [main] INFO o.d.c.k.b.impl.KieRepositoryImpl - KieModule was added: FileKieModule[releaseId=org.default:artifa
ct:1.0.0-SNAPSHOT,file=D:\workTestProjects\simpleDroolsApps\sda-core\build\resources\main]
10:13:01.035 [main] WARN o.d.c.k.b.impl.AbstractKieModule - No files found for KieBase defaultKieBase, searching folder D:\
workTestProjects\simpleDroolsApps\sda-core\build\resources\main
10:13:01.131 [main] DEBUG o.drools.core.impl.KnowledgeBaseImpl - Starting Engine in PHREAK mode
Exception in thread "main" java.lang.RuntimeException: Unexpected global [result]
at org.drools.core.impl.StatefulKnowledgeSessionImpl.setGlobal(StatefulKnowledgeSessionImpl.java:1163)
at pack.rup.drools.apps.core.RuleRunner.runRules(RuleRunner.java:57)
at pack.rup.drools.apps.Main.main(Main.java:27)
:sda-core:run FAILED
It seems that you must use a particular directory when writing DRL or XLS resources to the KieFileSystem. Try
String filename = ...; // code that set filename to (e.g.) rule.drl
kieFileSystem.write( "src/main/resources/" + filename, resource );
Also, in your DRL you have
import com.pack.drools.apps.domain....
whereas in Main.java there is
import pack.rup.drools.apps.domain....
These imports should be from the same package.
Edit To test what globals are in the session:
Globals globals = kieSession.getGlobals();
System.out.println( globals.getGlobalKeys() );
We spent 2 days with my colleague and finally figured out that "Unexpected global" error happens when your DRL is empty because of compilation errors, that's why addGlobal() can't find any global declaration.
Once DRL compiler does not throw any exception on errors, instead you can check it yourself using:
if (kieBuilder.hasErrors()) {
System.out.print( kieBuilder.getErrors() );
}
If you insert a global, you must consume it. For example, if you have:
ArrayList<Thing> myThings = new ArrayList<Thing>();
kSession.setGlobal("myThings", myThings);
In your DRL files, you must have at least one matching:
global ArrayList<Thing> myThings;
Otherwise, you get:
java.lang.RuntimeException: Unexpected global [myThings]
at org.drools.core.impl.StatefulKnowledgeSessionImpl.setGlobal(StatefulKnowledgeSessionImpl.java:1200)
at com.sample.ThingTest.test(ThingTest.java:37)
I've read through a lot of the examples here and I still can't isolate my coding mistake. I'm trying to use the built-in Jersey-client MessageBodyReaders.
My pojo looks like this:
#XmlAccessorType(XmlAccessType.FIELD)
#XmlType(name = "", propOrder = {"name", "complexId", "libraryList", "partitionList", "nextLinks"})
#XmlRootElement(name = "LibraryComplex")
public class YapiLibraryComplex
{
#XmlTransient LibraryComplex libComplex;
String name;
int complexId;
List<Integer> libraryList;
List<String> partitionList;
List<URI> nextLinks;
.
.
.
my service looks like this:
#Path ("/")
public class YAPIWebService
{
#Context Application yapiAppl;
#Context UriInfo uriInfo;
#GET
#Produces ("application/xml")
//#Produces ("MediaType.APPLICATION_XML")
public Response getLibraryComplex()
{
LibraryComplex libComplex = (((YAPIapplication) yapiAppl).getLibComplex());
YapiLibraryComplex yapiLibPlex;
.
.
.
return Response.ok(yapiLibPlex).build();
and my client:
public static void main(String[] args)
{ //client client = new client();
System.out.println("the beginning");
//ClientConfig cc = new DefaultClientConfig();
//cc.getClasses().add(com.sun.jersey.api.core.);
//Client c = Client.create(cc);
Client c = Client.create();
WebResource rsrc = c.resource("http://localhost:7101/");
//ClientResponse response = rsrc.get(ClientResponse.class);
ClientResponse response = rsrc.accept(MediaType.APPLICATION_XML).get(ClientResponse.class);
YapiLibraryComplex libPlex = response.getEntity(YapiLibraryComplex.class);
System.out.println("the libPlex object is " + libPlex.toString());
String entityBody = response.getEntity(String.class);
System.out.println("the response as a string is " + entityBody);
System.out.println("the status is " + response.getStatus());
System.out.println("the links are " + response.getLinks());
System.out.println("the end");
}
}
And my stack trace:
the beginning
Jul 25, 2012 6:47:22 PM com.sun.jersey.core.impl.provider.xml.SAXParserContextProvider getInstance WARNING: JAXP feature XMLConstants.FEATURE_SECURE_PROCESSING cannot be set on a SAXParserFactory. External general entity processing is disabled but other potential security related features will not be enabled. org.xml.sax.SAXNotRecognizedException: http://javax.xml.XMLConstants/feature/secure-processing at oracle.xml.jaxp.JXSAXParserFactory.setFeature(JXSAXParserFactory.java:129)
at com.sun.jersey.core.impl.provider.xml.SAXParserContextProvider.getInstance(SAXParserContextProvider.java:80)
at com.sun.jersey.core.impl.provider.xml.SAXParserContextProvider.getInstance(SAXParserContextProvider.java:54)
at com.sun.jersey.core.impl.provider.xml.ThreadLocalSingletonContextProvider$1.initialValue(ThreadLocalSingletonContextProvider.java:64)
at java.lang.ThreadLocal.setInitialValue(ThreadLocal.java:141)
at java.lang.ThreadLocal.get(ThreadLocal.java:131)
at com.sun.jersey.core.impl.provider.xml.ThreadLocalSingletonContextProvider$2.getValue(ThreadLocalSingletonContextProvider.java:77)
at com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider.readFrom(XMLRootElementProvider.java:113)
at com.sun.jersey.core.provider.jaxb.AbstractRootElementProvider.readFrom(AbstractRootElementProvider.java:111)
at com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:554)
at com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:506)
at .tape.acs.yapi.smokeTest.main(smokeTest.java:32) Exception in thread "main" javax.ws.rs.WebApplicationException: javax.xml.bind.JAXBException: Error creating SAXSource - with linked exception: [org.xml.sax.SAXNotSupportedException: SAX feature 'http://xml.org/sax/features/external-general-entities' not supported.]
at com.sun.jersey.core.provider.jaxb.AbstractRootElementProvider.readFrom(AbstractRootElementProvider.java:115)
at com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:554)
at com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:506)
at .tape.acs.yapi.smokeTest.main(smokeTest.java:32) Caused by: javax.xml.bind.JAXBException: Error creating SAXSource - with linked exception:[org.xml.sax.SAXNotSupportedException: SAX feature 'http://xml.org/sax/features/external-general-entities' not supported.]
at com.sun.jersey.core.provider.jaxb.AbstractJAXBProvider.getSAXSource(AbstractJAXBProvider.java:205)
at com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider.readFrom(XMLRootElementProvider.java:113)
at com.sun.jersey.core.provider.jaxb.AbstractRootElementProvider.readFrom(AbstractRootElementProvider.java:111)
... 3 more Caused by: org.xml.sax.SAXNotSupportedException: SAX feature 'http://xml.org/sax/features/external-general-entities' not supported.
at oracle.xml.parser.v2.NonValidatingParser.setFeature(NonValidatingParser.java:1975)
at oracle.xml.parser.v2.SAXParser.setFeature(SAXParser.java:270)
at oracle.xml.jaxp.JXSAXParserFactory.newSAXParser(JXSAXParserFactory.java:92)
at com.sun.jersey.core.provider.jaxb.AbstractJAXBProvider.getSAXSource(AbstractJAXBProvider.java:201)
... 5 more Process exited with exit code 1.
I have downloaded Quartz and I am trying to run a sample.
I have a sample that uses JDBCJobStore which doesn't work but this sample works fine with RAMJobStore.
Just when I choose JDBCJobStore and exception get raised.
I am using quartz-1.6.5.
code:
package test;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.SchedulerFactory;
import org.quartz.SimpleTrigger;
import org.quartz.Trigger;
public class ReportRunner {
public static void main(String[] args) {
try {
SchedulerFactory schedFact = new org.quartz.impl.StdSchedulerFactory();
Scheduler sched = schedFact.getScheduler();
sched.start();
JobDetail jobDetail = null;
SimpleTrigger trigger2 = null;
jobDetail = new JobDetail("Income Report", "Report Generation",
QuartzReport.class);
jobDetail.getJobDataMap().put("type", "FULL");
jobDetail.setDurability(true);
trigger2 = new SimpleTrigger("Income Report", "Report Generation");
trigger2.setStartTime(new java.util.Date(
System.currentTimeMillis() + 4000));
trigger2.setRepeatInterval(5000);
trigger2.setRepeatCount(100);
sched.scheduleJob(jobDetail, trigger2);
} catch (Exception e) {
e.printStackTrace();
}
}
}
package test;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
public class QuartzReport implements Job {
public void execute(JobExecutionContext cntxt) throws JobExecutionException {
System.out.println("Generating report - "
+ cntxt.getJobDetail().getJobDataMap().get("type"));
}
}
config file:
org.quartz.scheduler.instanceName = Sched1
org.quartz.scheduler.instanceId = 1
org.quartz.scheduler.rmi.export = false
org.quartz.scheduler.rmi.proxy = false
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 3
org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate
org.quartz.jobStore.tablePrefix = QRTZ_
org.quartz.jobStore.dataSource = myDS
org.quartz.dataSource.myDS.driver = com.mysql.jdbc.Driver
org.quartz.dataSource.myDS.URL = jdbc:mysql://192.168.0.4:3306/conference
org.quartz.dataSource.myDS.user = root
org.quartz.dataSource.myDS.password =root
org.quartz.dataSource.myDS.maxConnections 5
this the excpetion showd in runtime , it was logged
org.quartz.JobPersistenceException: Couldn't acquire next trigger: Field 'PRIORITY' doesn't have a default value [See nested exception: java.sql.SQLException: Field 'PRIORITY' doesn't have a default value]
at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTrigger(JobStoreSupport.java:1778)
at org.quartz.impl.jdbcjobstore.JobStoreTX.acquireNextTrigger(JobStoreTX.java:1218)
at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:233)
* Nested Exception (Underlying Cause) ---------------
java.sql.SQLException: Field 'PRIORITY' doesn't have a default value
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1056)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:957)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3376)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3308)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1837)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1961)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2543)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1737)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2022)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1940)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1925)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102)
at org.quartz.impl.jdbcjobstore.StdJDBCDelegate.insertFiredTrigger(StdJDBCDelegate.java:3360)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTrigger(JobStoreSupport.java:1771)
at org.quartz.impl.jdbcjobstore.JobStoreTX.acquireNextTrigger(JobStoreTX.java:1218)
at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:233)
547 [QuartzScheduler_MyClusteredScheduler-NON_CLUSTERED_MisfireHandler] DEBUG org.quartz.impl.jdbcjobstore.SimpleSemaphore - Lock 'TRIGGER_ACCESS' retuned by: QuartzScheduler_MyClusteredScheduler-NON_CLUSTERED_MisfireHandler
java.sql.SQLException: Field
'PRIORITY' doesn't have a default
value
I guess you can tell where the problem lies by seeing the exception above.
I tried with Quartz 1.6.5 and I did't found any result, but it with with Quartz 1.5., I guess there might be some bug in 1.6.5 for JDBC jobstore.
Mohammad
I had a similar problem, and it was my bad.. because I was using version 2.1.1 and I created tables from docs of 2.2.1, I updated the version in Maven and it is working fine now.