Service is failing with no exception thrown - service

I am somewhat new at developing in the VS C# environment and have come across the following issue. I have developed a C# service (BrassSS) that interfaces to an MS Access database and has been running since February 2018. The service is meant to perform a nightly backup at 4:00am, send reminder emails at 7 am, and status emails at 10,2, and 6 daily. This has all been running fine for years until about a week ago when a customer calls me that reminder emails were not working. BrassSS keeps a log which I checked and noticed that the service is now dying just a few milliseconds later when I attempt to open the database to send reminder emails at 7:00am. This had never happened so I have been trying to scour the internet with my limited knowledge and struggling with this. Note that I have a 'mirror' image of the service that I run as a console app (BrassConsoleApp), which also fails at the same location. I finally made it to the Event Viewer (two log entries shown below) and it would seem that an unhandled exception is occurring.
I don't know if this helps, and may only add to the confusion, but in the last month I have switched MS Access from 2007 to 2016. Having said that, note that at 4:00am, when the backup kicks in, the exact same code you see below to open the database, runs with no issue.
So at 7:00am, the timer elapses and I need to open the database, here is my code:
class DBif
{
const string cstClassName = "DBif";
private OleDbConnection conDB;
private string strPathToBEFile;
public bool openDB(string strFullPathToDB) {
// Connects to the DB
this.strPathToBEFile = strFullPathToDB;
try {
if (this.conDB != null) {
this.conDB.Close();
}
Logs.addEvent("Info", cstClassName, "openDB", "Attempt to Open DB: " + strPathToBEFile); //debug
string connectionString = "Provider=Microsoft.ACE.OLEDB.16.0;Data Source=" + strPathToBEFile + ";Jet OLEDB:Database Password=" + "----------" + ";";
Logs.addEvent("Info", cstClassName, "openDB", "Connection string: " + strPathToBEFile); //debug
this.conDB = new OleDbConnection(connectionString);
Logs.addEvent("Info", cstClassName, "openDB", "conDB successfull " + strPathToBEFile); //debug
this.conDB.Open(); ***<---- I place a breakpoint here, step over it, and the app FAILS WITH NO EXCEPTION***
Logs.addEvent("Info", cstClassName, "openDB", "DB Opened successfully: " + strPathToBEFile); //debug
return true;
} catch (Exception ex) {
Logs.addEvent("CRITICAL", cstClassName, "openConnection", "Error trying to Open database: " + ex.Message);
return false;
}
}
.....
}
I am hoping that some expert can shed some light into this and help me get to the root cause.
This is the Event Viewer log entry showing an ERROR when the app fails;
Log Name: Application
Source: Application Error
Date: 2021-Jun-10 4:30:01 PM
Event ID: 1000
Task Category: (100)
Level: Error
Keywords: Classic
User: N/A
Computer: Dell5759
Description:
Faulting application name: BrassConsoleApp.exe, version: 1.0.0.0, time stamp: 0x60c2722d
Faulting module name: mso20win32client.dll, version: 0.0.0.0, time stamp: 0x60a155a8
Exception code: 0xc000041d
Fault offset: 0x001d3a12
Faulting process id: 0x49a8
Faulting application start time: 0x01d75e34f0fb2b15
Faulting application path: D:\BitCrafters\Dev\Brass\Next\BrassConsoleApp\bin\Debug\BrassConsoleApp.exe
Faulting module path: C:\Program Files (x86)\Common Files\Microsoft Shared\Office16\mso20win32client.dll
Report Id: b2318536-61c1-4958-85c0-a6803c4bbd3b
Faulting package full name:
Faulting package-relative application ID:
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Application Error" />
<EventID Qualifiers="0">1000</EventID>
<Version>0</Version>
<Level>2</Level>
<Task>100</Task>
<Opcode>0</Opcode>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2021-06-10T20:30:01.9117979Z" />
<EventRecordID>200410</EventRecordID>
<Correlation />
<Execution ProcessID="0" ThreadID="0" />
<Channel>Application</Channel>
<Computer>Dell5759</Computer>
<Security />
</System>
<EventData>
<Data>BrassConsoleApp.exe</Data>
<Data>1.0.0.0</Data>
<Data>60c2722d</Data>
<Data>mso20win32client.dll</Data>
<Data>0.0.0.0</Data>
<Data>60a155a8</Data>
<Data>c000041d</Data>
<Data>001d3a12</Data>
<Data>49a8</Data>
<Data>01d75e34f0fb2b15</Data>
<Data>D:\BitCrafters\Dev\Brass\Next\BrassConsoleApp\bin\Debug\BrassConsoleApp.exe</Data>
<Data>C:\Program Files (x86)\Common Files\Microsoft Shared\Office16\mso20win32client.dll</Data>
<Data>b2318536-61c1-4958-85c0-a6803c4bbd3b</Data>
<Data>
</Data>
<Data>
</Data>
</EventData>
</Event>
SECOND EVENT VIEWER INFO LOG ENTRY JUST AFTER THE ONE ABOVE ---------------------------------------------------
Log Name: Application
Source: Windows Error Reporting
Date: 2021-Jun-10 4:30:04 PM
Event ID: 1001
Task Category: None
Level: Information
Keywords: Classic
User: N/A
Computer: Dell5759
Description:
Fault bucket 1496835596276001519, type 1
Event Name: APPCRASH
Response: Not available
Cab Id: 0
Problem signature:
P1: BrassConsoleApp.exe
P2: 1.0.0.0
P3: 60c2722d
P4: mso20win32client.dll
P5: 0.0.0.0
P6: 60a155a8
P7: c000041d
P8: 001d3a12
P9:
P10:
Attached files:
\\?\C:\TMP\{348A1C8B-8F9A-4947-A735-1A6662FAB73B} - OProcSessId.dat
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WERBA96.tmp.dmp
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WERBD95.tmp.WERInternalMetadata.xml
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WERBDC5.tmp.xml
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WERBDD3.tmp.csv
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WERBE22.tmp.txt
These files may be available here:
\\?\C:\ProgramData\Microsoft\Windows\WER\ReportArchive\AppCrash_BrassConsoleApp._a65121a9886cf85d89cc2caea488de84ebbc6379_15a45da1_128d96b7-c591-43c7-8393-71b1b078c790
Analysis symbol:
Rechecking for solution: 0
Report Id: b2318536-61c1-4958-85c0-a6803c4bbd3b
Report Status: 268435456
Hashed bucket: e03e080836cae1e184c5d40b5330eaef
Cab Guid: 0
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Windows Error Reporting" />
<EventID Qualifiers="0">1001</EventID>
<Version>0</Version>
<Level>4</Level>
<Task>0</Task>
<Opcode>0</Opcode>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2021-06-10T20:30:04.9119743Z" />
<EventRecordID>200411</EventRecordID>
<Correlation />
<Execution ProcessID="0" ThreadID="0" />
<Channel>Application</Channel>
<Computer>Dell5759</Computer>
<Security />
</System>
<EventData>
<Data>1496835596276001519</Data>
<Data>1</Data>
<Data>APPCRASH</Data>
<Data>Not available</Data>
<Data>0</Data>
<Data>BrassConsoleApp.exe</Data>
<Data>1.0.0.0</Data>
<Data>60c2722d</Data>
<Data>mso20win32client.dll</Data>
<Data>0.0.0.0</Data>
<Data>60a155a8</Data>
<Data>c000041d</Data>
<Data>001d3a12</Data>
<Data>
</Data>
<Data>
</Data>
<Data>
\\?\C:\TMP\{348A1C8B-8F9A-4947-A735-1A6662FAB73B} - OProcSessId.dat
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WERBA96.tmp.dmp
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WERBD95.tmp.WERInternalMetadata.xml
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WERBDC5.tmp.xml
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WERBDD3.tmp.csv
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WERBE22.tmp.txt</Data>
<Data>\\?\C:\ProgramData\Microsoft\Windows\WER\ReportArchive\AppCrash_BrassConsoleApp._a65121a9886cf85d89cc2caea488de84ebbc6379_15a45da1_128d96b7-c591-43c7-8393-71b1b078c790</Data>
<Data>
</Data>
<Data>0</Data>
<Data>b2318536-61c1-4958-85c0-a6803c4bbd3b</Data>
<Data>268435456</Data>
<Data>e03e080836cae1e184c5d40b5330eaef</Data>
<Data>0</Data>
</EventData>
</Event>
Any help would be appreciated!
Thanks

