tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jonathan Gallimore (JIRA)" <>
Subject [jira] [Created] (TOMEE-2151) Use correct classloader for creating application resources specified in resources.xml
Date Tue, 28 Nov 2017 20:46:00 GMT
Jonathan Gallimore created TOMEE-2151:

             Summary: Use correct classloader for creating application resources specified
in resources.xml
                 Key: TOMEE-2151
             Project: TomEE
          Issue Type: Bug
    Affects Versions: 7.0.4, 1.7.5
            Reporter: Jonathan Gallimore
            Assignee: Jonathan Gallimore

I have been digging into our support for connectors in WARs and EARs, and I believe I have
uncovered (and hopefully patched) a few issues, relating to EAR deployments, and defining
containers in an application's resources.xml file. I have 2 PRs (which are not ready to be
merged yet), and both have a sample with a connector in a WAR and a connector in a EAR file.

In essence, the issue that I have run into, is where the resource adapter and container are
defined in an application's resources.xml, like this:

    <Resource id="SampleResourceAdapter" class-name="org.superbiz.connector.adapter.SampleResourceAdapter">

    <Container id="SampleMDBContainer" ctype="MESSAGE">

    <Resource id="SampleConnectionFactory" type="org.superbiz.connector.api.SampleConnectionFactory"

when that application is deployed through webapps, either as an EAR or a WAR, it would fail:

at org.apache.openejb.assembler.classic.Assembler.replaceResourceAdapterProperty(
at org.apache.openejb.assembler.classic.Assembler.createContainer(
at org.apache.openejb.config.ConfigurationFactory.install(
at org.apache.openejb.config.AutoConfig.processApplicationContainers(
at org.apache.openejb.config.AutoConfig.deploy(
at org.apache.openejb.config.ConfigurationFactory$Chain.deploy(
at org.apache.openejb.config.ConfigurationFactory.configureApplication(

In essence what was happening was, the resource for SampleResourceAdapter was being created
as a lazy resource (i.e. initialized on first lookup), and the creation of the container (which
happened with TCCL being set to the main TomEE classloader), triggered that lookup, which
failed with a class not found exception. 

This message was sent by Atlassian JIRA

View raw message