[jboss-jira] [JBoss JIRA] (DROOLS-345) NotSerializableException when attempting to serialize kcontext.getMatch().getObjects()

Reinis Vicups (JIRA) jira-events at lists.jboss.org
Tue Nov 19 11:28:07 EST 2013


     [ https://issues.jboss.org/browse/DROOLS-345?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Reinis Vicups updated DROOLS-345:
---------------------------------

    Description: 
Optaplanner is using kcontext.getMatch().getObjects() to retrieve objects participating in the match.

This rule
{code}
rule "failing rule"
    when
        $project : Project
        $resourceParallelism : Set from accumulate( Assignment(project == $project, resource != null, $resource : resource),
            collectSet($resource) )
    then
        scoreHolder.addHardConstraintMatch(kcontext, -Math.abs($resourceParallelism.size() - $project.getOptimalResourceParallelism()));
end
{code}

cause kcontext.getMatch().getObjects() later on to return List with two elements:

1. element is instance of Project (serializable)
2. element is instance of HashMap$KeySet of Resource (serializable)

Issue is - HashMap$KeySet is not serializable thus causing the said Exception.

I checked up with Mr. Proctor and Mr. De Smet. The final assumption was that accumulate could somehow cause HashMap$KeySet to be returned.

Would be great if someone with understanding could check out how the objects get into kcontext.getMatch().getObjects() from the above rule and if it is drools wrapping my objects in HashMap$KeySet

  was:
Optaplanner is using kcontext.getMatch().getObjects() to retrieve objects participating in the match.

This rule
rule "failing rule"
    when
        $project : Project
        $resourceParallelism : Set from accumulate( Assignment(project == $project, resource != null, $resource : resource),
            collectSet($resource) )
    then
        scoreHolder.addHardConstraintMatch(kcontext, -Math.abs($resourceParallelism.size() - $project.getOptimalResourceParallelism()));
end

cause kcontext.getMatch().getObjects() later on to return List of two elements:

1. element is instance of Project (serializable)
2. element is instance of HashMap$KeySet of Resource (serializable)

Issue is - HashMap$KeySet is not serializable thus causing the said Exception.

I checked up with Mr. Proctor and Mr. De Smet. The final assumption was that accumulate could somehow cause HashMap$KeySet to be returned.

Would be great if someone with understanding could check out how the objects get into kcontext.getMatch().getObjects() from the above rule and if it is drools wrapping my objects in HashMap$KeySet


    
> NotSerializableException when attempting to serialize kcontext.getMatch().getObjects()
> --------------------------------------------------------------------------------------
>
>                 Key: DROOLS-345
>                 URL: https://issues.jboss.org/browse/DROOLS-345
>             Project: Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>    Affects Versions:  6.0.0.CR4
>         Environment: Windows, Oracle Java JDK 1.7.0_21
>            Reporter: Reinis Vicups
>            Assignee: Mark Proctor
>
> Optaplanner is using kcontext.getMatch().getObjects() to retrieve objects participating in the match.
> This rule
> {code}
> rule "failing rule"
>     when
>         $project : Project
>         $resourceParallelism : Set from accumulate( Assignment(project == $project, resource != null, $resource : resource),
>             collectSet($resource) )
>     then
>         scoreHolder.addHardConstraintMatch(kcontext, -Math.abs($resourceParallelism.size() - $project.getOptimalResourceParallelism()));
> end
> {code}
> cause kcontext.getMatch().getObjects() later on to return List with two elements:
> 1. element is instance of Project (serializable)
> 2. element is instance of HashMap$KeySet of Resource (serializable)
> Issue is - HashMap$KeySet is not serializable thus causing the said Exception.
> I checked up with Mr. Proctor and Mr. De Smet. The final assumption was that accumulate could somehow cause HashMap$KeySet to be returned.
> Would be great if someone with understanding could check out how the objects get into kcontext.getMatch().getObjects() from the above rule and if it is drools wrapping my objects in HashMap$KeySet

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list