After trying multiple approaches and dealing with this for over a week, I have decided to restructure my Service by replacing 3 timers with one. The single timer checks the time of day and calls the appropriate process.
I put this question up with the hope that someone would have the knowledge to decipher the Event Log entries. Since I did not get any response, I needed to move on with a solution.
Thank you for those of you that have taken a look and please disregard my original question as I have moved on.

Related

Need to XPath Filter for Specific USB Key in Event Log

I am trying to make my device shutdown whenever i take out my Win 10 BitLocker USB Startup Key (TSK). I have enabled the DriverFrameworks-UserMode/Operational Logging to generate the appropriate logs in which I want to grab the InstanceID of the specific USB drive.
Its able to pull all the 2102 events, from all removed USBs if I do the following:
Get-WinEvent -LogName Microsoft-Windows-DriverFrameworks-UserMode/Operational -FilterXPath '*[System[(EventID=2102)]]'
However when I attempt to filter for the one specific drive, it just errors out:
Get-WinEvent -LogName Microsoft-Windows-DriverFrameworks-UserMode/Operational -FilterXPath '*[System[(EventID=2102)]] and *[UserData[UMDFHostDeviceRequest[#instanceID="SWD\WPDBUSENUM\_??_USBSTOR#DISK&VEN__USB&PROD__SANDISK_3.2GEN1&REV_1.00#0401FCC4C24B5204ED6A023E9446EBDE67DADF08C86BAB77DBE89C8C17C339C#{53F56307-B6BF-11D0-94F2-00A0C91EFB8B}"]]]'
Whether I try changing all the & to & ,or the original posted above, it comes up with the error of:
Get-WinEvent : No events were found that match the specified selection criteria.
At line:1 char:1
+ Get-WinEvent -LogName Microsoft-Windows-DriverFrameworks-UserMode/Ope ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (:) [Get-WinEvent], Exception
+ FullyQualifiedErrorId : NoMatchingEventsFound,Microsoft.PowerShell.Commands.GetWinEventCommand
Any help would be greatly appreciated.
2102
Event Id 2102 General Tab (Event Viewer) - Message
Forwarded a finished Pnp or Power operation (27, 23) to the lower driver for device SWD\WPDBUSENUM\_??_USBSTOR#DISK&VEN__USB&PROD__SANDISK_3.2GEN1&REV_1.00#0401FCC4C24B5204ED6A023E9446EBDE67DADF08C86BAB77DBE89C8C17C339C#{53F56307-B6BF-11D0-94F2-00A0C91EFB8B} with status 0x0
Logname: Microsoft-Windows-DriverFrameworks-UserMode/Operational
Source: DriverFrameworks-UserMode Logged: [Date]
Event ID: 2102 Task Category: Pnp or Power Management to a particular device
Level: Information Keywords:
User : LOCAL SERVICE Computer: [Computername]
Op Code: (2)
2102 XML View
Event Id 2102 Details Tab (Event Viewer) - XML View
- <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
- <System>
<Provider Name="Microsoft-Windows-DriverFrameworks-UserMode" Guid="{2e35aaeb-857f-4beb-a418-2e6c0e54d988}" />
<EventID>2102</EventID>
<Version>1</Version>
<Level>4</Level>
<Task>37</Task>
<Opcode>2</Opcode>
<Keywords>0x8000000000000000</Keywords>
<TimeCreated SystemTime="2020-09-28T22:54:17.6538118Z" />
<EventRecordID>1883</EventRecordID>
<Correlation />
<Execution ProcessID="6580" ThreadID="22636" />
<Channel>Microsoft-Windows-DriverFrameworks-UserMode/Operational</Channel>
<Computer>Roswell</Computer>
<Security UserID="S-1-5-19" />
</System>
- <UserData>
- <UMDFHostDeviceRequest xmlns="http://www.microsoft.com/DriverFrameworks/UserMode/Event">
<LifetimeId>{c09c68ed-af3b-4e1a-b2dd-17e74f17dba3}</LifetimeId>
<InstanceId>SWD\WPDBUSENUM\_??_USBSTOR#DISK&VEN__USB&PROD__SANDISK_3.2GEN1&REV_1.00#0401FCC4C24B5204ED6A023E9446EBDE67DADF08C86BAB77DBE89C8C17C339C#{53F56307-B6BF-11D0-94F2-00A0C91EFB8B}</InstanceId>
<RequestMajorCode>27</RequestMajorCode>
<RequestMinorCode>23</RequestMinorCode>
<Argument1>0x0</Argument1>
<Argument2>0x0</Argument2>
<Argument3>0x0</Argument3>
<Argument4>0x0</Argument4>
<Status>0</Status>
</UMDFHostDeviceRequest>
</UserData>
</Event>
Try this
$instance = 'SWD\WPDBUSENUM\_??_USBSTOR#DISK&VEN__USB&PROD__SANDISK_3.2GEN1&REV_1.00#0401FCC4C24B5204ED6A023E9446EBDE67DADF08C86BAB77DBE89C8C17C339C#{53F56307-B6BF-11D0-94F2-00A0C91EFB8B}'
Get-WinEvent -LogName Microsoft-Windows-DriverFrameworks-UserMode/Operational -FilterXPath "*[System[EventID=2102]] and [UserData[UMDFHostDeviceRequest[#instanceID='$instance']]]"
Changing the #instanceID to InstanceId and XML escaping the instance id string did the trick for me. In your case the command should be something like this:
Get-WinEvent -LogName Microsoft-Windows-DriverFrameworks-UserMode/Operational -FilterXPath "*[System[(EventID=2102)]] and *[UserData[UMDFHostDeviceRequest[InstanceId='SWD\WPDBUSENUM\_??_USBSTOR#DISK&VEN__USB&PROD__SANDISK_3.2GEN1&REV_1.00#0401FCC4C24B5204ED6A023E9446EBDE67DADF08C86BAB77DBE89C8C17C339C#{53F56307-B6BF-11D0-94F2-00A0C91EFB8B}']]]"

