TomEE7 - JNDI lookup in web application fails on TomEE 7 web profile runtime

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

TomEE7 - JNDI lookup in web application fails on TomEE 7 web profile runtime

Adem
Hi

we are trying to migrate an existing web application from following runtimes

  *   Java EE 6 webprofile (working)
  *   Java Web Tomcat 7 (working)
to

  *   TomEE 7 web profile (not working)
  *   Java Web Tomcat 8 (working)

While this worked out of the box for Web Tomcat 8 we are struggling to make it work for the TomEE 7 web profile.
The JNDI lookup for a resource is not working with the TomEE 7 web profile.
I am suspecting a misconfiguration on my site but I am not sure what needs to be corrected.

Following some config files and logs.

context.xml file:


<?xml version="1.0" encoding="UTF-8"?>

<Context>

    <Resource name="jms/default" auth="Container"

        type="javax.jms.ConnectionFactory"

        description="JMS Connection Factory"

        factory="com.<replaced>.GenericBindingObjectFactory"

        java.naming.binding="default" />





    <Resource name="connectivityConfiguration"

        auth="Container"

        type="com.<replaced>.ConnectivityConfiguration"

        factory="com.<replaced>.ServiceObjectFactory" />

</Context>

web.xml file:


<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"

    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd<http://java.sun.com/xml/ns/javaee%20http:/java.sun.com/xml/ns/javaee/web-app_2_5.xsd>" id="WebApp_ID" version="2.5">

    <resource-ref>

        <res-ref-name>jms/default</res-ref-name>

        <res-type>javax.jms.ConnectionFactory</res-type>

    </resource-ref>



... some servlets



    <resource-ref>

        <res-ref-name>connectivityConfiguration</res-ref-name>

        <res-type>com.<replaced>.ConnectivityConfiguration</res-type>

    </resource-ref>





</web-app>

The jms/default resource is found while the connectivityConfiguration is not.
The difference is that jms/default type class and factory is residing in the project and is provided within the deployed application WAR.
The connectivityConfiguration resource cannot be found. The class and its factory is provided from the runtime environment.


LOG (when resources are defined in context.xml)

2020 10 27 11:12:00#+00#ERROR##anonymous#localhost-startStop-1#na#xxxx#conntest7#web##na#na#na#na#Failed to lookup 'java:comp/env/connectivityConfiguration' from InitialContext. javax.naming.NamingException: Could not load resource factory class
        at org.apache.naming.factory.FactoryBase.getObjectInstance(FactoryBase.java:70)
        at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:839)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:159)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:827)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:159)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:827)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:173)
        at org.apache.naming.SelectorContext.lookup(SelectorContext.java:163)
.....
Caused by: java.lang.ClassNotFoundException: <replaced with placeholder>.ServiceObjectFactory
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1358)
        at org.apache.tomee.catalina.TomEEWebappClassLoader.loadClass(TomEEWebappClassLoader.java:208)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1180)
        at org.apache.naming.factory.FactoryBase.getObjectInstance(FactoryBase.java:65)
        ... 48 common frames omitted
|

|
2020 10 27 11:12:00#+00#ERROR#OpenEJB.startup##anonymous#localhost-startStop-1#na#xxxx#conntest7#web##na#na#na#na#Unable to register MBean  java.lang.NullPointerException: Delegate cannot be null
        at org.apache.openejb.monitoring.MBeanPojoWrapper.<init>(MBeanPojoWrapper.java:65)
        at org.apache.openejb.assembler.classic.Assembler.registerAsMBean(Assembler.java:3393)
        at org.apache.openejb.assembler.classic.Assembler.doCreateResource(Assembler.java:3367)
        at org.apache.openejb.assembler.classic.Assembler.createResource(Assembler.java:2996)
        at org.apache.openejb.config.ConfigurationFactory.doInstall(ConfigurationFactory.java:466)
        at org.apache.openejb.config.ConfigurationFactory.install(ConfigurationFactory.java:459)
        at org.apache.openejb.config.AutoConfig.installResource(AutoConfig.java:2193)
        at org.apache.openejb.config.AutoConfig.processApplicationResources(AutoConfig.java:1026)
        at org.apache.openejb.config.AutoConfig.deploy(AutoConfig.java:191)
        at org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:420)
        at org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:1037)
        at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1281)
        at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1125)
        at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:133)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5053)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:970)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1840)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:836)
|
2020 10 27 11:12:00#+00#ERROR#OpenEJB##anonymous#localhost-startStop-1#na#xxxx#conntest7#web##na#na#na#na#Can't create resource null java.lang.ClassNotFoundException: ......ServiceObjectFactory
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1358)
        at org.apache.tomee.catalina.TomEEWebappClassLoader.loadClass(TomEEWebappClassLoader.java:208)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1180)
        at org.apache.tomee.catalina.TomcatResourceFactory.create(TomcatResourceFactory.java:75)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.xbean.recipe.ObjectRecipe.internalCreate(ObjectRecipe.java:301)
        at org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:96)
        at org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:61)
        at org.apache.openejb.assembler.classic.Assembler.doCreateResource(Assembler.java:3163)
        at org.apache.openejb.assembler.classic.Assembler.createResource(Assembler.java:2996)
        at org.apache.openejb.config.ConfigurationFactory.doInstall(ConfigurationFactory.java:466)
        at org.apache.openejb.config.ConfigurationFactory.install(ConfigurationFactory.java:459)
        at org.apache.openejb.config.AutoConfig.installResource(AutoConfig.java:2193)
        at org.apache.openejb.config.AutoConfig.processApplicationResources(AutoConfig.java:1026)
        at org.apache.openejb.config.AutoConfig.deploy(AutoConfig.java:191)
        at org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:420)
        at org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:1037)
        at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1281)
        at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1125)
        at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:133)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5053)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:970)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1840)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:836)
