XML Mapper issue in Mybatis - mybatis

nested exception is org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or markup.
this is the syntax
it working well while fetching the result in ORACLE SQL DEVELOPER
but while start my local server it gives error
please suggest what need to fix on this
SQL is good and working to get records directly from DB
select
rownum test,
os_alternate_label "altlabel",
em_customs_bar_code "label",
em_source_appl "source",
'H5' "altoutcome",
DECODE(OS_NL_DO_NOT_LOAD,1,'NL',
DECODE(OS_H5_ALT_DUP_HOLD,1,'H5',
DECODE(OS_BD_RTS_EC,1,'BD',
DECODE(OS_H2_EC_HOLD,1,'H2',
DECODE(OS_HD_NO_DISP_HOLD,1,'HD',
DECODE(OS_H3_CBP_HOLD,1,'H3',
DECODE(OS_H4_USPIS_HOLD,1,'H4',
DECODE(OS_UD_RTS_CUSTOMER,1,'UD',
DECODE(OS_NQ_EU_WAIT_TIME,1,'NQ',
DECODE(OS_H1_iPASS_HOLD,1,'H1',
DECODE(OS_DG_DANGER_HOLD,1,'DG',
DECODE(OS_CC_COMM_HOLD,1,'CC',
DECODE(OS_H6_CUS_DUP_HOLD,1,'H6',
DECODE(OS_RL_RELEASE,1,'RL','XX')))))))))))))) "customoutcome",
em_destination_country "destCo",
em_recipient_last_name "tolastName",
em_recipient_business "tobusinessname",
em_recipient_address "toaddress",
em_recipient_city "tocity",
em_recipient_state "toregionprov",
em_recipient_postcode "postcode",
to_char(em_date_time_received,'MM/DD/YY HH24:MI') "timeReceived"
FROM CUSTOMS.OUTCOME_STATUS_T,
CUSTOMS.ECM_MANIFEST_T
WHERE OS_CUSTOMS_BAR_CODE = EM_CUSTOMS_BAR_CODE

Use escape character I believe the '/' used to define date is causing problem
<![CDATA[
select
rownum test,
os_alternate_label "altlabel",
em_customs_bar_code "label",
em_source_appl "source",
'H5' "altoutcome",
DECODE(OS_NL_DO_NOT_LOAD,1,'NL',
DECODE(OS_H5_ALT_DUP_HOLD,1,'H5',
DECODE(OS_BD_RTS_EC,1,'BD',
DECODE(OS_H2_EC_HOLD,1,'H2',
DECODE(OS_HD_NO_DISP_HOLD,1,'HD',
DECODE(OS_H3_CBP_HOLD,1,'H3',
DECODE(OS_H4_USPIS_HOLD,1,'H4',
DECODE(OS_UD_RTS_CUSTOMER,1,'UD',
DECODE(OS_NQ_EU_WAIT_TIME,1,'NQ',
DECODE(OS_H1_iPASS_HOLD,1,'H1',
DECODE(OS_DG_DANGER_HOLD,1,'DG',
DECODE(OS_CC_COMM_HOLD,1,'CC',
DECODE(OS_H6_CUS_DUP_HOLD,1,'H6',
DECODE(OS_RL_RELEASE,1,'RL','XX')))))))))))))) "customoutcome",
em_destination_country "destCo",
em_recipient_last_name "tolastName",
em_recipient_business "tobusinessname",
em_recipient_address "toaddress",
em_recipient_city "tocity",
em_recipient_state "toregionprov",
em_recipient_postcode "postcode",
to_char(em_date_time_received,'MM/DD/YY HH24:MI') "timeReceived"
FROM CUSTOMS.OUTCOME_STATUS_T,
CUSTOMS.ECM_MANIFEST_T
WHERE OS_CUSTOMS_BAR_CODE = EM_CUSTOMS_BAR_CODE
]]>

Related

Why is SQLErrorCode zero?

