You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by "Shultz, Dmitry" <Dm...@kaltire.com> on 2019/02/21 03:40:58 UTC

How to disable default TomEE JMS and JDBC resources creation?

Hi All,

My tomee.xml is deliberately empty, but in the log at start up TomEE is configuring Default Unmanaged JDBC and Default JMS (which I don't really need).
The deployment is failing with this:

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

How to disable these default resources creation?

Cheers,
Dmitry

RE: How to disable default TomEE JMS and JDBC resources creation?

Posted by "Shultz, Dmitry" <Dm...@kaltire.com>.
Hi Jonathan,

I had to put SINGLETON and MANAGED containers definition when I disabled the default containers creation using the openejb.offline=true, but this gave me the clear error about some JMS connection factory that should not be there (instead of trying to create a matching default one). Apparently I forgot to remove the injection of old jms connection factory resource in one of my beans while migrating the service from Sonic to Artemis JMS. Once I removed it and cleaned up the tomee.xml everything went to normal :)  

Thanks a lot for your help!

Cheers,
Dmitry

-----Original Message-----
From: Jonathan Gallimore [mailto:jonathan.gallimore@gmail.com] 
Sent: Thursday, February 21, 2019 3:22 AM
To: users@tomee.apache.org
Subject: Re: How to disable default TomEE JMS and JDBC resources creation?

Hi

You can try the -Dopenejb.offline=true setting. This will stop any resources (and containers) being created automatically. The downside is that anything you are using, you'll need to explicitly declare in your tomee.xml - so EJB bean containers, for example. I just added this setting to an app here to get the following message:

21-Feb-2019 11:14:26.512 SEVERE [main]
org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal Unable to deploy collapsed ear in war StandardEngine[Catalina].StandardHost[localhost].StandardContext[]
 org.apache.openejb.OpenEJBException: A container of type SINGLETON must be declared in the configuration file for bean: XXXXXXXXXX at
org.apache.openejb.config.AutoConfig.createContainer(AutoConfig.java:1141)
at org.apache.openejb.config.AutoConfig.deploy(AutoConfig.java:864)
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:1286)
at
org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1130)
at
org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:134)

Which is correct, I'm using Singleton EJB beans and I'd need to define a container for them.

The error that you're seeing, sounds like something is triggering TomEE to try and start ActiveMQ, and that is failing, presumably because you're running the Webprofile flavour. This could happen if you have MDBs, or references to Topics/Queues in your app that you are intending to point to something else that isn't ActiveMQ. If you post your log, I'd be happy to take a look and advise whether there is something you could tweak to avoid the error, without going to the extreme of setting openejb.offline=true. Or if its a bug in the server, I'm happy to help fix it.

Thanks

Jon

On Thu, Feb 21, 2019 at 3:41 AM Shultz, Dmitry <Dm...@kaltire.com>
wrote:

> Hi All,
>
> My tomee.xml is deliberately empty, but in the log at start up TomEE 
> is configuring Default Unmanaged JDBC and Default JMS (which I don't 
> really need).
> The deployment is failing with this:
>
> java.lang.NoClassDefFoundError:
> org/apache/activemq/ra/ActiveMQResourceAdapter
>
> How to disable these default resources creation?
>
> Cheers,
> Dmitry
>

Re: How to disable default TomEE JMS and JDBC resources creation?

Posted by Jonathan Gallimore <jo...@gmail.com>.
Hi

You can try the -Dopenejb.offline=true setting. This will stop any
resources (and containers) being created automatically. The downside is
that anything you are using, you'll need to explicitly declare in your
tomee.xml - so EJB bean containers, for example. I just added this setting
to an app here to get the following message:

21-Feb-2019 11:14:26.512 SEVERE [main]
org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal Unable to
deploy collapsed ear in war
StandardEngine[Catalina].StandardHost[localhost].StandardContext[]
 org.apache.openejb.OpenEJBException: A container of type SINGLETON must be
declared in the configuration file for bean: XXXXXXXXXX
at
org.apache.openejb.config.AutoConfig.createContainer(AutoConfig.java:1141)
at org.apache.openejb.config.AutoConfig.deploy(AutoConfig.java:864)
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:1286)
at
org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1130)
at
org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:134)

Which is correct, I'm using Singleton EJB beans and I'd need to define a
container for them.

The error that you're seeing, sounds like something is triggering TomEE to
try and start ActiveMQ, and that is failing, presumably because you're
running the Webprofile flavour. This could happen if you have MDBs, or
references to Topics/Queues in your app that you are intending to point to
something else that isn't ActiveMQ. If you post your log, I'd be happy to
take a look and advise whether there is something you could tweak to avoid
the error, without going to the extreme of setting openejb.offline=true. Or
if its a bug in the server, I'm happy to help fix it.

Thanks

Jon

On Thu, Feb 21, 2019 at 3:41 AM Shultz, Dmitry <Dm...@kaltire.com>
wrote:

> Hi All,
>
> My tomee.xml is deliberately empty, but in the log at start up TomEE is
> configuring Default Unmanaged JDBC and Default JMS (which I don't really
> need).
> The deployment is failing with this:
>
> java.lang.NoClassDefFoundError:
> org/apache/activemq/ra/ActiveMQResourceAdapter
>
> How to disable these default resources creation?
>
> Cheers,
> Dmitry
>