|
2020 10 27 11:12:00#+00#ERROR#OpenEJB.startup##anonymous#localhost-startStop-1#na#xxxx#conntest7#web##na#na#na#na#Unable to register MBean  java.lang.NullPointerException: Delegate cannot be null
        at org.apache.openejb.monitoring.MBeanPojoWrapper.<init>(MBeanPojoWrapper.java:65)
        at org.apache.openejb.assembler.classic.Assembler.registerAsMBean(Assembler.java:3393)
        at org.apache.openejb.assembler.classic.Assembler.doCreateResource(Assembler.java:3367)
        at org.apache.openejb.assembler.classic.Assembler.createResource(Assembler.java:2996)
        at org.apache.openejb.config.ConfigurationFactory.doInstall(ConfigurationFactory.java:466)
        at org.apache.openejb.config.ConfigurationFactory.install(ConfigurationFactory.java:459)
        at org.apache.openejb.config.AutoConfig.installResource(AutoConfig.java:2193)
        at org.apache.openejb.config.AutoConfig.processApplicationResources(AutoConfig.java:1026)
        at org.apache.openejb.config.AutoConfig.deploy(AutoConfig.java:191)
        at org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:420)
        at org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:1037)
        at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1281)
        at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1125)
        at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:133)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5053)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:970)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1840)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:836)



When I remove the context.xml and let the runtime automatically create the resources with DelegatingObjectFactory (also provided from the environment) this works for the mentioned ConnectivityConfiguration but another error happens  later on with a class that is actually not used at all.
java.lang.NoClassDefFoundError: org/apache/activemq/ra/ActiveMQResourceAdapter

LOG (without context.xml resource definition)


2020 10 27 08:30:04#+00#DEBUG#DelegatingObjectFactory#BC-NEO-RT-JAV#anonymous#localhost-startStop-1#xxxx#conntest7#web##na#na#na#na#Object instance with name [connectivityConfiguration]is created by factory [com.<replaced>.ServiceObjectFactory@2925057c<mailto:.ServiceObjectFactory@2925057c>]. |

2020 10 27 08:30:06#+00#ERROR#org.apache.catalina.core.ContainerBase##anonymous#localhost-startStop-1#na#xxxx#conntest7#web##na#na#na#na#ContainerBase.addChild: start:  org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]

        at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)

        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)

        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743)

        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)

        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705)

        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:970)

        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1840)

        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

        at java.util.concurrent.FutureTask.run(FutureTask.java:266)

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

        at java.lang.Thread.run(Thread.java:836)

Caused by: java.lang.NoClassDefFoundError: org/apache/activemq/ra/ActiveMQResourceAdapter

        at java.lang.ClassLoader.defineClass1(Native Method)

        at java.lang.ClassLoader.defineClass(ClassLoader.java:851)

        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)

        at java.net.URLClassLoader.defineClass(URLClassLoader.java:530)

        at java.net.URLClassLoader.access$100(URLClassLoader.java:76)

        at java.net.URLClassLoader$1.run(URLClassLoader.java:431)

        at java.net.URLClassLoader$1.run(URLClassLoader.java:425)

        at java.security.AccessController.doPrivileged(Native Method)

        at java.net.URLClassLoader.findClass(URLClassLoader.java:424)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:480)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:413)

        at java.lang.Class.forName0(Native Method)

        at java.lang.Class.forNameFW(Class.java:362)

        at java.lang.Class.forName(Class.java:355)

        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1310)

        at org.apache.tomee.catalina.TomEEWebappClassLoader.loadClass(TomEEWebappClassLoader.java:208)

        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1180)

        at java.lang.Class.forName0(Native Method)

        at java.lang.Class.forNameFW(Class.java:362)

        at java.lang.Class.forName(Class.java:355)

        at org.apache.xbean.recipe.RecipeHelper.loadClass(RecipeHelper.java:54)

        at org.apache.xbean.recipe.ObjectRecipe.getType(ObjectRecipe.java:356)

        at org.apache.xbean.recipe.ObjectRecipe.internalCreate(ObjectRecipe.java:269)

        at org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:96)

        at org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:61)

        at org.apache.openejb.assembler.classic.Assembler.doCreateResource(Assembler.java:3163)

        at org.apache.openejb.assembler.classic.Assembler.createResource(Assembler.java:2996)

        at org.apache.openejb.config.ConfigurationFactory.doInstall(ConfigurationFactory.java:466)

        at org.apache.openejb.config.ConfigurationFactory.install(ConfigurationFactory.java:459)

        at org.apache.openejb.config.AutoConfig.installResource(AutoConfig.java:2193)

        at org.apache.openejb.config.AutoConfig.getResourceId(AutoConfig.java:2043)

        at org.apache.openejb.config.AutoConfig.getResourceId(AutoConfig.java:1978)

        at org.apache.openejb.config.AutoConfig.installResource(AutoConfig.java:2180)

        at org.apache.openejb.config.AutoConfig.autoCreateResource(AutoConfig.java:2068)

        at org.apache.openejb.config.AutoConfig.getResourceId(AutoConfig.java:2056)

        at org.apache.openejb.config.AutoConfig.getResourceId(AutoConfig.java:1978)

        at org.apache.openejb.config.AutoConfig.processResourceRef(AutoConfig.java:1218)

        at org.apache.openejb.config.AutoConfig.deploy(AutoConfig.java:892)

        at org.apache.openejb.config.AutoConfig.deploy(AutoConfig.java:200)

        at org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:420)

        at org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:1037)

        at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1281)

        at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1125)

        at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:133)

        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)

        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5053)

        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)

        ... 10 common frames omitted

Caused by: java.lang.ClassNotFoundException: org.apache.activemq.ra.ActiveMQResourceAdapter

        at java.net.URLClassLoader.findClass(URLClassLoader.java:444)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:480)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:413)

        ... 57 common frames omitted

|