Stop task when there is an exception thrown in ItemProcessor

I am designing a Spring Batch, which reads multiple csv files. I have used partitioning to read each file in chunk and process it to decrypt a certain column in the csv. Before decrypting if i encounter any validation error , i throw custom exception.
Now what i want is if the processing finds any validation error in the first line, the other lines should not be processed, and the job should end.
How can i achieve this? I tried to implement ProcessorListener too but it has no StepExecution object so that i can call SetTerminateOnly() or ExitStatus=Failed
Also note that i have multiple thread accessing the file in different lines.I want to kill all threads in the event of the first encountered error.
Thanks in advance
So, I identified that running multiple asynchronous concurrent threads (Spring Batch partitioning) was the real issue. Though one of the thread threw an Exception, the other threads were parallely running, and finished executing till the end.
Ath the end, the Job FAILED overall and there was no output processed, but it consumed time to process rest of the data.
Well,the solution to it is as simple as it gets. We just need stop the Job while encountering an error during processing.
The Custom Processor
public class MultiThreadedFlatFileItemProcessor implements ItemProcessor<BinFileVO, BinFileVO>,JobExecutionListener{
private JobExecution jobExecution;
private RSADecrypter decrypter;
public RSADecrypter getDecrypter() {
return decrypter;
}
public void setDecrypter(RSADecrypter decrypter) {
this.decrypter = decrypter;
}
#Override
/**
This method is used process the encrypted data
#param item
* */
public BinFileVO process(BinFileVO item) throws JobException {
if(null!=item.getEncryptedText() && !item.getEncryptedText().isEmpty()){
String decrypted = decrypter.getDecryptedText(item.getEncryptedText());
if(null!=decrypted && !decrypted.isEmpty()){
if(decrypted.matches("[0-9]+")){
if(decrypted.length() >= 12 && decrypted.length() <= 19){
item.setEncryptedText(decrypted);
}else{
this.jobExecution.stop();
throw new JobException(PropertyLoader.getValue(ApplicationConstants.DECRYPTED_CARD_NO_LENGTH_INVALID),item.getLineNumber());
}
}
}else{
this.jobExecution.stop();
throw new JobException(PropertyLoader.getValue(ApplicationConstants.EMPTY_ENCRYPTED_DATA),item.getLineNumber());
}
return item;
}
#Override
public void beforeJob(JobExecution jobExecution) {
this.jobExecution=jobExecution;
}
#Override
public void afterJob(JobExecution jobExecution) {
}
}
The Job xml config
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
.....>
<!-- JobRepository and JobLauncher are configuration/setup classes -->
<bean id="jobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean" />
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
<property name="jobRepository" ref="jobRepository" />
</bean>
<!-- Job Details -->
<job id="simpleMultiThreadsReaderJob" xmlns="http://www.springframework.org/schema/batch">
<step id="step" >
<partition step="step1" partitioner="partitioner">
<handler grid-size="5" task-executor="taskExecutor"/>
</partition>
</step>
<listeners>
<listener ref="decryptingItemProcessor"/>
</listeners>
</job>
<step id="step1" xmlns="http://www.springframework.org/schema/batch">
<tasklet>
<chunk reader="itemReader" writer="itemWriter" processor="decryptingItemProcessor" commit-interval="500"/>
<listeners>
<listener ref="customItemProcessorListener" />
</listeners>
</tasklet>
</step>
<!-- Processor Details -->
<bean id="decryptingItemProcessor" class="com.test.batch.io.MultiThreadedFlatFileItemProcessor">
<property name="decrypter" ref="rsaDecrypter" />
</bean>
<!-- RSA Decrypter class -->
<bean id="rsaDecrypter" class="test.batch.secure.rsa.client.RSADecrypter"/>
<!-- Partitioner Details -->
<bean class="org.springframework.batch.core.scope.StepScope" />
<bean id="partitioner" class="com.test.batch.partition.FlatFilePartitioner" scope="step">
<property name="resource" ref="inputFile"/>
</bean>
<bean id="taskExecutor"
class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
<property name="corePoolSize" value="10"/>
</bean>
<!-- Step will need a transaction manager -->
<bean id="transactionManager" class="org.springframework.batch.support.transaction.ResourcelessTransactionManager" />
........
.................
</beans>
Here are the logs
2016-09-01 06:32:40 INFO SimpleJobRepository:273 - Parent JobExecution is stopped, so passing message on to StepExecution
2016-09-01 06:32:43 INFO ThreadStepInterruptionPolicy:60 - Step interrupted through StepExecution
2016-09-01 06:32:43 INFO AbstractStep:216 - Encountered interruption executing step: Job interrupted status detected.
; org.springframework.batch.core.JobInterruptedException
2016-09-01 06:32:45 ERROR CustomJobListener:163 - exception :At line No. 1 : The decrypted card number is less than 12 or greater than 19 in length
2016-09-01 06:32:45 ERROR CustomJobListener:163 - exception :Job interrupted status detected.
2016-09-01 06:32:45 INFO SimpleJobLauncher:135 - Job: [FlowJob: [name=simpleMultiThreadsReaderJob]] completed with the following parameters: [{outputFile=/usr/local/pos/bulktokenization/csv/outputs/cc_output_EDWError_08162016.csv, partitionFile=/usr/local/pos/bulktokenization/csv/partitions/, inputFile=C:\usr\local\pos\bulktokenization\csv\inputs\cc_input_EDWError_08162016.csv, fileName=cc_input_EDWError_08162016}] and the following status: [FAILED]
2016-09-01 06:32:45 INFO BatchLauncher:122 - Exit Status : FAILED
2016-09-01 06:32:45 INFO BatchLauncher:123 - Time Taken : 8969
If we throw Custom Exception in Processor, Spring Batch will terminate and mark the job failed unless you setup 'skipable' exception. You have not mentioned where you perform validate step, are you doing in Processor or Reader? Let me know because it is where Spring Batch decides.
In my project, if I want to stop the job and throw Custom Exception, we put validation logic in a Tasklet or Processor and throw exception as below
private AccountInfoEntity getAccountInfo(Long partnerId) {
if(partnerId != null){
.....
return ....;
} else {
throw new ReportsException("XXXXX");
}
}

MS CRM Charts in Queue not saving

I am trying to create a chart in MS CRM and I keep getting an error.
Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: SecLib::AccessCheckEx failed. Returned hr = -2147187962, ObjectID: 00000000-0000-0000-0000-000000000000, OwnerId: e2e07c90-2105-e611-80f6-00155d293800, OwnerIdType: 8 and CallingUser: e2e07c90-2105-e611-80f6-00155d293800. ObjectTypeCode: 1112, objectBusinessUnitId: b4bd5fdf-2ccf-e311-80ca-00155d293800, AccessRights: CreateAccess Detail:
<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
<ErrorCode>-2147187962</ErrorCode>
<ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
<Message>SecLib::AccessCheckEx failed. Returned hr = -2147187962, ObjectID: 00000000-0000-0000-0000-000000000000, OwnerId: e2e07c90-2105-e611-80f6-00155d293800, OwnerIdType: 8 and CallingUser: e2e07c90-2105-e611-80f6-00155d293800. ObjectTypeCode: 1112, objectBusinessUnitId: b4bd5fdf-2ccf-e311-80ca-00155d293800, AccessRights: CreateAccess </Message>
<Timestamp>2016-08-08T06:05:22.5032353Z</Timestamp>
<InnerFault i:nil="true" />
<TraceText i:nil="true" />
</OrganizationServiceFault>
I understand this is a permissions error, but I can not find which permission to give.
ObjectTypeCode: 1112 is the user chart entity, and it looks like you are missing the CreateAccess right (e.g. create).

JAXB: default namespace declared in SOAP Envelop is not recognized in Body's xsi:type while unmarshalling

Below is a pseudo soap response coming from the server as below.
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn://tsys.com/xmlmessaging/T1">
<soap:Header>
<Header details/>
</soap:Header>
<soap:Body>
<inqMultiResponse>
<inqMultiResult status="000" statusMsg="passed" >
<inquireResult xsi:type="inqCustAddrResponseType" >
<addrInfo>
<addrType>Primary</addrType>
....
<x_4.0.0/>
</addrInfo>
</inquireResult>
<inquireResult xsi:type="inqGeneralAcctResponseType" status="000" statusMsg="passed">
<acctGeneralInfo>
<type>Z</type>
....
</stmtInfo>
<x_4.4.0/>
</acctGeneralInfo>
</inquireResult>
</inqMultiResult>
</inqMultiResponse>
</soap:Body>
While unmarshalling the xml using JAXB's Jaxb2Marshaller, i get the following exception in my EventHandler.
EVENT
SEVERITY: 1
MESSAGE: unrecognized type name: inqCustAddrResponseType. Did you mean {urn://tsys.com/xmlmessaging/T1}inqCustAddrResponseType?
LINKED EXCEPTION: null
LOCATOR
LINE NUMBER: -1
COLUMN NUMBER: -1
OFFSET: -1
OBJECT: null
NODE: [inquireResult: null]
URL: null
EVENT
SEVERITY: 2
MESSAGE: Unable to create an instance of com.tsys.xmlmessaging.t1.TSYSInquiryResponseType
LINKED EXCEPTION: java.lang.InstantiationException
LOCATOR
LINE NUMBER: -1
COLUMN NUMBER: -1
OFFSET: -1
OBJECT: null
NODE: [inquireResult: null]
URL: null
Below is my spring configuration.
<bean id="tsysTransactionMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
<property name="validationEventHandler" ref="validationEventHandler" />
<property name="contextPaths">
<list>
<value>com.tsys.xmlmessaging.t1</value>
</list>
</property>
</bean>
Request you to pls help me unmarshall the xml.
I have gone through various suggestions like
JAXB xsi:type subclass unmarshalling not working
and Blaise D blogs, but none of them talk of using it with Jaxb2Marshaller as in my case.
Please note,
- The classes are generated using XJC. Not including here to ensure that i dont clutter with unnecessary information. let me know if more info is required.
- We are not having any control on the xml soap response sent from server and hence we may not be able to change them.

Drools camel multiple ksession not firing

I am using drools 5.6. In camel-server.xml I have my route defined as:
<route>
<from uri="cxfrs://bean://rsServer"/>
<policy ref="droolsPolicy">
<unmarshal ref="xstream-json" />
<to uri="drools:node1" />
<marshal ref="xstream-json" />
</policy>
</route>
I am not defining a ksession. Then in my knowledge-service.xml I have 2 sessions defined (by user) that point to different DRL files. These import the same common DRL file
<drools:kbase id="kbase1" node="node1">
<drools:resources>
<drools:resource ref="ruletemplate" />
<drools:resource type="DRL" source="classpath:7.drl"/>
</drools:resources>
</drools:kbase>
<drools:ksession id="ksession-7" type="stateless" kbase="kbase1" node="node1"/>
<drools:kbase id="kbase2" node="node1">
<drools:resources>
<drools:resource ref="ruletemplate" />
<drools:resource type="DRL" source="classpath:12.drl"/>
</drools:resources>
</drools:kbase>
<drools:ksession id="ksession-12" type="stateless" kbase="kbase2" node="node1"/>
The idea is the ksession will be defined in the JSON request passed in:
{"batch-execution": { "lookup":"ksession-12", "commands": [ { "insert": { "out-identifier": ...
The server starts up and changing the lookup between 7 and 12 works. HOWEVER whatever lookup I run first is the only rule that actually fires. So if I start the server and run ksession-7 it will run successfully, then change to ksession-12 nothing happens (does not hit debugging in 12.drl)
If I then restart the server and run 12 first it will run successfully, then change to ksession-7 and nothing happens
I am confused by this and believe I am missing something. My goal is to have a common rule template with specific rules for each user. Can anyone help guide me why this is not being directed correctly (or not processing)
EDIT: Adding example
t1.drl:
package org.company.t1.rules
import org.test.*
rule "check patients age" dialect "mvel"
when
$p : Patient( age >= 10)
then
System.out.println("t1 - age greater then 10")
$ca = new Message("age greater then 10")
$p.alerts.add($ca)
end
t2.drl:
package org.company.t2.rules
import org.test.*
rule "check patients age" dialect "mvel"
when
$p : Patient( age >= 15)
then
System.out.println("t2 - age greater then 15")
$ca = new Message("age greater then 15")
$p.alerts.add($ca)
end
ruletemplate.drl:
package org.test
declare Message
text : String
end
declare Patient
id:String
age : Integer
alerts : java.util.ArrayList
end
rule "setup rule for alerts" dialect "mvel" salience 100
when
$p : Patient()
then
System.out.println("initialize array")
$p.alerts = new java.util.ArrayList();
end
knowledge-server.xml:
<drools:resource id="ruletemplate" type="DRL" source="classpath:ruletemplate.drl" />
<drools:kbase id="kbase5" node="node1">
<drools:resources>
<drools:resource ref="ruletemplate" />
<drools:resource type="DRL" source="classpath:t1.drl"/>
</drools:resources>
</drools:kbase>
<drools:kbase id="kbase6" node="node1">
<drools:resources>
<drools:resource ref="ruletemplate" />
<drools:resource type="DRL" source="classpath:t2.drl"/>
</drools:resources>
</drools:kbase>
<drools:ksession id="ksession5" type="stateless" kbase="kbase5" node="node1"/>
<drools:ksession id="ksession6" type="stateless" kbase="kbase6" node="node1"/>
First request that works:
{"batch-execution": { "lookup":"ksession5", "commands": [ { "insert": { "out-identifier": "patient", "object": { "org.test.Patient":[{"age":16}]}}},{"fire-all-rules": ""}]}}
{"execution-results":{"results":{"result":{"identifier":"patient","value":{"org.test.Patient":{"age":16,"alerts":{"org.test.Message":{"text":"age greater then 10"}}}}},"fact-handle":{"identifier":"patient","external-form":"0:2:537549803:537549803:2:DEFAULT"}}}}
Request 2: (doesnt work unless run first after server restart:
{"batch-execution": { "lookup":"ksession6", "commands": [ { "insert": { "out-identifier": "patient", "object": { "org.test.Patient":[{"age":16}]}}},{"fire-all-rules": ""}]}}
{"execution-results":{"results":{"result":{"identifier":"patient","value":{"org.test.Patient":{"age":16}}},"fact-handle":{"identifier":"patient","external-form":"0:2:552327108:552327108:2:DEFAULT"}}}}
Tailing catalina.out shows the debugger output for t1 as it was run first, but nothing on t2
What are you inserting? what kind of rules do you have in there?
Could be that the first run everything works well and the second is crashing in the back?