camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Dudgeon <tdudgeon...@gmail.com>
Subject Re: Simple CDI setup with Weld
Date Fri, 20 Jan 2017 17:31:15 GMT
Thanks. Adding Deltaspike explicitly was the solution.

Tim

On 20/01/2017 12:11, Antonin Stefanutti wrote:
> Hi Tim,
>
> DeltaSpike is only used by this Main class to bootstrap Camel CDI in Java SE. So the
dependency is optional to avoid polluting the classpath for other target runtimes.
>
> In the Camel examples, we add it to the Camel Maven plugin dependency, see: https://github.com/apache/camel/blob/6e95af29bc289a60fa633530118f5a11a1ff55cd/examples/camel-example-cdi-metrics/pom.xml#L109-L113
>
> Note that this dependency may be removed with CDI 2.0, as a standard way of bootstrapping
CDI in Java SE is now provided.
>
> Antonin
>
>> On 20 Jan 2017, at 12:47, Tim Dudgeon <tdudgeon.ml@gmail.com> wrote:
>>
>> Hi,
>>
>> I'm trying to setup a simple Java SE app using Camel CDI and Weld.
>>
>> The docs state that this can be run using the org.apache.camel.cdi.Main class.
>> However when running this I get an exception:
>>
>> Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/deltaspike/cdise/api/CdiContainerLoader
>> at org.apache.camel.cdi.Main.doStart(Main.java:96)
>> at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
>> at org.apache.camel.main.MainSupport.run(MainSupport.java:138)
>> at org.apache.camel.main.MainSupport.run(MainSupport.java:390)
>> at org.apache.camel.cdi.Main.main(Main.java:64)
>> Caused by: java.lang.ClassNotFoundException: org.apache.deltaspike.cdise.api.CdiContainerLoader
>> at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
>> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
>> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>> ... 5 more
>>
>> Looking at the source for that class is seems to assume its using Deltaspike as the
CDI implementation, but obviously I don't have the Deltaspike classes present (not are they
a transient dependency of camel-cdi.
>>
>> So what is the right way to launch a Weld CDI Camel Java SE app?
>>
>> Tim
>>
>>
>>


Mime
View raw message