2020 10 27 08:30:06#+00#ERROR#org.apache.catalina.startup.HostConfig##anonymous#localhost-startStop-1#na#xxxx#conntest7#web##na#na#na#na#Error deploying web application archive [/usr/xxx/ljs/webapps/ROOT.war] java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]

        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:747)

        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)

        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705)

        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:970)

        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1840)

        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

        at java.util.concurrent.FutureTask.run(FutureTask.java:266)

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

        at java.lang.Thread.run(Thread.java:836)

|

The NoClassDefFoundError is most likely caused by the same reason as described here:
http://tomee-openejb.979440.n4.nabble.com/How-to-disable-default-TomEE-JMS-and-JDBC-resources-creation-td4688081.html

Ideally I would like to define the resource in the context.xml and make the lookup work but so far I am unable to make it work.
Do I miss something in the configuration for provided classes (type and factory) from the runtime environment?

I am also fine with an automatic resource creation if I can avoid the error thrown for the java.lang.NoClassDefFoundError: org/apache/activemq/ra/ActiveMQResourceAdapter
This class is definitely not present in the application WAR nor provided by the environment as it is not used.
Is there a way of an automatic resource creation but excluding specific resources?

Best regards,
Adem


Reply | Threaded
Open this post in threaded view
|

Re: TomEE7 - JNDI lookup in web application fails on TomEE 7 web profile runtime

jgallimore
> java.lang.NoClassDefFoundError:
org/apache/activemq/ra/ActiveMQResourceAdapter

What flavor of TomEE are you using? If you're using webprofile, you maybe
need to switch to plus or plume (which include ActiveMQ).

Where are com.<replaced>.ServiceObjectFactory and
com.<replaced>.GenericBindingObjectFactory on your classpath? Are they in
the application itself, or in the lib directory? If its in the webapp, can
you try putting the necessary classes in a jar in the lib folder? If that
works, that may suggest there's a bug we need to look at, but it would be
useful to know.

Jon

On Wed, Oct 28, 2020 at 2:48 PM Vural, Adem <[hidden email]> wrote:

