[
https://issues.redhat.com/browse/WFLY-13391?page=com.atlassian.jira.plugi...
]
Dheeraj Joshi updated WFLY-13391:
---------------------------------
Workaround Description:
In our code where we are getting class loader, Rather than using context class loader we
are trying to get the current objects class loader and setting it to current threads class
loader and in finally block resetting the class loader to original value.
{code:java}
try {
final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
if (classLoader == null) {
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
}
clazz = Class.forName(className, true, classLoader);
} catch (final Exception e) {
throw new JbpmClassNotFoundException("couldn't load class " + className,
e);
} finally {
Thread.currentThread().setContextClassLoader(classLoader);
}
{code}
We don't know the consequence of this work around to our application.
was:
In our code where we are getting class loader, Rather than using context class loader we
are trying to get the current objects class loader and setting it to current threads class
loader and in finally block resetting the class loader to original value.
{code:java}
try {
final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
if (classLoader == null) {
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
}
clazz = Class.forName(className, true, classLoader);
} catch (final Exception e) {
throw new JbpmClassNotFoundException("couldn't load class " + className,
e);
} finally {
Thread.currentThread().setContextClassLoader(classLoader);
}
{code}
We don't know the consequence of this work around to our application.
getContextClassLoader is null in Managed thread factory
-------------------------------------------------------
Key: WFLY-13391
URL:
https://issues.redhat.com/browse/WFLY-13391
Project: WildFly
Issue Type: Bug
Components: Concurrency Utilities
Affects Versions: 18.0.1.Final, 19.0.0.Final
Reporter: Dheeraj Joshi
Assignee: Eduardo Martins
Priority: Major
Attachments: WildFly-16-server.log, WildFly-17-server.log, WildFly-18-server.log
We are using managed-thread-factory and Threads belong to this do not have context class
loader associated with it
{code:java}
<managed-thread-factories>
<managed-thread-factory name="FlowWorkManagerThreadFactory"
jndi-name="java:jboss/ee/concurrency/factory/FlowWorkManagerThreadFactory"
context-service="default"/>
</managed-thread-factories>
<managed-executor-services>
<managed-executor-service
name="InteractiveWorkflowWorkManagerExecutorService"
jndi-name="java:jboss/ee/concurrency/executor/FLOW_MANAGEDEXECUTOR"
core-threads="${threadpool.interactiveWorkflow.minthread}"
max-threads="${threadpool.interactiveWorkflow.maxthread}"
keepalive-time="5000"
queue-length="${threadpool.interactiveWorkflow.queuesize}"
thread-factory="FlowWorkManagerThreadFactory"
hung-task-threshold="600000" />
</managed-executor-services>
{code}
classLoader variable in below code
{code:java}
final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
{code}
evaluates as null when called inside managed thread.
Same code works fine with {{Wildfly 16}} and {{Wildfly 17.0.1}}
In 16 and 17.0.1 The class loader is from Service module loader.
Server logs with {{org.jboss.as.ee}} in {{TRACE}} level for {{Wildfly 16, 17.0.1 and
18}} are attached.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)