tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 62224] SafeForkJoinWorkerThreadFactory breaks class loading on org.apache.naming.java.javaURLContextFactory
Date Thu, 29 Mar 2018 02:03:34 GMT
https://bz.apache.org/bugzilla/show_bug.cgi?id=62224

Behrooz Nobakht <nobeh5@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |NEW

--- Comment #3 from Behrooz Nobakht <nobeh5@gmail.com> ---
Extracting a minimal reproducible example is quite difficult for me. I will
explain the current situation as is.

Tomcat is used with a custom server.xml:

<?xml version='1.0' encoding='utf-8'?>
<Server port="${shutdown.port}" shutdown="SHUTDOWN">
    <Listener className="org.apache.catalina.startup.VersionLoggerListener"/>
    <Listener className="org.apache.catalina.core.AprLifecycleListener"
SSLEngine="on"/>
    <Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
    <Listener
className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/>
    <Listener
className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>
    <Service name="Catalina">
        <Connector port="${port}" protocol="HTTP/1.1"
                   maxHttpHeaderSize="8192" maxThreads="150"
minSpareThreads="25" useBodyEncodingForURI="true"
                   enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000"
                   disableUploadTimeout="true"/>
        <Engine name="Catalina" defaultHost="localhost">
            <Host name="localhost" appBase="webapps" unpackWARs="true"
autoDeploy="true">
                <Context
containerSciFilter="org.apache.tomcat.websocket.server.WsSci"
path="${app.context}"
                         docBase="${app.docbase}" workDir="${tomcat.workdir}"
reloadable="false" useHttpOnly="true">
                    <Resource name="UserTransaction" auth="Container"
type="javax.transaction.UserTransaction"
                             
factory="org.objectweb.jotm.UserTransactionFactory" jotm.timeout="60"/>
                    <Manager pathname=""/>
                </Context>
                <Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs"
                       prefix="localhost_access_log." suffix=".txt"
                       pattern="%h %l %u %t &quot;%r&quot; %s %b %D"/>
            </Host>
        </Engine>
    </Service>
</Server>


Please note the definition of `Resource` in above.

When accessing one of the HTTP endpoints on the app, a business objects wants
for the first time to gain access to the JNDI resource
`java:env/comp/UserTransaction`. 

Because there's no custom definition of NamingContext provider API, the default
is picked by javax.naming.InitialContext. 

This is L313 of javax.naming.InitialContext in Java 1.8.0_172:

defaultInitCtx = NamingManager.getInitialContext(myProps);

`myProps` is filled by Catalina bootstrap to point to Apache Naming
implementation.

Going further down the stack, you will reach
com.sun.naming.internal.VersionHelper12 at L61:

return loadClass(className, getContextClassLoader());

The fix for ForkJoinWorkerThreadFactory means that there will be no context
class loader, which means it will be "system" class loader and eventually leads
to ClassNotFoundException.


Hope this clarifies further the issue.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message