> Hi
>
> we are trying to migrate an existing web application from following
> runtimes
>
>   *   Java EE 6 webprofile (working)
>   *   Java Web Tomcat 7 (working)
> to
>
>   *   TomEE 7 web profile (not working)
>   *   Java Web Tomcat 8 (working)
>
> While this worked out of the box for Web Tomcat 8 we are struggling to
> make it work for the TomEE 7 web profile.
> The JNDI lookup for a resource is not working with the TomEE 7 web profile.
> I am suspecting a misconfiguration on my site but I am not sure what needs
> to be corrected.
>
> Following some config files and logs.
>
> context.xml file:
>
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <Context>
>
>     <Resource name="jms/default" auth="Container"
>
>         type="javax.jms.ConnectionFactory"
>
>         description="JMS Connection Factory"
>
>         factory="com.<replaced>.GenericBindingObjectFactory"
>
>         java.naming.binding="default" />
>
>
>
>
>
>     <Resource name="connectivityConfiguration"
>
>         auth="Container"
>
>         type="com.<replaced>.ConnectivityConfiguration"
>
>         factory="com.<replaced>.ServiceObjectFactory" />
>
> </Context>
>
> web.xml file:
>
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="
> http://java.sun.com/xml/ns/javaee" xmlns:web="
> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
>
>     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd<
> http://java.sun.com/xml/ns/javaee%20http:/java.sun.com/xml/ns/javaee/web-app_2_5.xsd>"
> id="WebApp_ID" version="2.5">
>
>     <resource-ref>
>
>         <res-ref-name>jms/default</res-ref-name>
>
>         <res-type>javax.jms.ConnectionFactory</res-type>
>
>     </resource-ref>
>
>
>
> ... some servlets
>
>
>
>     <resource-ref>
>
>         <res-ref-name>connectivityConfiguration</res-ref-name>
>
>         <res-type>com.<replaced>.ConnectivityConfiguration</res-type>
>
>     </resource-ref>
>
>
>
>
>
> </web-app>
>
> The jms/default resource is found while the connectivityConfiguration is
> not.
> The difference is that jms/default type class and factory is residing in
> the project and is provided within the deployed application WAR.
> The connectivityConfiguration resource cannot be found. The class and its
> factory is provided from the runtime environment.
>
>
> LOG (when resources are defined in context.xml)
>
> 2020 10 27
> 11:12:00#+00#ERROR##anonymous#localhost-startStop-1#na#xxxx#conntest7#web##na#na#na#na#Failed
> to lookup 'java:comp/env/connectivityConfiguration' from InitialContext.
> javax.naming.NamingException: Could not load resource factory class
>         at
> org.apache.naming.factory.FactoryBase.getObjectInstance(FactoryBase.java:70)
>         at
> javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
>         at org.apache.naming.NamingContext.lookup(NamingContext.java:839)
>         at org.apache.naming.NamingContext.lookup(NamingContext.java:159)
>         at org.apache.naming.NamingContext.lookup(NamingContext.java:827)
>         at org.apache.naming.NamingContext.lookup(NamingContext.java:159)
>         at org.apache.naming.NamingContext.lookup(NamingContext.java:827)
>         at org.apache.naming.NamingContext.lookup(NamingContext.java:173)
>         at
> org.apache.naming.SelectorContext.lookup(SelectorContext.java:163)
> .....
> Caused by: java.lang.ClassNotFoundException: <replaced with
> placeholder>.ServiceObjectFactory
>         at
> org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1358)
>         at
> org.apache.tomee.catalina.TomEEWebappClassLoader.loadClass(TomEEWebappClassLoader.java:208)
>         at
> org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1180)
>         at
> org.apache.naming.factory.FactoryBase.getObjectInstance(FactoryBase.java:65)
>         ... 48 common frames omitted
> |
>
> |
> 2020 10 27
> 11:12:00#+00#ERROR#OpenEJB.startup##anonymous#localhost-startStop-1#na#xxxx#conntest7#web##na#na#na#na#Unable
> to register MBean  java.lang.NullPointerException: Delegate cannot be null
>         at
> org.apache.openejb.monitoring.MBeanPojoWrapper.<init>(MBeanPojoWrapper.java:65)
>         at
> org.apache.openejb.assembler.classic.Assembler.registerAsMBean(Assembler.java:3393)
>         at
> org.apache.openejb.assembler.classic.Assembler.doCreateResource(Assembler.java:3367)
>         at
> org.apache.openejb.assembler.classic.Assembler.createResource(Assembler.java:2996)
>         at
> org.apache.openejb.config.ConfigurationFactory.doInstall(ConfigurationFactory.java:466)
>         at
> org.apache.openejb.config.ConfigurationFactory.install(ConfigurationFactory.java:459)
>         at
> org.apache.openejb.config.AutoConfig.installResource(AutoConfig.java:2193)
>         at
> org.apache.openejb.config.AutoConfig.processApplicationResources(AutoConfig.java:1026)
>         at org.apache.openejb.config.AutoConfig.deploy(AutoConfig.java:191)
>         at
> org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:420)
>         at
> org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:1037)
>         at
> org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1281)
>         at
> org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1125)
>         at
> org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:133)
>         at
> org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
>         at
> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5053)
>         at
> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
>         at
> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743)
>         at
> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)
>         at
> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705)
>         at
> org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:970)
>         at
> org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1840)
>         at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
>         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>         at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>         at java.lang.Thread.run(Thread.java:836)
> |
> 2020 10 27
> 11:12:00#+00#ERROR#OpenEJB##anonymous#localhost-startStop-1#na#xxxx#conntest7#web##na#na#na#na#Can't
> create resource null java.lang.ClassNotFoundException:
> ......ServiceObjectFactory
>         at
> org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1358)
>         at
> org.apache.tomee.catalina.TomEEWebappClassLoader.loadClass(TomEEWebappClassLoader.java:208)
>         at
> org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1180)
>         at
> org.apache.tomee.catalina.TomcatResourceFactory.create(TomcatResourceFactory.java:75)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:498)
>         at
> org.apache.xbean.recipe.ObjectRecipe.internalCreate(ObjectRecipe.java:301)
>         at
> org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:96)
>         at
> org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:61)
>         at
> org.apache.openejb.assembler.classic.Assembler.doCreateResource(Assembler.java:3163)
>         at
> org.apache.openejb.assembler.classic.Assembler.createResource(Assembler.java:2996)
>         at
> org.apache.openejb.config.ConfigurationFactory.doInstall(ConfigurationFactory.java:466)
>         at
> org.apache.openejb.config.ConfigurationFactory.install(ConfigurationFactory.java:459)
>         at
> org.apache.openejb.config.AutoConfig.installResource(AutoConfig.java:2193)
>         at
> org.apache.openejb.config.AutoConfig.processApplicationResources(AutoConfig.java:1026)
>         at org.apache.openejb.config.AutoConfig.deploy(AutoConfig.java:191)
>         at
> org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:420)
>         at
> org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:1037)
>         at
> org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1281)
>         at
> org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1125)
>         at
> org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:133)
>         at
> org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
>         at
> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5053)
>         at
> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
>         at
> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743)
>         at
> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)
>         at
> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705)
>         at
> org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:970)
>         at
> org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1840)
>         at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
>         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>         at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>         at java.lang.Thread.run(Thread.java:836)
> |
> 2020 10 27
> 11:12:00#+00#ERROR#OpenEJB.startup##anonymous#localhost-startStop-1#na#xxxx#conntest7#web##na#na#na#na#Unable
> to register MBean  java.lang.NullPointerException: Delegate cannot be null
>         at
> org.apache.openejb.monitoring.MBeanPojoWrapper.<init>(MBeanPojoWrapper.java:65)
>         at
> org.apache.openejb.assembler.classic.Assembler.registerAsMBean(Assembler.java:3393)
>         at
> org.apache.openejb.assembler.classic.Assembler.doCreateResource(Assembler.java:3367)
>         at
> org.apache.openejb.assembler.classic.Assembler.createResource(Assembler.java:2996)
>         at
> org.apache.openejb.config.ConfigurationFactory.doInstall(ConfigurationFactory.java:466)
>         at
> org.apache.openejb.config.ConfigurationFactory.install(ConfigurationFactory.java:459)
>         at
> org.apache.openejb.config.AutoConfig.installResource(AutoConfig.java:2193)
>         at
> org.apache.openejb.config.AutoConfig.processApplicationResources(AutoConfig.java:1026)
>         at org.apache.openejb.config.AutoConfig.deploy(AutoConfig.java:191)
>         at
> org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:420)
>         at
> org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:1037)
>         at
> org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1281)
>         at
> org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1125)
>         at
> org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:133)
>         at
> org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
>         at
> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5053)
>         at
> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
>         at
> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743)
>         at
> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)
>         at
> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705)
>         at
> org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:970)
>         at
> org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1840)
>         at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
>         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>         at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>         at java.lang.Thread.run(Thread.java:836)
>
>
>
> When I remove the context.xml and let the runtime automatically create the
> resources with DelegatingObjectFactory (also provided from the environment)
> this works for the mentioned ConnectivityConfiguration but another error
> happens  later on with a class that is actually not used at all.
> java.lang.NoClassDefFoundError:
> org/apache/activemq/ra/ActiveMQResourceAdapter
>
> LOG (without context.xml resource definition)
>
>
> 2020 10 27
> 08:30:04#+00#DEBUG#DelegatingObjectFactory#BC-NEO-RT-JAV#anonymous#localhost-startStop-1#xxxx#conntest7#web##na#na#na#na#Object
> instance with name [connectivityConfiguration]is created by factory
> [com.<replaced>.ServiceObjectFactory@2925057c<mailto:
> .ServiceObjectFactory@2925057c>]. |
>
> 2020 10 27
> 08:30:06#+00#ERROR#org.apache.catalina.core.ContainerBase##anonymous#localhost-startStop-1#na#xxxx#conntest7#web##na#na#na#na#ContainerBase.addChild:
> start:  org.apache.catalina.LifecycleException: Failed to start component
> [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
>
>         at
> org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)
>
>         at
> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
>
>         at
> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743)
>
>         at
> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)
>
>         at
> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705)
>
>         at
> org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:970)
>
>         at
> org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1840)
>
>         at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
>
>         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>
>         at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>
>         at java.lang.Thread.run(Thread.java:836)
>
> Caused by: java.lang.NoClassDefFoundError:
> org/apache/activemq/ra/ActiveMQResourceAdapter
>
>         at java.lang.ClassLoader.defineClass1(Native Method)
>
>         at java.lang.ClassLoader.defineClass(ClassLoader.java:851)
>
>         at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
>
>         at java.net.URLClassLoader.defineClass(URLClassLoader.java:530)
>
>         at java.net.URLClassLoader.access$100(URLClassLoader.java:76)
>
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:431)
>
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:425)
>
>         at java.security.AccessController.doPrivileged(Native Method)
>
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:424)
>
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:480)
>
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:413)
>
>         at java.lang.Class.forName0(Native Method)
>
>         at java.lang.Class.forNameFW(Class.java:362)
>
>         at java.lang.Class.forName(Class.java:355)
>
>         at
> org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1310)
>
>         at
> org.apache.tomee.catalina.TomEEWebappClassLoader.loadClass(TomEEWebappClassLoader.java:208)
>
>         at
> org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1180)
>
>         at java.lang.Class.forName0(Native Method)
>
>         at java.lang.Class.forNameFW(Class.java:362)
>
>         at java.lang.Class.forName(Class.java:355)
>
>         at
> org.apache.xbean.recipe.RecipeHelper.loadClass(RecipeHelper.java:54)
>
>         at
> org.apache.xbean.recipe.ObjectRecipe.getType(ObjectRecipe.java:356)
>
>         at
> org.apache.xbean.recipe.ObjectRecipe.internalCreate(ObjectRecipe.java:269)
>
>         at
> org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:96)
>
>         at
> org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:61)
>
>         at
> org.apache.openejb.assembler.classic.Assembler.doCreateResource(Assembler.java:3163)
>
>         at
> org.apache.openejb.assembler.classic.Assembler.createResource(Assembler.java:2996)
>
>         at
> org.apache.openejb.config.ConfigurationFactory.doInstall(ConfigurationFactory.java:466)
>
>         at
> org.apache.openejb.config.ConfigurationFactory.install(ConfigurationFactory.java:459)
>
>         at
> org.apache.openejb.config.AutoConfig.installResource(AutoConfig.java:2193)
>
>         at
> org.apache.openejb.config.AutoConfig.getResourceId(AutoConfig.java:2043)
>
>         at
> org.apache.openejb.config.AutoConfig.getResourceId(AutoConfig.java:1978)
>
>         at
> org.apache.openejb.config.AutoConfig.installResource(AutoConfig.java:2180)
>
>         at
> org.apache.openejb.config.AutoConfig.autoCreateResource(AutoConfig.java:2068)
>
>         at
> org.apache.openejb.config.AutoConfig.getResourceId(AutoConfig.java:2056)
>
>         at
> org.apache.openejb.config.AutoConfig.getResourceId(AutoConfig.java:1978)
>
>         at
> org.apache.openejb.config.AutoConfig.processResourceRef(AutoConfig.java:1218)
>
>         at org.apache.openejb.config.AutoConfig.deploy(AutoConfig.java:892)
>
>         at org.apache.openejb.config.AutoConfig.deploy(AutoConfig.java:200)
>
>         at
> org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:420)
>
>         at
> org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:1037)
>
>         at
> org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1281)
>
>         at
> org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1125)
>
>         at
> org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:133)
>
>         at
> org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
>
>         at
> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5053)
>
>         at
> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
>
>         ... 10 common frames omitted
>
> Caused by: java.lang.ClassNotFoundException:
> org.apache.activemq.ra.ActiveMQResourceAdapter
>
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:444)
>
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:480)
>
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:413)
>
>         ... 57 common frames omitted
>
> |
>
> 2020 10 27
> 08:30:06#+00#ERROR#org.apache.catalina.startup.HostConfig##anonymous#localhost-startStop-1#na#xxxx#conntest7#web##na#na#na#na#Error
> deploying web application archive [/usr/xxx/ljs/webapps/ROOT.war]
> java.lang.IllegalStateException: ContainerBase.addChild: start:
> org.apache.catalina.LifecycleException: Failed to start component
> [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
>
>         at
> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:747)
>
>         at
> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)
>
>         at
> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705)
>
>         at
> org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:970)
>
>         at
> org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1840)
>
>         at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
>
>         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>
>         at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>
>         at java.lang.Thread.run(Thread.java:836)
>
> |
>
> The NoClassDefFoundError is most likely caused by the same reason as
> described here:
>
> http://tomee-openejb.979440.n4.nabble.com/How-to-disable-default-TomEE-JMS-and-JDBC-resources-creation-td4688081.html
>
> Ideally I would like to define the resource in the context.xml and make
> the lookup work but so far I am unable to make it work.
> Do I miss something in the configuration for provided classes (type and
> factory) from the runtime environment?
>
> I am also fine with an automatic resource creation if I can avoid the
> error thrown for the java.lang.NoClassDefFoundError:
> org/apache/activemq/ra/ActiveMQResourceAdapter
> This class is definitely not present in the application WAR nor provided
> by the environment as it is not used.
> Is there a way of an automatic resource creation but excluding specific
> resources?
>
> Best regards,
> Adem
>
>
>
Reply | Threaded
Open this post in threaded view
|

