[JBoss JIRA] (DROOLS-4564) Reconnecting the Kie-server to the controller while using the WebSocket connection problem
by Mario Fusco (Jira)
[ https://issues.redhat.com/browse/DROOLS-4564?page=com.atlassian.jira.plug... ]
Mario Fusco updated DROOLS-4564:
--------------------------------
Sprint: (was: 2020 Week 01-03 (from Dec 30))
> Reconnecting the Kie-server to the controller while using the WebSocket connection problem
> ------------------------------------------------------------------------------------------
>
> Key: DROOLS-4564
> URL: https://issues.redhat.com/browse/DROOLS-4564
> Project: Drools
> Issue Type: Bug
> Components: integration, kie server
> Affects Versions: 7.24.0.Final
> Reporter: Marcin Kasza
> Assignee: Mario Fusco
> Priority: Major
>
> When the kie-server connects to the controller / workbench via web-sockets and this connection fails (e.g., due to network problems), the kie-server will try to reconnect.
> Reconnect thread started in WebSocketClientImpl (kie-server-controller-websocket-common), fails with NPE with log message: _WebSocketClientImpl: Unable to reconnect to the controller through the Null socket because of null_
> NPE is thrown because session.getRequestURI returns NULL value
> at this.session = container.connectToServer(this, this.config, session.getRequestURI());
> In my case kie-server (WebSocketContainer) running on tomcat 8.5
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
6 years, 5 months
[JBoss JIRA] (WFWIP-288) JWT signed by 1024 bit long key is rejected
by Darran Lofthouse (Jira)
[ https://issues.redhat.com/browse/WFWIP-288?page=com.atlassian.jira.plugin... ]
Darran Lofthouse commented on WFWIP-288:
----------------------------------------
Additionally I have raised this issue against the MicroProfile JWT specification https://github.com/eclipse/microprofile-jwt-auth/issues/142
[~jkasik] If you could please look at the references above, I think this one can be closed as an issue with the spec.
> JWT signed by 1024 bit long key is rejected
> -------------------------------------------
>
> Key: WFWIP-288
> URL: https://issues.redhat.com/browse/WFWIP-288
> Project: WildFly WIP
> Issue Type: Bug
> Components: MP JWT
> Reporter: Jan Kasik
> Assignee: Darran Lofthouse
> Priority: Blocker
>
> According to MP-JWT 1.1 specification, 1024 and 2048 bit key sizes must be supported. Though when there is JWT signed by 1024 bit long key presented to the server, it is rejected and client receives "Unauthorized" (code 401) message.
> See chapter 9.2. Supported Public Key Formats:
> {quote}
> Support for RSA Public Keys of 1024 or 2048 bits in length is required. Other key sizes are allowed, but should be considered vendor-specific.
> {quote}
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
6 years, 5 months
[JBoss JIRA] (DROOLS-1093) Database Outage causes Session Persistence to break
by Mario Fusco (Jira)
[ https://issues.redhat.com/browse/DROOLS-1093?page=com.atlassian.jira.plug... ]
Mario Fusco resolved DROOLS-1093.
---------------------------------
Resolution: Out of Date
> Database Outage causes Session Persistence to break
> ----------------------------------------------------
>
> Key: DROOLS-1093
> URL: https://issues.redhat.com/browse/DROOLS-1093
> Project: Drools
> Issue Type: Bug
> Components: core engine
> Affects Versions: 6.3.0.Final
> Environment: Mac OS 10.10.5, Eclipse Mars Release, Java 1.8, Drools 6.3.0.Final
> Docs QE Status: NEW
> Reporter: Artur Kronenberg
> Assignee: Mario Fusco
> Priority: Major
> Attachments: test-standalone.zip, test-standalone.zip
>
>
> Hi,
> I have ran into this a number of times and I am still working on the reproducer. I decided to raise this issue in case someone has seen something similar and/or I am on the wrong track and I'd rather know now before spending even more days on chasing this down.
> We had a DB outage 2 nights ago, and I have a timer task inserting 1 object into my rules every minute. The first time this happened with the DB outage, the result was:
> {code:java}
> java.lang.RuntimeException: Unable to commit transaction
> at org.drools.persistence.jta.JtaTransactionManager.commit(JtaTransactionManager.java:239) ~[drools-persistence-jpa-6.3.0.Final.jar:6.3.0.Final]
> at org.drools.persistence.SingleSessionCommandService$TransactionInterceptor.execute(SingleSessionCommandService.java:587) ~[drools-persistence-jpa-6.3.0.Final.jar:6.3.0.Final]
> at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:377) ~[drools-persistence-jpa-6.3.0.Final.jar:6.3.0.Final]
> at org.drools.core.command.impl.CommandBasedStatefulKnowledgeSession.insert(CommandBasedStatefulKnowledgeSession.java:410) ~[drools-core-6.3.0.Final.jar:6.3.0.Final]
> at io.shureview.drools.model.impl.SessionHolder.insert(SessionHolder.java:62) ~[shureview-drools-engine-1.0.jar:na]
> at io.shureview.drools.tasks.ExpiryTimerTask.lambda$run$18(ExpiryTimerTask.java:60) ~[shureview-drools-engine-1.0.jar:na]
> at java.util.concurrent.ConcurrentHashMap$ValuesView.forEach(ConcurrentHashMap.java:4707) ~[na:1.8.0_72]
> at io.shureview.drools.tasks.ExpiryTimerTask.run(ExpiryTimerTask.java:55) ~[shureview-drools-engine-1.0.jar:na]
> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_72]
> at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [na:1.8.0_72]
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_72]
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [na:1.8.0_72]
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_72]
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_72]
> at java.lang.Thread.run(Thread.java:745) [na:1.8.0_72]
> Caused by: bitronix.tm.internal.BitronixRollbackException: RuntimeException thrown during beforeCompletion cycle caused transaction rollback
> at bitronix.tm.BitronixTransaction.commit(BitronixTransaction.java:241) ~[btm-2.1.4.jar:2.1.4]
> at bitronix.tm.BitronixTransactionManager.commit(BitronixTransactionManager.java:143) ~[btm-2.1.4.jar:2.1.4]
> at org.drools.persistence.jta.JtaTransactionManager.commit(JtaTransactionManager.java:236) ~[drools-persistence-jpa-6.3.0.Final.jar:6.3.0.Final]
> ... 14 common frames omitted
> Caused by: javax.persistence.PersistenceException: org.hibernate.exception.JDBCConnectionException: could not execute statement
> at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1387) ~[hibernate-entitymanager-4.2.21.Final.jar:4.2.21.Final]
> at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1310) ~[hibernate-entitymanager-4.2.21.Final.jar:4.2.21.Final]
> at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1316) ~[hibernate-entitymanager-4.2.21.Final.jar:4.2.21.Final]
> at org.hibernate.ejb.AbstractEntityManagerImpl$CallbackExceptionMapperImpl.mapManagedFlushFailure(AbstractEntityManagerImpl.java:1510) ~[hibernate-entitymanager-4.2.21.Final.jar:4.2.21.Final]
> at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorNonTrackingImpl.beforeCompletion(SynchronizationCallbackCoordinatorNonTrackingImpl.java:114) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
> at org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization.beforeCompletion(RegisteredSynchronization.java:53) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
> at bitronix.tm.BitronixTransaction.fireBeforeCompletionEvent(BitronixTransaction.java:532) ~[btm-2.1.4.jar:2.1.4]
> at bitronix.tm.BitronixTransaction.commit(BitronixTransaction.java:235) ~[btm-2.1.4.jar:2.1.4]
> ... 16 common frames omitted
> Caused by: org.hibernate.exception.JDBCConnectionException: could not execute statement
> at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:132) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
> at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
> at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:124) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
> at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
> at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:189) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
> at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3240) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
> at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:3138) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
> at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3468) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
> at org.hibernate.action.internal.EntityUpdateAction.execute(EntityUpdateAction.java:140) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
> at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:395) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
> at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:387) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
> at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:304) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
> at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:349) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
> at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:56) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
> at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1195) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
> at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:404) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
> at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorNonTrackingImpl.beforeCompletion(SynchronizationCallbackCoordinatorNonTrackingImpl.java:109) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
> ... 19 common frames omitted
> Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Connection reset
> at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1884) ~[sqljdbc4-4.2.jar:na]
> at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1868) ~[sqljdbc4-4.2.jar:na]
> at com.microsoft.sqlserver.jdbc.TDSChannel.write(IOBuffer.java:1855) ~[sqljdbc4-4.2.jar:na]
> at com.microsoft.sqlserver.jdbc.TDSWriter.flush(IOBuffer.java:4215) ~[sqljdbc4-4.2.jar:na]
> at com.microsoft.sqlserver.jdbc.TDSWriter.writePacket(IOBuffer.java:4116) ~[sqljdbc4-4.2.jar:na]
> at com.microsoft.sqlserver.jdbc.TDSWriter.endMessage(IOBuffer.java:3122) ~[sqljdbc4-4.2.jar:na]
> at com.microsoft.sqlserver.jdbc.TDSCommand.startResponse(IOBuffer.java:7127) ~[sqljdbc4-4.2.jar:na]
> at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:444) ~[sqljdbc4-4.2.jar:na]
> at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:383) ~[sqljdbc4-4.2.jar:na]
> at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:6703) ~[sqljdbc4-4.2.jar:na]
> at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1929) ~[sqljdbc4-4.2.jar:na]
> at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:184) ~[sqljdbc4-4.2.jar:na]
> at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:159) ~[sqljdbc4-4.2.jar:na]
> at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(SQLServerPreparedStatement.java:326) ~[sqljdbc4-4.2.jar:na]
> at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:186) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
> ... 31 common frames omitted
> {code}
> This is then followed by:
> {code:java}
> java.lang.RuntimeException: Unable to load session snapshot
> at org.drools.persistence.SessionMarshallingHelper.loadSnapshot(SessionMarshallingHelper.java:103) ~[drools-persistence-jpa-6.3.0.Final.jar:6.3.0.Final]
> at org.drools.persistence.SingleSessionCommandService.initExistingKnowledgeSession(SingleSessionCommandService.java:242) ~[drools-persistence-jpa-6.3.0.Final.jar:6.3.0.Final]
> at org.drools.persistence.SingleSessionCommandService$TransactionInterceptor.execute(SingleSessionCommandService.java:557) ~[drools-persistence-jpa-6.3.0.Final.jar:6.3.0.Final]
> at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:377) ~[drools-persistence-jpa-6.3.0.Final.jar:6.3.0.Final]
> at org.drools.core.command.impl.CommandBasedStatefulKnowledgeSession.insert(CommandBasedStatefulKnowledgeSession.java:410) ~[drools-core-6.3.0.Final.jar:6.3.0.Final]
> at io.shureview.drools.model.impl.SessionHolder.insert(SessionHolder.java:62) ~[shureview-drools-engine-1.0.jar:na]
> at io.shureview.drools.tasks.ExpiryTimerTask.lambda$run$18(ExpiryTimerTask.java:60) ~[shureview-drools-engine-1.0.jar:na]
> at java.util.concurrent.ConcurrentHashMap$ValuesView.forEach(ConcurrentHashMap.java:4707) ~[na:1.8.0_72]
> at io.shureview.drools.tasks.ExpiryTimerTask.run(ExpiryTimerTask.java:55) ~[shureview-drools-engine-1.0.jar:na]
> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_72]
> at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [na:1.8.0_72]
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_72]
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [na:1.8.0_72]
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_72]
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_72]
> at java.lang.Thread.run(Thread.java:745) [na:1.8.0_72]
> Caused by: java.lang.NullPointerException: null
> at org.drools.core.marshalling.impl.ProtobufInputMarshaller.readTruthMaintenanceSystem(ProtobufInputMarshaller.java:586) ~[drools-core-6.3.0.Final.jar:6.3.0.Final]
> at org.drools.core.marshalling.impl.ProtobufInputMarshaller.readSession(ProtobufInputMarshaller.java:247) ~[drools-core-6.3.0.Final.jar:6.3.0.Final]
> at org.drools.core.marshalling.impl.ProtobufInputMarshaller.readSession(ProtobufInputMarshaller.java:118) ~[drools-core-6.3.0.Final.jar:6.3.0.Final]
> at org.drools.core.marshalling.impl.ProtobufMarshaller.unmarshall(ProtobufMarshaller.java:131) ~[drools-core-6.3.0.Final.jar:6.3.0.Final]
> at org.drools.persistence.SessionMarshallingHelper.loadSnapshot(SessionMarshallingHelper.java:95) ~[drools-persistence-jpa-6.3.0.Final.jar:6.3.0.Final]
> ... 15 common frames omitted
> {code}
> My rules update and retract facts each time the rules are run.
> I wonder if somehow an object is removed from the working memory, then the persistence fails to update the table, the rollback does not rollback the working memory, and the persistence is broken.
> I have NOT found a solution for this so far. I was wondering though, is there a way for me to run a replace-all flush operation to simply serialise the working state of my session and throw away all other data. This could be a temporary workaround.
> Thanks and let me know if there is something else you need. I will try and add a reproducer as soon as I can.
> P.S.: Not sure if this may be Bitronix at fault here. I am running without a container, so I provided this standalone implementation for JTA.
> Thanks,
> Artur
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
6 years, 5 months
[JBoss JIRA] (DROOLS-4662) Resources added through KieHelper get interpreted using the default character set
by Mario Fusco (Jira)
[ https://issues.redhat.com/browse/DROOLS-4662?page=com.atlassian.jira.plug... ]
Mario Fusco edited comment on DROOLS-4662 at 12/18/19 10:53 AM:
----------------------------------------------------------------
I tried on master the following test case setting the file.enconding as you suggested but it works for me
{code}
@Test
public void testI18NKieHelper() throws UnsupportedEncodingException {
String testString = "\u2200x. \u2203y. x < y";
String rules =
"rule \"foo\"\n" +
" when\n" +
" not String()\n" +
" then\n" +
" insert(\"" + testString + "\");\n" +
" end\n";
KieServices kieServices = KieServices.Factory.get();
KieHelper kieHelper = new KieHelper();
Resource rulesResource = kieServices.getResources().newByteArrayResource(rules.getBytes("UTF-8"), "UTF-8");
rulesResource.setTargetPath("src/main/resources/rules.drl");
kieHelper.addResource(rulesResource);
KieBase kieBase = kieHelper.build();
KieSession kieSession = kieBase.newKieSession();
kieSession.fireAllRules();
String out = (String) kieSession.getObjects().iterator().next();
System.out.println(out);
assertEquals(out, testString);
}
{code}
and prints
∀x. ∃y. x < y
I also tried the opposite with this slightly modified test case
{code}
@Test
public void testI18NKieHelper() throws UnsupportedEncodingException {
String testString = new String("\u2200x. \u2203y. x < y".getBytes( "latin1" ));
String rules =
"rule \"foo\"\n" +
" when\n" +
" not String()\n" +
" then\n" +
" insert(\"" + testString + "\");\n" +
" end\n";
KieServices kieServices = KieServices.Factory.get();
KieHelper kieHelper = new KieHelper();
Resource rulesResource = kieServices.getResources().newByteArrayResource(rules.getBytes("latin1"), "latin1");
rulesResource.setTargetPath("src/main/resources/rules.drl");
kieHelper.addResource(rulesResource);
KieBase kieBase = kieHelper.build();
KieSession kieSession = kieBase.newKieSession();
kieSession.fireAllRules();
String out = (String) kieSession.getObjects().iterator().next();
System.out.println(out);
assertEquals(out, testString);
}
{code}
e.g. setting both the encoding of string and rule resource to latin1 and this also works adn prints as expected
?x. ?y. x < y
As a final note consider that in all cases the KieHelper class is only intended for internal use and it is not part of our API.
was (Author: mfusco):
I tried on master the following test case setting the file.enconding as you suggested but it works for me
{code}
@Test
public void testI18NKieHelper() throws UnsupportedEncodingException {
String testString = "\u2200x. \u2203y. x < y";
String rules =
"rule \"foo\"\n" +
" when\n" +
" not String()\n" +
" then\n" +
" insert(\"" + testString + "\");\n" +
" end\n";
KieServices kieServices = KieServices.Factory.get();
KieHelper kieHelper = new KieHelper();
Resource rulesResource = kieServices.getResources().newByteArrayResource(rules.getBytes("UTF-8"), "UTF-8");
rulesResource.setTargetPath("src/main/resources/rules.drl");
kieHelper.addResource(rulesResource);
KieBase kieBase = kieHelper.build();
KieSession kieSession = kieBase.newKieSession();
kieSession.fireAllRules();
String out = (String) kieSession.getObjects().iterator().next();
System.out.println(out);
assertEquals(out, testString);
}
{code}
and prints
∀x. ∃y. x < y
I also tried the opposite with this slightly modified test case
{code}
@Test
public void testI18NKieHelper() throws UnsupportedEncodingException {
String testString = new String("\u2200x. \u2203y. x < y".getBytes( "latin1" ));
String rules =
"rule \"foo\"\n" +
" when\n" +
" not String()\n" +
" then\n" +
" insert(\"" + testString + "\");\n" +
" end\n";
KieServices kieServices = KieServices.Factory.get();
KieHelper kieHelper = new KieHelper();
Resource rulesResource = kieServices.getResources().newByteArrayResource(rules.getBytes("latin1"), "latin1");
rulesResource.setTargetPath("src/main/resources/rules.drl");
kieHelper.addResource(rulesResource);
KieBase kieBase = kieHelper.build();
KieSession kieSession = kieBase.newKieSession();
kieSession.fireAllRules();
String out = (String) kieSession.getObjects().iterator().next();
System.out.println(out);
assertEquals(out, testString);
}
{code]
e.g. setting both the encoding of string and rule resource to latin1 and this also works adn prints as expected
?x. ?y. x < y
As a final note consider that in all cases the KieHelper class is only intended for internal use and it is not part of our API.
> Resources added through KieHelper get interpreted using the default character set
> ---------------------------------------------------------------------------------
>
> Key: DROOLS-4662
> URL: https://issues.redhat.com/browse/DROOLS-4662
> Project: Drools
> Issue Type: Bug
> Affects Versions: 7.10.0.Final, 7.20.0.Final, 7.28.0.Final
> Environment: Windows. Can be reproduced on other OSes using "-Dfile.encoding=latin1".
> Reporter: Max Zerzouri
> Assignee: Mario Fusco
> Priority: Major
> Attachments: Test.java
>
>
> When a resource is added using {{KieHelper.addResource}}, any specified encoding is ignored when it is added to the {{MemoryFileSystem}} by {{KieFileSystemImpl.write(Resource)}} (effectively assuming the {{InputStream}} is already encoded in UTF-8).
> Additionally, when the resource is read again by {{AbstractKieModule.getResource}}, it constructs a {{Resource}} object with no encoding specified, whereas it should probably specify an encoding of UTF-8, since it seems that sources are considered to be UTF-8 already at least in the case of the {{MemoryKieModule}}.
> I've attached a fairly minimal test case where the rules bytes are passed in UTF-8 with the encoding explicitly specified. This currently produces an error when the default file encoding is not UTF-8 (eg, by passing {{-Dfile.encoding=latin1}} as a JVM argument, or by using the default arguments on Windows).
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
6 years, 5 months
[JBoss JIRA] (DROOLS-4662) Resources added through KieHelper get interpreted using the default character set
by Mario Fusco (Jira)
[ https://issues.redhat.com/browse/DROOLS-4662?page=com.atlassian.jira.plug... ]
Mario Fusco resolved DROOLS-4662.
---------------------------------
Resolution: Cannot Reproduce
I tried on master the following test case setting the file.enconding as you suggested but it works for me
{code}
@Test
public void testI18NKieHelper() throws UnsupportedEncodingException {
String testString = "\u2200x. \u2203y. x < y";
String rules =
"rule \"foo\"\n" +
" when\n" +
" not String()\n" +
" then\n" +
" insert(\"" + testString + "\");\n" +
" end\n";
KieServices kieServices = KieServices.Factory.get();
KieHelper kieHelper = new KieHelper();
Resource rulesResource = kieServices.getResources().newByteArrayResource(rules.getBytes("UTF-8"), "UTF-8");
rulesResource.setTargetPath("src/main/resources/rules.drl");
kieHelper.addResource(rulesResource);
KieBase kieBase = kieHelper.build();
KieSession kieSession = kieBase.newKieSession();
kieSession.fireAllRules();
String out = (String) kieSession.getObjects().iterator().next();
System.out.println(out);
assertEquals(out, testString);
}
{code}
and prints
∀x. ∃y. x < y
I also tried the opposite with this slightly modified test case
{code}
@Test
public void testI18NKieHelper() throws UnsupportedEncodingException {
String testString = new String("\u2200x. \u2203y. x < y".getBytes( "latin1" ));
String rules =
"rule \"foo\"\n" +
" when\n" +
" not String()\n" +
" then\n" +
" insert(\"" + testString + "\");\n" +
" end\n";
KieServices kieServices = KieServices.Factory.get();
KieHelper kieHelper = new KieHelper();
Resource rulesResource = kieServices.getResources().newByteArrayResource(rules.getBytes("latin1"), "latin1");
rulesResource.setTargetPath("src/main/resources/rules.drl");
kieHelper.addResource(rulesResource);
KieBase kieBase = kieHelper.build();
KieSession kieSession = kieBase.newKieSession();
kieSession.fireAllRules();
String out = (String) kieSession.getObjects().iterator().next();
System.out.println(out);
assertEquals(out, testString);
}
{code]
e.g. setting both the encoding of string and rule resource to latin1 and this also works adn prints as expected
?x. ?y. x < y
As a final note consider that in all cases the KieHelper class is only intended for internal use and it is not part of our API.
> Resources added through KieHelper get interpreted using the default character set
> ---------------------------------------------------------------------------------
>
> Key: DROOLS-4662
> URL: https://issues.redhat.com/browse/DROOLS-4662
> Project: Drools
> Issue Type: Bug
> Affects Versions: 7.10.0.Final, 7.20.0.Final, 7.28.0.Final
> Environment: Windows. Can be reproduced on other OSes using "-Dfile.encoding=latin1".
> Reporter: Max Zerzouri
> Assignee: Mario Fusco
> Priority: Major
> Attachments: Test.java
>
>
> When a resource is added using {{KieHelper.addResource}}, any specified encoding is ignored when it is added to the {{MemoryFileSystem}} by {{KieFileSystemImpl.write(Resource)}} (effectively assuming the {{InputStream}} is already encoded in UTF-8).
> Additionally, when the resource is read again by {{AbstractKieModule.getResource}}, it constructs a {{Resource}} object with no encoding specified, whereas it should probably specify an encoding of UTF-8, since it seems that sources are considered to be UTF-8 already at least in the case of the {{MemoryKieModule}}.
> I've attached a fairly minimal test case where the rules bytes are passed in UTF-8 with the encoding explicitly specified. This currently produces an error when the default file encoding is not UTF-8 (eg, by passing {{-Dfile.encoding=latin1}} as a JVM argument, or by using the default arguments on Windows).
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
6 years, 5 months
[JBoss JIRA] (WFCORE-4778) Legacy LDAP realm, runtime operations and access to runtime attributes fail
by Darran Lofthouse (Jira)
[ https://issues.redhat.com/browse/WFCORE-4778?page=com.atlassian.jira.plug... ]
Darran Lofthouse reassigned WFCORE-4778:
----------------------------------------
Assignee: Richard Opalka (was: Darran Lofthouse)
> Legacy LDAP realm, runtime operations and access to runtime attributes fail
> ---------------------------------------------------------------------------
>
> Key: WFCORE-4778
> URL: https://issues.redhat.com/browse/WFCORE-4778
> Project: WildFly Core
> Issue Type: Bug
> Components: Security
> Affects Versions: 10.0.0.Final
> Reporter: Ondrej Kotek
> Assignee: Richard Opalka
> Priority: Blocker
> Labels: caching, ldap, legacy
> Fix For: 11.0.0.Final
>
>
> Runtime operations and access to runtime attributes fail for legacy LDAP realm.
> {noformat}
> ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 2) WFLYCTL0013: Operation ("read-attribute") failed - address: ([
> ("core-service" => "management"),
> ("security-realm" => "authn-by-search-time-neg-neg"),
> ("authentication" => "ldap"),
> ("cache" => "by-search-time")
> ]): java.lang.UnsupportedOperationException
> at org.jboss.msc.service.ServiceControllerImpl.awaitValue(ServiceControllerImpl.java:1115)
> at org.jboss.msc.service.DelegatingServiceController.awaitValue(DelegatingServiceController.java:110)
> at org.jboss.as.domain.management.security.LdapCacheResourceDefinition$BaseRuntimeOpHandler.lookupService(LdapCacheResourceDefinition.java:321)
> at org.jboss.as.domain.management.security.LdapCacheResourceDefinition$BaseRuntimeOpHandler.readAttribute(LdapCacheResourceDefinition.java:288)
> at org.jboss.as.domain.management.security.LdapCacheResourceDefinition$BaseRuntimeOpHandler$1.execute(LdapCacheResourceDefinition.java:269)
> at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:999)
> at org.jboss.as.controller.AbstractOperationContext.processStages(AbstractOperationContext.java:743)
> at org.jboss.as.controller.AbstractOperationContext.executeOperation(AbstractOperationContext.java:467)
> at org.jboss.as.controller.OperationContextImpl.executeOperation(OperationContextImpl.java:1413)
> at org.jboss.as.controller.ModelControllerImpl.internalExecute(ModelControllerImpl.java:423)
> at org.jboss.as.controller.ModelControllerImpl.lambda$execute$1(ModelControllerImpl.java:243)
> at org.wildfly.security.auth.server.SecurityIdentity.runAs(SecurityIdentity.java:289)
> at org.wildfly.security.auth.server.SecurityIdentity.runAs(SecurityIdentity.java:255)
> at org.jboss.as.controller.ModelControllerImpl.execute(ModelControllerImpl.java:243)
> at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler.doExecute(ModelControllerClientOperationHandler.java:240)
> at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler.access$400(ModelControllerClientOperationHandler.java:138)
> at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler$1$1.run(ModelControllerClientOperationHandler.java:162)
> at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler$1$1.run(ModelControllerClientOperationHandler.java:158)
> at org.wildfly.security.auth.server.SecurityIdentity.runAs(SecurityIdentity.java:313)
> at org.wildfly.security.auth.server.SecurityIdentity.runAs(SecurityIdentity.java:270)
> at org.jboss.as.controller.AccessAuditContext.doAs(AccessAuditContext.java:254)
> at org.jboss.as.controller.AccessAuditContext.doAs(AccessAuditContext.java:225)
> at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler$1.execute(ModelControllerClientOperationHandler.java:158)
> at org.jboss.as.protocol.mgmt.ManagementRequestContextImpl$1.doExecute(ManagementRequestContextImpl.java:70)
> at org.jboss.as.protocol.mgmt.ManagementRequestContextImpl$AsyncTaskRunner.run(ManagementRequestContextImpl.java:160)
> at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
> at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
> at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
> at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
> at java.lang.Thread.run(Thread.java:748)
> at org.jboss.threads.JBossThread.run(JBossThread.java:485)
> {noformat}
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
6 years, 5 months