Bug 1065314

Summary: Unable to retrieve a JSON formatted Task instance via the REST API
Product: [Retired] JBoss BPMS Platform 6 Reporter: Marco Rietveld <mrietvel>
Component: Business CentralAssignee: Marco Rietveld <mrietvel>
Status: CLOSED CURRENTRELEASE QA Contact: Ivo Bek <ibek>
Severity: high Docs Contact:
Priority: high    
Version: 6.0.1CC: abhumbe, kverlaen, mbaluch, mbiarnes, rrajasek, rzhang, smcgowan, vigoyal
Target Milestone: ER3   
Target Release: 6.0.2   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Latest summary: REST operations that retrieved Task instances would fail when forced to use the JSON format (ACCEPT header). There was a server side error thrown when the server instance tried to convert the (JAXB) Task instance to JSON. The workaround for this issue was to use XML instead of JSON (by setting it in the ACCEPT header). This issue has now been fixed in the latest version of the product and the workaround is no longer required. Old Summary: REST operations that retrieve Task instances will fail when forced to use the JSON format (ACCEPT header). There is a server side error thrown when the server instance tries to convert the (JAXB) Task instance to JSON. To workaround this issue, please use XML instead of JSON (by setting it i the ACCEPT header). Cause: Consequence: Fix: Result:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-08-06 19:50:37 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
JSON_stack_trace
none
Received message with exception on IBM JDK none

Description Marco Rietveld 2014-02-14 10:46:58 UTC
Description of problem:

REST operations that retrieve Task instances will fail when forced to use the JSON format (ACCEPT header). 

How reproducible:

Always.

Steps to Reproduce:
1. Call http://server:<port>/business-central/rest/task/<taskId> (GET, with ACCEPT header that specifies the application/json format)

Actual results:

An error will be thrown on the server side when the server instance tries to convert the (Jaxb)Task instance to JSON. 

Expected results:

No error will occur and the client will receive a correctly filled-in and correctly (JSON) formatted instance of the (Jaxb)Task.

Comment 1 Marco Rietveld 2014-02-14 10:48:04 UTC
JSON has been chosen as the default format to be used with business-central.

Comment 2 Marco Rietveld 2014-02-14 10:48:50 UTC
The fix for this issue is available, I am simply waiting for the appropriate flags in order to push it to the 6.0.x branch.

Comment 4 Marek Baluch 2014-03-09 16:37:16 UTC
Created attachment 872427 [details]
JSON_stack_trace

Marco,

there's still an exception present in the server log. There's a getter conflict between org.jbpm.services.task.impl.model.xml.JaxbTask#getArchived(0 params) and org.jbpm.services.task.impl.model.xml.JaxbTask#isArchived(0 params).

Please see JSON_stack_trace.log for the whole stack-trace.

Comment 5 Marek Baluch 2014-03-09 16:38:29 UTC
If I missed something then please put the issue back to ON_QA. Thanks!

Comment 7 Michael 2014-03-14 17:40:13 UTC
Ticket cherry-picked into 6.0.1.CR1. 
Commits: c66f85ebd2e63bea310fad67d4b3418a22b3ece8
         68e2cd4526495a4431b4b66fb48f5d6bde6a5006
         995a9d1bbaef260da385420a65a55383680c2443

Comment 13 Marco Rietveld 2014-03-25 18:00:23 UTC
Okay, with these commits I ended up just deleting the "isArchived()" method so that the above message isn't possible. I ran the GetTaskJSONTest and it passed. 

However, given that this is try #3, and I've already been wrong twice, I'm not saying anything else. :) 

Commits: 

6.0.x: 
https://github.com/droolsjbpm/droolsjbpm-knowledge/commit/a8e5385a
https://github.com/droolsjbpm/jbpm/commit/aa5b4112
https://github.com/droolsjbpm/jbpm/commit/73729bf1

master: 
https://github.com/droolsjbpm/droolsjbpm-knowledge/commit/b4fe4c67
https://github.com/droolsjbpm/jbpm/commit/cfe190e8

Comment 15 Ivo Bek 2014-04-29 12:11:07 UTC
Verified in BPMS 6.0.2.ER2

Comment 16 Ivo Bek 2014-05-14 09:01:01 UTC
Hi Marco,

the fix works well on Oracle JDK and OpenJDK but I see some problems on IBM JDK.

I rather open this issue once more than to file another one for the same problem but on IBM JDK. I get the following exception on IBM JDK 1.6 and 1.7 for the same reproducer [comment 10 https://bugzilla.redhat.com/show_bug.cgi?id=1065314#c10] :

org.codehaus.jackson.map.JsonMappingException: Conflicting getter definitions for property "archived": org.jbpm.services.task.impl.model.TaskImpl#getArchived(0 params) vs org.jbpm.services.task.impl.model.TaskImpl#isArchived(0 params) (through reference chain: org.jbpm.services.task.impl.model.xml.JaxbTask["task"])
 at org.codehaus.jackson.map.ser.StdSerializerProvider._createAndCacheUntypedSerializer(StdSerializerProvider.java:740)
 at org.codehaus.jackson.map.ser.StdSerializerProvider.findValueSerializer(StdSerializerProvider.java:344)
 at org.codehaus.jackson.map.ser.impl.PropertySerializerMap.findAndAddSerializer(PropertySerializerMap.java:39)

I am going to attach the full message I received with the stacktrace.

Thanks

Comment 17 Ivo Bek 2014-05-14 09:02:10 UTC
Created attachment 895412 [details]
Received message with exception on IBM JDK

Comment 18 Marco Rietveld 2014-05-14 11:30:19 UTC
Thanks for the thorough testing! 

Fixed. I haven't run integration tests on this, but I've fixed the cause of the problem: there were 2 "getter" methods: getArchived() and isArchived(). I've removed the getArchived() method everywhere. 

Commits: 

6.0.x: 
https://github.com/droolsjbpm/droolsjbpm-knowledge/commit/ff773e69
https://github.com/droolsjbpm/jbpm/commit/f398cf50

master: 
https://github.com/droolsjbpm/droolsjbpm-knowledge/commit/4f486448
https://github.com/droolsjbpm/jbpm/commit/d833cd2e

Comment 19 Marek Baluch 2014-06-06 14:48:59 UTC
Test passed. Setting to VERIFIED (on BPMS 6.0.2.ER3).