RE: TomEE7 - JNDI lookup in web application fails on TomEE 7 web profile runtime

Adem
Hi Jon,

thanks for the fast response.

To clarify:

We are using TomEE 7 webprofile.
Both classes are coming through a  maven dependency into the webapp.
The webapp dependency tree looks as following

[INFO] +- javax.servlet:javax.servlet-api:jar:3.0.1:provided
[INFO] +- org.slf4j:slf4j-api:jar:1.7.2:provided
[INFO] \- …..clientfactory.tomcat.all:pom:1.3.0-SNAPSHOT:compile
[INFO]    +-   ….clientfactory.jms:jar:1.3.0-SNAPSHOT:compile
[INFO]    +-   ….clientfactory.spi:jar:1.3.0-SNAPSHOT:compile
[INFO]    +-   ….clientfactory.spi.jms:jar:1.3.0-SNAPSHOT:compile
[INFO]    +-   ….clientfactory.solace:jar:1.3.0-SNAPSHOT:compile
[INFO]    |  \- com.solacesystems:sol-jms:jar:10.5.0:compile
[INFO]    |     +- commons-logging:commons-logging:jar:1.1.3:compile
[INFO]    |     +- commons-lang:commons-lang:jar:2.6:compile
[INFO]    |     +- org.osgi:org.osgi.annotation:jar:6.0.0:compile
[INFO]    |     \- org.apache.servicemix.bundles:org.apache.servicemix.bundles.jzlib:jar:1.0.7_2:compile
[INFO]    +-   .clientfactory.hcp:jar:1.3.0-SNAPSHOT:compile <<< the important dependency
[INFO]    \- javax.jms:com.springsource.javax.jms:jar:1.1.0:compile