In my Java program I'm using JDBC to access my PostgreSQL database and that is running fine. Trying to catch SQLExceptions does not really work.
My code:
...
catch (SQLException se) {
System.out.println("\nSQLException: " + se.getMessage());
SqlErrorCode = se.getErrorCode();
System.out.println("\nSqlErrorCode: " + SqlErrorCode);
}
...
My query (generated by program):
SELECT osm_id, osm_type from (SELECT osm_dach_admin_boundaries_old.osm_id,
osm_dach_admin_boundaries_old.osm_type
FROM osm_dach_admin_boundaries_old
FULL OUTER JOIN osm_dach_admin_boundaries
ON (osm_dach_admin_boundaries_old.osm_id = osm_dach_admin_boundaries.osm_id
and osm_dach_admin_boundaries_old.osm_type = osm_dach_admin_boundaries.osm_type)
WHERE (osm_dach_admin_boundaries_old.osm_id IS NULL
OR osm_dach_admin_boundaries.osm_id IS NULL)) foo
WHERE osm_id is not null order by osm_id, osm_typeXXX;
Note the column osm_typeXXX, which I added to force an exception.
Running this query leads to
SQLException: ERROR: column "osm_typexxx" does not exist
Hinweis: Perhaps you meant to reference the column "foo.osm_type".
Position: 533
SqlErrorCode: 0
Closing source SQL-Connection
Closing destination SQL-Connection
Why is SqlErrorCode zero and how can I fix that?
java.sql.SQLException.getErrorCode() is documented as:
Retrieves the vendor-specific exception code for this SQLException object.
Now PostgreSQL doesn't have vendor-specific error codes – it uses the standard conforming SQLSTATE instead.
So you should use java.sql.SQLException.getSQLState().

Customise frappe query report

I've been trying to make a query_report on frappe.
but it doesn't return the data on the browser.
the console says 'Unable to handle success response'
console.trace() Each data element must implement a unique 'id' property
this is my sql syntax
SELECT
`tabPayment Entry`.`name` AS `id`,
`tabFees`.`student` AS `student id::100`,
`tabFees`.`student_name` AS `name::200`,
`tabFees`.`posting_date` AS `tgl bayar::200`,
`tabFees`.`due_date` AS `bulan inv::200`,
`tabFees`.`outstanding_amount` AS `blm bayar::200`,
`tabFees`.`paid_amount` AS `terbayar::200`,
`tabFees`.`grand_total` AS `total::200`,
`tabFees`.`status` AS `status::200`,
`tabPayment Entry`.`mode_of_payment` AS `mode::200`
FROM
(tabFees
LEFT JOIN `tabPayment Entry` ON (`tabFees`.`student` = `tabPayment Entry`.`party`))
WHERE
`tabFees`.`status` = %(status)s AND
`tabFees`.`due_date` BETWEEN %(from_date)s AND %(to_date)s
this is the screenshot of the
console report
that sql syntax is working perfectly on the sql preview software.
Please if you have some answer i will appreciate it....

Boto3 Write to DynamoDB from AWS Glue, Unhashable Type: 'dict'

I am attempting to use the boto3 module in PySpark (AWS Glue ETL job) to load a dataframe into DynamoDB but am being met with the error:
Parameter validation failed: Invalid type for parameter Item, value: set(["{u'ecosystemName': u'animals', u'regionalCenter': u'center', u'dataExtractedTimestamp': u'20190502T13:12:11.111Z'}"]), type: <type 'set'>, valid types: <type 'dict'> Could not write to the Audit Table for regional center:
Can anyone please help me resolve this issue and explain why it is happening? I'd like to understand the root of the issue.
Here is my current code. Please note that there will ever only be a single row in this data frame. The SQL used below is fake data for testing only.
try:
timestamp_sql = """select
'animals' as ecosystemName,
'20190502T13:12:11.111Z' as dataExtractedTimestamp,
'center' as regionalCenter
"""
# Make a data frame from SQL
audit_data_frame=spark.sql(timestamp_sql)
# Write the joined dynamic frame out to a datasink
dynamodb = boto3.resource('dynamodb','us-west-2')
table = dynamodb.Table(args['DynamoDBTable2Name'])
audit_data_frame_prep = json.loads(audit_data_frame.toJSON().first())
print(audit_data_frame_prep)
table.put_item( Item = { "{}".format(audit_data_frame_prep) } )
print('Audit trail successfully written for ' + regional_center + '.')
except Exception as e:
print(e)
print('Could not write to the Audit Table for regional center: ' + regional_center + '.')
pass
Dang, 5 minute rule strikes again...
It was in my put_item call. I had the extra brackets there, effectively rendering the JSON invalid. This change solves my issue:
table.put_item( Item = audit_data_frame_prep )

How to pass a null value received on msg.req.query to msg.payload

