You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by murt_ryan <ma...@gmail.com> on 2016/03/30 17:00:51 UTC

Camel 2.17 camel-cdi injection problem

Hi,
Apologies if my question is not clear but here goes: 

I am currently experiencing problems with camel-cdi injection after moving
from Camel 2.16 to 2.17. I realise alot of work has gone on in this area in
this new release.

I am trying to run camel as part of JBoss EAP 6.4 (I cannot use Wildfly with
the camel extensions, and I cannot use Fuse which my company pays for (as it
currently only supports camel 2.16 and I need elasticsearch 2.0 support
which is only available in camel 2.17))

The fault: 
WELD-000119 Not generating any bean definitions from
org.apache.camel.cdi.Main because of underlying class loading error

Which I tracked down to as being caused by 
 java.lang.NoClassDefFoundError:
Lorg/apache/deltaspike/cdise/api/CdiContainer;

It seems that the inclusion of deltaspike in 2.17 is optional (from
camel-cdi pom.xml file)

 DeltaSpike is only used to provide Main support thus optional
                <dependency>
                    <groupId>org.apache.deltaspike.cdictrl</groupId>
                    <artifactId>deltaspike-cdictrl-api</artifactId>
                    <version>${deltaspike-version}</version>
                    <optional>true</optional>
                </dependency>

How can i ensure that the jar file is included in camel-cdi 2.17?


thanks
/murt





--
View this message in context: http://camel.465427.n5.nabble.com/Camel-2-17-camel-cdi-injection-problem-tp5780050.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel 2.17 camel-cdi injection problem

Posted by murt_ryan <ma...@gmail.com>.
Hi Antonin,
That answers my question perfectly, thanks very much for your time.

/marty



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-2-17-camel-cdi-injection-problem-tp5780050p5780492.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel 2.17 camel-cdi injection problem

Posted by Antonin Stefanutti <an...@stefanutti.fr>.
Hi Murt,

> On 30 Mar 2016, at 17:00, murt_ryan <ma...@gmail.com> wrote:
> 
> Hi,
> Apologies if my question is not clear but here goes: 

Your question is very clear ;)

> I am currently experiencing problems with camel-cdi injection after moving
> from Camel 2.16 to 2.17. I realise alot of work has gone on in this area in
> this new release.
> 
> I am trying to run camel as part of JBoss EAP 6.4 (I cannot use Wildfly with
> the camel extensions, and I cannot use Fuse which my company pays for (as it
> currently only supports camel 2.16 and I need elasticsearch 2.0 support
> which is only available in camel 2.17))
> 
> The fault: 
> WELD-000119 Not generating any bean definitions from
> org.apache.camel.cdi.Main because of underlying class loading error
> 
> Which I tracked down to as being caused by 
> java.lang.NoClassDefFoundError:
> Lorg/apache/deltaspike/cdise/api/CdiContainer;
> 
> It seems that the inclusion of deltaspike in 2.17 is optional (from
> camel-cdi pom.xml file)
> 
> DeltaSpike is only used to provide Main support thus optional
>                <dependency>
>                    <groupId>org.apache.deltaspike.cdictrl</groupId>
>                    <artifactId>deltaspike-cdictrl-api</artifactId>
>                    <version>${deltaspike-version}</version>
>                    <optional>true</optional>
>                </dependency>
> 
> How can i ensure that the jar file is included in camel-cdi 2.17?

The org.apache.camel.cdi.Main is only useful when using Camel CDI in Java SE. It then uses DeltaSpike (for the time being, as CDI 2.0 will provide a standard way of doing it) to bootstrap the CDI container, hence the optional dependency, to avoid other environments to depend on it.

So the CDI container should not scan that class. That’s why it’s excluded in the beans.xml file of the camel-cdi.jar. Unfortunately, that scan exclusion is only supported starting CDI 1.1 and JBoss EAP 6.4 is still CDI 1.0. So the exception occurs because there is no way to tell the CDI 1.0 / Weld 1.x to not scan that class. So new CDI versions (1.1 and 1.2) avoids having an unnecessary dependency on DeltaSpike, the trade-off being that CDI 1.0 users have to declare that dependency explicitly.

That being said, I think WELD-000119 is only a warning and does not prevent the application to deploy. So either that warning is acceptable for you (until you upgrade to a newer CDI version), or you can add the dependency on DeltaSpike control API explicitly.

Let me know if that answers your question.

Antonin

> thanks
> /murt
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-2-17-camel-cdi-injection-problem-tp5780050.html
> Sent from the Camel - Users mailing list archive at Nabble.com.