[JBoss JIRA] (JGRP-1880) UDP.ip_ttl is ignored and is always 1
by Bela Ban (JIRA)
[ https://issues.jboss.org/browse/JGRP-1880?page=com.atlassian.jira.plugin.... ]
Bela Ban updated JGRP-1880:
---------------------------
Fix Version/s: 3.5.1
> UDP.ip_ttl is ignored and is always 1
> -------------------------------------
>
> Key: JGRP-1880
> URL: https://issues.jboss.org/browse/JGRP-1880
> Project: JGroups
> Issue Type: Bug
> Reporter: Bela Ban
> Assignee: Bela Ban
> Fix For: 3.5.1, 3.6
>
>
> Since we switched from using a {{MulticastSocket}} for sending of multicast packets to a {{DatagramSocket}}, the time-to-live (TTL) of a packet is always {{1}}. The reason is that method {{setTimeToLive()}} only exists in {{MulticastSocket}}, but not in {{DatagramSocket}}.
> We cannot revert the code and use a {{MulticastSocket}} to send multicasts, as this won't reveal the real IP address of the sender, but only the multicast address, and the real address is needed to drop packets at the _transport level_.
> Investigate whether we could use reflection to get the {{DatagramSocketImpl}} and call {{setTimeToLive()}}.
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)
9 years, 9 months
[JBoss JIRA] (DROOLS-613) JBRULES-3723 NullPointerException in RuleNetworkEvaluator.innerEval(RuleNetworkEvaluator.java:271)
by qibiao deng (JIRA)
[ https://issues.jboss.org/browse/DROOLS-613?page=com.atlassian.jira.plugin... ]
qibiao deng updated DROOLS-613:
-------------------------------
Description:
when there is one rule in KBase, dynamically add second rule and fire it. drools report this error:
{code:title=Exception stack |borderStyle=solid}
java.lang.NullPointerException
at org.drools.core.phreak.RuleNetworkEvaluator.innerEval(RuleNetworkEvaluator.java:271)
at org.drools.core.phreak.RuleNetworkEvaluator.outerEval(RuleNetworkEvaluator.java:161)
at org.drools.core.phreak.RuleNetworkEvaluator.evaluateNetwork(RuleNetworkEvaluator.java:116)
at org.drools.core.phreak.RuleExecutor.reEvaluateNetwork(RuleExecutor.java:216)
at org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:91)
at org.drools.core.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:964)
at org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1234)
at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1239)
at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1222)
at mock.com.camel.drools.expert.sample.service.DynamicAddRuleBugTest.testReproduceBugWithSDO(DynamicAddRuleBugTest.java:134)
{code}
That two drl rules are almost same expect package name:
{code:title=drl 1|borderStyle=solid}
package com.camel.drools.expert.sample.testbug1
import mock.com.camel.drools.expert.sample.service.domain.Order;
import mock.com.camel.drools.expert.sample.service.domain.RuleConditionSdo;
rule "order flow"
when
$rcs:RuleConditionSdo($rc:ruleCondition)
$order:Order(price>$rc.getDouble("minPrice"), source==$rc.getString("source"), dest==$rc.getString("dest"))
then
System.out.println("finished rule for bug test 1" + $rc.getString("source"));
end
{code}
{code:title=drl 2|borderStyle=solid}
package com.camel.drools.expert.sample.testbug2
import mock.com.camel.drools.expert.sample.service.domain.Order;
import mock.com.camel.drools.expert.sample.service.domain.RuleConditionSdo;
rule "order flow"
when
$rcs:RuleConditionSdo($rc:ruleCondition)
$order:Order(price>$rc.getDouble("minPrice"), source==$rc.getString("source"), dest==$rc.getString("dest"))
then
System.out.println("finished rule for bug test 2" + $rc.getString("source"));
end
{code}
1. The RuleConditionSdo object was dynamically created at runtime, it using a SDO technic. This works failed
2. If changed RuleCondtionSdo with a pre-write pojo, It works fine.
3. If use Cglib util net.sf.cglib.beans.BeanGenerator creat RuleConditionSdo object dynamically. It works still fine.
so, It's like a bug with SDO object.
Test code below:
{code:title=DynamicAddRuleBugTest.java |borderStyle=solid}
package mock.com.camel.drools.expert.sample.service;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.HashMap;
import java.util.Map;
import mock.com.camel.drools.expert.sample.service.domain.Order;
import mock.com.camel.drools.expert.sample.service.domain.RuleCondition;
import mock.com.camel.drools.expert.sample.service.domain.RuleConditionSdo;
import org.drools.compiler.builder.impl.KnowledgeBuilderImpl;
import org.drools.compiler.compiler.DroolsParserException;
import org.drools.core.impl.InternalKnowledgeBase;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.kie.api.runtime.KieSession;
import org.kie.api.runtime.rule.AgendaFilter;
import org.kie.api.runtime.rule.Match;
import org.kie.internal.KnowledgeBaseFactory;
import com.camel.drools.expert.sample.utils.CglibDynamicBeanGenerator;
import com.camel.drools.expert.sample.utils.RegisterSDOXsd;
/**
* reproduce dynamic add rule bug
* @author dengqb
* @date 2014年9月19日
*/
public class DynamicAddRuleBugTest {
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
}
/**
* @throws java.lang.Exception
*/
@After
public void tearDown() throws Exception {
}
/**
* using pre-write RuleCondition Object
* result: fine
*/
@Test
public void testReproduceBug() {
InternalKnowledgeBase kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase();
String drlFile = "/drools/drl/bug_test1.drl";
loadPackageFromDrl(kBase, drlFile);
Order order = new Order(50,"ebay","china");
RuleCondition ruleCondition = new RuleCondition(30,"ebay","china");
KieSession kieSession = kBase.newStatefulKnowledgeSession();
kieSession.insert(ruleCondition);
kieSession.insert(order);
kieSession.fireAllRules(new AgendaFilter(){
@Override
public boolean accept(Match match) {
return match.getRule().getPackageName().endsWith("testbug1");
}
});
//statfull session使用后必需调用dispose
kieSession.dispose();
System.out.println("========add new rule=================");
String drlFile2 = "/drools/drl/bug_test2.drl";
loadPackageFromDrl(kBase, drlFile2);
kieSession = kBase.newStatefulKnowledgeSession();
Order order2 = new Order(32.0,"ebay","brazil");
RuleCondition ruleCondition2 = new RuleCondition(30,"ebay","brazil");
kieSession.insert(ruleCondition2);
kieSession.insert(order2);
kieSession.fireAllRules(new AgendaFilter(){
@Override
public boolean accept(Match match) {
return match.getRule().getPackageName().endsWith("testbug2");
}
});
kieSession.dispose();
}
/**
* using a RuleConditonSdo object, it is dynamically created by SDO technic
* result: false
*/
@Test
public void testReproduceBugWithSDO() {
InternalKnowledgeBase kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase();
String drlFile = "/drools/drl/bug_sdo_test1.drl";
loadPackageFromDrl(kBase, drlFile);
Order order = new Order(50,"ebay","china");
//注册sdo对象
RegisterSDOXsd register = new RegisterSDOXsd();
register.setXsdFilePath("/drools/xsd/xsdList.txt");
register.register();
RuleConditionSdo rcsdo = new RuleConditionSdo();
rcsdo.getRuleCondition().setDouble("minPrice",30);
rcsdo.getRuleCondition().setString("source","ebay");
rcsdo.getRuleCondition().setString("dest","china");
KieSession kieSession = kBase.newStatefulKnowledgeSession();
kieSession.insert(rcsdo);
kieSession.insert(order);
kieSession.fireAllRules(new AgendaFilter(){
@Override
public boolean accept(Match match) {
return match.getRule().getPackageName().endsWith("testbug1");
}
});
//statfull session使用后必需调用dispose
kieSession.dispose();
System.out.println("========add new rule=================");
String drlFile2 = "/drools/drl/bug_sdo_test2.drl";
loadPackageFromDrl(kBase, drlFile2);
kieSession = kBase.newStatefulKnowledgeSession();
Order order2 = new Order(32.0,"ebay","brazil");
//RuleCondition ruleCondition2 = new RuleCondition(30,"ebay","brazil");
RuleConditionSdo rcsdo2 = new RuleConditionSdo();
rcsdo.getRuleCondition().setDouble("minPrice",30);
rcsdo.getRuleCondition().setString("source","ebay");
rcsdo.getRuleCondition().setString("dest","breazil");
kieSession.insert(rcsdo2);
kieSession.insert(order2);
kieSession.fireAllRules(new AgendaFilter(){
@Override
public boolean accept(Match match) {
return match.getRule().getPackageName().endsWith("testbug2");
}
});
kieSession.dispose();
}
/**
* using a dynamicl RuleCondition object, it created by cglib BeanGenerator
* result: fine
* @throws ClassNotFoundException
*/
@Test
public void testReproduceBugWithDynamicBean() throws ClassNotFoundException{
InternalKnowledgeBase kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase();
String drlFile = "/drools/drl/bug_dyb_test1.drl";
loadPackageFromDrl(kBase, drlFile);
Order order = new Order(50,"ebay","china");
Map<String,Class<?>> properties = new HashMap<String,Class<?>>();
properties.put("minPrice", Class.forName("java.lang.Double"));
properties.put("source", Class.forName("java.lang.String"));
properties.put("dest", Class.forName("java.lang.String"));
// 生成动态 Bean
CglibDynamicBeanGenerator ruleCondition = new CglibDynamicBeanGenerator(properties);
ruleCondition.setValue("minPrice", 40d);
ruleCondition.setValue("source", "ebay");
ruleCondition.setValue("dest", "china");
KieSession kieSession = kBase.newStatefulKnowledgeSession();
kieSession.insert(ruleCondition);
kieSession.insert(order);
kieSession.fireAllRules(new AgendaFilter(){
@Override
public boolean accept(Match match) {
return match.getRule().getPackageName().endsWith("testbug1");
}
});
//statfull session使用后必需调用dispose
kieSession.dispose();
System.out.println("========add new rule=================");
String drlFile2 = "/drools/drl/bug_dyb_test2.drl";
loadPackageFromDrl(kBase, drlFile2);
kieSession = kBase.newStatefulKnowledgeSession();
Order order2 = new Order(32.0,"ebay","brazil");
ruleCondition = new CglibDynamicBeanGenerator(properties);
ruleCondition.setValue("minPrice", 30d);
ruleCondition.setValue("source", "ebay");
ruleCondition.setValue("dest", "brazil");
kieSession.insert(ruleCondition);
kieSession.insert(order2);
kieSession.fireAllRules(new AgendaFilter(){
@Override
public boolean accept(Match match) {
return match.getRule().getPackageName().endsWith("testbug2");
}
});
kieSession.dispose();
}
private void loadPackageFromDrl(InternalKnowledgeBase kBase, String drlFile) {
final Reader drlReader = new InputStreamReader(this.getClass().getResourceAsStream(drlFile));
final KnowledgeBuilderImpl builder = new KnowledgeBuilderImpl();
try {
builder.addPackageFromDrl(drlReader);
if (builder.hasErrors()){
System.out.println(builder.getErrors());
}
kBase.addPackage(builder.getPackage());
} catch (DroolsParserException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
{code}
SDO RuleCondition class
{code::title=RuleConditionSdo.java |borderStyle=solid}
package mock.com.camel.drools.expert.sample.service.domain;
import commonj.sdo.DataObject;
import commonj.sdo.helper.DataFactory;
/**
*
* @author dengqb
* @date 2014年9月19日
*/
public class RuleConditionSdo {
private DataObject ruleCondition;
public RuleConditionSdo(){
ruleCondition = DataFactory.INSTANCE.create("http://drools.research.com/xsd/RuleCondition", "RuleCondition");
}
public DataObject getRuleCondition() {
return ruleCondition;
}
public void setRuleCondition(DataObject ruleCondition) {
this.ruleCondition = ruleCondition;
}
}
{code}
was:
when there is one rule in KBase, dynamically add second rule and fire it. drools report this error:
{code:title=Exception stack |borderStyle=solid}
java.lang.NullPointerException
at org.drools.core.phreak.RuleNetworkEvaluator.innerEval(RuleNetworkEvaluator.java:271)
at org.drools.core.phreak.RuleNetworkEvaluator.outerEval(RuleNetworkEvaluator.java:161)
at org.drools.core.phreak.RuleNetworkEvaluator.evaluateNetwork(RuleNetworkEvaluator.java:116)
at org.drools.core.phreak.RuleExecutor.reEvaluateNetwork(RuleExecutor.java:216)
at org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:91)
at org.drools.core.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:964)
at org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1234)
at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1239)
at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1222)
at mock.com.camel.drools.expert.sample.service.DynamicAddRuleBugTest.testReproduceBugWithSDO(DynamicAddRuleBugTest.java:134)
{code}
That two drl rules are almost same expect package name:
{code:title=drl 1|borderStyle=solid}
package com.camel.drools.expert.sample.testbug1
import mock.com.camel.drools.expert.sample.service.domain.Order;
import mock.com.camel.drools.expert.sample.service.domain.RuleConditionSdo;
rule "order flow"
when
$rcs:RuleConditionSdo($rc:ruleCondition)
$order:Order(price>$rc.getDouble("minPrice"), source==$rc.getString("source"), dest==$rc.getString("dest"))
then
System.out.println("finished rule for bug test 1" + $rc.getString("source"));
end
{code}
{code:title=drl 2|borderStyle=solid}
package com.camel.drools.expert.sample.testbug2
import mock.com.camel.drools.expert.sample.service.domain.Order;
import mock.com.camel.drools.expert.sample.service.domain.RuleConditionSdo;
rule "order flow"
when
$rcs:RuleConditionSdo($rc:ruleCondition)
$order:Order(price>$rc.getDouble("minPrice"), source==$rc.getString("source"), dest==$rc.getString("dest"))
then
System.out.println("finished rule for bug test 2" + $rc.getString("source"));
end
{code}
1. The RuleConditionSdo object was dynamically created at runtime, it using a SDO technic. This works failed
2. If changed RuleCondtionSdo with a pre-write pojo, It works fine.
3. If use Cglib util net.sf.cglib.beans.BeanGenerator creat RuleConditionSdo object dynamically. It works still fine.
so, It's like a bug with SDO object.
Test code below:
{code:title=DynamicAddRuleBugTest.java |borderStyle=solid}
package mock.com.camel.drools.expert.sample.service;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.HashMap;
import java.util.Map;
import mock.com.camel.drools.expert.sample.service.domain.Order;
import mock.com.camel.drools.expert.sample.service.domain.RuleCondition;
import mock.com.camel.drools.expert.sample.service.domain.RuleConditionSdo;
import org.drools.compiler.builder.impl.KnowledgeBuilderImpl;
import org.drools.compiler.compiler.DroolsParserException;
import org.drools.core.impl.InternalKnowledgeBase;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.kie.api.runtime.KieSession;
import org.kie.api.runtime.rule.AgendaFilter;
import org.kie.api.runtime.rule.Match;
import org.kie.internal.KnowledgeBaseFactory;
import com.camel.drools.expert.sample.utils.CglibDynamicBeanGenerator;
import com.camel.drools.expert.sample.utils.RegisterSDOXsd;
/**
* reproduce dynamic add rule bug
* @author dengqb
* @date 2014年9月19日
*/
public class DynamicAddRuleBugTest {
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
}
/**
* @throws java.lang.Exception
*/
@After
public void tearDown() throws Exception {
}
/**
* using pre-write RuleCondition Object
* result: fine
*/
@Test
public void testReproduceBug() {
InternalKnowledgeBase kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase();
String drlFile = "/drools/drl/bug_test1.drl";
loadPackageFromDrl(kBase, drlFile);
Order order = new Order(50,"ebay","china");
RuleCondition ruleCondition = new RuleCondition(30,"ebay","china");
KieSession kieSession = kBase.newStatefulKnowledgeSession();
kieSession.insert(ruleCondition);
kieSession.insert(order);
kieSession.fireAllRules(new AgendaFilter(){
@Override
public boolean accept(Match match) {
return match.getRule().getPackageName().endsWith("testbug1");
}
});
//statfull session使用后必需调用dispose
kieSession.dispose();
System.out.println("========add new rule=================");
String drlFile2 = "/drools/drl/bug_test2.drl";
loadPackageFromDrl(kBase, drlFile2);
kieSession = kBase.newStatefulKnowledgeSession();
Order order2 = new Order(32.0,"ebay","brazil");
RuleCondition ruleCondition2 = new RuleCondition(30,"ebay","brazil");
kieSession.insert(ruleCondition2);
kieSession.insert(order2);
kieSession.fireAllRules(new AgendaFilter(){
@Override
public boolean accept(Match match) {
return match.getRule().getPackageName().endsWith("testbug2");
}
});
kieSession.dispose();
}
/**
* using a RuleConditonSdo object, it is dynamically created by SDO technic
* result: false
*/
@Test
public void testReproduceBugWithSDO() {
InternalKnowledgeBase kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase();
String drlFile = "/drools/drl/bug_sdo_test1.drl";
loadPackageFromDrl(kBase, drlFile);
Order order = new Order(50,"ebay","china");
//注册sdo对象
RegisterSDOXsd register = new RegisterSDOXsd();
register.setXsdFilePath("/drools/xsd/xsdList.txt");
register.register();
RuleConditionSdo rcsdo = new RuleConditionSdo();
rcsdo.getRuleCondition().setDouble("minPrice",30);
rcsdo.getRuleCondition().setString("source","ebay");
rcsdo.getRuleCondition().setString("dest","china");
KieSession kieSession = kBase.newStatefulKnowledgeSession();
kieSession.insert(rcsdo);
kieSession.insert(order);
kieSession.fireAllRules(new AgendaFilter(){
@Override
public boolean accept(Match match) {
return match.getRule().getPackageName().endsWith("testbug1");
}
});
//statfull session使用后必需调用dispose
kieSession.dispose();
System.out.println("========add new rule=================");
String drlFile2 = "/drools/drl/bug_sdo_test2.drl";
loadPackageFromDrl(kBase, drlFile2);
kieSession = kBase.newStatefulKnowledgeSession();
Order order2 = new Order(32.0,"ebay","brazil");
//RuleCondition ruleCondition2 = new RuleCondition(30,"ebay","brazil");
RuleConditionSdo rcsdo2 = new RuleConditionSdo();
rcsdo.getRuleCondition().setDouble("minPrice",30);
rcsdo.getRuleCondition().setString("source","ebay");
rcsdo.getRuleCondition().setString("dest","breazil");
kieSession.insert(rcsdo2);
kieSession.insert(order2);
kieSession.fireAllRules(new AgendaFilter(){
@Override
public boolean accept(Match match) {
return match.getRule().getPackageName().endsWith("testbug2");
}
});
kieSession.dispose();
}
/**
* using a dynamicl RuleCondition object, it created by cglib BeanGenerator
* result: fine
* @throws ClassNotFoundException
*/
@Test
public void testReproduceBugWithDynamicBean() throws ClassNotFoundException{
InternalKnowledgeBase kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase();
String drlFile = "/drools/drl/bug_dyb_test1.drl";
loadPackageFromDrl(kBase, drlFile);
Order order = new Order(50,"ebay","china");
Map<String,Class<?>> properties = new HashMap<String,Class<?>>();
properties.put("minPrice", Class.forName("java.lang.Double"));
properties.put("source", Class.forName("java.lang.String"));
properties.put("dest", Class.forName("java.lang.String"));
// 生成动态 Bean
CglibDynamicBeanGenerator ruleCondition = new CglibDynamicBeanGenerator(properties);
ruleCondition.setValue("minPrice", 40d);
ruleCondition.setValue("source", "ebay");
ruleCondition.setValue("dest", "china");
KieSession kieSession = kBase.newStatefulKnowledgeSession();
kieSession.insert(ruleCondition);
kieSession.insert(order);
kieSession.fireAllRules(new AgendaFilter(){
@Override
public boolean accept(Match match) {
return match.getRule().getPackageName().endsWith("testbug1");
}
});
//statfull session使用后必需调用dispose
kieSession.dispose();
System.out.println("========add new rule=================");
String drlFile2 = "/drools/drl/bug_dyb_test2.drl";
loadPackageFromDrl(kBase, drlFile2);
kieSession = kBase.newStatefulKnowledgeSession();
Order order2 = new Order(32.0,"ebay","brazil");
ruleCondition = new CglibDynamicBeanGenerator(properties);
ruleCondition.setValue("minPrice", 30d);
ruleCondition.setValue("source", "ebay");
ruleCondition.setValue("dest", "brazil");
kieSession.insert(ruleCondition);
kieSession.insert(order2);
kieSession.fireAllRules(new AgendaFilter(){
@Override
public boolean accept(Match match) {
return match.getRule().getPackageName().endsWith("testbug2");
}
});
kieSession.dispose();
}
private void loadPackageFromDrl(InternalKnowledgeBase kBase, String drlFile) {
final Reader drlReader = new InputStreamReader(this.getClass().getResourceAsStream(drlFile));
final KnowledgeBuilderImpl builder = new KnowledgeBuilderImpl();
try {
builder.addPackageFromDrl(drlReader);
if (builder.hasErrors()){
System.out.println(builder.getErrors());
}
kBase.addPackage(builder.getPackage());
} catch (DroolsParserException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
{code}
> JBRULES-3723 NullPointerException in RuleNetworkEvaluator.innerEval(RuleNetworkEvaluator.java:271)
> --------------------------------------------------------------------------------------------------
>
> Key: DROOLS-613
> URL: https://issues.jboss.org/browse/DROOLS-613
> Project: Drools
> Issue Type: Bug
> Affects Versions: 6.0.1.Final, 6.1.0.Final
> Environment: drools-core: 6.1.0.Final
> drools-compiler: 6.1.0.Final
> JDK: 1.7.0_45
> IDE:eclipse kepler
> OS: windows 7
> Test: Junit4
> Reporter: qibiao deng
> Assignee: Mark Proctor
> Labels: DRL, Drools, SDO
>
> when there is one rule in KBase, dynamically add second rule and fire it. drools report this error:
> {code:title=Exception stack |borderStyle=solid}
> java.lang.NullPointerException
> at org.drools.core.phreak.RuleNetworkEvaluator.innerEval(RuleNetworkEvaluator.java:271)
> at org.drools.core.phreak.RuleNetworkEvaluator.outerEval(RuleNetworkEvaluator.java:161)
> at org.drools.core.phreak.RuleNetworkEvaluator.evaluateNetwork(RuleNetworkEvaluator.java:116)
> at org.drools.core.phreak.RuleExecutor.reEvaluateNetwork(RuleExecutor.java:216)
> at org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:91)
> at org.drools.core.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:964)
> at org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1234)
> at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1239)
> at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1222)
> at mock.com.camel.drools.expert.sample.service.DynamicAddRuleBugTest.testReproduceBugWithSDO(DynamicAddRuleBugTest.java:134)
> {code}
> That two drl rules are almost same expect package name:
> {code:title=drl 1|borderStyle=solid}
> package com.camel.drools.expert.sample.testbug1
> import mock.com.camel.drools.expert.sample.service.domain.Order;
> import mock.com.camel.drools.expert.sample.service.domain.RuleConditionSdo;
> rule "order flow"
> when
> $rcs:RuleConditionSdo($rc:ruleCondition)
> $order:Order(price>$rc.getDouble("minPrice"), source==$rc.getString("source"), dest==$rc.getString("dest"))
> then
> System.out.println("finished rule for bug test 1" + $rc.getString("source"));
> end
> {code}
> {code:title=drl 2|borderStyle=solid}
> package com.camel.drools.expert.sample.testbug2
> import mock.com.camel.drools.expert.sample.service.domain.Order;
> import mock.com.camel.drools.expert.sample.service.domain.RuleConditionSdo;
> rule "order flow"
> when
> $rcs:RuleConditionSdo($rc:ruleCondition)
> $order:Order(price>$rc.getDouble("minPrice"), source==$rc.getString("source"), dest==$rc.getString("dest"))
> then
> System.out.println("finished rule for bug test 2" + $rc.getString("source"));
> end
> {code}
> 1. The RuleConditionSdo object was dynamically created at runtime, it using a SDO technic. This works failed
> 2. If changed RuleCondtionSdo with a pre-write pojo, It works fine.
> 3. If use Cglib util net.sf.cglib.beans.BeanGenerator creat RuleConditionSdo object dynamically. It works still fine.
> so, It's like a bug with SDO object.
> Test code below:
> {code:title=DynamicAddRuleBugTest.java |borderStyle=solid}
> package mock.com.camel.drools.expert.sample.service;
> import java.io.IOException;
> import java.io.InputStreamReader;
> import java.io.Reader;
> import java.util.HashMap;
> import java.util.Map;
> import mock.com.camel.drools.expert.sample.service.domain.Order;
> import mock.com.camel.drools.expert.sample.service.domain.RuleCondition;
> import mock.com.camel.drools.expert.sample.service.domain.RuleConditionSdo;
> import org.drools.compiler.builder.impl.KnowledgeBuilderImpl;
> import org.drools.compiler.compiler.DroolsParserException;
> import org.drools.core.impl.InternalKnowledgeBase;
> import org.junit.After;
> import org.junit.Before;
> import org.junit.Test;
> import org.kie.api.runtime.KieSession;
> import org.kie.api.runtime.rule.AgendaFilter;
> import org.kie.api.runtime.rule.Match;
> import org.kie.internal.KnowledgeBaseFactory;
> import com.camel.drools.expert.sample.utils.CglibDynamicBeanGenerator;
> import com.camel.drools.expert.sample.utils.RegisterSDOXsd;
> /**
> * reproduce dynamic add rule bug
> * @author dengqb
> * @date 2014年9月19日
> */
> public class DynamicAddRuleBugTest {
> /**
> * @throws java.lang.Exception
> */
> @Before
> public void setUp() throws Exception {
> }
> /**
> * @throws java.lang.Exception
> */
> @After
> public void tearDown() throws Exception {
> }
> /**
> * using pre-write RuleCondition Object
> * result: fine
> */
> @Test
> public void testReproduceBug() {
> InternalKnowledgeBase kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase();
> String drlFile = "/drools/drl/bug_test1.drl";
> loadPackageFromDrl(kBase, drlFile);
>
> Order order = new Order(50,"ebay","china");
> RuleCondition ruleCondition = new RuleCondition(30,"ebay","china");
>
> KieSession kieSession = kBase.newStatefulKnowledgeSession();
> kieSession.insert(ruleCondition);
> kieSession.insert(order);
> kieSession.fireAllRules(new AgendaFilter(){
> @Override
> public boolean accept(Match match) {
> return match.getRule().getPackageName().endsWith("testbug1");
> }
> });
> //statfull session使用后必需调用dispose
> kieSession.dispose();
>
> System.out.println("========add new rule=================");
> String drlFile2 = "/drools/drl/bug_test2.drl";
> loadPackageFromDrl(kBase, drlFile2);
>
> kieSession = kBase.newStatefulKnowledgeSession();
> Order order2 = new Order(32.0,"ebay","brazil");
> RuleCondition ruleCondition2 = new RuleCondition(30,"ebay","brazil");
> kieSession.insert(ruleCondition2);
> kieSession.insert(order2);
> kieSession.fireAllRules(new AgendaFilter(){
> @Override
> public boolean accept(Match match) {
> return match.getRule().getPackageName().endsWith("testbug2");
> }
> });
> kieSession.dispose();
> }
> /**
> * using a RuleConditonSdo object, it is dynamically created by SDO technic
> * result: false
> */
> @Test
> public void testReproduceBugWithSDO() {
> InternalKnowledgeBase kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase();
> String drlFile = "/drools/drl/bug_sdo_test1.drl";
> loadPackageFromDrl(kBase, drlFile);
>
> Order order = new Order(50,"ebay","china");
>
> //注册sdo对象
> RegisterSDOXsd register = new RegisterSDOXsd();
> register.setXsdFilePath("/drools/xsd/xsdList.txt");
> register.register();
>
> RuleConditionSdo rcsdo = new RuleConditionSdo();
> rcsdo.getRuleCondition().setDouble("minPrice",30);
> rcsdo.getRuleCondition().setString("source","ebay");
> rcsdo.getRuleCondition().setString("dest","china");
>
> KieSession kieSession = kBase.newStatefulKnowledgeSession();
> kieSession.insert(rcsdo);
> kieSession.insert(order);
> kieSession.fireAllRules(new AgendaFilter(){
> @Override
> public boolean accept(Match match) {
> return match.getRule().getPackageName().endsWith("testbug1");
> }
> });
> //statfull session使用后必需调用dispose
> kieSession.dispose();
>
> System.out.println("========add new rule=================");
> String drlFile2 = "/drools/drl/bug_sdo_test2.drl";
> loadPackageFromDrl(kBase, drlFile2);
>
> kieSession = kBase.newStatefulKnowledgeSession();
> Order order2 = new Order(32.0,"ebay","brazil");
> //RuleCondition ruleCondition2 = new RuleCondition(30,"ebay","brazil");
> RuleConditionSdo rcsdo2 = new RuleConditionSdo();
> rcsdo.getRuleCondition().setDouble("minPrice",30);
> rcsdo.getRuleCondition().setString("source","ebay");
> rcsdo.getRuleCondition().setString("dest","breazil");
> kieSession.insert(rcsdo2);
> kieSession.insert(order2);
> kieSession.fireAllRules(new AgendaFilter(){
> @Override
> public boolean accept(Match match) {
> return match.getRule().getPackageName().endsWith("testbug2");
> }
> });
> kieSession.dispose();
> }
>
> /**
> * using a dynamicl RuleCondition object, it created by cglib BeanGenerator
> * result: fine
> * @throws ClassNotFoundException
> */
> @Test
> public void testReproduceBugWithDynamicBean() throws ClassNotFoundException{
> InternalKnowledgeBase kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase();
> String drlFile = "/drools/drl/bug_dyb_test1.drl";
> loadPackageFromDrl(kBase, drlFile);
>
> Order order = new Order(50,"ebay","china");
>
> Map<String,Class<?>> properties = new HashMap<String,Class<?>>();
> properties.put("minPrice", Class.forName("java.lang.Double"));
> properties.put("source", Class.forName("java.lang.String"));
> properties.put("dest", Class.forName("java.lang.String"));
> // 生成动态 Bean
> CglibDynamicBeanGenerator ruleCondition = new CglibDynamicBeanGenerator(properties);
> ruleCondition.setValue("minPrice", 40d);
> ruleCondition.setValue("source", "ebay");
> ruleCondition.setValue("dest", "china");
>
> KieSession kieSession = kBase.newStatefulKnowledgeSession();
> kieSession.insert(ruleCondition);
> kieSession.insert(order);
> kieSession.fireAllRules(new AgendaFilter(){
> @Override
> public boolean accept(Match match) {
> return match.getRule().getPackageName().endsWith("testbug1");
> }
> });
> //statfull session使用后必需调用dispose
> kieSession.dispose();
>
> System.out.println("========add new rule=================");
> String drlFile2 = "/drools/drl/bug_dyb_test2.drl";
> loadPackageFromDrl(kBase, drlFile2);
>
> kieSession = kBase.newStatefulKnowledgeSession();
> Order order2 = new Order(32.0,"ebay","brazil");
>
> ruleCondition = new CglibDynamicBeanGenerator(properties);
> ruleCondition.setValue("minPrice", 30d);
> ruleCondition.setValue("source", "ebay");
> ruleCondition.setValue("dest", "brazil");
>
> kieSession.insert(ruleCondition);
> kieSession.insert(order2);
> kieSession.fireAllRules(new AgendaFilter(){
> @Override
> public boolean accept(Match match) {
> return match.getRule().getPackageName().endsWith("testbug2");
> }
> });
> kieSession.dispose();
> }
> private void loadPackageFromDrl(InternalKnowledgeBase kBase, String drlFile) {
> final Reader drlReader = new InputStreamReader(this.getClass().getResourceAsStream(drlFile));
>
> final KnowledgeBuilderImpl builder = new KnowledgeBuilderImpl();
> try {
> builder.addPackageFromDrl(drlReader);
> if (builder.hasErrors()){
> System.out.println(builder.getErrors());
> }
> kBase.addPackage(builder.getPackage());
> } catch (DroolsParserException e) {
> e.printStackTrace();
> } catch (IOException e) {
> e.printStackTrace();
> }
> }
> }
> {code}
> SDO RuleCondition class
> {code::title=RuleConditionSdo.java |borderStyle=solid}
> package mock.com.camel.drools.expert.sample.service.domain;
> import commonj.sdo.DataObject;
> import commonj.sdo.helper.DataFactory;
> /**
> *
> * @author dengqb
> * @date 2014年9月19日
> */
> public class RuleConditionSdo {
> private DataObject ruleCondition;
>
> public RuleConditionSdo(){
> ruleCondition = DataFactory.INSTANCE.create("http://drools.research.com/xsd/RuleCondition", "RuleCondition");
> }
> public DataObject getRuleCondition() {
> return ruleCondition;
> }
> public void setRuleCondition(DataObject ruleCondition) {
> this.ruleCondition = ruleCondition;
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)
9 years, 9 months
[JBoss JIRA] (DROOLS-613) JBRULES-3723 NullPointerException in RuleNetworkEvaluator.innerEval(RuleNetworkEvaluator.java:271)
by qibiao deng (JIRA)
[ https://issues.jboss.org/browse/DROOLS-613?page=com.atlassian.jira.plugin... ]
qibiao deng updated DROOLS-613:
-------------------------------
Description:
when there is one rule in KBase, dynamically add second rule and fire it. drools report this error:
{code:title=Exception stack |borderStyle=solid}
java.lang.NullPointerException
at org.drools.core.phreak.RuleNetworkEvaluator.innerEval(RuleNetworkEvaluator.java:271)
at org.drools.core.phreak.RuleNetworkEvaluator.outerEval(RuleNetworkEvaluator.java:161)
at org.drools.core.phreak.RuleNetworkEvaluator.evaluateNetwork(RuleNetworkEvaluator.java:116)
at org.drools.core.phreak.RuleExecutor.reEvaluateNetwork(RuleExecutor.java:216)
at org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:91)
at org.drools.core.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:964)
at org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1234)
at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1239)
at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1222)
at mock.com.camel.drools.expert.sample.service.DynamicAddRuleBugTest.testReproduceBugWithSDO(DynamicAddRuleBugTest.java:134)
{code}
That two drl rules are almost same expect package name:
{code:title=drl 1|borderStyle=solid}
package com.camel.drools.expert.sample.testbug1
import mock.com.camel.drools.expert.sample.service.domain.Order;
import mock.com.camel.drools.expert.sample.service.domain.RuleConditionSdo;
rule "order flow"
when
$rcs:RuleConditionSdo($rc:ruleCondition)
$order:Order(price>$rc.getDouble("minPrice"), source==$rc.getString("source"), dest==$rc.getString("dest"))
then
System.out.println("finished rule for bug test 1" + $rc.getString("source"));
end
{code}
{code:title=drl 2|borderStyle=solid}
package com.camel.drools.expert.sample.testbug2
import mock.com.camel.drools.expert.sample.service.domain.Order;
import mock.com.camel.drools.expert.sample.service.domain.RuleConditionSdo;
rule "order flow"
when
$rcs:RuleConditionSdo($rc:ruleCondition)
$order:Order(price>$rc.getDouble("minPrice"), source==$rc.getString("source"), dest==$rc.getString("dest"))
then
System.out.println("finished rule for bug test 2" + $rc.getString("source"));
end
{code}
1. The RuleConditionSdo object was dynamically created at runtime, it using a SDO technic. This works failed
2. If changed RuleCondtionSdo with a pre-write pojo, It works fine.
3. If use Cglib util net.sf.cglib.beans.BeanGenerator creat RuleConditionSdo object dynamically. It works still fine.
so, It's like a bug with SDO object.
Test code below:
{code:title=DynamicAddRuleBugTest.java |borderStyle=solid}
package mock.com.camel.drools.expert.sample.service;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.HashMap;
import java.util.Map;
import mock.com.camel.drools.expert.sample.service.domain.Order;
import mock.com.camel.drools.expert.sample.service.domain.RuleCondition;
import mock.com.camel.drools.expert.sample.service.domain.RuleConditionSdo;
import org.drools.compiler.builder.impl.KnowledgeBuilderImpl;
import org.drools.compiler.compiler.DroolsParserException;
import org.drools.core.impl.InternalKnowledgeBase;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.kie.api.runtime.KieSession;
import org.kie.api.runtime.rule.AgendaFilter;
import org.kie.api.runtime.rule.Match;
import org.kie.internal.KnowledgeBaseFactory;
import com.camel.drools.expert.sample.utils.CglibDynamicBeanGenerator;
import com.camel.drools.expert.sample.utils.RegisterSDOXsd;
/**
* reproduce dynamic add rule bug
* @author dengqb
* @date 2014年9月19日
*/
public class DynamicAddRuleBugTest {
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
}
/**
* @throws java.lang.Exception
*/
@After
public void tearDown() throws Exception {
}
/**
* using pre-write RuleCondition Object
* result: fine
*/
@Test
public void testReproduceBug() {
InternalKnowledgeBase kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase();
String drlFile = "/drools/drl/bug_test1.drl";
loadPackageFromDrl(kBase, drlFile);
Order order = new Order(50,"ebay","china");
RuleCondition ruleCondition = new RuleCondition(30,"ebay","china");
KieSession kieSession = kBase.newStatefulKnowledgeSession();
kieSession.insert(ruleCondition);
kieSession.insert(order);
kieSession.fireAllRules(new AgendaFilter(){
@Override
public boolean accept(Match match) {
return match.getRule().getPackageName().endsWith("testbug1");
}
});
//statfull session使用后必需调用dispose
kieSession.dispose();
System.out.println("========add new rule=================");
String drlFile2 = "/drools/drl/bug_test2.drl";
loadPackageFromDrl(kBase, drlFile2);
kieSession = kBase.newStatefulKnowledgeSession();
Order order2 = new Order(32.0,"ebay","brazil");
RuleCondition ruleCondition2 = new RuleCondition(30,"ebay","brazil");
kieSession.insert(ruleCondition2);
kieSession.insert(order2);
kieSession.fireAllRules(new AgendaFilter(){
@Override
public boolean accept(Match match) {
return match.getRule().getPackageName().endsWith("testbug2");
}
});
kieSession.dispose();
}
/**
* using a RuleConditonSdo object, it is dynamically created by SDO technic
* result: false
*/
@Test
public void testReproduceBugWithSDO() {
InternalKnowledgeBase kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase();
String drlFile = "/drools/drl/bug_sdo_test1.drl";
loadPackageFromDrl(kBase, drlFile);
Order order = new Order(50,"ebay","china");
//注册sdo对象
RegisterSDOXsd register = new RegisterSDOXsd();
register.setXsdFilePath("/drools/xsd/xsdList.txt");
register.register();
RuleConditionSdo rcsdo = new RuleConditionSdo();
rcsdo.getRuleCondition().setDouble("minPrice",30);
rcsdo.getRuleCondition().setString("source","ebay");
rcsdo.getRuleCondition().setString("dest","china");
KieSession kieSession = kBase.newStatefulKnowledgeSession();
kieSession.insert(rcsdo);
kieSession.insert(order);
kieSession.fireAllRules(new AgendaFilter(){
@Override
public boolean accept(Match match) {
return match.getRule().getPackageName().endsWith("testbug1");
}
});
//statfull session使用后必需调用dispose
kieSession.dispose();
System.out.println("========add new rule=================");
String drlFile2 = "/drools/drl/bug_sdo_test2.drl";
loadPackageFromDrl(kBase, drlFile2);
kieSession = kBase.newStatefulKnowledgeSession();
Order order2 = new Order(32.0,"ebay","brazil");
//RuleCondition ruleCondition2 = new RuleCondition(30,"ebay","brazil");
RuleConditionSdo rcsdo2 = new RuleConditionSdo();
rcsdo.getRuleCondition().setDouble("minPrice",30);
rcsdo.getRuleCondition().setString("source","ebay");
rcsdo.getRuleCondition().setString("dest","breazil");
kieSession.insert(rcsdo2);
kieSession.insert(order2);
kieSession.fireAllRules(new AgendaFilter(){
@Override
public boolean accept(Match match) {
return match.getRule().getPackageName().endsWith("testbug2");
}
});
kieSession.dispose();
}
/**
* using a dynamicl RuleCondition object, it created by cglib BeanGenerator
* result: fine
* @throws ClassNotFoundException
*/
@Test
public void testReproduceBugWithDynamicBean() throws ClassNotFoundException{
InternalKnowledgeBase kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase();
String drlFile = "/drools/drl/bug_dyb_test1.drl";
loadPackageFromDrl(kBase, drlFile);
Order order = new Order(50,"ebay","china");
Map<String,Class<?>> properties = new HashMap<String,Class<?>>();
properties.put("minPrice", Class.forName("java.lang.Double"));
properties.put("source", Class.forName("java.lang.String"));
properties.put("dest", Class.forName("java.lang.String"));
// 生成动态 Bean
CglibDynamicBeanGenerator ruleCondition = new CglibDynamicBeanGenerator(properties);
ruleCondition.setValue("minPrice", 40d);
ruleCondition.setValue("source", "ebay");
ruleCondition.setValue("dest", "china");
KieSession kieSession = kBase.newStatefulKnowledgeSession();
kieSession.insert(ruleCondition);
kieSession.insert(order);
kieSession.fireAllRules(new AgendaFilter(){
@Override
public boolean accept(Match match) {
return match.getRule().getPackageName().endsWith("testbug1");
}
});
//statfull session使用后必需调用dispose
kieSession.dispose();
System.out.println("========add new rule=================");
String drlFile2 = "/drools/drl/bug_dyb_test2.drl";
loadPackageFromDrl(kBase, drlFile2);
kieSession = kBase.newStatefulKnowledgeSession();
Order order2 = new Order(32.0,"ebay","brazil");
ruleCondition = new CglibDynamicBeanGenerator(properties);
ruleCondition.setValue("minPrice", 30d);
ruleCondition.setValue("source", "ebay");
ruleCondition.setValue("dest", "brazil");
kieSession.insert(ruleCondition);
kieSession.insert(order2);
kieSession.fireAllRules(new AgendaFilter(){
@Override
public boolean accept(Match match) {
return match.getRule().getPackageName().endsWith("testbug2");
}
});
kieSession.dispose();
}
private void loadPackageFromDrl(InternalKnowledgeBase kBase, String drlFile) {
final Reader drlReader = new InputStreamReader(this.getClass().getResourceAsStream(drlFile));
final KnowledgeBuilderImpl builder = new KnowledgeBuilderImpl();
try {
builder.addPackageFromDrl(drlReader);
if (builder.hasErrors()){
System.out.println(builder.getErrors());
}
kBase.addPackage(builder.getPackage());
} catch (DroolsParserException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
{code}
was:
when there is one rule in KBase, dynamically add second rule and fire it. drools report this error:
{code:title=Exception stack |borderStyle=solid}
java.lang.NullPointerException
at org.drools.core.phreak.RuleNetworkEvaluator.innerEval(RuleNetworkEvaluator.java:271)
at org.drools.core.phreak.RuleNetworkEvaluator.outerEval(RuleNetworkEvaluator.java:161)
at org.drools.core.phreak.RuleNetworkEvaluator.evaluateNetwork(RuleNetworkEvaluator.java:116)
at org.drools.core.phreak.RuleExecutor.reEvaluateNetwork(RuleExecutor.java:216)
at org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:91)
at org.drools.core.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:964)
at org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1234)
at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1239)
at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1222)
at mock.com.camel.drools.expert.sample.service.DynamicAddRuleBugTest.testReproduceBugWithSDO(DynamicAddRuleBugTest.java:134)
{code}
That tow drl rules are almost same expect package name:
{code:title=drl 1|borderStyle=solid}
package com.camel.drools.expert.sample.testbug1
import mock.com.camel.drools.expert.sample.service.domain.Order;
import mock.com.camel.drools.expert.sample.service.domain.RuleConditionSdo;
rule "order flow"
when
$rcs:RuleConditionSdo($rc:ruleCondition)
$order:Order(price>$rc.getDouble("minPrice"), source==$rc.getString("source"), dest==$rc.getString("dest"))
then
System.out.println("finished rule for bug test 1" + $rc.getString("source"));
end
{code}
{code:title=drl 2|borderStyle=solid}
package com.camel.drools.expert.sample.testbug2
import mock.com.camel.drools.expert.sample.service.domain.Order;
import mock.com.camel.drools.expert.sample.service.domain.RuleConditionSdo;
rule "order flow"
when
$rcs:RuleConditionSdo($rc:ruleCondition)
$order:Order(price>$rc.getDouble("minPrice"), source==$rc.getString("source"), dest==$rc.getString("dest"))
then
System.out.println("finished rule for bug test 2" + $rc.getString("source"));
end
{code}
1. The RuleConditionSdo object was dynamically created at runtime, it using a SDO technic.
2. If changed RuleCondtionSdo with a pre-write pojo, It works fine.
3. If use Cglib util net.sf.cglib.beans.BeanGenerator creat RuleConditionSdo object dynamically. It works still fine.
so, It's like a bug.
Test code below:
{code:title=DynamicAddRuleBugTest.java |borderStyle=solid}
package mock.com.camel.drools.expert.sample.service;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.HashMap;
import java.util.Map;
import mock.com.camel.drools.expert.sample.service.domain.Order;
import mock.com.camel.drools.expert.sample.service.domain.RuleCondition;
import mock.com.camel.drools.expert.sample.service.domain.RuleConditionSdo;
import org.drools.compiler.builder.impl.KnowledgeBuilderImpl;
import org.drools.compiler.compiler.DroolsParserException;
import org.drools.core.impl.InternalKnowledgeBase;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.kie.api.runtime.KieSession;
import org.kie.api.runtime.rule.AgendaFilter;
import org.kie.api.runtime.rule.Match;
import org.kie.internal.KnowledgeBaseFactory;
import com.camel.drools.expert.sample.utils.CglibDynamicBeanGenerator;
import com.camel.drools.expert.sample.utils.RegisterSDOXsd;
/**
* reproduce dynamic add rule bug
* @author dengqb
* @date 2014年9月19日
*/
public class DynamicAddRuleBugTest {
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
}
/**
* @throws java.lang.Exception
*/
@After
public void tearDown() throws Exception {
}
/**
* using pre-write RuleCondition Object
* result: fine
*/
@Test
public void testReproduceBug() {
InternalKnowledgeBase kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase();
String drlFile = "/drools/drl/bug_test1.drl";
loadPackageFromDrl(kBase, drlFile);
Order order = new Order(50,"ebay","china");
RuleCondition ruleCondition = new RuleCondition(30,"ebay","china");
KieSession kieSession = kBase.newStatefulKnowledgeSession();
kieSession.insert(ruleCondition);
kieSession.insert(order);
kieSession.fireAllRules(new AgendaFilter(){
@Override
public boolean accept(Match match) {
return match.getRule().getPackageName().endsWith("testbug1");
}
});
//statfull session使用后必需调用dispose
kieSession.dispose();
System.out.println("========add new rule=================");
String drlFile2 = "/drools/drl/bug_test2.drl";
loadPackageFromDrl(kBase, drlFile2);
kieSession = kBase.newStatefulKnowledgeSession();
Order order2 = new Order(32.0,"ebay","brazil");
RuleCondition ruleCondition2 = new RuleCondition(30,"ebay","brazil");
kieSession.insert(ruleCondition2);
kieSession.insert(order2);
kieSession.fireAllRules(new AgendaFilter(){
@Override
public boolean accept(Match match) {
return match.getRule().getPackageName().endsWith("testbug2");
}
});
kieSession.dispose();
}
/**
* using a RuleConditonSdo object, it is dynamically created by SDO technic
* result: false
*/
@Test
public void testReproduceBugWithSDO() {
InternalKnowledgeBase kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase();
String drlFile = "/drools/drl/bug_sdo_test1.drl";
loadPackageFromDrl(kBase, drlFile);
Order order = new Order(50,"ebay","china");
//注册sdo对象
RegisterSDOXsd register = new RegisterSDOXsd();
register.setXsdFilePath("/drools/xsd/xsdList.txt");
register.register();
RuleConditionSdo rcsdo = new RuleConditionSdo();
rcsdo.getRuleCondition().setDouble("minPrice",30);
rcsdo.getRuleCondition().setString("source","ebay");
rcsdo.getRuleCondition().setString("dest","china");
KieSession kieSession = kBase.newStatefulKnowledgeSession();
kieSession.insert(rcsdo);
kieSession.insert(order);
kieSession.fireAllRules(new AgendaFilter(){
@Override
public boolean accept(Match match) {
return match.getRule().getPackageName().endsWith("testbug1");
}
});
//statfull session使用后必需调用dispose
kieSession.dispose();
System.out.println("========add new rule=================");
String drlFile2 = "/drools/drl/bug_sdo_test2.drl";
loadPackageFromDrl(kBase, drlFile2);
kieSession = kBase.newStatefulKnowledgeSession();
Order order2 = new Order(32.0,"ebay","brazil");
//RuleCondition ruleCondition2 = new RuleCondition(30,"ebay","brazil");
RuleConditionSdo rcsdo2 = new RuleConditionSdo();
rcsdo.getRuleCondition().setDouble("minPrice",30);
rcsdo.getRuleCondition().setString("source","ebay");
rcsdo.getRuleCondition().setString("dest","breazil");
kieSession.insert(rcsdo2);
kieSession.insert(order2);
kieSession.fireAllRules(new AgendaFilter(){
@Override
public boolean accept(Match match) {
return match.getRule().getPackageName().endsWith("testbug2");
}
});
kieSession.dispose();
}
/**
* using a dynamicl RuleCondition object, it created by cglib BeanGenerator
* result: fine
* @throws ClassNotFoundException
*/
@Test
public void testReproduceBugWithDynamicBean() throws ClassNotFoundException{
InternalKnowledgeBase kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase();
String drlFile = "/drools/drl/bug_dyb_test1.drl";
loadPackageFromDrl(kBase, drlFile);
Order order = new Order(50,"ebay","china");
Map<String,Class<?>> properties = new HashMap<String,Class<?>>();
properties.put("minPrice", Class.forName("java.lang.Double"));
properties.put("source", Class.forName("java.lang.String"));
properties.put("dest", Class.forName("java.lang.String"));
// 生成动态 Bean
CglibDynamicBeanGenerator ruleCondition = new CglibDynamicBeanGenerator(properties);
ruleCondition.setValue("minPrice", 40d);
ruleCondition.setValue("source", "ebay");
ruleCondition.setValue("dest", "china");
KieSession kieSession = kBase.newStatefulKnowledgeSession();
kieSession.insert(ruleCondition);
kieSession.insert(order);
kieSession.fireAllRules(new AgendaFilter(){
@Override
public boolean accept(Match match) {
return match.getRule().getPackageName().endsWith("testbug1");
}
});
//statfull session使用后必需调用dispose
kieSession.dispose();
System.out.println("========add new rule=================");
String drlFile2 = "/drools/drl/bug_dyb_test2.drl";
loadPackageFromDrl(kBase, drlFile2);
kieSession = kBase.newStatefulKnowledgeSession();
Order order2 = new Order(32.0,"ebay","brazil");
ruleCondition = new CglibDynamicBeanGenerator(properties);
ruleCondition.setValue("minPrice", 30d);
ruleCondition.setValue("source", "ebay");
ruleCondition.setValue("dest", "brazil");
kieSession.insert(ruleCondition);
kieSession.insert(order2);
kieSession.fireAllRules(new AgendaFilter(){
@Override
public boolean accept(Match match) {
return match.getRule().getPackageName().endsWith("testbug2");
}
});
kieSession.dispose();
}
private void loadPackageFromDrl(InternalKnowledgeBase kBase, String drlFile) {
final Reader drlReader = new InputStreamReader(this.getClass().getResourceAsStream(drlFile));
final KnowledgeBuilderImpl builder = new KnowledgeBuilderImpl();
try {
builder.addPackageFromDrl(drlReader);
if (builder.hasErrors()){
System.out.println(builder.getErrors());
}
kBase.addPackage(builder.getPackage());
} catch (DroolsParserException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
{code}
> JBRULES-3723 NullPointerException in RuleNetworkEvaluator.innerEval(RuleNetworkEvaluator.java:271)
> --------------------------------------------------------------------------------------------------
>
> Key: DROOLS-613
> URL: https://issues.jboss.org/browse/DROOLS-613
> Project: Drools
> Issue Type: Bug
> Affects Versions: 6.0.1.Final, 6.1.0.Final
> Environment: drools-core: 6.1.0.Final
> drools-compiler: 6.1.0.Final
> JDK: 1.7.0_45
> IDE:eclipse kepler
> OS: windows 7
> Test: Junit4
> Reporter: qibiao deng
> Assignee: Mark Proctor
> Labels: DRL, Drools, SDO
>
> when there is one rule in KBase, dynamically add second rule and fire it. drools report this error:
> {code:title=Exception stack |borderStyle=solid}
> java.lang.NullPointerException
> at org.drools.core.phreak.RuleNetworkEvaluator.innerEval(RuleNetworkEvaluator.java:271)
> at org.drools.core.phreak.RuleNetworkEvaluator.outerEval(RuleNetworkEvaluator.java:161)
> at org.drools.core.phreak.RuleNetworkEvaluator.evaluateNetwork(RuleNetworkEvaluator.java:116)
> at org.drools.core.phreak.RuleExecutor.reEvaluateNetwork(RuleExecutor.java:216)
> at org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:91)
> at org.drools.core.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:964)
> at org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1234)
> at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1239)
> at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1222)
> at mock.com.camel.drools.expert.sample.service.DynamicAddRuleBugTest.testReproduceBugWithSDO(DynamicAddRuleBugTest.java:134)
> {code}
> That two drl rules are almost same expect package name:
> {code:title=drl 1|borderStyle=solid}
> package com.camel.drools.expert.sample.testbug1
> import mock.com.camel.drools.expert.sample.service.domain.Order;
> import mock.com.camel.drools.expert.sample.service.domain.RuleConditionSdo;
> rule "order flow"
> when
> $rcs:RuleConditionSdo($rc:ruleCondition)
> $order:Order(price>$rc.getDouble("minPrice"), source==$rc.getString("source"), dest==$rc.getString("dest"))
> then
> System.out.println("finished rule for bug test 1" + $rc.getString("source"));
> end
> {code}
> {code:title=drl 2|borderStyle=solid}
> package com.camel.drools.expert.sample.testbug2
> import mock.com.camel.drools.expert.sample.service.domain.Order;
> import mock.com.camel.drools.expert.sample.service.domain.RuleConditionSdo;
> rule "order flow"
> when
> $rcs:RuleConditionSdo($rc:ruleCondition)
> $order:Order(price>$rc.getDouble("minPrice"), source==$rc.getString("source"), dest==$rc.getString("dest"))
> then
> System.out.println("finished rule for bug test 2" + $rc.getString("source"));
> end
> {code}
> 1. The RuleConditionSdo object was dynamically created at runtime, it using a SDO technic. This works failed
> 2. If changed RuleCondtionSdo with a pre-write pojo, It works fine.
> 3. If use Cglib util net.sf.cglib.beans.BeanGenerator creat RuleConditionSdo object dynamically. It works still fine.
> so, It's like a bug with SDO object.
> Test code below:
> {code:title=DynamicAddRuleBugTest.java |borderStyle=solid}
> package mock.com.camel.drools.expert.sample.service;
> import java.io.IOException;
> import java.io.InputStreamReader;
> import java.io.Reader;
> import java.util.HashMap;
> import java.util.Map;
> import mock.com.camel.drools.expert.sample.service.domain.Order;
> import mock.com.camel.drools.expert.sample.service.domain.RuleCondition;
> import mock.com.camel.drools.expert.sample.service.domain.RuleConditionSdo;
> import org.drools.compiler.builder.impl.KnowledgeBuilderImpl;
> import org.drools.compiler.compiler.DroolsParserException;
> import org.drools.core.impl.InternalKnowledgeBase;
> import org.junit.After;
> import org.junit.Before;
> import org.junit.Test;
> import org.kie.api.runtime.KieSession;
> import org.kie.api.runtime.rule.AgendaFilter;
> import org.kie.api.runtime.rule.Match;
> import org.kie.internal.KnowledgeBaseFactory;
> import com.camel.drools.expert.sample.utils.CglibDynamicBeanGenerator;
> import com.camel.drools.expert.sample.utils.RegisterSDOXsd;
> /**
> * reproduce dynamic add rule bug
> * @author dengqb
> * @date 2014年9月19日
> */
> public class DynamicAddRuleBugTest {
> /**
> * @throws java.lang.Exception
> */
> @Before
> public void setUp() throws Exception {
> }
> /**
> * @throws java.lang.Exception
> */
> @After
> public void tearDown() throws Exception {
> }
> /**
> * using pre-write RuleCondition Object
> * result: fine
> */
> @Test
> public void testReproduceBug() {
> InternalKnowledgeBase kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase();
> String drlFile = "/drools/drl/bug_test1.drl";
> loadPackageFromDrl(kBase, drlFile);
>
> Order order = new Order(50,"ebay","china");
> RuleCondition ruleCondition = new RuleCondition(30,"ebay","china");
>
> KieSession kieSession = kBase.newStatefulKnowledgeSession();
> kieSession.insert(ruleCondition);
> kieSession.insert(order);
> kieSession.fireAllRules(new AgendaFilter(){
> @Override
> public boolean accept(Match match) {
> return match.getRule().getPackageName().endsWith("testbug1");
> }
> });
> //statfull session使用后必需调用dispose
> kieSession.dispose();
>
> System.out.println("========add new rule=================");
> String drlFile2 = "/drools/drl/bug_test2.drl";
> loadPackageFromDrl(kBase, drlFile2);
>
> kieSession = kBase.newStatefulKnowledgeSession();
> Order order2 = new Order(32.0,"ebay","brazil");
> RuleCondition ruleCondition2 = new RuleCondition(30,"ebay","brazil");
> kieSession.insert(ruleCondition2);
> kieSession.insert(order2);
> kieSession.fireAllRules(new AgendaFilter(){
> @Override
> public boolean accept(Match match) {
> return match.getRule().getPackageName().endsWith("testbug2");
> }
> });
> kieSession.dispose();
> }
> /**
> * using a RuleConditonSdo object, it is dynamically created by SDO technic
> * result: false
> */
> @Test
> public void testReproduceBugWithSDO() {
> InternalKnowledgeBase kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase();
> String drlFile = "/drools/drl/bug_sdo_test1.drl";
> loadPackageFromDrl(kBase, drlFile);
>
> Order order = new Order(50,"ebay","china");
>
> //注册sdo对象
> RegisterSDOXsd register = new RegisterSDOXsd();
> register.setXsdFilePath("/drools/xsd/xsdList.txt");
> register.register();
>
> RuleConditionSdo rcsdo = new RuleConditionSdo();
> rcsdo.getRuleCondition().setDouble("minPrice",30);
> rcsdo.getRuleCondition().setString("source","ebay");
> rcsdo.getRuleCondition().setString("dest","china");
>
> KieSession kieSession = kBase.newStatefulKnowledgeSession();
> kieSession.insert(rcsdo);
> kieSession.insert(order);
> kieSession.fireAllRules(new AgendaFilter(){
> @Override
> public boolean accept(Match match) {
> return match.getRule().getPackageName().endsWith("testbug1");
> }
> });
> //statfull session使用后必需调用dispose
> kieSession.dispose();
>
> System.out.println("========add new rule=================");
> String drlFile2 = "/drools/drl/bug_sdo_test2.drl";
> loadPackageFromDrl(kBase, drlFile2);
>
> kieSession = kBase.newStatefulKnowledgeSession();
> Order order2 = new Order(32.0,"ebay","brazil");
> //RuleCondition ruleCondition2 = new RuleCondition(30,"ebay","brazil");
> RuleConditionSdo rcsdo2 = new RuleConditionSdo();
> rcsdo.getRuleCondition().setDouble("minPrice",30);
> rcsdo.getRuleCondition().setString("source","ebay");
> rcsdo.getRuleCondition().setString("dest","breazil");
> kieSession.insert(rcsdo2);
> kieSession.insert(order2);
> kieSession.fireAllRules(new AgendaFilter(){
> @Override
> public boolean accept(Match match) {
> return match.getRule().getPackageName().endsWith("testbug2");
> }
> });
> kieSession.dispose();
> }
>
> /**
> * using a dynamicl RuleCondition object, it created by cglib BeanGenerator
> * result: fine
> * @throws ClassNotFoundException
> */
> @Test
> public void testReproduceBugWithDynamicBean() throws ClassNotFoundException{
> InternalKnowledgeBase kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase();
> String drlFile = "/drools/drl/bug_dyb_test1.drl";
> loadPackageFromDrl(kBase, drlFile);
>
> Order order = new Order(50,"ebay","china");
>
> Map<String,Class<?>> properties = new HashMap<String,Class<?>>();
> properties.put("minPrice", Class.forName("java.lang.Double"));
> properties.put("source", Class.forName("java.lang.String"));
> properties.put("dest", Class.forName("java.lang.String"));
> // 生成动态 Bean
> CglibDynamicBeanGenerator ruleCondition = new CglibDynamicBeanGenerator(properties);
> ruleCondition.setValue("minPrice", 40d);
> ruleCondition.setValue("source", "ebay");
> ruleCondition.setValue("dest", "china");
>
> KieSession kieSession = kBase.newStatefulKnowledgeSession();
> kieSession.insert(ruleCondition);
> kieSession.insert(order);
> kieSession.fireAllRules(new AgendaFilter(){
> @Override
> public boolean accept(Match match) {
> return match.getRule().getPackageName().endsWith("testbug1");
> }
> });
> //statfull session使用后必需调用dispose
> kieSession.dispose();
>
> System.out.println("========add new rule=================");
> String drlFile2 = "/drools/drl/bug_dyb_test2.drl";
> loadPackageFromDrl(kBase, drlFile2);
>
> kieSession = kBase.newStatefulKnowledgeSession();
> Order order2 = new Order(32.0,"ebay","brazil");
>
> ruleCondition = new CglibDynamicBeanGenerator(properties);
> ruleCondition.setValue("minPrice", 30d);
> ruleCondition.setValue("source", "ebay");
> ruleCondition.setValue("dest", "brazil");
>
> kieSession.insert(ruleCondition);
> kieSession.insert(order2);
> kieSession.fireAllRules(new AgendaFilter(){
> @Override
> public boolean accept(Match match) {
> return match.getRule().getPackageName().endsWith("testbug2");
> }
> });
> kieSession.dispose();
> }
> private void loadPackageFromDrl(InternalKnowledgeBase kBase, String drlFile) {
> final Reader drlReader = new InputStreamReader(this.getClass().getResourceAsStream(drlFile));
>
> final KnowledgeBuilderImpl builder = new KnowledgeBuilderImpl();
> try {
> builder.addPackageFromDrl(drlReader);
> if (builder.hasErrors()){
> System.out.println(builder.getErrors());
> }
> kBase.addPackage(builder.getPackage());
> } catch (DroolsParserException e) {
> e.printStackTrace();
> } catch (IOException e) {
> e.printStackTrace();
> }
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)
9 years, 9 months
[JBoss JIRA] (DROOLS-613) JBRULES-3723 NullPointerException in RuleNetworkEvaluator.innerEval(RuleNetworkEvaluator.java:271)
by qibiao deng (JIRA)
qibiao deng created DROOLS-613:
----------------------------------
Summary: JBRULES-3723 NullPointerException in RuleNetworkEvaluator.innerEval(RuleNetworkEvaluator.java:271)
Key: DROOLS-613
URL: https://issues.jboss.org/browse/DROOLS-613
Project: Drools
Issue Type: Bug
Affects Versions: 6.1.0.Final, 6.0.1.Final
Environment: drools-core: 6.1.0.Final
drools-compiler: 6.1.0.Final
JDK: 1.7.0_45
IDE:eclipse kepler
OS: windows 7
Test: Junit4
Reporter: qibiao deng
Assignee: Mark Proctor
when there is one rule in KBase, dynamically add second rule and fire it. drools report this error:
{code:title=Exception stack |borderStyle=solid}
java.lang.NullPointerException
at org.drools.core.phreak.RuleNetworkEvaluator.innerEval(RuleNetworkEvaluator.java:271)
at org.drools.core.phreak.RuleNetworkEvaluator.outerEval(RuleNetworkEvaluator.java:161)
at org.drools.core.phreak.RuleNetworkEvaluator.evaluateNetwork(RuleNetworkEvaluator.java:116)
at org.drools.core.phreak.RuleExecutor.reEvaluateNetwork(RuleExecutor.java:216)
at org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:91)
at org.drools.core.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:964)
at org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1234)
at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1239)
at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1222)
at mock.com.camel.drools.expert.sample.service.DynamicAddRuleBugTest.testReproduceBugWithSDO(DynamicAddRuleBugTest.java:134)
{code}
That tow drl rules are almost same expect package name:
{code:title=drl 1|borderStyle=solid}
package com.camel.drools.expert.sample.testbug1
import mock.com.camel.drools.expert.sample.service.domain.Order;
import mock.com.camel.drools.expert.sample.service.domain.RuleConditionSdo;
rule "order flow"
when
$rcs:RuleConditionSdo($rc:ruleCondition)
$order:Order(price>$rc.getDouble("minPrice"), source==$rc.getString("source"), dest==$rc.getString("dest"))
then
System.out.println("finished rule for bug test 1" + $rc.getString("source"));
end
{code}
{code:title=drl 2|borderStyle=solid}
package com.camel.drools.expert.sample.testbug2
import mock.com.camel.drools.expert.sample.service.domain.Order;
import mock.com.camel.drools.expert.sample.service.domain.RuleConditionSdo;
rule "order flow"
when
$rcs:RuleConditionSdo($rc:ruleCondition)
$order:Order(price>$rc.getDouble("minPrice"), source==$rc.getString("source"), dest==$rc.getString("dest"))
then
System.out.println("finished rule for bug test 2" + $rc.getString("source"));
end
{code}
1. The RuleConditionSdo object was dynamically created at runtime, it using a SDO technic.
2. If changed RuleCondtionSdo with a pre-write pojo, It works fine.
3. If use Cglib util net.sf.cglib.beans.BeanGenerator creat RuleConditionSdo object dynamically. It works still fine.
so, It's like a bug.
Test code below:
{code:title=DynamicAddRuleBugTest.java |borderStyle=solid}
package mock.com.camel.drools.expert.sample.service;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.HashMap;
import java.util.Map;
import mock.com.camel.drools.expert.sample.service.domain.Order;
import mock.com.camel.drools.expert.sample.service.domain.RuleCondition;
import mock.com.camel.drools.expert.sample.service.domain.RuleConditionSdo;
import org.drools.compiler.builder.impl.KnowledgeBuilderImpl;
import org.drools.compiler.compiler.DroolsParserException;
import org.drools.core.impl.InternalKnowledgeBase;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.kie.api.runtime.KieSession;
import org.kie.api.runtime.rule.AgendaFilter;
import org.kie.api.runtime.rule.Match;
import org.kie.internal.KnowledgeBaseFactory;
import com.camel.drools.expert.sample.utils.CglibDynamicBeanGenerator;
import com.camel.drools.expert.sample.utils.RegisterSDOXsd;
/**
* reproduce dynamic add rule bug
* @author dengqb
* @date 2014年9月19日
*/
public class DynamicAddRuleBugTest {
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
}
/**
* @throws java.lang.Exception
*/
@After
public void tearDown() throws Exception {
}
/**
* using pre-write RuleCondition Object
* result: fine
*/
@Test
public void testReproduceBug() {
InternalKnowledgeBase kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase();
String drlFile = "/drools/drl/bug_test1.drl";
loadPackageFromDrl(kBase, drlFile);
Order order = new Order(50,"ebay","china");
RuleCondition ruleCondition = new RuleCondition(30,"ebay","china");
KieSession kieSession = kBase.newStatefulKnowledgeSession();
kieSession.insert(ruleCondition);
kieSession.insert(order);
kieSession.fireAllRules(new AgendaFilter(){
@Override
public boolean accept(Match match) {
return match.getRule().getPackageName().endsWith("testbug1");
}
});
//statfull session使用后必需调用dispose
kieSession.dispose();
System.out.println("========add new rule=================");
String drlFile2 = "/drools/drl/bug_test2.drl";
loadPackageFromDrl(kBase, drlFile2);
kieSession = kBase.newStatefulKnowledgeSession();
Order order2 = new Order(32.0,"ebay","brazil");
RuleCondition ruleCondition2 = new RuleCondition(30,"ebay","brazil");
kieSession.insert(ruleCondition2);
kieSession.insert(order2);
kieSession.fireAllRules(new AgendaFilter(){
@Override
public boolean accept(Match match) {
return match.getRule().getPackageName().endsWith("testbug2");
}
});
kieSession.dispose();
}
/**
* using a RuleConditonSdo object, it is dynamically created by SDO technic
* result: false
*/
@Test
public void testReproduceBugWithSDO() {
InternalKnowledgeBase kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase();
String drlFile = "/drools/drl/bug_sdo_test1.drl";
loadPackageFromDrl(kBase, drlFile);
Order order = new Order(50,"ebay","china");
//注册sdo对象
RegisterSDOXsd register = new RegisterSDOXsd();
register.setXsdFilePath("/drools/xsd/xsdList.txt");
register.register();
RuleConditionSdo rcsdo = new RuleConditionSdo();
rcsdo.getRuleCondition().setDouble("minPrice",30);
rcsdo.getRuleCondition().setString("source","ebay");
rcsdo.getRuleCondition().setString("dest","china");
KieSession kieSession = kBase.newStatefulKnowledgeSession();
kieSession.insert(rcsdo);
kieSession.insert(order);
kieSession.fireAllRules(new AgendaFilter(){
@Override
public boolean accept(Match match) {
return match.getRule().getPackageName().endsWith("testbug1");
}
});
//statfull session使用后必需调用dispose
kieSession.dispose();
System.out.println("========add new rule=================");
String drlFile2 = "/drools/drl/bug_sdo_test2.drl";
loadPackageFromDrl(kBase, drlFile2);
kieSession = kBase.newStatefulKnowledgeSession();
Order order2 = new Order(32.0,"ebay","brazil");
//RuleCondition ruleCondition2 = new RuleCondition(30,"ebay","brazil");
RuleConditionSdo rcsdo2 = new RuleConditionSdo();
rcsdo.getRuleCondition().setDouble("minPrice",30);
rcsdo.getRuleCondition().setString("source","ebay");
rcsdo.getRuleCondition().setString("dest","breazil");
kieSession.insert(rcsdo2);
kieSession.insert(order2);
kieSession.fireAllRules(new AgendaFilter(){
@Override
public boolean accept(Match match) {
return match.getRule().getPackageName().endsWith("testbug2");
}
});
kieSession.dispose();
}
/**
* using a dynamicl RuleCondition object, it created by cglib BeanGenerator
* result: fine
* @throws ClassNotFoundException
*/
@Test
public void testReproduceBugWithDynamicBean() throws ClassNotFoundException{
InternalKnowledgeBase kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase();
String drlFile = "/drools/drl/bug_dyb_test1.drl";
loadPackageFromDrl(kBase, drlFile);
Order order = new Order(50,"ebay","china");
Map<String,Class<?>> properties = new HashMap<String,Class<?>>();
properties.put("minPrice", Class.forName("java.lang.Double"));
properties.put("source", Class.forName("java.lang.String"));
properties.put("dest", Class.forName("java.lang.String"));
// 生成动态 Bean
CglibDynamicBeanGenerator ruleCondition = new CglibDynamicBeanGenerator(properties);
ruleCondition.setValue("minPrice", 40d);
ruleCondition.setValue("source", "ebay");
ruleCondition.setValue("dest", "china");
KieSession kieSession = kBase.newStatefulKnowledgeSession();
kieSession.insert(ruleCondition);
kieSession.insert(order);
kieSession.fireAllRules(new AgendaFilter(){
@Override
public boolean accept(Match match) {
return match.getRule().getPackageName().endsWith("testbug1");
}
});
//statfull session使用后必需调用dispose
kieSession.dispose();
System.out.println("========add new rule=================");
String drlFile2 = "/drools/drl/bug_dyb_test2.drl";
loadPackageFromDrl(kBase, drlFile2);
kieSession = kBase.newStatefulKnowledgeSession();
Order order2 = new Order(32.0,"ebay","brazil");
ruleCondition = new CglibDynamicBeanGenerator(properties);
ruleCondition.setValue("minPrice", 30d);
ruleCondition.setValue("source", "ebay");
ruleCondition.setValue("dest", "brazil");
kieSession.insert(ruleCondition);
kieSession.insert(order2);
kieSession.fireAllRules(new AgendaFilter(){
@Override
public boolean accept(Match match) {
return match.getRule().getPackageName().endsWith("testbug2");
}
});
kieSession.dispose();
}
private void loadPackageFromDrl(InternalKnowledgeBase kBase, String drlFile) {
final Reader drlReader = new InputStreamReader(this.getClass().getResourceAsStream(drlFile));
final KnowledgeBuilderImpl builder = new KnowledgeBuilderImpl();
try {
builder.addPackageFromDrl(drlReader);
if (builder.hasErrors()){
System.out.println(builder.getErrors());
}
kBase.addPackage(builder.getPackage());
} catch (DroolsParserException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
{code}
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)
9 years, 9 months
[JBoss JIRA] (HIBERNATE-146) Remove after get with optimistic lock fails
by Arcadiy Ivanov (JIRA)
[ https://issues.jboss.org/browse/HIBERNATE-146?page=com.atlassian.jira.plu... ]
Arcadiy Ivanov edited comment on HIBERNATE-146 at 9/26/14 12:37 AM:
--------------------------------------------------------------------
Credits for investigating the issue go to Joe Rombs (joe.rombs(a)servicemesh.com) and for creating a test case to Keith Yarbrough (keith.yarbrough(a)servicemesh.com).
was (Author: arcivanov):
Credits for investigating the issue go to Joe Rombs (joe.rombs(a)servicemesh.com) and for creating a test case to Keith Yarborough (keith.yarborough(a)servicemesh.com).
> Remove after get with optimistic lock fails
> -------------------------------------------
>
> Key: HIBERNATE-146
> URL: https://issues.jboss.org/browse/HIBERNATE-146
> Project: Hibernate Integration
> Issue Type: Bug
> Reporter: Arcadiy Ivanov
> Assignee: Steve Ebersole
> Attachments: hibernate-146.tar.gz, hibernate-146.tar.gz
>
>
> Whenever an entity is retrieved with an optimistic lock and then later is removed within the same transaction, an OptimisticLockException is thrown incorrectly.
> This is caused by the lock being incorrectly tracked altogether in case of an explicit optimistic lock. The unlocked/default lock behavior tracks entity versions correctly deleting entity even with optimistic check.
> EclipseLink, being a reference implementation, behaves correctly in this case.
> =====
> Running the attached test case the following behaviors can be observed:
> Insert + Commit, Get unlocked + Delete + Commit = OK
> {noformat}
> Hibernate:
> /* insert com.csc.hibernate146.Person
> */ insert
> into
> Person
> (name, version)
> values
> (?, ?)
> Hibernate:
> /* named HQL query Person.getPerson */ select
> person0_.id as id1_0_,
> person0_.name as name2_0_,
> person0_.version as version3_0_
> from
> Person person0_
> where
> person0_.name=?
> Deleting without lock: Person [id=1, name=John Doe, version=0]
> Hibernate:
> /* delete com.csc.hibernate146.Person */ delete
> from
> Person
> where
> id=?
> and version=?
> {noformat}
> Insert + Commit, Get + LockModeType.OPTIMISTIC + Delete + Commit = OptimisticLockException
> {noformat}
> Hibernate:
> /* insert com.csc.hibernate146.Person
> */ insert
> into
> Person
> (name, version)
> values
> (?, ?)
> Hibernate:
> /* named HQL query Person.getPerson */ select
> person0_.id as id1_0_,
> person0_.name as name2_0_,
> person0_.version as version3_0_
> from
> Person person0_
> where
> person0_.name=?
> Deleting under optimistic lock: Person [id=2, name=Jane Doe, version=0]
> Hibernate:
> /* delete com.csc.hibernate146.Person */ delete
> from
> Person
> where
> id=?
> and version=?
> Hibernate:
> /* get version com.csc.hibernate146.Person */ select
> version
> from
> Person
> where
> id =?
> WARN [com.arjuna.ats.arjuna] ARJUNA012125: TwoPhaseCoordinator.beforeCompletion - failed for SynchronizationImple< 0:ffffc0a87b34:-72291bdb:5424d3a3:22, org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization@7c440164 >: org.hibernate.OptimisticLockException: Newer version [null] of entity [[com.csc.hibernate146.Person#2]] found in database
> at org.hibernate.action.internal.EntityVerifyVersionProcess.doBeforeTransactionCompletion(EntityVerifyVersionProcess.java:60) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
> at org.hibernate.engine.spi.ActionQueue$BeforeTransactionCompletionProcessQueue.beforeTransactionCompletion(ActionQueue.java:715) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
> at org.hibernate.engine.spi.ActionQueue.beforeTransactionCompletion(ActionQueue.java:389) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
> at org.hibernate.internal.SessionImpl.beforeTransactionCompletion(SessionImpl.java:516) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
> at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorNonTrackingImpl.beforeCompletion(SynchronizationCallbackCoordinatorNonTrackingImpl.java:119) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
> at org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization.beforeCompletion(RegisteredSynchronization.java:50) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
> at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:76)
> at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:358)
> at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:91)
> at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:162)
> at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1166)
> at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:126)
> at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)
> at org.jboss.as.ejb3.tx.CMTTxInterceptor.endTransaction(CMTTxInterceptor.java:93) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:277) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:340) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:239) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ejb3.component.invocationmetrics.WaitTimeInterceptor.processInvocation(WaitTimeInterceptor.java:43) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:95) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:55) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64) [jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:326) [:1.2.1.Final]
> at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:448) [wildfly-security-manager-1.0.0.Final.jar:1.0.0.Final]
> at org.jboss.invocation.AccessCheckingInterceptor.processInvocation(AccessCheckingInterceptor.java:61) [jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:326) [:1.2.1.Final]
> at org.jboss.invocation.PrivilegedWithCombinerInterceptor.processInvocation(PrivilegedWithCombinerInterceptor.java:80) [jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:185)
> at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:182)
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:73)
> at com.csc.hibernate146.PersonManagementBean$$$view1.getByNameAndDeletePersonLocked(Unknown Source) [ee86ef2e-58da-4691-b087-2c3678ec3ddf.jar:]
> at com.csc.hibernate146.test.Hibernate146Test.createAndDeletePersonLocked(Hibernate146Test.java:59) [ee86ef2e-58da-4691-b087-2c3678ec3ddf.jar:]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
> at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
> at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) [arquillian-junit.jar:]
> at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [arquillian-junit.jar:]
> at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian$6$1.invoke(Arquillian.java:301) [arquillian-junit.jar:]
> at org.jboss.arquillian.container.test.impl.execution.LocalTestExecuter.execute(LocalTestExecuter.java:60) [arquillian-core.jar:]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
> at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67) [arquillian-core.jar:]
> at org.jboss.arquillian.container.test.impl.execution.ContainerTestExecuter.execute(ContainerTestExecuter.java:38) [arquillian-core.jar:]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
> at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81) [arquillian-core.jar:]
> at org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:102) [arquillian-core.jar:]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
> at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-core.jar:]
> at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:84) [arquillian-core.jar:]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
> at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-core.jar:]
> at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:65) [arquillian-core.jar:]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
> at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145) [arquillian-core.jar:]
> at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.test(EventTestRunnerAdaptor.java:111) [arquillian-core.jar:]
> at org.jboss.arquillian.junit.Arquillian$6.evaluate(Arquillian.java:294) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian$5.evaluate(Arquillian.java:267) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) [arquillian-junit.jar:]
> at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) [arquillian-junit.jar:]
> at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:193) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:345) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.java:49) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:207) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner.run(ParentRunner.java:309) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:155) [arquillian-junit.jar:]
> at org.junit.runner.JUnitCore.run(JUnitCore.java:160) [arquillian-junit.jar:]
> at org.junit.runner.JUnitCore.run(JUnitCore.java:138) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.container.JUnitTestRunner.execute(JUnitTestRunner.java:66) [arquillian-junit.jar:]
> at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.executeTest(ServletTestRunner.java:160) [arquillian-protocol.jar:]
> at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.execute(ServletTestRunner.java:126) [arquillian-protocol.jar:]
> at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.doGet(ServletTestRunner.java:90) [arquillian-protocol.jar:]
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
> at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
> at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
> at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.server.Connectors.executeRootHandler(Connectors.java:177) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:727) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_67]
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_67]
> at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_67]
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)
9 years, 9 months
[JBoss JIRA] (HIBERNATE-146) Remove after get with optimistic lock fails
by Arcadiy Ivanov (JIRA)
[ https://issues.jboss.org/browse/HIBERNATE-146?page=com.atlassian.jira.plu... ]
Arcadiy Ivanov edited comment on HIBERNATE-146 at 9/26/14 12:36 AM:
--------------------------------------------------------------------
Updated test version without PostgreSQL dialect
was (Author: arcivanov):
Updated version without PostgreSQL dialect
> Remove after get with optimistic lock fails
> -------------------------------------------
>
> Key: HIBERNATE-146
> URL: https://issues.jboss.org/browse/HIBERNATE-146
> Project: Hibernate Integration
> Issue Type: Bug
> Reporter: Arcadiy Ivanov
> Assignee: Steve Ebersole
> Attachments: hibernate-146.tar.gz, hibernate-146.tar.gz
>
>
> Whenever an entity is retrieved with an optimistic lock and then later is removed within the same transaction, an OptimisticLockException is thrown incorrectly.
> This is caused by the lock being incorrectly tracked altogether in case of an explicit optimistic lock. The unlocked/default lock behavior tracks entity versions correctly deleting entity even with optimistic check.
> EclipseLink, being a reference implementation, behaves correctly in this case.
> =====
> Running the attached test case the following behaviors can be observed:
> Insert + Commit, Get unlocked + Delete + Commit = OK
> {noformat}
> Hibernate:
> /* insert com.csc.hibernate146.Person
> */ insert
> into
> Person
> (name, version)
> values
> (?, ?)
> Hibernate:
> /* named HQL query Person.getPerson */ select
> person0_.id as id1_0_,
> person0_.name as name2_0_,
> person0_.version as version3_0_
> from
> Person person0_
> where
> person0_.name=?
> Deleting without lock: Person [id=1, name=John Doe, version=0]
> Hibernate:
> /* delete com.csc.hibernate146.Person */ delete
> from
> Person
> where
> id=?
> and version=?
> {noformat}
> Insert + Commit, Get + LockModeType.OPTIMISTIC + Delete + Commit = OptimisticLockException
> {noformat}
> Hibernate:
> /* insert com.csc.hibernate146.Person
> */ insert
> into
> Person
> (name, version)
> values
> (?, ?)
> Hibernate:
> /* named HQL query Person.getPerson */ select
> person0_.id as id1_0_,
> person0_.name as name2_0_,
> person0_.version as version3_0_
> from
> Person person0_
> where
> person0_.name=?
> Deleting under optimistic lock: Person [id=2, name=Jane Doe, version=0]
> Hibernate:
> /* delete com.csc.hibernate146.Person */ delete
> from
> Person
> where
> id=?
> and version=?
> Hibernate:
> /* get version com.csc.hibernate146.Person */ select
> version
> from
> Person
> where
> id =?
> WARN [com.arjuna.ats.arjuna] ARJUNA012125: TwoPhaseCoordinator.beforeCompletion - failed for SynchronizationImple< 0:ffffc0a87b34:-72291bdb:5424d3a3:22, org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization@7c440164 >: org.hibernate.OptimisticLockException: Newer version [null] of entity [[com.csc.hibernate146.Person#2]] found in database
> at org.hibernate.action.internal.EntityVerifyVersionProcess.doBeforeTransactionCompletion(EntityVerifyVersionProcess.java:60) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
> at org.hibernate.engine.spi.ActionQueue$BeforeTransactionCompletionProcessQueue.beforeTransactionCompletion(ActionQueue.java:715) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
> at org.hibernate.engine.spi.ActionQueue.beforeTransactionCompletion(ActionQueue.java:389) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
> at org.hibernate.internal.SessionImpl.beforeTransactionCompletion(SessionImpl.java:516) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
> at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorNonTrackingImpl.beforeCompletion(SynchronizationCallbackCoordinatorNonTrackingImpl.java:119) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
> at org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization.beforeCompletion(RegisteredSynchronization.java:50) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
> at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:76)
> at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:358)
> at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:91)
> at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:162)
> at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1166)
> at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:126)
> at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)
> at org.jboss.as.ejb3.tx.CMTTxInterceptor.endTransaction(CMTTxInterceptor.java:93) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:277) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:340) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:239) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ejb3.component.invocationmetrics.WaitTimeInterceptor.processInvocation(WaitTimeInterceptor.java:43) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:95) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:55) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64) [jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:326) [:1.2.1.Final]
> at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:448) [wildfly-security-manager-1.0.0.Final.jar:1.0.0.Final]
> at org.jboss.invocation.AccessCheckingInterceptor.processInvocation(AccessCheckingInterceptor.java:61) [jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:326) [:1.2.1.Final]
> at org.jboss.invocation.PrivilegedWithCombinerInterceptor.processInvocation(PrivilegedWithCombinerInterceptor.java:80) [jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:185)
> at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:182)
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:73)
> at com.csc.hibernate146.PersonManagementBean$$$view1.getByNameAndDeletePersonLocked(Unknown Source) [ee86ef2e-58da-4691-b087-2c3678ec3ddf.jar:]
> at com.csc.hibernate146.test.Hibernate146Test.createAndDeletePersonLocked(Hibernate146Test.java:59) [ee86ef2e-58da-4691-b087-2c3678ec3ddf.jar:]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
> at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
> at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) [arquillian-junit.jar:]
> at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [arquillian-junit.jar:]
> at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian$6$1.invoke(Arquillian.java:301) [arquillian-junit.jar:]
> at org.jboss.arquillian.container.test.impl.execution.LocalTestExecuter.execute(LocalTestExecuter.java:60) [arquillian-core.jar:]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
> at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67) [arquillian-core.jar:]
> at org.jboss.arquillian.container.test.impl.execution.ContainerTestExecuter.execute(ContainerTestExecuter.java:38) [arquillian-core.jar:]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
> at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81) [arquillian-core.jar:]
> at org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:102) [arquillian-core.jar:]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
> at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-core.jar:]
> at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:84) [arquillian-core.jar:]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
> at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-core.jar:]
> at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:65) [arquillian-core.jar:]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
> at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145) [arquillian-core.jar:]
> at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.test(EventTestRunnerAdaptor.java:111) [arquillian-core.jar:]
> at org.jboss.arquillian.junit.Arquillian$6.evaluate(Arquillian.java:294) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian$5.evaluate(Arquillian.java:267) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) [arquillian-junit.jar:]
> at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) [arquillian-junit.jar:]
> at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:193) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:345) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.java:49) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:207) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner.run(ParentRunner.java:309) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:155) [arquillian-junit.jar:]
> at org.junit.runner.JUnitCore.run(JUnitCore.java:160) [arquillian-junit.jar:]
> at org.junit.runner.JUnitCore.run(JUnitCore.java:138) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.container.JUnitTestRunner.execute(JUnitTestRunner.java:66) [arquillian-junit.jar:]
> at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.executeTest(ServletTestRunner.java:160) [arquillian-protocol.jar:]
> at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.execute(ServletTestRunner.java:126) [arquillian-protocol.jar:]
> at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.doGet(ServletTestRunner.java:90) [arquillian-protocol.jar:]
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
> at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
> at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
> at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.server.Connectors.executeRootHandler(Connectors.java:177) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:727) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_67]
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_67]
> at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_67]
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)
9 years, 9 months
[JBoss JIRA] (HIBERNATE-146) Remove after get with optimistic lock fails
by Arcadiy Ivanov (JIRA)
[ https://issues.jboss.org/browse/HIBERNATE-146?page=com.atlassian.jira.plu... ]
Arcadiy Ivanov updated HIBERNATE-146:
-------------------------------------
Attachment: hibernate-146.tar.gz
Updated version without PostgreSQL dialect
> Remove after get with optimistic lock fails
> -------------------------------------------
>
> Key: HIBERNATE-146
> URL: https://issues.jboss.org/browse/HIBERNATE-146
> Project: Hibernate Integration
> Issue Type: Bug
> Reporter: Arcadiy Ivanov
> Assignee: Steve Ebersole
> Attachments: hibernate-146.tar.gz, hibernate-146.tar.gz
>
>
> Whenever an entity is retrieved with an optimistic lock and then later is removed within the same transaction, an OptimisticLockException is thrown incorrectly.
> This is caused by the lock being incorrectly tracked altogether in case of an explicit optimistic lock. The unlocked/default lock behavior tracks entity versions correctly deleting entity even with optimistic check.
> EclipseLink, being a reference implementation, behaves correctly in this case.
> =====
> Running the attached test case the following behaviors can be observed:
> Insert + Commit, Get unlocked + Delete + Commit = OK
> {noformat}
> Hibernate:
> /* insert com.csc.hibernate146.Person
> */ insert
> into
> Person
> (name, version)
> values
> (?, ?)
> Hibernate:
> /* named HQL query Person.getPerson */ select
> person0_.id as id1_0_,
> person0_.name as name2_0_,
> person0_.version as version3_0_
> from
> Person person0_
> where
> person0_.name=?
> Deleting without lock: Person [id=1, name=John Doe, version=0]
> Hibernate:
> /* delete com.csc.hibernate146.Person */ delete
> from
> Person
> where
> id=?
> and version=?
> {noformat}
> Insert + Commit, Get + LockModeType.OPTIMISTIC + Delete + Commit = OptimisticLockException
> {noformat}
> Hibernate:
> /* insert com.csc.hibernate146.Person
> */ insert
> into
> Person
> (name, version)
> values
> (?, ?)
> Hibernate:
> /* named HQL query Person.getPerson */ select
> person0_.id as id1_0_,
> person0_.name as name2_0_,
> person0_.version as version3_0_
> from
> Person person0_
> where
> person0_.name=?
> Deleting under optimistic lock: Person [id=2, name=Jane Doe, version=0]
> Hibernate:
> /* delete com.csc.hibernate146.Person */ delete
> from
> Person
> where
> id=?
> and version=?
> Hibernate:
> /* get version com.csc.hibernate146.Person */ select
> version
> from
> Person
> where
> id =?
> WARN [com.arjuna.ats.arjuna] ARJUNA012125: TwoPhaseCoordinator.beforeCompletion - failed for SynchronizationImple< 0:ffffc0a87b34:-72291bdb:5424d3a3:22, org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization@7c440164 >: org.hibernate.OptimisticLockException: Newer version [null] of entity [[com.csc.hibernate146.Person#2]] found in database
> at org.hibernate.action.internal.EntityVerifyVersionProcess.doBeforeTransactionCompletion(EntityVerifyVersionProcess.java:60) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
> at org.hibernate.engine.spi.ActionQueue$BeforeTransactionCompletionProcessQueue.beforeTransactionCompletion(ActionQueue.java:715) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
> at org.hibernate.engine.spi.ActionQueue.beforeTransactionCompletion(ActionQueue.java:389) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
> at org.hibernate.internal.SessionImpl.beforeTransactionCompletion(SessionImpl.java:516) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
> at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorNonTrackingImpl.beforeCompletion(SynchronizationCallbackCoordinatorNonTrackingImpl.java:119) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
> at org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization.beforeCompletion(RegisteredSynchronization.java:50) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
> at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:76)
> at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:358)
> at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:91)
> at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:162)
> at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1166)
> at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:126)
> at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)
> at org.jboss.as.ejb3.tx.CMTTxInterceptor.endTransaction(CMTTxInterceptor.java:93) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:277) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:340) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:239) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ejb3.component.invocationmetrics.WaitTimeInterceptor.processInvocation(WaitTimeInterceptor.java:43) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:95) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:55) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64) [jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:326) [:1.2.1.Final]
> at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:448) [wildfly-security-manager-1.0.0.Final.jar:1.0.0.Final]
> at org.jboss.invocation.AccessCheckingInterceptor.processInvocation(AccessCheckingInterceptor.java:61) [jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:326) [:1.2.1.Final]
> at org.jboss.invocation.PrivilegedWithCombinerInterceptor.processInvocation(PrivilegedWithCombinerInterceptor.java:80) [jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:185)
> at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:182)
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:73)
> at com.csc.hibernate146.PersonManagementBean$$$view1.getByNameAndDeletePersonLocked(Unknown Source) [ee86ef2e-58da-4691-b087-2c3678ec3ddf.jar:]
> at com.csc.hibernate146.test.Hibernate146Test.createAndDeletePersonLocked(Hibernate146Test.java:59) [ee86ef2e-58da-4691-b087-2c3678ec3ddf.jar:]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
> at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
> at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) [arquillian-junit.jar:]
> at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [arquillian-junit.jar:]
> at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian$6$1.invoke(Arquillian.java:301) [arquillian-junit.jar:]
> at org.jboss.arquillian.container.test.impl.execution.LocalTestExecuter.execute(LocalTestExecuter.java:60) [arquillian-core.jar:]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
> at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67) [arquillian-core.jar:]
> at org.jboss.arquillian.container.test.impl.execution.ContainerTestExecuter.execute(ContainerTestExecuter.java:38) [arquillian-core.jar:]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
> at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81) [arquillian-core.jar:]
> at org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:102) [arquillian-core.jar:]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
> at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-core.jar:]
> at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:84) [arquillian-core.jar:]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
> at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-core.jar:]
> at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:65) [arquillian-core.jar:]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
> at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145) [arquillian-core.jar:]
> at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.test(EventTestRunnerAdaptor.java:111) [arquillian-core.jar:]
> at org.jboss.arquillian.junit.Arquillian$6.evaluate(Arquillian.java:294) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian$5.evaluate(Arquillian.java:267) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) [arquillian-junit.jar:]
> at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) [arquillian-junit.jar:]
> at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:193) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:345) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.java:49) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:207) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner.run(ParentRunner.java:309) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:155) [arquillian-junit.jar:]
> at org.junit.runner.JUnitCore.run(JUnitCore.java:160) [arquillian-junit.jar:]
> at org.junit.runner.JUnitCore.run(JUnitCore.java:138) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.container.JUnitTestRunner.execute(JUnitTestRunner.java:66) [arquillian-junit.jar:]
> at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.executeTest(ServletTestRunner.java:160) [arquillian-protocol.jar:]
> at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.execute(ServletTestRunner.java:126) [arquillian-protocol.jar:]
> at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.doGet(ServletTestRunner.java:90) [arquillian-protocol.jar:]
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
> at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
> at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
> at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.server.Connectors.executeRootHandler(Connectors.java:177) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:727) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_67]
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_67]
> at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_67]
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)
9 years, 9 months
[JBoss JIRA] (HIBERNATE-146) Remove after get with optimistic lock fails
by Arcadiy Ivanov (JIRA)
[ https://issues.jboss.org/browse/HIBERNATE-146?page=com.atlassian.jira.plu... ]
Arcadiy Ivanov edited comment on HIBERNATE-146 at 9/25/14 11:27 PM:
--------------------------------------------------------------------
Credits for investigating the issue go to Joe Rombs (joe.rombs(a)servicemesh.com) and for creating a test case to Keith Yarborough (keith.yarborough(a)servicemesh.com).
was (Author: arcivanov):
Credits for investigating the issue go to Joe Rombs and for creating a test case to Keith Yarborough.
> Remove after get with optimistic lock fails
> -------------------------------------------
>
> Key: HIBERNATE-146
> URL: https://issues.jboss.org/browse/HIBERNATE-146
> Project: Hibernate Integration
> Issue Type: Bug
> Reporter: Arcadiy Ivanov
> Assignee: Steve Ebersole
> Attachments: hibernate-146.tar.gz
>
>
> Whenever an entity is retrieved with an optimistic lock and then later is removed within the same transaction, an OptimisticLockException is thrown incorrectly.
> This is caused by the lock being incorrectly tracked altogether in case of an explicit optimistic lock. The unlocked/default lock behavior tracks entity versions correctly deleting entity even with optimistic check.
> EclipseLink, being a reference implementation, behaves correctly in this case.
> =====
> Running the attached test case the following behaviors can be observed:
> Insert + Commit, Get unlocked + Delete + Commit = OK
> {noformat}
> Hibernate:
> /* insert com.csc.hibernate146.Person
> */ insert
> into
> Person
> (name, version)
> values
> (?, ?)
> Hibernate:
> /* named HQL query Person.getPerson */ select
> person0_.id as id1_0_,
> person0_.name as name2_0_,
> person0_.version as version3_0_
> from
> Person person0_
> where
> person0_.name=?
> Deleting without lock: Person [id=1, name=John Doe, version=0]
> Hibernate:
> /* delete com.csc.hibernate146.Person */ delete
> from
> Person
> where
> id=?
> and version=?
> {noformat}
> Insert + Commit, Get + LockModeType.OPTIMISTIC + Delete + Commit = OptimisticLockException
> {noformat}
> Hibernate:
> /* insert com.csc.hibernate146.Person
> */ insert
> into
> Person
> (name, version)
> values
> (?, ?)
> Hibernate:
> /* named HQL query Person.getPerson */ select
> person0_.id as id1_0_,
> person0_.name as name2_0_,
> person0_.version as version3_0_
> from
> Person person0_
> where
> person0_.name=?
> Deleting under optimistic lock: Person [id=2, name=Jane Doe, version=0]
> Hibernate:
> /* delete com.csc.hibernate146.Person */ delete
> from
> Person
> where
> id=?
> and version=?
> Hibernate:
> /* get version com.csc.hibernate146.Person */ select
> version
> from
> Person
> where
> id =?
> WARN [com.arjuna.ats.arjuna] ARJUNA012125: TwoPhaseCoordinator.beforeCompletion - failed for SynchronizationImple< 0:ffffc0a87b34:-72291bdb:5424d3a3:22, org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization@7c440164 >: org.hibernate.OptimisticLockException: Newer version [null] of entity [[com.csc.hibernate146.Person#2]] found in database
> at org.hibernate.action.internal.EntityVerifyVersionProcess.doBeforeTransactionCompletion(EntityVerifyVersionProcess.java:60) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
> at org.hibernate.engine.spi.ActionQueue$BeforeTransactionCompletionProcessQueue.beforeTransactionCompletion(ActionQueue.java:715) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
> at org.hibernate.engine.spi.ActionQueue.beforeTransactionCompletion(ActionQueue.java:389) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
> at org.hibernate.internal.SessionImpl.beforeTransactionCompletion(SessionImpl.java:516) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
> at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorNonTrackingImpl.beforeCompletion(SynchronizationCallbackCoordinatorNonTrackingImpl.java:119) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
> at org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization.beforeCompletion(RegisteredSynchronization.java:50) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
> at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:76)
> at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:358)
> at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:91)
> at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:162)
> at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1166)
> at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:126)
> at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)
> at org.jboss.as.ejb3.tx.CMTTxInterceptor.endTransaction(CMTTxInterceptor.java:93) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:277) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:340) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:239) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ejb3.component.invocationmetrics.WaitTimeInterceptor.processInvocation(WaitTimeInterceptor.java:43) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:95) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:55) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64) [jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:326) [:1.2.1.Final]
> at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:448) [wildfly-security-manager-1.0.0.Final.jar:1.0.0.Final]
> at org.jboss.invocation.AccessCheckingInterceptor.processInvocation(AccessCheckingInterceptor.java:61) [jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:326) [:1.2.1.Final]
> at org.jboss.invocation.PrivilegedWithCombinerInterceptor.processInvocation(PrivilegedWithCombinerInterceptor.java:80) [jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:185)
> at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:182)
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:73)
> at com.csc.hibernate146.PersonManagementBean$$$view1.getByNameAndDeletePersonLocked(Unknown Source) [ee86ef2e-58da-4691-b087-2c3678ec3ddf.jar:]
> at com.csc.hibernate146.test.Hibernate146Test.createAndDeletePersonLocked(Hibernate146Test.java:59) [ee86ef2e-58da-4691-b087-2c3678ec3ddf.jar:]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
> at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
> at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) [arquillian-junit.jar:]
> at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [arquillian-junit.jar:]
> at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian$6$1.invoke(Arquillian.java:301) [arquillian-junit.jar:]
> at org.jboss.arquillian.container.test.impl.execution.LocalTestExecuter.execute(LocalTestExecuter.java:60) [arquillian-core.jar:]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
> at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67) [arquillian-core.jar:]
> at org.jboss.arquillian.container.test.impl.execution.ContainerTestExecuter.execute(ContainerTestExecuter.java:38) [arquillian-core.jar:]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
> at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81) [arquillian-core.jar:]
> at org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:102) [arquillian-core.jar:]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
> at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-core.jar:]
> at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:84) [arquillian-core.jar:]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
> at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-core.jar:]
> at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:65) [arquillian-core.jar:]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
> at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145) [arquillian-core.jar:]
> at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.test(EventTestRunnerAdaptor.java:111) [arquillian-core.jar:]
> at org.jboss.arquillian.junit.Arquillian$6.evaluate(Arquillian.java:294) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian$5.evaluate(Arquillian.java:267) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) [arquillian-junit.jar:]
> at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) [arquillian-junit.jar:]
> at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:193) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:345) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.java:49) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:207) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner.run(ParentRunner.java:309) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:155) [arquillian-junit.jar:]
> at org.junit.runner.JUnitCore.run(JUnitCore.java:160) [arquillian-junit.jar:]
> at org.junit.runner.JUnitCore.run(JUnitCore.java:138) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.container.JUnitTestRunner.execute(JUnitTestRunner.java:66) [arquillian-junit.jar:]
> at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.executeTest(ServletTestRunner.java:160) [arquillian-protocol.jar:]
> at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.execute(ServletTestRunner.java:126) [arquillian-protocol.jar:]
> at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.doGet(ServletTestRunner.java:90) [arquillian-protocol.jar:]
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
> at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
> at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
> at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.server.Connectors.executeRootHandler(Connectors.java:177) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:727) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_67]
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_67]
> at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_67]
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)
9 years, 9 months
[JBoss JIRA] (HIBERNATE-146) Remove after get with optimistic lock fails
by Arcadiy Ivanov (JIRA)
[ https://issues.jboss.org/browse/HIBERNATE-146?page=com.atlassian.jira.plu... ]
Arcadiy Ivanov updated HIBERNATE-146:
-------------------------------------
Attachment: hibernate-146.tar.gz
Example test case.
Run _mvn clean verify_ and observe the unit test failures.
> Remove after get with optimistic lock fails
> -------------------------------------------
>
> Key: HIBERNATE-146
> URL: https://issues.jboss.org/browse/HIBERNATE-146
> Project: Hibernate Integration
> Issue Type: Bug
> Reporter: Arcadiy Ivanov
> Assignee: Steve Ebersole
> Attachments: hibernate-146.tar.gz
>
>
> Whenever an entity is retrieved with an optimistic lock and then later is removed within the same transaction, an OptimisticLockException is thrown incorrectly.
> This is caused by the lock being incorrectly tracked altogether in case of an explicit optimistic lock. The unlocked/default lock behavior tracks entity versions correctly deleting entity even with optimistic check.
> EclipseLink, being a reference implementation, behaves correctly in this case.
> =====
> Running the attached test case the following behaviors can be observed:
> Insert + Commit, Get unlocked + Delete + Commit = OK
> {noformat}
> Hibernate:
> /* insert com.csc.hibernate146.Person
> */ insert
> into
> Person
> (name, version)
> values
> (?, ?)
> Hibernate:
> /* named HQL query Person.getPerson */ select
> person0_.id as id1_0_,
> person0_.name as name2_0_,
> person0_.version as version3_0_
> from
> Person person0_
> where
> person0_.name=?
> Deleting without lock: Person [id=1, name=John Doe, version=0]
> Hibernate:
> /* delete com.csc.hibernate146.Person */ delete
> from
> Person
> where
> id=?
> and version=?
> {noformat}
> Insert + Commit, Get + LockModeType.OPTIMISTIC + Delete + Commit = OptimisticLockException
> {noformat}
> Hibernate:
> /* insert com.csc.hibernate146.Person
> */ insert
> into
> Person
> (name, version)
> values
> (?, ?)
> Hibernate:
> /* named HQL query Person.getPerson */ select
> person0_.id as id1_0_,
> person0_.name as name2_0_,
> person0_.version as version3_0_
> from
> Person person0_
> where
> person0_.name=?
> Deleting under optimistic lock: Person [id=2, name=Jane Doe, version=0]
> Hibernate:
> /* delete com.csc.hibernate146.Person */ delete
> from
> Person
> where
> id=?
> and version=?
> Hibernate:
> /* get version com.csc.hibernate146.Person */ select
> version
> from
> Person
> where
> id =?
> WARN [com.arjuna.ats.arjuna] ARJUNA012125: TwoPhaseCoordinator.beforeCompletion - failed for SynchronizationImple< 0:ffffc0a87b34:-72291bdb:5424d3a3:22, org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization@7c440164 >: org.hibernate.OptimisticLockException: Newer version [null] of entity [[com.csc.hibernate146.Person#2]] found in database
> at org.hibernate.action.internal.EntityVerifyVersionProcess.doBeforeTransactionCompletion(EntityVerifyVersionProcess.java:60) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
> at org.hibernate.engine.spi.ActionQueue$BeforeTransactionCompletionProcessQueue.beforeTransactionCompletion(ActionQueue.java:715) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
> at org.hibernate.engine.spi.ActionQueue.beforeTransactionCompletion(ActionQueue.java:389) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
> at org.hibernate.internal.SessionImpl.beforeTransactionCompletion(SessionImpl.java:516) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
> at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorNonTrackingImpl.beforeCompletion(SynchronizationCallbackCoordinatorNonTrackingImpl.java:119) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
> at org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization.beforeCompletion(RegisteredSynchronization.java:50) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
> at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:76)
> at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:358)
> at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:91)
> at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:162)
> at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1166)
> at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:126)
> at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)
> at org.jboss.as.ejb3.tx.CMTTxInterceptor.endTransaction(CMTTxInterceptor.java:93) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:277) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:340) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:239) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ejb3.component.invocationmetrics.WaitTimeInterceptor.processInvocation(WaitTimeInterceptor.java:43) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:95) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:55) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64) [jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:326) [:1.2.1.Final]
> at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:448) [wildfly-security-manager-1.0.0.Final.jar:1.0.0.Final]
> at org.jboss.invocation.AccessCheckingInterceptor.processInvocation(AccessCheckingInterceptor.java:61) [jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:326) [:1.2.1.Final]
> at org.jboss.invocation.PrivilegedWithCombinerInterceptor.processInvocation(PrivilegedWithCombinerInterceptor.java:80) [jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:185)
> at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:182)
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:73)
> at com.csc.hibernate146.PersonManagementBean$$$view1.getByNameAndDeletePersonLocked(Unknown Source) [ee86ef2e-58da-4691-b087-2c3678ec3ddf.jar:]
> at com.csc.hibernate146.test.Hibernate146Test.createAndDeletePersonLocked(Hibernate146Test.java:59) [ee86ef2e-58da-4691-b087-2c3678ec3ddf.jar:]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
> at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
> at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) [arquillian-junit.jar:]
> at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [arquillian-junit.jar:]
> at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian$6$1.invoke(Arquillian.java:301) [arquillian-junit.jar:]
> at org.jboss.arquillian.container.test.impl.execution.LocalTestExecuter.execute(LocalTestExecuter.java:60) [arquillian-core.jar:]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
> at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67) [arquillian-core.jar:]
> at org.jboss.arquillian.container.test.impl.execution.ContainerTestExecuter.execute(ContainerTestExecuter.java:38) [arquillian-core.jar:]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
> at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81) [arquillian-core.jar:]
> at org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:102) [arquillian-core.jar:]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
> at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-core.jar:]
> at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:84) [arquillian-core.jar:]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
> at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-core.jar:]
> at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:65) [arquillian-core.jar:]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
> at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145) [arquillian-core.jar:]
> at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.test(EventTestRunnerAdaptor.java:111) [arquillian-core.jar:]
> at org.jboss.arquillian.junit.Arquillian$6.evaluate(Arquillian.java:294) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian$5.evaluate(Arquillian.java:267) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) [arquillian-junit.jar:]
> at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) [arquillian-junit.jar:]
> at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:193) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:345) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.java:49) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:207) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner.run(ParentRunner.java:309) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:155) [arquillian-junit.jar:]
> at org.junit.runner.JUnitCore.run(JUnitCore.java:160) [arquillian-junit.jar:]
> at org.junit.runner.JUnitCore.run(JUnitCore.java:138) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.container.JUnitTestRunner.execute(JUnitTestRunner.java:66) [arquillian-junit.jar:]
> at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.executeTest(ServletTestRunner.java:160) [arquillian-protocol.jar:]
> at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.execute(ServletTestRunner.java:126) [arquillian-protocol.jar:]
> at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.doGet(ServletTestRunner.java:90) [arquillian-protocol.jar:]
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
> at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
> at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
> at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.server.Connectors.executeRootHandler(Connectors.java:177) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:727) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_67]
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_67]
> at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_67]
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)
9 years, 9 months
[JBoss JIRA] (HIBERNATE-146) Remove after get with optimistic lock fails
by Arcadiy Ivanov (JIRA)
[ https://issues.jboss.org/browse/HIBERNATE-146?page=com.atlassian.jira.plu... ]
Arcadiy Ivanov commented on HIBERNATE-146:
------------------------------------------
Credits for investigating the issue go to Joe Rombs and for creating a test case to Keith Yarborough.
> Remove after get with optimistic lock fails
> -------------------------------------------
>
> Key: HIBERNATE-146
> URL: https://issues.jboss.org/browse/HIBERNATE-146
> Project: Hibernate Integration
> Issue Type: Bug
> Reporter: Arcadiy Ivanov
> Assignee: Steve Ebersole
>
> Whenever an entity is retrieved with an optimistic lock and then later is removed within the same transaction, an OptimisticLockException is thrown incorrectly.
> This is caused by the lock being incorrectly tracked altogether in case of an explicit optimistic lock. The unlocked/default lock behavior tracks entity versions correctly deleting entity even with optimistic check.
> EclipseLink, being a reference implementation, behaves correctly in this case.
> =====
> Running the attached test case the following behaviors can be observed:
> Insert + Commit, Get unlocked + Delete + Commit = OK
> {noformat}
> Hibernate:
> /* insert com.csc.hibernate146.Person
> */ insert
> into
> Person
> (name, version)
> values
> (?, ?)
> Hibernate:
> /* named HQL query Person.getPerson */ select
> person0_.id as id1_0_,
> person0_.name as name2_0_,
> person0_.version as version3_0_
> from
> Person person0_
> where
> person0_.name=?
> Deleting without lock: Person [id=1, name=John Doe, version=0]
> Hibernate:
> /* delete com.csc.hibernate146.Person */ delete
> from
> Person
> where
> id=?
> and version=?
> {noformat}
> Insert + Commit, Get + LockModeType.OPTIMISTIC + Delete + Commit = OptimisticLockException
> {noformat}
> Hibernate:
> /* insert com.csc.hibernate146.Person
> */ insert
> into
> Person
> (name, version)
> values
> (?, ?)
> Hibernate:
> /* named HQL query Person.getPerson */ select
> person0_.id as id1_0_,
> person0_.name as name2_0_,
> person0_.version as version3_0_
> from
> Person person0_
> where
> person0_.name=?
> Deleting under optimistic lock: Person [id=2, name=Jane Doe, version=0]
> Hibernate:
> /* delete com.csc.hibernate146.Person */ delete
> from
> Person
> where
> id=?
> and version=?
> Hibernate:
> /* get version com.csc.hibernate146.Person */ select
> version
> from
> Person
> where
> id =?
> WARN [com.arjuna.ats.arjuna] ARJUNA012125: TwoPhaseCoordinator.beforeCompletion - failed for SynchronizationImple< 0:ffffc0a87b34:-72291bdb:5424d3a3:22, org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization@7c440164 >: org.hibernate.OptimisticLockException: Newer version [null] of entity [[com.csc.hibernate146.Person#2]] found in database
> at org.hibernate.action.internal.EntityVerifyVersionProcess.doBeforeTransactionCompletion(EntityVerifyVersionProcess.java:60) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
> at org.hibernate.engine.spi.ActionQueue$BeforeTransactionCompletionProcessQueue.beforeTransactionCompletion(ActionQueue.java:715) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
> at org.hibernate.engine.spi.ActionQueue.beforeTransactionCompletion(ActionQueue.java:389) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
> at org.hibernate.internal.SessionImpl.beforeTransactionCompletion(SessionImpl.java:516) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
> at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorNonTrackingImpl.beforeCompletion(SynchronizationCallbackCoordinatorNonTrackingImpl.java:119) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
> at org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization.beforeCompletion(RegisteredSynchronization.java:50) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]
> at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:76)
> at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:358)
> at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:91)
> at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:162)
> at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1166)
> at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:126)
> at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)
> at org.jboss.as.ejb3.tx.CMTTxInterceptor.endTransaction(CMTTxInterceptor.java:93) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:277) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:340) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:239) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ejb3.component.invocationmetrics.WaitTimeInterceptor.processInvocation(WaitTimeInterceptor.java:43) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:95) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:55) [wildfly-ejb3-8.1.0.Final.jar:8.1.0.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64) [jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:326) [:1.2.1.Final]
> at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:448) [wildfly-security-manager-1.0.0.Final.jar:1.0.0.Final]
> at org.jboss.invocation.AccessCheckingInterceptor.processInvocation(AccessCheckingInterceptor.java:61) [jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:326) [:1.2.1.Final]
> at org.jboss.invocation.PrivilegedWithCombinerInterceptor.processInvocation(PrivilegedWithCombinerInterceptor.java:80) [jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:185)
> at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:182)
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) [:1.2.1.Final]
> at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:73)
> at com.csc.hibernate146.PersonManagementBean$$$view1.getByNameAndDeletePersonLocked(Unknown Source) [ee86ef2e-58da-4691-b087-2c3678ec3ddf.jar:]
> at com.csc.hibernate146.test.Hibernate146Test.createAndDeletePersonLocked(Hibernate146Test.java:59) [ee86ef2e-58da-4691-b087-2c3678ec3ddf.jar:]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
> at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
> at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) [arquillian-junit.jar:]
> at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [arquillian-junit.jar:]
> at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian$6$1.invoke(Arquillian.java:301) [arquillian-junit.jar:]
> at org.jboss.arquillian.container.test.impl.execution.LocalTestExecuter.execute(LocalTestExecuter.java:60) [arquillian-core.jar:]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
> at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67) [arquillian-core.jar:]
> at org.jboss.arquillian.container.test.impl.execution.ContainerTestExecuter.execute(ContainerTestExecuter.java:38) [arquillian-core.jar:]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
> at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81) [arquillian-core.jar:]
> at org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:102) [arquillian-core.jar:]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
> at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-core.jar:]
> at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:84) [arquillian-core.jar:]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
> at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-core.jar:]
> at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:65) [arquillian-core.jar:]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
> at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-core.jar:]
> at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145) [arquillian-core.jar:]
> at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.test(EventTestRunnerAdaptor.java:111) [arquillian-core.jar:]
> at org.jboss.arquillian.junit.Arquillian$6.evaluate(Arquillian.java:294) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian$5.evaluate(Arquillian.java:267) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) [arquillian-junit.jar:]
> at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) [arquillian-junit.jar:]
> at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:193) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:345) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.java:49) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:207) [arquillian-junit.jar:]
> at org.junit.runners.ParentRunner.run(ParentRunner.java:309) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:155) [arquillian-junit.jar:]
> at org.junit.runner.JUnitCore.run(JUnitCore.java:160) [arquillian-junit.jar:]
> at org.junit.runner.JUnitCore.run(JUnitCore.java:138) [arquillian-junit.jar:]
> at org.jboss.arquillian.junit.container.JUnitTestRunner.execute(JUnitTestRunner.java:66) [arquillian-junit.jar:]
> at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.executeTest(ServletTestRunner.java:160) [arquillian-protocol.jar:]
> at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.execute(ServletTestRunner.java:126) [arquillian-protocol.jar:]
> at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.doGet(ServletTestRunner.java:90) [arquillian-protocol.jar:]
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
> at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
> at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
> at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.server.Connectors.executeRootHandler(Connectors.java:177) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:727) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_67]
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_67]
> at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_67]
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)
9 years, 9 months