I am developing an application using Dashdb on Bluemix and nodered, my PHP application uses the call to webservice to invoke the node-red, whenever my function on PHP invokes the node to insert on table and the field GEO_ID is null, the application fails, I understand the issue, it seems the third parameter was not informed, I have just tried to check the param before and passing something like NULL but it continues not working.
See the code:
msg.account_id = msg.req.query.account_id;
msg.user_id = msg.req.query.user_id;
msg.geo_id=msg.req.query.geo_id;
msg.payload = "INSERT INTO ACCOUNT_USER (ACCOUNT_ID, USER_ID, GEO_ID) VALUES (?,?,?) ";
return msg;
And on Dashdb component I have set the parameter as below:
msg.account_id,msg.user_id,msg.geo_id
The third geo_id is the issue, I have tried something like the code below:
if(msg.req.query.geo_id===null){msg.geo_id=null}
or
if(msg.req.query.geo_id===null){msg.geo_id="null"}
The error I got is the one below:
dashDB query node: Error: [IBM][CLI Driver][DB2/LINUXX8664] SQL0420N Invalid character found in a character string argument of the function "DECIMAL". SQLSTATE=22018
I really appreciate if someone could help me on it .
Thanks,
Eduardo Diogo Garcia
Is it possible that msg.req.query.geo_id is set to an empty string?
In that case neither if statement above would get executed, and you would be trying to insert an empty string into a DECIMAL column. Maybe try something like this:
if (! msg.req.query.geo_id || msg.req.query.geo_id == '') {
msg.geo_id = null;
}

Tridion Workflow Error on EDA_ITEMS_UPDATE Stored Procedure When Restarting WF Activities