GenericBindingObjectFactory is already residing in the lib folder as it’s part of that maven dependency clientfactory.hcp source.
ServiceObjectFactory is provided by the environment and is also included as a dependency (scope provided) in clientfactory.hcp.
I have pulled ServiceObjectFactory into the src of the clientfactory.hcp so that both classes are in a jar that is in the lib folder of the web app.

Results were the same.

With context.xml file:


<?xml version="1.0" encoding="UTF-8"?>

<Context>

    <Resource name="jms/default" auth="Container"

        type="javax.jms.ConnectionFactory"

        description="JMS Connection Factory"

        factory="com.<replaced>.GenericBindingObjectFactory"

        java.naming.binding="default" />





    <Resource name="connectivityConfiguration"

        auth="Container"

        type="com.<replaced>.ConnectivityConfiguration"

        factory="com.<replaced>.ServiceObjectFactory" />

</Context>

The jms/default resource is found while the connectivityConfiguration is not. (same log as provided in the initial mail)

Without the context.xml the connectivityConfiguration is found and created by trying different factories until a factory is found that is able to create an instance of the object.

2020 10 27 08:30:04#+00#DEBUG#DelegatingObjectFactory#BC-NEO-RT-JAV#anonymous#localhost-startStop-1#xxxx#conntest7#web##na#na#na#na#Object instance with name [connectivityConfiguration]is created by factory [com.<replaced>.ServiceObjectFactory@2925057c<mailto:.ServiceObjectFactory@2925057c>...

Afterwards and error is thrown:
java.lang.NoClassDefFoundError: org/apache/activemq/ra/ActiveMQResourceAdapter

Removing the contex.xml is not an option because the jms/default resource is needed.

Best regards,
Adem



From: Jonathan Gallimore <[hidden email]<mailto:[hidden email]>>
Sent: Mittwoch, 28. Oktober 2020 18:01
To: [hidden email]<mailto:[hidden email]>
Cc: Blehm, Samuel <[hidden email]<mailto:[hidden email]>>; Amend, Christian <[hidden email]<mailto:[hidden email]>>
Subject: Re: TomEE7 - JNDI lookup in web application fails on TomEE 7 web profile runtime

> java.lang.NoClassDefFoundError: org/apache/activemq/ra/ActiveMQResourceAdapter

What flavor of TomEE are you using? If you're using webprofile, you maybe need to switch to plus or plume (which include ActiveMQ).

Where are com.<replaced>.ServiceObjectFactory and com.<replaced>.GenericBindingObjectFactory on your classpath? Are they in the application itself, or in the lib directory? If its in the webapp, can you try putting the necessary classes in a jar in the lib folder? If that works, that may suggest there's a bug we need to look at, but it would be useful to know.

Jon

On Wed, Oct 28, 2020 at 2:48 PM Vural, Adem <[hidden email]<mailto:[hidden email]>> wrote:
Hi

we are trying to migrate an existing web application from following runtimes

  *   Java EE 6 webprofile (working)
  *   Java Web Tomcat 7 (working)
to

  *   TomEE 7 web profile (not working)
  *   Java Web Tomcat 8 (working)

While this worked out of the box for Web Tomcat 8 we are struggling to make it work for the TomEE 7 web profile.
The JNDI lookup for a resource is not working with the TomEE 7 web profile.
I am suspecting a misconfiguration on my site but I am not sure what needs to be corrected.

Following some config files and logs.

context.xml file:


<?xml version="1.0" encoding="UTF-8"?>

<Context>

    <Resource name="jms/default" auth="Container"

        type="javax.jms.ConnectionFactory"

        description="JMS Connection Factory"

        factory="com.<replaced>.GenericBindingObjectFactory"

        java.naming.binding="default" />





    <Resource name="connectivityConfiguration"

        auth="Container"

        type="com.<replaced>.ConnectivityConfiguration"

        factory="com.<replaced>.ServiceObjectFactory" />

</Context>

web.xml file:


