[jboss-jira] [JBoss JIRA] (DROOLS-805) JobResult causes exception creating JAXB context
Carl Miller (JIRA)
issues at jboss.org
Tue Jun 9 17:09:02 EDT 2015
[ https://issues.jboss.org/browse/DROOLS-805?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13076425#comment-13076425 ]
Carl Miller commented on DROOLS-805:
------------------------------------
Sorry for the delay and confusion. In the drools-guvnor project hosted at GitHub, there is a Java class named JobResult.java in the package org.guvnor.rest.client. Part of what may be confusing above is the use-case by which I ran into this particular problem. I was using EclipseLink to convert JSON data back to Java and in setting up that environment (you need a jaxb.properties file that specifies javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory). In any case, when using that environment, the one line of code noted originally in the issue will throw an exception preventing the code from continuing. The exception is due to the inconsistency between the getter and setter for lastModified in the JobResult class.
I've switched over to using jax rs but I'm still using my modified class (changed the signature in the setLastModified to accept a Long). I'm not running into any issues at this point but thought even just from a code review/consistency view, that getter and setter should work with the same data type to conform to standard Java beans. And if anyone else tries to use EclipseLink like I did, well, they'll run into the same issue when trying to process REST call results that return that class in JSON.
> JobResult causes exception creating JAXB context
> ------------------------------------------------
>
> Key: DROOLS-805
> URL: https://issues.jboss.org/browse/DROOLS-805
> Project: Drools
> Issue Type: Bug
> Components: core engine
> Affects Versions: 6.2.0.Final
> Reporter: Carl Miller
> Assignee: Mario Fusco
>
> In trying to use the following snippet of code:
> JAXBContext jc = JAXBContext.newInstance( JobResult.class );
> to transform a json string returned by a /jobs/jobId REST call into a JobResult, I kept getting an error stating setLastModified( Long ) was not a method in that class. Upon further examination, the getter in the JobResult.java class returns a "Long" yet the setter accepts a "long" (subtle difference). Made the change to setLastModified to accept a Long and my JaxBContext issue went away.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
More information about the jboss-jira
mailing list