I'm hitting an error whenever 2 or more instances of a workflow is restarted. We have suspended workflows during a network incident in our office(s). It was a script timeout that disrupted the process. I couldn't reproduce this timeout anymore so I attempted to restart the workflow activities to complete the process. However, when I restart more than 1 suspended activity, I get this error (the full log is farther below):
Cannot insert the value NULL into column 'ITEM_ID', table 'tridion_cm.dbo.ITEM_ASSOCIATIONS'; column does not allow nulls. INSERT fails.
The statement has been terminated.
Restarting activities and letting it finish one by one has no problem.
Full Event Log:
An error occurred while executing the Workflow script.
The Script Engine returned the following information:
SOURCE:
Line = 0
Column = 0
Number = -2147220673
Source = Component.Save
Description =
<?xml version="1.0" standalone="yes"?>
<tcm:Error ErrorCode="8004033F" Category="4" Source="Kernel" Severity="1" xmlns:tcm="http://www.tridion.com/ContentManager/5.0">
<tcm:Line ErrorCode="8004033F" Cause="false" MessageID="16137"><![CDATA[Unable to save Component (tcm:5-32795).]]>
<tcm:Token>RESID_4574</tcm:Token>
<tcm:Token>RESID_4418</tcm:Token>
<tcm:Token>tcm:5-32795</tcm:Token>
</tcm:Line>
<tcm:Line ErrorCode="8004033F" Cause="true">CDATA[No data found. ETA_ITEMS, U Cannot insert the value NULL into column 'ITEM_ID', table 'tridion_cm.dbo.ITEM_ASSOCIATIONS'; column does not allow nulls. INSERT fails. The statement has been terminated.
</tcm:Line>
<tcm:Line ErrorCode="8004033F" Cause="false"><![CDATA[A database error occurred while executing Stored Procedure "EDA_ITEMS_UPDATE".]]>
<tcm:Token>EDA_ITEMS_UPDATE</tcm:Token>
</tcm:Line>
<tcm:Details>
<tcm:CallStack>
<tcm:Location>System.Data.SqlClient.SqlConnection.OnError(SqlException,Boolean)</tcm:Location>
<tcm:Location>System.Data.SqlClient.SqlInternalConnection.OnError(SqlException,Boolean)</tcm:Location>
<tcm:Location>System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(</tcm:Location>
<tcm:Location>System.Data.SqlClient.TdsParser.Run(RunBehavior,SqlCommand,SqlDataReader,BulkCopySimpleResultSet,TdsParserStateObject)</tcm:Location>
<tcm:Location>System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader,RunBehavior,String)</tcm:Location>
<tcm:Location>System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior,RunBehavior,Boolean,Boolean)</tcm:Location>
<tcm:Location>System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior,RunBehavior,Boolean,String,DbAsyncResult)</tcm:Location>
<tcm:Location>System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult,String,Boolean)</tcm:Location>
<tcm:Location>System.Data.SqlClient.SqlCommand.ExecuteNonQuery()</tcm:Location>
<tcm:Location>Tridion.ContentManager.Data.AdoNet.DatabaseUtilities.ExecuteNonQuery(StoredProcedureInvocation)</tcm:Location>
<tcm:Location>Tridion.ContentManager.Data.AdoNet.Sql.SqlDatabaseUtilities.ExecuteNonQuery(StoredProcedureInvocation)</tcm:Location>
<tcm:Location>Tridion.ContentManager.Data.AdoNet.Sql.SqlDatabaseUtilities.ExecuteNonQuery(StoredProcedureInvocation)</tcm:Location>
<tcm:Location>Tridion.ContentManager.Data.AdoNet.IdentifiableObjectDataMapper.Tridion.ContentManager.Data.IIdentifiableObjectDataMapper.Update(IdentifiableObjectData)</tcm:Location>
<tcm:Location>Tridion.ContentManager.IdentifiableObject.Save(SaveEventArgs)</tcm:Location>
<tcm:Location>Tridion.ContentManager.ContentManagement.VersionedItem.Save(Boolean)</tcm:Location>
<tcm:Location>Tridion.ContentManager.ContentManagement.VersionedItem.Save()</tcm:Location>
<tcm:Location>Tridion.ContentManager.BLFacade.ContentManagement.VersionedItemFacade.UpdateAndCheckIn(UserContext,String,Boolean,Boolean)</tcm:Location>
<tcm:Location>XMLState.Save</tcm:Location>
<tcm:Location>Component.Save</tcm:Location>
</tcm:CallStack>
</tcm:Details>
</tcm:Error>
HelpFile =
HelpContext = 1000440
caused by: Component.Save
and description:
<?xml version="1.0" standalone="yes"?>
<tcm:Error ErrorCode="8004033F" Category="4" Source="Kernel" Severity="1" xmlns:tcm="http://www.tridion.com/ContentManager/5.0">
<tcm:Line ErrorCode="8004033F" Cause="false" MessageID="16137"><![CDATA[Unable to save Component (tcm:5-32795).]]>
<tcm:Token>RESID_4574</tcm:Token>
<tcm:Token>RESID_4418</tcm:Token>
<tcm:Token>tcm:5-32795</tcm:Token>
</tcm:Line>
<tcm:Line ErrorCode="8004033F" Cause="true">CDATA[No data found. ETA_ITEMS, U Cannot insert the value NULL into column 'ITEM_ID', table 'tridion_cm.dbo.ITEM_ASSOCIATIONS'; column does not allow nulls. INSERT fails. The statement has been terminated.
</tcm:Line>
<tcm:Line ErrorCode="8004033F" Cause="false"><![CDATA[A database error occurred while executing Stored Procedure "EDA_ITEMS_UPDATE".]]>
<tcm:Token>EDA_ITEMS_UPDATE</tcm:Token>
</tcm:Line>
<tcm:Details>
<tcm:CallStack>
<tcm:Location>System.Data.SqlClient.SqlConnection.OnError(SqlException,Boolean)</tcm:Location>
<tcm:Location>System.Data.SqlClient.SqlInternalConnection.OnError(SqlException,Boolean)</tcm:Location>
<tcm:Location>System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(</tcm:Location>
<tcm:Location>System.Data.SqlClient.TdsParser.Run(RunBehavior,SqlCommand,SqlDataReader,BulkCopySimpleResultSet,TdsParserStateObject)</tcm:Location>
<tcm:Location>System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader,RunBehavior,String)</tcm:Location>
<tcm:Location>System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior,RunBehavior,Boolean,Boolean)</tcm:Location>
<tcm:Location>System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior,RunBehavior,Boolean,String,DbAsyncResult)</tcm:Location>
<tcm:Location>System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult,String,Boolean)</tcm:Location>
<tcm:Location>System.Data.SqlClient.SqlCommand.ExecuteNonQuery()</tcm:Location>
<tcm:Location>Tridion.ContentManager.Data.AdoNet.DatabaseUtilities.ExecuteNonQuery(StoredProcedureInvocation)</tcm:Location>
<tcm:Location>Tridion.ContentManager.Data.AdoNet.Sql.SqlDatabaseUtilities.ExecuteNonQuery(StoredProcedureInvocation)</tcm:Location>
<tcm:Location>Tridion.ContentManager.Data.AdoNet.Sql.SqlDatabaseUtilities.ExecuteNonQuery(StoredProcedureInvocation)</tcm:Location>
<tcm:Location>Tridion.ContentManager.Data.AdoNet.IdentifiableObjectDataMapper.Tridion.ContentManager.Data.IIdentifiableObjectDataMapper.Update(IdentifiableObjectData)</tcm:Location>
<tcm:Location>Tridion.ContentManager.IdentifiableObject.Save(SaveEventArgs)</tcm:Location>
<tcm:Location>Tridion.ContentManager.ContentManagement.VersionedItem.Save(Boolean)</tcm:Location>
<tcm:Location>Tridion.ContentManager.ContentManagement.VersionedItem.Save()</tcm:Location>
<tcm:Location>Tridion.ContentManager.BLFacade.ContentManagement.VersionedItemFacade.UpdateAndCheckIn(UserContext,String,Boolean,Boolean)</tcm:Location>
<tcm:Location>XMLState.Save</tcm:Location>
<tcm:Location>Component.Save</tcm:Location>
</tcm:CallStack>
</tcm:Details>
</tcm:Error>
Source:
LogScriptError
Workflow Info
The components are newly created by another application through BusinessConnector. It performs revision saves before finishing the activity. The objective of the WF is to
assign the necessary component links based on text values from the other system;
create a page;
and publish it to a target.
I know this could've been done better by other means but it is how it is right now, please bear with the implementation.
Model / Schema
Product
- modelName (text)
- categoryName (text)
- categoryCL (component link)
- statusName (text)
- statusCL (component link)
- blah1 (text)
- blah2 (text)
- blah3 (text)
- blah4 (text)
Automatic Activity Script:
' COMPONENT WORKFLOW for PRODUCT SCHEMA (START)
' Load common functions
ExecuteGlobal oTDSE.GetObject("/webdav/200%20Design/Building%20Blocks/Library/Design/Workflow/Common/Workflow%20Functions.tbbs", 1).Content
' Initialize
Set objComp = CurrentWorkItem.GetItem()
Set oContentPub = objComp.Publication
Set oWebsitePub = oTDSE.GetObject(GetStagingLangPub("EN", "website1"), 1)
modelName = objComp.Fields.Item("modelName").Value.Item(1)
' Search and Assign component links based on some text fields from BC client
Set compListRowFilter = oTDSE.CreateListRowFilter()
Call compListRowFilter.SetCondition("ShowNewItems", TRUE)
Call compListRowFilter.SetCondition("ItemType", 16)
' Assign the first component link (categoryCL)
categoryName = objComp.Fields.Item("categoryName").Value.Item(1)
Set categoryComp = GetObjectFromFolder(categoryName, oTDSE.GetObject(categoryFolderWebDav, 1), compListRowFilter)
If Not categoryComp is Nothing Then
objComp.Fields.Item("categoryCL").Value.RemoveAll
objComp.Fields.Item("categoryCL").Value.Add(categoryComp)
Call objComp.Save(True)
Else
Call SendNoObjectEmail("Category", categoryName, "categoryCL", GetEmailsFromGroup(oContentPub, categoryOwner), "")
End if
' Assign the second component link (statusCL)
statusName = objComp.Fields.Item("statusName").Value.Item(1)
Set statusComp = GetObjectFromFolder(statusName, oTDSE.GetObject(statusFolderWebDav, 1), compListRowFilter)
If Not statusComp is Nothing Then
objComp.Fields.Item("statusCL").Value.RemoveAll
objComp.Fields.Item("statusCL").Value.Add(statusComp)
Call objComp.Save(True)
Else
Call SendNoObjectEmail("Status", statusName, "statusCL", GetEmailsFromGroup(oContentPub, statusOwner), "")
End if
' Create a page with the component in WF
Set oPage = CreateDefaultPage(modelName, oWebSitePub, SaveToFolderWebDav, PageTemplateWebDav)
Call oPage.ComponentPresentations.Add(oWebSitePub, oTDSE.GetObject(ComponentTemplateWebDav, 1))
oPage.Save(True)
' Publish the page
....
' Send email
....
' Finish the Activity
Call CurrentWorkItem.ActivityInstance.FinishActivity("someMsg")
' COMPONENT WORKFLOW for PRODUCT SCHEMA (END)
I haven't zoomed in to where exactly it happens but I would assume it is either the categoryCL or statusCL's objComp.Save(True) line.
I notice that you are calling Call objComp.Save(True) - The "True" parameter forces a "CheckIn", as it means "Done Editing".
It looks like this can occur twice (i.e. If there is a statusCL and a categoryCL) whichmay be causing the problem. I would try changing the behavior so that you only the call Save() method at the end if a change has been made, and not saving it twice.
From what I see the problem is that you are trying to assign nulls as component links. Are you sure that you are not trying to link these 2 components one to another? It might be that the link you are trying to create is to new component in workflow (it has no checked-in version yet), hence you can't create link to it. Try adding some logging to your script, so we could see where exactly does it fail and what are the parameters.
And I agree with Frank that this exception is worth a defect report.