<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"

    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd<http://java.sun.com/xml/ns/javaee%20http:/java.sun.com/xml/ns/javaee/web-app_2_5.xsd>" id="WebApp_ID" version="2.5">

    <resource-ref>

        <res-ref-name>jms/default</res-ref-name>

        <res-type>javax.jms.ConnectionFactory</res-type>

    </resource-ref>



... some servlets



    <resource-ref>

        <res-ref-name>connectivityConfiguration</res-ref-name>

        <res-type>com.<replaced>.ConnectivityConfiguration</res-type>

    </resource-ref>





</web-app>

The jms/default resource is found while the connectivityConfiguration is not.
The difference is that jms/default type class and factory is residing in the project and is provided within the deployed application WAR.
The connectivityConfiguration resource cannot be found. The class and its factory is provided from the runtime environment.


LOG (when resources are defined in context.xml)

2020 10 27 11:12:00#+00#ERROR##anonymous#localhost-startStop-1#na#xxxx#conntest7#web##na#na#na#na#Failed to lookup 'java:comp/env/connectivityConfiguration' from InitialContext. javax.naming.NamingException: Could not load resource factory class
        at org.apache.naming.factory.FactoryBase.getObjectInstance(FactoryBase.java:70)
        at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:839)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:159)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:827)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:159)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:827)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:173)
        at org.apache.naming.SelectorContext.lookup(SelectorContext.java:163)
.....
Caused by: java.lang.ClassNotFoundException: <replaced with placeholder>.ServiceObjectFactory
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1358)
        at org.apache.tomee.catalina.TomEEWebappClassLoader.loadClass(TomEEWebappClassLoader.java:208)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1180)
        at org.apache.naming.factory.FactoryBase.getObjectInstance(FactoryBase.java:65)
        ... 48 common frames omitted
|

|
2020 10 27 11:12:00#+00#ERROR#OpenEJB.startup##anonymous#localhost-startStop-1#na#xxxx#conntest7#web##na#na#na#na#Unable to register MBean  java.lang.NullPointerException: Delegate cannot be null
        at org.apache.openejb.monitoring.MBeanPojoWrapper.<init>(MBeanPojoWrapper.java:65)
        at org.apache.openejb.assembler.classic.Assembler.registerAsMBean(Assembler.java:3393)
        at org.apache.openejb.assembler.classic.Assembler.doCreateResource(Assembler.java:3367)
        at org.apache.openejb.assembler.classic.Assembler.createResource(Assembler.java:2996)
        at org.apache.openejb.config.ConfigurationFactory.doInstall(ConfigurationFactory.java:466)
        at org.apache.openejb.config.ConfigurationFactory.install(ConfigurationFactory.java:459)
        at org.apache.openejb.config.AutoConfig.installResource(AutoConfig.java:2193)
        at org.apache.openejb.config.AutoConfig.processApplicationResources(AutoConfig.java:1026)
        at org.apache.openejb.config.AutoConfig.deploy(AutoConfig.java:191)
        at org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:420)
        at org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:1037)
        at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1281)
        at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1125)
        at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:133)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5053)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:970)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1840)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:836)
|
2020 10 27 11:12:00#+00#ERROR#OpenEJB##anonymous#localhost-startStop-1#na#xxxx#conntest7#web##na#na#na#na#Can't create resource null java.lang.ClassNotFoundException: ......ServiceObjectFactory
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1358)
        at org.apache.tomee.catalina.TomEEWebappClassLoader.loadClass(TomEEWebappClassLoader.java:208)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1180)
        at org.apache.tomee.catalina.TomcatResourceFactory.create(TomcatResourceFactory.java:75)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.xbean.recipe.ObjectRecipe.internalCreate(ObjectRecipe.java:301)
        at org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:96)
        at org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:61)
        at org.apache.openejb.assembler.classic.Assembler.doCreateResource(Assembler.java:3163)
        at org.apache.openejb.assembler.classic.Assembler.createResource(Assembler.java:2996)
        at org.apache.openejb.config.ConfigurationFactory.doInstall(ConfigurationFactory.java:466)
        at org.apache.openejb.config.ConfigurationFactory.install(ConfigurationFactory.java:459)
        at org.apache.openejb.config.AutoConfig.installResource(AutoConfig.java:2193)
        at org.apache.openejb.config.AutoConfig.processApplicationResources(AutoConfig.java:1026)
        at org.apache.openejb.config.AutoConfig.deploy(AutoConfig.java:191)
        at org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:420)
        at org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:1037)
        at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1281)
        at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1125)
        at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:133)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5053)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:970)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1840)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:836)
|
2020 10 27 11:12:00#+00#ERROR#OpenEJB.startup##anonymous#localhost-startStop-1#na#xxxx#conntest7#web##na#na#na#na#Unable to register MBean  java.lang.NullPointerException: Delegate cannot be null
        at org.apache.openejb.monitoring.MBeanPojoWrapper.<init>(MBeanPojoWrapper.java:65)
        at org.apache.openejb.assembler.classic.Assembler.registerAsMBean(Assembler.java:3393)
        at org.apache.openejb.assembler.classic.Assembler.doCreateResource(Assembler.java:3367)
        at org.apache.openejb.assembler.classic.Assembler.createResource(Assembler.java:2996)
        at org.apache.openejb.config.ConfigurationFactory.doInstall(ConfigurationFactory.java:466)
        at org.apache.openejb.config.ConfigurationFactory.install(ConfigurationFactory.java:459)
        at org.apache.openejb.config.AutoConfig.installResource(AutoConfig.java:2193)
        at org.apache.openejb.config.AutoConfig.processApplicationResources(AutoConfig.java:1026)
        at org.apache.openejb.config.AutoConfig.deploy(AutoConfig.java:191)
        at org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:420)
        at org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:1037)
        at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1281)
        at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1125)
        at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:133)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5053)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:970)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1840)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:836)



