[JBoss JIRA] (JBRULES-3323) Using Set in accumulate causes NPE in some scenarios
by Reinis Vicups (Created) (JIRA)
Using Set in accumulate causes NPE in some scenarios
----------------------------------------------------
Key: JBRULES-3323
URL: https://issues.jboss.org/browse/JBRULES-3323
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-core
Affects Versions: 5.3.1.Final, 5.2.0.Final
Environment: Linux (Ubuntu Oneiric); Eclipse; JavaSE-1.6
Reporter: Reinis Vicups
Assignee: Mark Proctor
When using either "collectSet" or the full syntax (init, action, reverse, result) of "accumulate" an NPE is beeing thrown in org.drools.rule.Accumulate.reverse(final Object[] workingMemoryContext, final Object[] context, ...). Actual exception is comming from a generated(?) accumulator within the reverse() method of Accumulate.
IMPORTANT: When using Rule 2 (full syntax) I was able to replicate that the NPE is thrown during the execution of "reverse" block of "accumulate"!
I am attaching
- example rules causing NPE;
- Stack trace;
- test project as soon as I have set it up;
- Rule 1 causing NPE
{code}rule "Sub optimal resource parallelism"
when
$project : Project($optimalResourceParallelism : optimalResourceParallelism)
$assignment : Assignment(project == $project, $leftId : id, resource != null, $leftResource : resource)
exists Assignment(project == $project, id != $leftId, resource != null && != $leftResource)
$resourceParallelism : Set ((size + 1) != $optimalResourceParallelism)
from accumulate ( $otherAssignment : Assignment(project == $project, id != $leftId, resource != null && != $leftResource, $resource : resource),
collectSet($resource) )
then
insertLogical(new IntConstraintOccurrence("sub-optimal resource parallelism", ConstraintType.NEGATIVE_SOFT
, Math.abs($optimalResourceParallelism - ($resourceParallelism.size() + 1)), $assignment));
System.out.println("Sub optimal resource parallelism detected. Assignment: " + $assignment.getId()
+ " optimalParallelism is: " + $optimalResourceParallelism + " and actual: " + ($resourceParallelism.size() + 1));
end{code}
- Rule 2 causing NPE
{code}rule "Sub optimal resource parallelism"
when
$project : Project($optimalResourceParallelism : optimalResourceParallelism)
$assignment : Assignment(project == $project, $leftId : id, resource != null, $leftResource : resource)
exists Assignment(project == $project, id != $leftId, resource != null && != $leftResource)
$resourceParallelism : Set ((size + 1) != $optimalResourceParallelism)
from accumulate ( $otherAssignment : Assignment(project == $project, id != $leftId, resource != null && != $leftResource, $resource : resource),
init( Set<Resource> resources = new HashSet<Resource>(); ),
action( resources.add($resource); ),
reverse( resources.remove($resource); ),
result( resources.size(); ) )
then
insertLogical(new IntConstraintOccurrence("sub-optimal resource parallelism", ConstraintType.NEGATIVE_SOFT
, Math.abs($optimalResourceParallelism - ($resourceParallelism.size() + 1)), $assignment));
System.out.println("Sub optimal resource parallelism detected. Assignment: " + $assignment.getId()
+ " optimalParallelism is: " + $optimalResourceParallelism + " and actual: " + ($resourceParallelism.size() + 1));
end{code}
- Stack trace
{code}org.drools.RuntimeDroolsException: java.lang.NullPointerException
at org.drools.rule.Accumulate.reverse(Accumulate.java:217)
at org.drools.reteoo.AccumulateNode.removeMatch(AccumulateNode.java:888)
at org.drools.reteoo.AccumulateNode.modifyRightTuple(AccumulateNode.java:554)
at org.drools.reteoo.BetaNode.modifyObject(BetaNode.java:431)
at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateModifyObject(CompositeObjectSinkAdapter.java:468)
at org.drools.reteoo.CompositeObjectSinkAdapter.propagateModifyObject(CompositeObjectSinkAdapter.java:436)
at org.drools.reteoo.AlphaNode.modifyObject(AlphaNode.java:149)
at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateModifyObject(CompositeObjectSinkAdapter.java:468)
at org.drools.reteoo.CompositeObjectSinkAdapter.propagateModifyObject(CompositeObjectSinkAdapter.java:436)
at org.drools.reteoo.ObjectTypeNode.modifyObject(ObjectTypeNode.java:284)
at org.drools.reteoo.EntryPointNode.modifyObject(EntryPointNode.java:271)
at org.drools.common.NamedEntryPoint.update(NamedEntryPoint.java:465)
at org.drools.common.AbstractWorkingMemory.update(AbstractWorkingMemory.java:959)
at org.drools.common.AbstractWorkingMemory.update(AbstractWorkingMemory.java:932)
at org.drools.planner.core.heuristic.selector.variable.PlanningValueWalker.changeWorkingValue(PlanningValueWalker.java:125)
at org.drools.planner.core.heuristic.selector.variable.PlanningValueWalker.walk(PlanningValueWalker.java:112)
at org.drools.planner.core.heuristic.selector.variable.PlanningVariableWalker.walk(PlanningVariableWalker.java:130)
at org.drools.planner.core.constructionheuristic.greedyFit.decider.DefaultGreedyDecider.decideNextStep(DefaultGreedyDecider.java:62)
at org.drools.planner.core.constructionheuristic.greedyFit.DefaultGreedyFitSolverPhase.solve(DefaultGreedyFitSolverPhase.java:62)
at org.drools.planner.core.solver.DefaultSolver.runSolverPhases(DefaultSolver.java:166)
at org.drools.planner.core.solver.DefaultSolver.solve(DefaultSolver.java:138)
at de.orbitx.retena.domain.ScheduleTest.schedule(ScheduleTest.java:227)
at de.orbitx.retena.domain.ScheduleTest.testGetScoreTrivialScenario(ScheduleTest.java:78)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:35)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:115)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:97)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)
at $Proxy0.invoke(Unknown Source)
at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150)
at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)
Caused by: java.lang.NullPointerException
at org.drools.base.accumulators.CollectSetAccumulateFunction.reverse(CollectSetAccumulateFunction.java:123)
at org.drools.base.accumulators.JavaAccumulatorFunctionExecutor.reverse(JavaAccumulatorFunctionExecutor.java:130)
at org.drools.rule.Accumulate.reverse(Accumulate.java:208)
... 51 more{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 5 months
[JBoss JIRA] (AS7-2433) Hibernate session is getting closed during JPA transaction
by Lasse Wallentin (Created) (JIRA)
Hibernate session is getting closed during JPA transaction
----------------------------------------------------------
Key: AS7-2433
URL: https://issues.jboss.org/browse/AS7-2433
Project: Application Server 7
Issue Type: Bug
Components: JPA / Hibernate
Affects Versions: 7.0.2.Final
Environment: Windows 7
Reporter: Lasse Wallentin
Assignee: Scott Marlow
We have a simple setup where a web service is using a Dao to store data in a Database.
The Dao uses an injected persistence context. The dao is in turn injected into the webservice as a simple EJB.
This is a classic setup we have used extensively on JBoss AS 5.1.
However on JBoss 7.0.2.Final the hibernate session is closed on the second call to the web service.
I have created a simple maven project containing the problem. It uses the standard datasource from the standalone-preview configuration.
I will attach the project and server.log containing all relevant exceptions.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 5 months
[JBoss JIRA] (AS7-1338) Remote JNDI support for AS7
by Tobias Frech (Commented) (JIRA)
[ https://issues.jboss.org/browse/AS7-1338?page=com.atlassian.jira.plugin.s... ]
Tobias Frech commented on AS7-1338:
-----------------------------------
Jason,
that sounds good to me. If write access to JNDI could be optionally limited to non-remote clients that would be perfect.
> Remote JNDI support for AS7
> ---------------------------
>
> Key: AS7-1338
> URL: https://issues.jboss.org/browse/AS7-1338
> Project: Application Server 7
> Issue Type: Task
> Components: Naming
> Reporter: Richard Opalka
> Assignee: John Bailey
> Priority: Critical
> Labels: eap6-req
> Fix For: 7.1.0.Final
>
>
> Add support for remote JNDI after all. It was agreed that:
> * Remote JNDI would run over Remoting
> * Remote JNDI for EJB is strictly a legacy access protocol, deprecated in favor of "ejb:"
> * The Remote JNDI service would proxy to a specific Context of the server JNDI tree - maybe "java:jboss/shared", maybe something else
> * Server-side services would opt-in to Remote JNDI; initially we'd only support:
> ** Remote EJB interfaces
> ** HornetQ connection factories
> * In the future we may support:
> ** User bindings, so long as they're serializable
> * In the future we will never support:
> ** Proxied DataSources
> ** Proxied JMS invocations
> Initial project tree is at https://github.com/dmlloyd/jboss-remote-jndi for now.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 5 months
[JBoss JIRA] (AS7-1338) Remote JNDI support for AS7
by Jason Greene (Commented) (JIRA)
[ https://issues.jboss.org/browse/AS7-1338?page=com.atlassian.jira.plugin.s... ]
Jason Greene commented on AS7-1338:
-----------------------------------
Hello Tobias,
Since this is going to be over remoting, we are planning to share port 4447 for this (also used for EJB invocation). Also the port will be secured for the final release.
> Remote JNDI support for AS7
> ---------------------------
>
> Key: AS7-1338
> URL: https://issues.jboss.org/browse/AS7-1338
> Project: Application Server 7
> Issue Type: Task
> Components: Naming
> Reporter: Richard Opalka
> Assignee: John Bailey
> Priority: Critical
> Labels: eap6-req
> Fix For: 7.1.0.Final
>
>
> Add support for remote JNDI after all. It was agreed that:
> * Remote JNDI would run over Remoting
> * Remote JNDI for EJB is strictly a legacy access protocol, deprecated in favor of "ejb:"
> * The Remote JNDI service would proxy to a specific Context of the server JNDI tree - maybe "java:jboss/shared", maybe something else
> * Server-side services would opt-in to Remote JNDI; initially we'd only support:
> ** Remote EJB interfaces
> ** HornetQ connection factories
> * In the future we may support:
> ** User bindings, so long as they're serializable
> * In the future we will never support:
> ** Proxied DataSources
> ** Proxied JMS invocations
> Initial project tree is at https://github.com/dmlloyd/jboss-remote-jndi for now.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 5 months