[JBoss JIRA] (WFLY-13697) JBoss CLI can't find java:app/AppName
by Michal Petrov (Jira)
[ https://issues.redhat.com/browse/WFLY-13697?page=com.atlassian.jira.plugi... ]
Michal Petrov resolved WFLY-13697.
----------------------------------
Assignee: (was: Cheng Fang)
Resolution: Duplicate Issue
> JBoss CLI can't find java:app/AppName
> -------------------------------------
>
> Key: WFLY-13697
> URL: https://issues.redhat.com/browse/WFLY-13697
> Project: WildFly
> Issue Type: Bug
> Components: Batch, Management
> Affects Versions: JBoss AS7 7.2.0.Final
> Reporter: José Fernando Tepedino Martins
> Priority: Minor
> Labels: CLI, JNDI
>
> With a JEE aplication in a WAR package, when starting a functionality, as a Batch Job, via CLI, CDI injection and JNDI lookup fail to find resources 'java:app/AppName' and 'java:module/ModuleName'.
> For example, a job listener or other job artifact with the following code
> {code:java}
> @Resource(lookup="java:app/AppName")
> private String applicationName;{code}
> or
> {code:java}
> private String applicationName;
> @PostConstruct
> protected void initialize() throws NamingException {
> applicationName = InitialContext.doLookup("java:app/AppName");
> }{code}
> when the batch job is started from JBoss CLI, the following error will be logged:
> {code:java}
> javax.naming.NameNotFoundException: java:app/AppName
> {code}
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
5 years, 2 months
[JBoss JIRA] (WFLY-13697) JBoss CLI can't find java:app/AppName
by Michal Petrov (Jira)
[ https://issues.redhat.com/browse/WFLY-13697?page=com.atlassian.jira.plugi... ]
Michal Petrov reassigned WFLY-13697:
------------------------------------
Assignee: Cheng Fang (was: Michal Petrov)
> JBoss CLI can't find java:app/AppName
> -------------------------------------
>
> Key: WFLY-13697
> URL: https://issues.redhat.com/browse/WFLY-13697
> Project: WildFly
> Issue Type: Bug
> Components: Batch, Management
> Affects Versions: JBoss AS7 7.2.0.Final
> Reporter: José Fernando Tepedino Martins
> Assignee: Cheng Fang
> Priority: Minor
> Labels: CLI, JNDI
>
> With a JEE aplication in a WAR package, when starting a functionality, as a Batch Job, via CLI, CDI injection and JNDI lookup fail to find resources 'java:app/AppName' and 'java:module/ModuleName'.
> For example, a job listener or other job artifact with the following code
> {code:java}
> @Resource(lookup="java:app/AppName")
> private String applicationName;{code}
> or
> {code:java}
> private String applicationName;
> @PostConstruct
> protected void initialize() throws NamingException {
> applicationName = InitialContext.doLookup("java:app/AppName");
> }{code}
> when the batch job is started from JBoss CLI, the following error will be logged:
> {code:java}
> javax.naming.NameNotFoundException: java:app/AppName
> {code}
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
5 years, 2 months
[JBoss JIRA] (DROOLS-5560) ClassCastException on Fact Attribute Set After UpdateToVersion
by Mario Fusco (Jira)
[ https://issues.redhat.com/browse/DROOLS-5560?page=com.atlassian.jira.plug... ]
Mario Fusco updated DROOLS-5560:
--------------------------------
Sprint: 2020 Week 31-33 (from Jul 27)
> ClassCastException on Fact Attribute Set After UpdateToVersion
> --------------------------------------------------------------
>
> Key: DROOLS-5560
> URL: https://issues.redhat.com/browse/DROOLS-5560
> Project: Drools
> Issue Type: Bug
> Components: core engine
> Affects Versions: 7.41.0.Final
> Reporter: Matteo Casalino
> Assignee: Mario Fusco
> Priority: Major
> Attachments: class-cast-exception-on-fact-attribute-set-after-update.zip
>
>
> After updating a KieContainer with a change in a fact type _UnreferencedType_, if instances of another unrelated fact type _ReferencedType_ are modified in a rule, then setting any field of _ReferencedType_ through the _FactType_ API will throw a _ClassCastException_:
> {noformat}
> java.lang.ClassCastException: class org.example.facts.ReferencedType cannot be cast to class org.example.facts.ReferencedType (org.example.facts.ReferencedType is in unnamed module of loader org.drools.dynamic.DynamicProjectClassLoader$DefaultInternalTypesClassLoader @59901c4d; org.example.facts.ReferencedType is in unnamed module of loader org.drools.dynamic.DynamicProjectClassLoader$DefaultInternalTypesClassLoader @5e1fc2aa)
>
> at org.drools.base.org.example.facts.ReferencedType1921143808$setStr.setValue(Unknown Source)
> at org.drools.core.base.ClassFieldWriter.setValue(ClassFieldWriter.java:164)
> at org.drools.core.base.ClassFieldAccessor.setValue(ClassFieldAccessor.java:246)
> at org.drools.core.factmodel.ClassDefinition.set(ClassDefinition.java:278)
> at org.example.reproducer.FactTypeUpdateTest.testUpdateThenSetFactAttribute(FactTypeUpdateTest.java:132)
> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.base/java.lang.reflect.Method.invoke(Method.java:566)
> at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
> at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
> at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
> at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
> at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
> at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
> at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
> at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
> at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
> at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
> at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
> at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
> at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
> at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
> at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
> at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
> at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
> at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
> at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
> at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
> at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58){noformat}
> Below the example DRL that triggers the issue.
> Initial DRL:
> {noformat}
> package org.example.facts
> declare ReferencedType
> str : String
> end
> declare UnreferencedType
> x : int
> end
>
> package org.example.rules
> import org.example.facts.*;
> rule "rule updating ReferencedType"
> when
> $x : ReferencedType( )
> then
> $x.setStr("foo");
> update($x);
> end{noformat}
> Updated DRL:
> {noformat}
> package org.example.facts
> declare ReferencedType
> str : String
> end
> declare UnreferencedType
> x : int
> y : String // NEW ATTRIBUTE ADDED HERE
> end
>
> package org.example.rules
> import org.example.facts.*;
> rule "rule updating ReferencedType"
> when
> $x : ReferencedType( )
> then
> $x.setStr("foo");
> update($x);
> end{noformat}
> Throwing code example:
> {noformat}
> updateToVersion(); // Updates the KieContainer
> KieBase kiebase = kieContainer.getKieBase("ExampleKiebase");
> FactType referencedType = kiebase.getFactType("org.example.facts", "ReferencedType");
> Object instance = referencedType.newInstance();
> referencedType.set(instance, "str", "bar"); // Throws ClassCastException{noformat}
>
> This is similar to DROOLS-5449, but in this case we instantiate the fact from the updated fact type, so we believe that there is no API misuse.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
5 years, 2 months
[JBoss JIRA] (WFLY-13744) Improvements on Galleon layers community documentation
by Tommaso Borgato (Jira)
[ https://issues.redhat.com/browse/WFLY-13744?page=com.atlassian.jira.plugi... ]
Tommaso Borgato edited comment on WFLY-13744 at 8/5/20 12:35 PM:
-----------------------------------------------------------------
One suggestion is to add some simple instructions on how to provision a trimmed server from a fresh local clone of the WildFly repository, something like:
{code}
After cloning the WildFly repository locally, you can provision a trimmed server leveraging the galleon cli:
git clone git@github.com:wildfly/wildfly.git
cd wildfly
galleon.sh install wildfly:current/snapshot --layers=jsf,datasources-web-server --dir=my-wildfly-server
{code}
was (Author: tommaso-borgato):
One suggestion is to add some simple instructions on how to provision a trimmed server from a fresh local clone of the WildFly repository, something like:
{code}
After cloning the WildFly repository locally, you can provision a trimmed server leveraging the galleon cli:
git clone git@github.com:wildfly/wildfly.git
cd wildfly
galleon.sh install wildfly:current/snapshot --layers=jsf,datasources-web-server --dir=my-wildfly-server
{code}
:
> Improvements on Galleon layers community documentation
> ------------------------------------------------------
>
> Key: WFLY-13744
> URL: https://issues.redhat.com/browse/WFLY-13744
> Project: WildFly
> Issue Type: Task
> Components: Documentation
> Reporter: Yeray Borges Santana
> Assignee: Yeray Borges Santana
> Priority: Major
>
> We could make some improvements on the WildFly community documentation about the Galleon layers:
> * Somehow facilitate the identification of what contains each layer.
> * Describe in this Galleon layers section a short introduction about the different available options to generate a trimmed server
> * Links about examples
>
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
5 years, 2 months
[JBoss JIRA] (WFLY-13744) Improvements on Galleon layers community documentation
by Tommaso Borgato (Jira)
[ https://issues.redhat.com/browse/WFLY-13744?page=com.atlassian.jira.plugi... ]
Tommaso Borgato commented on WFLY-13744:
----------------------------------------
One suggestion is to add some simple instructions on how to provision a trimmed server from a fresh local clone of the WildFly repository, something like:
{code}
After cloning the WildFly repository locally, you can provision a trimmed server leveraging the galleon cli:
git clone git@github.com:wildfly/wildfly.git
cd wildfly
galleon.sh install wildfly:current/snapshot --layers=jsf,datasources-web-server --dir=my-wildfly-server
{code}
:
> Improvements on Galleon layers community documentation
> ------------------------------------------------------
>
> Key: WFLY-13744
> URL: https://issues.redhat.com/browse/WFLY-13744
> Project: WildFly
> Issue Type: Task
> Components: Documentation
> Reporter: Yeray Borges Santana
> Assignee: Yeray Borges Santana
> Priority: Major
>
> We could make some improvements on the WildFly community documentation about the Galleon layers:
> * Somehow facilitate the identification of what contains each layer.
> * Describe in this Galleon layers section a short introduction about the different available options to generate a trimmed server
> * Links about examples
>
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
5 years, 2 months
[JBoss JIRA] (WFCORE-5084) Why does the elytron layer bring in access control?
by Darran Lofthouse (Jira)
Darran Lofthouse created WFCORE-5084:
----------------------------------------
Summary: Why does the elytron layer bring in access control?
Key: WFCORE-5084
URL: https://issues.redhat.com/browse/WFCORE-5084
Project: WildFly Core
Issue Type: Task
Components: Build System, Management, Security
Reporter: Darran Lofthouse
Assignee: Darran Lofthouse
Fix For: 13.0.0.Beta4
The following shows the set of changes created by adding the elytron layer to a provisioned server:
https://gist.github.com/darranl/68f4a3d60560dae9a9225ec1a0e35a9f/revisions
This includes the following:
{code:xml}
<management>
<access-control provider="simple">
<role-mapping>
<role name="SuperUser">
<include>
<user name="$local"/>
</include>
</role>
</role-mapping>
</access-control>
</management>
{code}
Shouldn't this section be added if any form of authenticated management is added instead?
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
5 years, 2 months
[JBoss JIRA] (DROOLS-5560) ClassCastException on Fact Attribute Set After UpdateToVersion
by Matteo Casalino (Jira)
[ https://issues.redhat.com/browse/DROOLS-5560?page=com.atlassian.jira.plug... ]
Matteo Casalino updated DROOLS-5560:
------------------------------------
Description:
After updating a KieContainer with a change in a fact type _UnreferencedType_, if instances of another unrelated fact type _ReferencedType_ are modified in a rule, then setting any field of _ReferencedType_ through the _FactType_ API will throw a _ClassCastException_:
{noformat}
java.lang.ClassCastException: class org.example.facts.ReferencedType cannot be cast to class org.example.facts.ReferencedType (org.example.facts.ReferencedType is in unnamed module of loader org.drools.dynamic.DynamicProjectClassLoader$DefaultInternalTypesClassLoader @59901c4d; org.example.facts.ReferencedType is in unnamed module of loader org.drools.dynamic.DynamicProjectClassLoader$DefaultInternalTypesClassLoader @5e1fc2aa)
at org.drools.base.org.example.facts.ReferencedType1921143808$setStr.setValue(Unknown Source)
at org.drools.core.base.ClassFieldWriter.setValue(ClassFieldWriter.java:164)
at org.drools.core.base.ClassFieldAccessor.setValue(ClassFieldAccessor.java:246)
at org.drools.core.factmodel.ClassDefinition.set(ClassDefinition.java:278)
at org.example.reproducer.FactTypeUpdateTest.testUpdateThenSetFactAttribute(FactTypeUpdateTest.java:132)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58){noformat}
Below the example DRL that triggers the issue.
Initial DRL:
{noformat}
package org.example.facts
declare ReferencedType
str : String
end
declare UnreferencedType
x : int
end
package org.example.rules
import org.example.facts.*;
rule "rule updating ReferencedType"
when
$x : ReferencedType( )
then
$x.setStr("foo");
update($x);
end{noformat}
Updated DRL:
{noformat}
package org.example.facts
declare ReferencedType
str : String
end
declare UnreferencedType
x : int
y : String // NEW ATTRIBUTE ADDED HERE
end
package org.example.rules
import org.example.facts.*;
rule "rule updating ReferencedType"
when
$x : ReferencedType( )
then
$x.setStr("foo");
update($x);
end{noformat}
Throwing code example:
{noformat}
updateToVersion(); // Updates the KieContainer
KieBase kiebase = kieContainer.getKieBase("ExampleKiebase");
FactType referencedType = kiebase.getFactType("org.example.facts", "ReferencedType");
Object instance = referencedType.newInstance();
referencedType.set(instance, "str", "bar"); // Throws ClassCastException{noformat}
This is similar to DROOLS-5449, but in this case we instantiate the fact from the updated fact type, so we believe that there is no API misuse.
was:
After updating a KieContainer with a change in a fact type _UnreferencedType_, if instances of another unrelated fact type _ReferencedType_ are modified in a rule, then setting any field of _ReferencedType_ through the _FactType_ API will throw a _ClassCastException_:
{noformat}
java.lang.ClassCastException: class org.example.facts.ReferencedType cannot be cast to class org.example.facts.ReferencedType (org.example.facts.ReferencedType is in unnamed module of loader org.drools.dynamic.DynamicProjectClassLoader$DefaultInternalTypesClassLoader @59901c4d; org.example.facts.ReferencedType is in unnamed module of loader org.drools.dynamic.DynamicProjectClassLoader$DefaultInternalTypesClassLoader @5e1fc2aa)
at org.drools.base.org.example.facts.ReferencedType1921143808$setStr.setValue(Unknown Source)
at org.drools.core.base.ClassFieldWriter.setValue(ClassFieldWriter.java:164)
at org.drools.core.base.ClassFieldAccessor.setValue(ClassFieldAccessor.java:246)
at org.drools.core.factmodel.ClassDefinition.set(ClassDefinition.java:278)
at org.example.reproducer.FactTypeUpdateTest.testUpdateThenSetFactAttribute(FactTypeUpdateTest.java:132)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58){noformat}
Below the example DRL that triggers the issue.
Initial DRL:
{noformat}
package org.example.facts
declare ReferencedType
str : String
end
declare UnreferencedType
x : int
end
package org.example.rules
import org.example.facts.*;
rule "rule updating ReferencedType"
"when
$x : ReferencedType( )
then
$x.setStr("foo");
update($x);
end{noformat}
Updated DRL:
{noformat}
package org.example.facts
declare ReferencedType
str : String
end
declare UnreferencedType
x : int
y : String // NEW ATTRIBUTE ADDED HERE
end
package org.example.rules
import org.example.facts.*;
rule "rule updating ReferencedType"
"when
$x : ReferencedType( )
then
$x.setStr("foo");
update($x);
end{noformat}
Throwing code example:
{noformat}
updateToVersion(); // Updates the KieContainer
KieBase kiebase = kieContainer.getKieBase("ExampleKiebase");
FactType referencedType = kiebase.getFactType("org.example.facts", "ReferencedType");
Object instance = referencedType.newInstance();
referencedType.set(instance, "str", "bar"); // Throws ClassCastException{noformat}
This is similar to DROOLS-5449, but in this case we instantiate the fact from the updated fact type, so we believe that there is no API misuse.
> ClassCastException on Fact Attribute Set After UpdateToVersion
> --------------------------------------------------------------
>
> Key: DROOLS-5560
> URL: https://issues.redhat.com/browse/DROOLS-5560
> Project: Drools
> Issue Type: Bug
> Components: core engine
> Affects Versions: 7.41.0.Final
> Reporter: Matteo Casalino
> Assignee: Mario Fusco
> Priority: Major
> Attachments: class-cast-exception-on-fact-attribute-set-after-update.zip
>
>
> After updating a KieContainer with a change in a fact type _UnreferencedType_, if instances of another unrelated fact type _ReferencedType_ are modified in a rule, then setting any field of _ReferencedType_ through the _FactType_ API will throw a _ClassCastException_:
> {noformat}
> java.lang.ClassCastException: class org.example.facts.ReferencedType cannot be cast to class org.example.facts.ReferencedType (org.example.facts.ReferencedType is in unnamed module of loader org.drools.dynamic.DynamicProjectClassLoader$DefaultInternalTypesClassLoader @59901c4d; org.example.facts.ReferencedType is in unnamed module of loader org.drools.dynamic.DynamicProjectClassLoader$DefaultInternalTypesClassLoader @5e1fc2aa)
>
> at org.drools.base.org.example.facts.ReferencedType1921143808$setStr.setValue(Unknown Source)
> at org.drools.core.base.ClassFieldWriter.setValue(ClassFieldWriter.java:164)
> at org.drools.core.base.ClassFieldAccessor.setValue(ClassFieldAccessor.java:246)
> at org.drools.core.factmodel.ClassDefinition.set(ClassDefinition.java:278)
> at org.example.reproducer.FactTypeUpdateTest.testUpdateThenSetFactAttribute(FactTypeUpdateTest.java:132)
> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.base/java.lang.reflect.Method.invoke(Method.java:566)
> at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
> at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
> at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
> at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
> at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
> at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
> at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
> at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
> at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
> at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
> at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
> at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
> at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
> at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
> at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
> at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
> at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
> at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
> at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
> at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
> at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58){noformat}
> Below the example DRL that triggers the issue.
> Initial DRL:
> {noformat}
> package org.example.facts
> declare ReferencedType
> str : String
> end
> declare UnreferencedType
> x : int
> end
>
> package org.example.rules
> import org.example.facts.*;
> rule "rule updating ReferencedType"
> when
> $x : ReferencedType( )
> then
> $x.setStr("foo");
> update($x);
> end{noformat}
> Updated DRL:
> {noformat}
> package org.example.facts
> declare ReferencedType
> str : String
> end
> declare UnreferencedType
> x : int
> y : String // NEW ATTRIBUTE ADDED HERE
> end
>
> package org.example.rules
> import org.example.facts.*;
> rule "rule updating ReferencedType"
> when
> $x : ReferencedType( )
> then
> $x.setStr("foo");
> update($x);
> end{noformat}
> Throwing code example:
> {noformat}
> updateToVersion(); // Updates the KieContainer
> KieBase kiebase = kieContainer.getKieBase("ExampleKiebase");
> FactType referencedType = kiebase.getFactType("org.example.facts", "ReferencedType");
> Object instance = referencedType.newInstance();
> referencedType.set(instance, "str", "bar"); // Throws ClassCastException{noformat}
>
> This is similar to DROOLS-5449, but in this case we instantiate the fact from the updated fact type, so we believe that there is no API misuse.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
5 years, 2 months
[JBoss JIRA] (DROOLS-5560) ClassCastException on Fact Attribute Set After UpdateToVersion
by Matteo Casalino (Jira)
[ https://issues.redhat.com/browse/DROOLS-5560?page=com.atlassian.jira.plug... ]
Matteo Casalino updated DROOLS-5560:
------------------------------------
Attachment: class-cast-exception-on-fact-attribute-set-after-update.zip
> ClassCastException on Fact Attribute Set After UpdateToVersion
> --------------------------------------------------------------
>
> Key: DROOLS-5560
> URL: https://issues.redhat.com/browse/DROOLS-5560
> Project: Drools
> Issue Type: Bug
> Components: core engine
> Affects Versions: 7.41.0.Final
> Reporter: Matteo Casalino
> Assignee: Mario Fusco
> Priority: Major
> Attachments: class-cast-exception-on-fact-attribute-set-after-update.zip
>
>
> After updating a KieContainer with a change in a fact type _UnreferencedType_, if instances of another unrelated fact type _ReferencedType_ are modified in a rule, then setting any field of _ReferencedType_ through the _FactType_ API will throw a _ClassCastException_:
> {noformat}
> java.lang.ClassCastException: class org.example.facts.ReferencedType cannot be cast to class org.example.facts.ReferencedType (org.example.facts.ReferencedType is in unnamed module of loader org.drools.dynamic.DynamicProjectClassLoader$DefaultInternalTypesClassLoader @59901c4d; org.example.facts.ReferencedType is in unnamed module of loader org.drools.dynamic.DynamicProjectClassLoader$DefaultInternalTypesClassLoader @5e1fc2aa)
>
> at org.drools.base.org.example.facts.ReferencedType1921143808$setStr.setValue(Unknown Source)
> at org.drools.core.base.ClassFieldWriter.setValue(ClassFieldWriter.java:164)
> at org.drools.core.base.ClassFieldAccessor.setValue(ClassFieldAccessor.java:246)
> at org.drools.core.factmodel.ClassDefinition.set(ClassDefinition.java:278)
> at org.example.reproducer.FactTypeUpdateTest.testUpdateThenSetFactAttribute(FactTypeUpdateTest.java:132)
> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.base/java.lang.reflect.Method.invoke(Method.java:566)
> at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
> at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
> at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
> at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
> at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
> at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
> at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
> at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
> at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
> at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
> at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
> at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
> at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
> at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
> at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
> at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
> at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
> at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
> at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
> at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
> at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58){noformat}
> Below the example DRL that triggers the issue.
> Initial DRL:
> {noformat}
> package org.example.facts
> declare ReferencedType
> str : String
> end
> declare UnreferencedType
> x : int
> end
>
> package org.example.rules
> import org.example.facts.*;
> rule "rule updating ReferencedType"
> "when
> $x : ReferencedType( )
> then
> $x.setStr("foo");
> update($x);
> end{noformat}
> Updated DRL:
> {noformat}
> package org.example.facts
> declare ReferencedType
> str : String
> end
> declare UnreferencedType
> x : int
> y : String // NEW ATTRIBUTE ADDED HERE
> end
>
> package org.example.rules
> import org.example.facts.*;
> rule "rule updating ReferencedType"
> "when
> $x : ReferencedType( )
> then
> $x.setStr("foo");
> update($x);
> end{noformat}
> Throwing code example:
> {noformat}
> updateToVersion(); // Updates the KieContainer
> KieBase kiebase = kieContainer.getKieBase("ExampleKiebase");
> FactType referencedType = kiebase.getFactType("org.example.facts", "ReferencedType");
> Object instance = referencedType.newInstance();
> referencedType.set(instance, "str", "bar"); // Throws ClassCastException{noformat}
>
> This is similar to DROOLS-5449, but in this case we instantiate the fact from the updated fact type, so we believe that there is no API misuse.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
5 years, 2 months
[JBoss JIRA] (DROOLS-5560) ClassCastException on Fact Attribute Set After UpdateToVersion
by Matteo Casalino (Jira)
Matteo Casalino created DROOLS-5560:
---------------------------------------
Summary: ClassCastException on Fact Attribute Set After UpdateToVersion
Key: DROOLS-5560
URL: https://issues.redhat.com/browse/DROOLS-5560
Project: Drools
Issue Type: Bug
Components: core engine
Affects Versions: 7.41.0.Final
Reporter: Matteo Casalino
Assignee: Mario Fusco
Attachments: class-cast-exception-on-fact-attribute-set-after-update.zip
After updating a KieContainer with a change in a fact type _UnreferencedType_, if instances of another unrelated fact type _ReferencedType_ are modified in a rule, then setting any field of _ReferencedType_ through the _FactType_ API will throw a _ClassCastException_:
{noformat}
java.lang.ClassCastException: class org.example.facts.ReferencedType cannot be cast to class org.example.facts.ReferencedType (org.example.facts.ReferencedType is in unnamed module of loader org.drools.dynamic.DynamicProjectClassLoader$DefaultInternalTypesClassLoader @59901c4d; org.example.facts.ReferencedType is in unnamed module of loader org.drools.dynamic.DynamicProjectClassLoader$DefaultInternalTypesClassLoader @5e1fc2aa)
at org.drools.base.org.example.facts.ReferencedType1921143808$setStr.setValue(Unknown Source)
at org.drools.core.base.ClassFieldWriter.setValue(ClassFieldWriter.java:164)
at org.drools.core.base.ClassFieldAccessor.setValue(ClassFieldAccessor.java:246)
at org.drools.core.factmodel.ClassDefinition.set(ClassDefinition.java:278)
at org.example.reproducer.FactTypeUpdateTest.testUpdateThenSetFactAttribute(FactTypeUpdateTest.java:132)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58){noformat}
Below the example DRL that triggers the issue.
Initial DRL:
{noformat}
package org.example.facts
declare ReferencedType
str : String
end
declare UnreferencedType
x : int
end
package org.example.rules
import org.example.facts.*;
rule "rule updating ReferencedType"
"when
$x : ReferencedType( )
then
$x.setStr("foo");
update($x);
end{noformat}
Updated DRL:
{noformat}
package org.example.facts
declare ReferencedType
str : String
end
declare UnreferencedType
x : int
y : String // NEW ATTRIBUTE ADDED HERE
end
package org.example.rules
import org.example.facts.*;
rule "rule updating ReferencedType"
"when
$x : ReferencedType( )
then
$x.setStr("foo");
update($x);
end{noformat}
Throwing code example:
{noformat}
updateToVersion(); // Updates the KieContainer
KieBase kiebase = kieContainer.getKieBase("ExampleKiebase");
FactType referencedType = kiebase.getFactType("org.example.facts", "ReferencedType");
Object instance = referencedType.newInstance();
referencedType.set(instance, "str", "bar"); // Throws ClassCastException{noformat}
This is similar to DROOLS-5449, but in this case we instantiate the fact from the updated fact type, so we believe that there is no API misuse.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
5 years, 2 months