When I remove the context.xml and let the runtime automatically create the resources with DelegatingObjectFactory (also provided from the environment) this works for the mentioned ConnectivityConfiguration but another error happens  later on with a class that is actually not used at all.
java.lang.NoClassDefFoundError: org/apache/activemq/ra/ActiveMQResourceAdapter

LOG (without context.xml resource definition)


2020 10 27 08:30:04#+00#DEBUG#DelegatingObjectFactory#BC-NEO-RT-JAV#anonymous#localhost-startStop-1#xxxx#conntest7#web##na#na#na#na#Object instance with name [connectivityConfiguration]is created by factory [com.<replaced>.ServiceObjectFactory@2925057c<mailto:.ServiceObjectFactory@2925057c<mailto:.ServiceObjectFactory@2925057c%3cmailto:.ServiceObjectFactory@2925057c>>]. |

2020 10 27 08:30:06#+00#ERROR#org.apache.catalina.core.ContainerBase##anonymous#localhost-startStop-1#na#xxxx#conntest7#web##na#na#na#na#ContainerBase.addChild: start:  org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]

        at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)

        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)

        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743)

        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)

        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705)

        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:970)

        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1840)

        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

        at java.util.concurrent.FutureTask.run(FutureTask.java:266)

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

        at java.lang.Thread.run(Thread.java:836)

Caused by: java.lang.NoClassDefFoundError: org/apache/activemq/ra/ActiveMQResourceAdapter

        at java.lang.ClassLoader.defineClass1(Native Method)

        at java.lang.ClassLoader.defineClass(ClassLoader.java:851)

        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)

        at java.net.URLClassLoader.defineClass(URLClassLoader.java:530)

        at java.net.URLClassLoader.access$100(URLClassLoader.java:76)

        at java.net.URLClassLoader$1.run(URLClassLoader.java:431)

        at java.net.URLClassLoader$1.run(URLClassLoader.java:425)

        at java.security.AccessController.doPrivileged(Native Method)

        at java.net.URLClassLoader.findClass(URLClassLoader.java:424)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:480)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:413)

        at java.lang.Class.forName0(Native Method)

        at java.lang.Class.forNameFW(Class.java:362)

        at java.lang.Class.forName(Class.java:355)

        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1310)

        at org.apache.tomee.catalina.TomEEWebappClassLoader.loadClass(TomEEWebappClassLoader.java:208)

        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1180)

        at java.lang.Class.forName0(Native Method)

        at java.lang.Class.forNameFW(Class.java:362)

        at java.lang.Class.forName(Class.java:355)

        at org.apache.xbean.recipe.RecipeHelper.loadClass(RecipeHelper.java:54)

        at org.apache.xbean.recipe.ObjectRecipe.getType(ObjectRecipe.java:356)

        at org.apache.xbean.recipe.ObjectRecipe.internalCreate(ObjectRecipe.java:269)

        at org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:96)

        at org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:61)

        at org.apache.openejb.assembler.classic.Assembler.doCreateResource(Assembler.java:3163)

        at org.apache.openejb.assembler.classic.Assembler.createResource(Assembler.java:2996)

        at org.apache.openejb.config.ConfigurationFactory.doInstall(ConfigurationFactory.java:466)

        at org.apache.openejb.config.ConfigurationFactory.install(ConfigurationFactory.java:459)

        at org.apache.openejb.config.AutoConfig.installResource(AutoConfig.java:2193)

        at org.apache.openejb.config.AutoConfig.getResourceId(AutoConfig.java:2043)

        at org.apache.openejb.config.AutoConfig.getResourceId(AutoConfig.java:1978)

        at org.apache.openejb.config.AutoConfig.installResource(AutoConfig.java:2180)

        at org.apache.openejb.config.AutoConfig.autoCreateResource(AutoConfig.java:2068)

        at org.apache.openejb.config.AutoConfig.getResourceId(AutoConfig.java:2056)

        at org.apache.openejb.config.AutoConfig.getResourceId(AutoConfig.java:1978)

        at org.apache.openejb.config.AutoConfig.processResourceRef(AutoConfig.java:1218)

        at org.apache.openejb.config.AutoConfig.deploy(AutoConfig.java:892)

        at org.apache.openejb.config.AutoConfig.deploy(AutoConfig.java:200)

        at org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:420)

        at org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:1037)

        at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1281)

        at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1125)

        at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:133)

        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)

        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5053)

        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)

        ... 10 common frames omitted

Caused by: java.lang.ClassNotFoundException: org.apache.activemq.ra.ActiveMQResourceAdapter

        at java.net.URLClassLoader.findClass(URLClassLoader.java:444)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:480)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:413)

        ... 57 common frames omitted

|

2020 10 27 08:30:06#+00#ERROR#org.apache.catalina.startup.HostConfig##anonymous#localhost-startStop-1#na#xxxx#conntest7#web##na#na#na#na#Error deploying web application archive [/usr/xxx/ljs/webapps/ROOT.war] java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]

        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:747)

        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)

        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705)

        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:970)

        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1840)

        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

        at java.util.concurrent.FutureTask.run(FutureTask.java:266)

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

        at java.lang.Thread.run(Thread.java:836)

|

The NoClassDefFoundError is most likely caused by the same reason as described here:
http://tomee-openejb.979440.n4.nabble.com/How-to-disable-default-TomEE-JMS-and-JDBC-resources-creation-td4688081.html

Ideally I would like to define the resource in the context.xml and make the lookup work but so far I am unable to make it work.
Do I miss something in the configuration for provided classes (type and factory) from the runtime environment?

I am also fine with an automatic resource creation if I can avoid the error thrown for the java.lang.NoClassDefFoundError: org/apache/activemq/ra/ActiveMQResourceAdapter
This class is definitely not present in the application WAR nor provided by the environment as it is not used.
Is there a way of an automatic resource creation but excluding specific resources?

Best regards,
Adem