Using camel-cdi on Wildfly-10.1

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

Using camel-cdi on Wildfly-10.1

dkozic
Hello,

I want to use Camel 2.18.3 on WildFly-10.1.0.Final. My desired setup
is as follow:
- to use camel-cdi features
- to deploy camel and all third party dependencies as WildFly modules
- to deploy my application as war on WildFly with all internal
dependencies as jars in web-inf/lib
- I do not want to use WilfFly Camel Subsystem from
https://github.com/wildfly-extras/wildfly-camel

I have deployed camel as module by looking at WildFly Camel Subsystem
(wildfly-camel-patch-4.6.0). I took all content starting from
modules/system/layers/fuse/org/apache/camel and put it into my Wildfly
installation into modules/system/layers/base/org/apache/camel.

I have created some routes and processors. Everything went fine untill
moment when I modified my processor to trigger one of my services
which are using Deltaspike data module functionality. I got this log
output:

17:27:52,280 INFO
[com.mvneco.tebio.batch.common.BatchCamelContextProducer] (MSC service
thread 1-5) CamelContext configured: batch-camel-context
17:27:52,297 INFO  [com.mvneco.tebio.batch.simple.MySimpleProcessor]
(MSC service thread 1-5) Processor constructed: MySimpleProcessor
17:27:52,335 INFO  [com.mvneco.tebio.batch.simple.MySimpleRoute] (MSC
service thread 1-5) Route configured: MySimpleRoute
17:27:52,341 INFO  [org.apache.camel.cdi.CdiCamelExtension] (MSC
service thread 1-5) Camel CDI is starting Camel context
[batch-camel-context]
17:27:52,342 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
service thread 1-5) Apache Camel 2.18.3 (CamelContext:
batch-camel-context) is starting
17:27:52,344 INFO
[org.apache.camel.management.ManagedManagementStrategy] (MSC service
thread 1-5) JMX is enabled
17:27:52,455 INFO
[org.apache.camel.impl.converter.DefaultTypeConverter] (MSC service
thread 1-5) Loaded 189 type converters
17:27:52,493 INFO
[org.apache.camel.impl.DefaultRuntimeEndpointRegistry] (MSC service
thread 1-5) Runtime endpoint registry is in extended mode gathering
usage statistics of all incoming and outgoing endpoints (cache limit:
1000)
17:27:52,498 WARN  [org.jboss.as.weld] (MSC service thread 1-5)
WFLYWELD0052: Using deployment classloader to load proxy classes for
module org.apache.camel.core:main. Package-private access will not
work. To fix this the module should declare dependencies on
[org.jboss.weld.core, org.jboss.weld.spi]
17:27:52,630 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
service thread 1-5) StreamCaching is not in use. If using streams then
its recommended to enable stream caching. See more details at
http://camel.apache.org/stream-caching.html
17:27:52,693 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
service thread 1-5) Route: MySimpleRoute started and consuming from:
file://c:/test-folder?move=.done&moveFailed=.error
17:27:52,694 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
service thread 1-5) Total 1 routes, of which 1 are started.
17:27:52,695 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
service thread 1-5) Apache Camel 2.18.3 (CamelContext:
batch-camel-context) started in 0.351 seconds
17:27:52,968 INFO  [org.wildfly.extension.undertow] (ServerService
Thread Pool -- 59) WFLYUT0021: Registered web context: /tebio-batch
17:27:53,013 INFO  [org.jboss.as.server] (ServerService Thread Pool --
34) WFLYSRV0010: Deployed "tebio-batch.war" (runtime-name :
"tebio-batch.war")
17:27:53,164 INFO  [org.jboss.as] (Controller Boot Thread)
WFLYSRV0060: Http management interface listening on
http://127.0.0.1:9990/management
17:27:53,165 INFO  [org.jboss.as] (Controller Boot Thread)
WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
17:27:53,165 INFO  [org.jboss.as] (Controller Boot Thread)
WFLYSRV0025: WildFly Full 10.1.0.Final (WildFly Core 2.2.0.Final)
started in 17385ms - Started 465 of 713 services (409 services are
lazy, passive or on-demand)
17:28:14,328 WARN
[org.apache.camel.component.file.GenericFileOnCompletion] (Camel
(batch-camel-context) thread #0 - file://c:/test-folder) Rollback file
strategy: org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy@77ab824b
for file: GenericFile[c:\test-folder\test1.txt]
17:28:14,337 ERROR [com.mvneco.tebio.batch] (Camel
(batch-camel-context) thread #0 - file://c:/test-folder) Failed
delivery for (MessageId: ID-dkozic-PC-58228-1493825271666-0-1 on
ExchangeId: ID-dkozic-PC-58228-1493825271666-0-2). Exhausted after
delivery attempt: 1 caught: java.lang.IllegalStateException: Could not
find beans for Type=class
org.apache.deltaspike.data.impl.handler.QueryHandler

Message History
---------------------------------------------------------------------------------------------------------------------------------------
RouteId              ProcessorId          Processor
                                                    Elapsed (ms)
[MySimpleRoute     ] [MySimpleRoute     ]
[file://c:/test-folder?move=.done&moveFailed=.error
        ] [        33]
[MySimpleRoute     ] [MySimpleProcessor ] [Processor@0x60f6861a
                                                  ] [        20]

Stacktrace
---------------------------------------------------------------------------------------------------------------------------------------:
java.lang.IllegalStateException: Could not find beans for Type=class
org.apache.deltaspike.data.impl.handler.QueryHandler
        at org.apache.deltaspike.core.api.provider.BeanProvider.getBeanDefinitions(BeanProvider.java:415)
        at org.apache.deltaspike.core.api.provider.BeanProvider.getBeanDefinitions(BeanProvider.java:398)
        at org.apache.deltaspike.proxy.api.DeltaSpikeProxyContextualLifecycle.instantiateDelegateInvocationHandler(DeltaSpikeProxyContextualLifecycle.java:124)
        at org.apache.deltaspike.proxy.api.DeltaSpikeProxyContextualLifecycle.create(DeltaSpikeProxyContextualLifecycle.java:84)
        at org.apache.deltaspike.core.util.bean.ImmutableBean.create(ImmutableBean.java:72)
        at org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:70)
        at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:101)
        at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
        at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:742)
        at org.jboss.weld.manager.BeanManagerImpl.getInjectableReference(BeanManagerImpl.java:842)
        at org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:92)
        at org.jboss.weld.util.Beans.injectBoundFields(Beans.java:364)
        at org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:375)
        at org.jboss.weld.injection.producer.ResourceInjector$1.proceed(ResourceInjector.java:70)
        at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48)
        at org.jboss.weld.injection.producer.ResourceInjector.inject(ResourceInjector.java:72)
        at org.jboss.weld.injection.producer.BasicInjectionTarget.inject(BasicInjectionTarget.java:121)
        at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:159)
        at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:96)
        at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:101)
        at org.jboss.weld.bean.ContextualInstanceStrategy$ApplicationScopedContextualInstanceStrategy.get(ContextualInstanceStrategy.java:141)
        at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
        at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:99)
        at org.jboss.weld.bean.proxy.ProxyMethodHandler.getInstance(ProxyMethodHandler.java:125)
        at com.mvneco.ecofin.service.FinAccountServiceBean$Proxy$_$$_WeldClientProxy.getOptionalFinAccount(Unknown
Source)
        at com.mvneco.tebio.batch.simple.MySimpleProcessor.process(MySimpleProcessor.java:37)
        at org.apache.camel.processor.DelegateSyncProcessor.process(DelegateSyncProcessor.java:63)
        at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
        at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:542)
        at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
        at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
        at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:460)
        at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:227)
        at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:191)
        at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:175)
        at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:102)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)

I have to mention that my tests passes (@RunWith(CamelCdiRunner.class)).

My src/main/webapp/META-INF/jboss-deployment-structure.xml is like this:

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
        <deployment>
                <dependencies>
                        <module name="org.apache.deltaspike.core"
services="export" />
                        <module name="org.apache.deltaspike.modules"
services="export" />
                        <module name="org.apache.commons.lang3" />

                        <module name="org.apache.camel.core"
export="true" services="export" />
                        <module name="org.apache.camel.component.ftp"
export="true" services="export" />
                        <module name="org.apache.camel.component.cdi"
export="true" services="export" />

                </dependencies>
        </deployment>
</jboss-deployment-structure>

Every of jars declared as dependency in pom.xml have beans.xml. I have
tried different wildfly module configurations without success.

Any help is appreciated.


Drazen Kozic
Reply | Threaded
Open this post in threaded view
|

Re: Using camel-cdi on Wildfly-10.1

astefanutti
Hi Drazen,

It looks like the org.apache.deltaspike.data.impl.handler.QueryHandler class is not visible from the Camel module you’ve deployed. So it’s rather an issue of using Deltaspike data module within the WildFly module system. So you may need to add the deltaspike-data-module JARs to your module or properly create a module for Deltaspike data module.

Antonin

> On 5 May 2017, at 08:05, Drazen Kozic <[hidden email]> wrote:
>
> Hello,
>
> I want to use Camel 2.18.3 on WildFly-10.1.0.Final. My desired setup
> is as follow:
> - to use camel-cdi features
> - to deploy camel and all third party dependencies as WildFly modules
> - to deploy my application as war on WildFly with all internal
> dependencies as jars in web-inf/lib
> - I do not want to use WilfFly Camel Subsystem from
> https://github.com/wildfly-extras/wildfly-camel
>
> I have deployed camel as module by looking at WildFly Camel Subsystem
> (wildfly-camel-patch-4.6.0). I took all content starting from
> modules/system/layers/fuse/org/apache/camel and put it into my Wildfly
> installation into modules/system/layers/base/org/apache/camel.
>
> I have created some routes and processors. Everything went fine untill
> moment when I modified my processor to trigger one of my services
> which are using Deltaspike data module functionality. I got this log
> output:
>
> 17:27:52,280 INFO
> [com.mvneco.tebio.batch.common.BatchCamelContextProducer] (MSC service
> thread 1-5) CamelContext configured: batch-camel-context
> 17:27:52,297 INFO  [com.mvneco.tebio.batch.simple.MySimpleProcessor]
> (MSC service thread 1-5) Processor constructed: MySimpleProcessor
> 17:27:52,335 INFO  [com.mvneco.tebio.batch.simple.MySimpleRoute] (MSC
> service thread 1-5) Route configured: MySimpleRoute
> 17:27:52,341 INFO  [org.apache.camel.cdi.CdiCamelExtension] (MSC
> service thread 1-5) Camel CDI is starting Camel context
> [batch-camel-context]
> 17:27:52,342 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
> service thread 1-5) Apache Camel 2.18.3 (CamelContext:
> batch-camel-context) is starting
> 17:27:52,344 INFO
> [org.apache.camel.management.ManagedManagementStrategy] (MSC service
> thread 1-5) JMX is enabled
> 17:27:52,455 INFO
> [org.apache.camel.impl.converter.DefaultTypeConverter] (MSC service
> thread 1-5) Loaded 189 type converters
> 17:27:52,493 INFO
> [org.apache.camel.impl.DefaultRuntimeEndpointRegistry] (MSC service
> thread 1-5) Runtime endpoint registry is in extended mode gathering
> usage statistics of all incoming and outgoing endpoints (cache limit:
> 1000)
> 17:27:52,498 WARN  [org.jboss.as.weld] (MSC service thread 1-5)
> WFLYWELD0052: Using deployment classloader to load proxy classes for
> module org.apache.camel.core:main. Package-private access will not
> work. To fix this the module should declare dependencies on
> [org.jboss.weld.core, org.jboss.weld.spi]
> 17:27:52,630 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
> service thread 1-5) StreamCaching is not in use. If using streams then
> its recommended to enable stream caching. See more details at
> http://camel.apache.org/stream-caching.html
> 17:27:52,693 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
> service thread 1-5) Route: MySimpleRoute started and consuming from:
> file://c:/test-folder?move=.done&moveFailed=.error
> 17:27:52,694 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
> service thread 1-5) Total 1 routes, of which 1 are started.
> 17:27:52,695 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
> service thread 1-5) Apache Camel 2.18.3 (CamelContext:
> batch-camel-context) started in 0.351 seconds
> 17:27:52,968 INFO  [org.wildfly.extension.undertow] (ServerService
> Thread Pool -- 59) WFLYUT0021: Registered web context: /tebio-batch
> 17:27:53,013 INFO  [org.jboss.as.server] (ServerService Thread Pool --
> 34) WFLYSRV0010: Deployed "tebio-batch.war" (runtime-name :
> "tebio-batch.war")
> 17:27:53,164 INFO  [org.jboss.as] (Controller Boot Thread)
> WFLYSRV0060: Http management interface listening on
> http://127.0.0.1:9990/management
> 17:27:53,165 INFO  [org.jboss.as] (Controller Boot Thread)
> WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
> 17:27:53,165 INFO  [org.jboss.as] (Controller Boot Thread)
> WFLYSRV0025: WildFly Full 10.1.0.Final (WildFly Core 2.2.0.Final)
> started in 17385ms - Started 465 of 713 services (409 services are
> lazy, passive or on-demand)
> 17:28:14,328 WARN
> [org.apache.camel.component.file.GenericFileOnCompletion] (Camel
> (batch-camel-context) thread #0 - file://c:/test-folder) Rollback file
> strategy: org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy@77ab824b
> for file: GenericFile[c:\test-folder\test1.txt]
> 17:28:14,337 ERROR [com.mvneco.tebio.batch] (Camel
> (batch-camel-context) thread #0 - file://c:/test-folder) Failed
> delivery for (MessageId: ID-dkozic-PC-58228-1493825271666-0-1 on
> ExchangeId: ID-dkozic-PC-58228-1493825271666-0-2). Exhausted after
> delivery attempt: 1 caught: java.lang.IllegalStateException: Could not
> find beans for Type=class
> org.apache.deltaspike.data.impl.handler.QueryHandler
>
> Message History
> ---------------------------------------------------------------------------------------------------------------------------------------
> RouteId              ProcessorId          Processor
>                                                    Elapsed (ms)
> [MySimpleRoute     ] [MySimpleRoute     ]
> [file://c:/test-folder?move=.done&moveFailed=.error
>        ] [        33]
> [MySimpleRoute     ] [MySimpleProcessor ] [Processor@0x60f6861a
>                                                  ] [        20]
>
> Stacktrace
> ---------------------------------------------------------------------------------------------------------------------------------------:
> java.lang.IllegalStateException: Could not find beans for Type=class
> org.apache.deltaspike.data.impl.handler.QueryHandler
>        at org.apache.deltaspike.core.api.provider.BeanProvider.getBeanDefinitions(BeanProvider.java:415)
>        at org.apache.deltaspike.core.api.provider.BeanProvider.getBeanDefinitions(BeanProvider.java:398)
>        at org.apache.deltaspike.proxy.api.DeltaSpikeProxyContextualLifecycle.instantiateDelegateInvocationHandler(DeltaSpikeProxyContextualLifecycle.java:124)
>        at org.apache.deltaspike.proxy.api.DeltaSpikeProxyContextualLifecycle.create(DeltaSpikeProxyContextualLifecycle.java:84)
>        at org.apache.deltaspike.core.util.bean.ImmutableBean.create(ImmutableBean.java:72)
>        at org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:70)
>        at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:101)
>        at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
>        at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:742)
>        at org.jboss.weld.manager.BeanManagerImpl.getInjectableReference(BeanManagerImpl.java:842)
>        at org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:92)
>        at org.jboss.weld.util.Beans.injectBoundFields(Beans.java:364)
>        at org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:375)
>        at org.jboss.weld.injection.producer.ResourceInjector$1.proceed(ResourceInjector.java:70)
>        at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48)
>        at org.jboss.weld.injection.producer.ResourceInjector.inject(ResourceInjector.java:72)
>        at org.jboss.weld.injection.producer.BasicInjectionTarget.inject(BasicInjectionTarget.java:121)
>        at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:159)
>        at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:96)
>        at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:101)
>        at org.jboss.weld.bean.ContextualInstanceStrategy$ApplicationScopedContextualInstanceStrategy.get(ContextualInstanceStrategy.java:141)
>        at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
>        at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:99)
>        at org.jboss.weld.bean.proxy.ProxyMethodHandler.getInstance(ProxyMethodHandler.java:125)
>        at com.mvneco.ecofin.service.FinAccountServiceBean$Proxy$_$$_WeldClientProxy.getOptionalFinAccount(Unknown
> Source)
>        at com.mvneco.tebio.batch.simple.MySimpleProcessor.process(MySimpleProcessor.java:37)
>        at org.apache.camel.processor.DelegateSyncProcessor.process(DelegateSyncProcessor.java:63)
>        at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
>        at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:542)
>        at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
>        at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
>        at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:460)
>        at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:227)
>        at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:191)
>        at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:175)
>        at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:102)
>        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
>        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
>        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
>        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
>        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>        at java.lang.Thread.run(Thread.java:745)
>
> I have to mention that my tests passes (@RunWith(CamelCdiRunner.class)).
>
> My src/main/webapp/META-INF/jboss-deployment-structure.xml is like this:
>
> <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
>        <deployment>
>                <dependencies>
>                        <module name="org.apache.deltaspike.core"
> services="export" />
>                        <module name="org.apache.deltaspike.modules"
> services="export" />
>                        <module name="org.apache.commons.lang3" />
>
>                        <module name="org.apache.camel.core"
> export="true" services="export" />
>                        <module name="org.apache.camel.component.ftp"
> export="true" services="export" />
>                        <module name="org.apache.camel.component.cdi"
> export="true" services="export" />
>
>                </dependencies>
>        </deployment>
> </jboss-deployment-structure>
>
> Every of jars declared as dependency in pom.xml have beans.xml. I have
> tried different wildfly module configurations without success.
>
> Any help is appreciated.
>
>
> Drazen Kozic

Reply | Threaded
Open this post in threaded view
|

Re: Using camel-cdi on Wildfly-10.1

dkozic
Hello Antonin,
Thanks for the help. My assumption also was related to DeltaSpike
module configuration. Especially having in mind that tests are passing
OK.
I have downloaded distribution-full-1.7.2.zip of the DeltaSpike.
Inside it there are module.xml files for Wildfly. I didn't change
anything.

Regards


Best regards

Drazen Kozic


On Fri, May 5, 2017 at 10:34 AM, Antonin Stefanutti
<[hidden email]> wrote:

> Hi Drazen,
>
> It looks like the org.apache.deltaspike.data.impl.handler.QueryHandler class is not visible from the Camel module you’ve deployed. So it’s rather an issue of using Deltaspike data module within the WildFly module system. So you may need to add the deltaspike-data-module JARs to your module or properly create a module for Deltaspike data module.
>
> Antonin
>
>> On 5 May 2017, at 08:05, Drazen Kozic <[hidden email]> wrote:
>>
>> Hello,
>>
>> I want to use Camel 2.18.3 on WildFly-10.1.0.Final. My desired setup
>> is as follow:
>> - to use camel-cdi features
>> - to deploy camel and all third party dependencies as WildFly modules
>> - to deploy my application as war on WildFly with all internal
>> dependencies as jars in web-inf/lib
>> - I do not want to use WilfFly Camel Subsystem from
>> https://github.com/wildfly-extras/wildfly-camel
>>
>> I have deployed camel as module by looking at WildFly Camel Subsystem
>> (wildfly-camel-patch-4.6.0). I took all content starting from
>> modules/system/layers/fuse/org/apache/camel and put it into my Wildfly
>> installation into modules/system/layers/base/org/apache/camel.
>>
>> I have created some routes and processors. Everything went fine untill
>> moment when I modified my processor to trigger one of my services
>> which are using Deltaspike data module functionality. I got this log
>> output:
>>
>> 17:27:52,280 INFO
>> [com.mvneco.tebio.batch.common.BatchCamelContextProducer] (MSC service
>> thread 1-5) CamelContext configured: batch-camel-context
>> 17:27:52,297 INFO  [com.mvneco.tebio.batch.simple.MySimpleProcessor]
>> (MSC service thread 1-5) Processor constructed: MySimpleProcessor
>> 17:27:52,335 INFO  [com.mvneco.tebio.batch.simple.MySimpleRoute] (MSC
>> service thread 1-5) Route configured: MySimpleRoute
>> 17:27:52,341 INFO  [org.apache.camel.cdi.CdiCamelExtension] (MSC
>> service thread 1-5) Camel CDI is starting Camel context
>> [batch-camel-context]
>> 17:27:52,342 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
>> service thread 1-5) Apache Camel 2.18.3 (CamelContext:
>> batch-camel-context) is starting
>> 17:27:52,344 INFO
>> [org.apache.camel.management.ManagedManagementStrategy] (MSC service
>> thread 1-5) JMX is enabled
>> 17:27:52,455 INFO
>> [org.apache.camel.impl.converter.DefaultTypeConverter] (MSC service
>> thread 1-5) Loaded 189 type converters
>> 17:27:52,493 INFO
>> [org.apache.camel.impl.DefaultRuntimeEndpointRegistry] (MSC service
>> thread 1-5) Runtime endpoint registry is in extended mode gathering
>> usage statistics of all incoming and outgoing endpoints (cache limit:
>> 1000)
>> 17:27:52,498 WARN  [org.jboss.as.weld] (MSC service thread 1-5)
>> WFLYWELD0052: Using deployment classloader to load proxy classes for
>> module org.apache.camel.core:main. Package-private access will not
>> work. To fix this the module should declare dependencies on
>> [org.jboss.weld.core, org.jboss.weld.spi]
>> 17:27:52,630 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
>> service thread 1-5) StreamCaching is not in use. If using streams then
>> its recommended to enable stream caching. See more details at
>> http://camel.apache.org/stream-caching.html
>> 17:27:52,693 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
>> service thread 1-5) Route: MySimpleRoute started and consuming from:
>> file://c:/test-folder?move=.done&moveFailed=.error
>> 17:27:52,694 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
>> service thread 1-5) Total 1 routes, of which 1 are started.
>> 17:27:52,695 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
>> service thread 1-5) Apache Camel 2.18.3 (CamelContext:
>> batch-camel-context) started in 0.351 seconds
>> 17:27:52,968 INFO  [org.wildfly.extension.undertow] (ServerService
>> Thread Pool -- 59) WFLYUT0021: Registered web context: /tebio-batch
>> 17:27:53,013 INFO  [org.jboss.as.server] (ServerService Thread Pool --
>> 34) WFLYSRV0010: Deployed "tebio-batch.war" (runtime-name :
>> "tebio-batch.war")
>> 17:27:53,164 INFO  [org.jboss.as] (Controller Boot Thread)
>> WFLYSRV0060: Http management interface listening on
>> http://127.0.0.1:9990/management
>> 17:27:53,165 INFO  [org.jboss.as] (Controller Boot Thread)
>> WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
>> 17:27:53,165 INFO  [org.jboss.as] (Controller Boot Thread)
>> WFLYSRV0025: WildFly Full 10.1.0.Final (WildFly Core 2.2.0.Final)
>> started in 17385ms - Started 465 of 713 services (409 services are
>> lazy, passive or on-demand)
>> 17:28:14,328 WARN
>> [org.apache.camel.component.file.GenericFileOnCompletion] (Camel
>> (batch-camel-context) thread #0 - file://c:/test-folder) Rollback file
>> strategy: org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy@77ab824b
>> for file: GenericFile[c:\test-folder\test1.txt]
>> 17:28:14,337 ERROR [com.mvneco.tebio.batch] (Camel
>> (batch-camel-context) thread #0 - file://c:/test-folder) Failed
>> delivery for (MessageId: ID-dkozic-PC-58228-1493825271666-0-1 on
>> ExchangeId: ID-dkozic-PC-58228-1493825271666-0-2). Exhausted after
>> delivery attempt: 1 caught: java.lang.IllegalStateException: Could not
>> find beans for Type=class
>> org.apache.deltaspike.data.impl.handler.QueryHandler
>>
>> Message History
>> ---------------------------------------------------------------------------------------------------------------------------------------
>> RouteId              ProcessorId          Processor
>>                                                    Elapsed (ms)
>> [MySimpleRoute     ] [MySimpleRoute     ]
>> [file://c:/test-folder?move=.done&moveFailed=.error
>>        ] [        33]
>> [MySimpleRoute     ] [MySimpleProcessor ] [Processor@0x60f6861a
>>                                                  ] [        20]
>>
>> Stacktrace
>> ---------------------------------------------------------------------------------------------------------------------------------------:
>> java.lang.IllegalStateException: Could not find beans for Type=class
>> org.apache.deltaspike.data.impl.handler.QueryHandler
>>        at org.apache.deltaspike.core.api.provider.BeanProvider.getBeanDefinitions(BeanProvider.java:415)
>>        at org.apache.deltaspike.core.api.provider.BeanProvider.getBeanDefinitions(BeanProvider.java:398)
>>        at org.apache.deltaspike.proxy.api.DeltaSpikeProxyContextualLifecycle.instantiateDelegateInvocationHandler(DeltaSpikeProxyContextualLifecycle.java:124)
>>        at org.apache.deltaspike.proxy.api.DeltaSpikeProxyContextualLifecycle.create(DeltaSpikeProxyContextualLifecycle.java:84)
>>        at org.apache.deltaspike.core.util.bean.ImmutableBean.create(ImmutableBean.java:72)
>>        at org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:70)
>>        at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:101)
>>        at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
>>        at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:742)
>>        at org.jboss.weld.manager.BeanManagerImpl.getInjectableReference(BeanManagerImpl.java:842)
>>        at org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:92)
>>        at org.jboss.weld.util.Beans.injectBoundFields(Beans.java:364)
>>        at org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:375)
>>        at org.jboss.weld.injection.producer.ResourceInjector$1.proceed(ResourceInjector.java:70)
>>        at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48)
>>        at org.jboss.weld.injection.producer.ResourceInjector.inject(ResourceInjector.java:72)
>>        at org.jboss.weld.injection.producer.BasicInjectionTarget.inject(BasicInjectionTarget.java:121)
>>        at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:159)
>>        at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:96)
>>        at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:101)
>>        at org.jboss.weld.bean.ContextualInstanceStrategy$ApplicationScopedContextualInstanceStrategy.get(ContextualInstanceStrategy.java:141)
>>        at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
>>        at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:99)
>>        at org.jboss.weld.bean.proxy.ProxyMethodHandler.getInstance(ProxyMethodHandler.java:125)
>>        at com.mvneco.ecofin.service.FinAccountServiceBean$Proxy$_$$_WeldClientProxy.getOptionalFinAccount(Unknown
>> Source)
>>        at com.mvneco.tebio.batch.simple.MySimpleProcessor.process(MySimpleProcessor.java:37)
>>        at org.apache.camel.processor.DelegateSyncProcessor.process(DelegateSyncProcessor.java:63)
>>        at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
>>        at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:542)
>>        at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
>>        at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
>>        at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:460)
>>        at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:227)
>>        at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:191)
>>        at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:175)
>>        at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:102)
>>        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
>>        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
>>        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
>>        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
>>        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>>        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>>        at java.lang.Thread.run(Thread.java:745)
>>
>> I have to mention that my tests passes (@RunWith(CamelCdiRunner.class)).
>>
>> My src/main/webapp/META-INF/jboss-deployment-structure.xml is like this:
>>
>> <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
>>        <deployment>
>>                <dependencies>
>>                        <module name="org.apache.deltaspike.core"
>> services="export" />
>>                        <module name="org.apache.deltaspike.modules"
>> services="export" />
>>                        <module name="org.apache.commons.lang3" />
>>
>>                        <module name="org.apache.camel.core"
>> export="true" services="export" />
>>                        <module name="org.apache.camel.component.ftp"
>> export="true" services="export" />
>>                        <module name="org.apache.camel.component.cdi"
>> export="true" services="export" />
>>
>>                </dependencies>
>>        </deployment>
>> </jboss-deployment-structure>
>>
>> Every of jars declared as dependency in pom.xml have beans.xml. I have
>> tried different wildfly module configurations without success.
>>
>> Any help is appreciated.
>>
>>
>> Drazen Kozic
>
Reply | Threaded
Open this post in threaded view
|

Re: Using camel-cdi on Wildfly-10.1

astefanutti
Ah indeed, it looks like DeltaSpike Data module impl JAR is included in:

<module name="org.apache.deltaspike.modules"
services="export" />

https://github.com/apache/deltaspike/blob/a82f6ad27486756cc6d80d3a2db1695b779e36be/deltaspike/dist/full/src/main/distribution/modules-module.xml#L25-L26

That being said, it is likely to be an issue at how DeltaSpike integrates with WildFly module system rather than a Camel issue. SO I would you post a question on the WildFly forum or contact DeltaSpike user group.

Let us know what you think.

Antonin

> On 5 May 2017, at 11:35, Drazen Kozic <[hidden email]> wrote:
>
> Hello Antonin,
> Thanks for the help. My assumption also was related to DeltaSpike
> module configuration. Especially having in mind that tests are passing
> OK.
> I have downloaded distribution-full-1.7.2.zip of the DeltaSpike.
> Inside it there are module.xml files for Wildfly. I didn't change
> anything.
>
> Regards
>
>
> Best regards
>
> Drazen Kozic
>
>
> On Fri, May 5, 2017 at 10:34 AM, Antonin Stefanutti
> <[hidden email]> wrote:
>> Hi Drazen,
>>
>> It looks like the org.apache.deltaspike.data.impl.handler.QueryHandler class is not visible from the Camel module you’ve deployed. So it’s rather an issue of using Deltaspike data module within the WildFly module system. So you may need to add the deltaspike-data-module JARs to your module or properly create a module for Deltaspike data module.
>>
>> Antonin
>>
>>> On 5 May 2017, at 08:05, Drazen Kozic <[hidden email]> wrote:
>>>
>>> Hello,
>>>
>>> I want to use Camel 2.18.3 on WildFly-10.1.0.Final. My desired setup
>>> is as follow:
>>> - to use camel-cdi features
>>> - to deploy camel and all third party dependencies as WildFly modules
>>> - to deploy my application as war on WildFly with all internal
>>> dependencies as jars in web-inf/lib
>>> - I do not want to use WilfFly Camel Subsystem from
>>> https://github.com/wildfly-extras/wildfly-camel
>>>
>>> I have deployed camel as module by looking at WildFly Camel Subsystem
>>> (wildfly-camel-patch-4.6.0). I took all content starting from
>>> modules/system/layers/fuse/org/apache/camel and put it into my Wildfly
>>> installation into modules/system/layers/base/org/apache/camel.
>>>
>>> I have created some routes and processors. Everything went fine untill
>>> moment when I modified my processor to trigger one of my services
>>> which are using Deltaspike data module functionality. I got this log
>>> output:
>>>
>>> 17:27:52,280 INFO
>>> [com.mvneco.tebio.batch.common.BatchCamelContextProducer] (MSC service
>>> thread 1-5) CamelContext configured: batch-camel-context
>>> 17:27:52,297 INFO  [com.mvneco.tebio.batch.simple.MySimpleProcessor]
>>> (MSC service thread 1-5) Processor constructed: MySimpleProcessor
>>> 17:27:52,335 INFO  [com.mvneco.tebio.batch.simple.MySimpleRoute] (MSC
>>> service thread 1-5) Route configured: MySimpleRoute
>>> 17:27:52,341 INFO  [org.apache.camel.cdi.CdiCamelExtension] (MSC
>>> service thread 1-5) Camel CDI is starting Camel context
>>> [batch-camel-context]
>>> 17:27:52,342 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
>>> service thread 1-5) Apache Camel 2.18.3 (CamelContext:
>>> batch-camel-context) is starting
>>> 17:27:52,344 INFO
>>> [org.apache.camel.management.ManagedManagementStrategy] (MSC service
>>> thread 1-5) JMX is enabled
>>> 17:27:52,455 INFO
>>> [org.apache.camel.impl.converter.DefaultTypeConverter] (MSC service
>>> thread 1-5) Loaded 189 type converters
>>> 17:27:52,493 INFO
>>> [org.apache.camel.impl.DefaultRuntimeEndpointRegistry] (MSC service
>>> thread 1-5) Runtime endpoint registry is in extended mode gathering
>>> usage statistics of all incoming and outgoing endpoints (cache limit:
>>> 1000)
>>> 17:27:52,498 WARN  [org.jboss.as.weld] (MSC service thread 1-5)
>>> WFLYWELD0052: Using deployment classloader to load proxy classes for
>>> module org.apache.camel.core:main. Package-private access will not
>>> work. To fix this the module should declare dependencies on
>>> [org.jboss.weld.core, org.jboss.weld.spi]
>>> 17:27:52,630 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
>>> service thread 1-5) StreamCaching is not in use. If using streams then
>>> its recommended to enable stream caching. See more details at
>>> http://camel.apache.org/stream-caching.html
>>> 17:27:52,693 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
>>> service thread 1-5) Route: MySimpleRoute started and consuming from:
>>> file://c:/test-folder?move=.done&moveFailed=.error
>>> 17:27:52,694 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
>>> service thread 1-5) Total 1 routes, of which 1 are started.
>>> 17:27:52,695 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
>>> service thread 1-5) Apache Camel 2.18.3 (CamelContext:
>>> batch-camel-context) started in 0.351 seconds
>>> 17:27:52,968 INFO  [org.wildfly.extension.undertow] (ServerService
>>> Thread Pool -- 59) WFLYUT0021: Registered web context: /tebio-batch
>>> 17:27:53,013 INFO  [org.jboss.as.server] (ServerService Thread Pool --
>>> 34) WFLYSRV0010: Deployed "tebio-batch.war" (runtime-name :
>>> "tebio-batch.war")
>>> 17:27:53,164 INFO  [org.jboss.as] (Controller Boot Thread)
>>> WFLYSRV0060: Http management interface listening on
>>> http://127.0.0.1:9990/management
>>> 17:27:53,165 INFO  [org.jboss.as] (Controller Boot Thread)
>>> WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
>>> 17:27:53,165 INFO  [org.jboss.as] (Controller Boot Thread)
>>> WFLYSRV0025: WildFly Full 10.1.0.Final (WildFly Core 2.2.0.Final)
>>> started in 17385ms - Started 465 of 713 services (409 services are
>>> lazy, passive or on-demand)
>>> 17:28:14,328 WARN
>>> [org.apache.camel.component.file.GenericFileOnCompletion] (Camel
>>> (batch-camel-context) thread #0 - file://c:/test-folder) Rollback file
>>> strategy: org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy@77ab824b
>>> for file: GenericFile[c:\test-folder\test1.txt]
>>> 17:28:14,337 ERROR [com.mvneco.tebio.batch] (Camel
>>> (batch-camel-context) thread #0 - file://c:/test-folder) Failed
>>> delivery for (MessageId: ID-dkozic-PC-58228-1493825271666-0-1 on
>>> ExchangeId: ID-dkozic-PC-58228-1493825271666-0-2). Exhausted after
>>> delivery attempt: 1 caught: java.lang.IllegalStateException: Could not
>>> find beans for Type=class
>>> org.apache.deltaspike.data.impl.handler.QueryHandler
>>>
>>> Message History
>>> ---------------------------------------------------------------------------------------------------------------------------------------
>>> RouteId              ProcessorId          Processor
>>>                                                   Elapsed (ms)
>>> [MySimpleRoute     ] [MySimpleRoute     ]
>>> [file://c:/test-folder?move=.done&moveFailed=.error
>>>       ] [        33]
>>> [MySimpleRoute     ] [MySimpleProcessor ] [Processor@0x60f6861a
>>>                                                 ] [        20]
>>>
>>> Stacktrace
>>> ---------------------------------------------------------------------------------------------------------------------------------------:
>>> java.lang.IllegalStateException: Could not find beans for Type=class
>>> org.apache.deltaspike.data.impl.handler.QueryHandler
>>>       at org.apache.deltaspike.core.api.provider.BeanProvider.getBeanDefinitions(BeanProvider.java:415)
>>>       at org.apache.deltaspike.core.api.provider.BeanProvider.getBeanDefinitions(BeanProvider.java:398)
>>>       at org.apache.deltaspike.proxy.api.DeltaSpikeProxyContextualLifecycle.instantiateDelegateInvocationHandler(DeltaSpikeProxyContextualLifecycle.java:124)
>>>       at org.apache.deltaspike.proxy.api.DeltaSpikeProxyContextualLifecycle.create(DeltaSpikeProxyContextualLifecycle.java:84)
>>>       at org.apache.deltaspike.core.util.bean.ImmutableBean.create(ImmutableBean.java:72)
>>>       at org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:70)
>>>       at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:101)
>>>       at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
>>>       at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:742)
>>>       at org.jboss.weld.manager.BeanManagerImpl.getInjectableReference(BeanManagerImpl.java:842)
>>>       at org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:92)
>>>       at org.jboss.weld.util.Beans.injectBoundFields(Beans.java:364)
>>>       at org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:375)
>>>       at org.jboss.weld.injection.producer.ResourceInjector$1.proceed(ResourceInjector.java:70)
>>>       at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48)
>>>       at org.jboss.weld.injection.producer.ResourceInjector.inject(ResourceInjector.java:72)
>>>       at org.jboss.weld.injection.producer.BasicInjectionTarget.inject(BasicInjectionTarget.java:121)
>>>       at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:159)
>>>       at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:96)
>>>       at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:101)
>>>       at org.jboss.weld.bean.ContextualInstanceStrategy$ApplicationScopedContextualInstanceStrategy.get(ContextualInstanceStrategy.java:141)
>>>       at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
>>>       at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:99)
>>>       at org.jboss.weld.bean.proxy.ProxyMethodHandler.getInstance(ProxyMethodHandler.java:125)
>>>       at com.mvneco.ecofin.service.FinAccountServiceBean$Proxy$_$$_WeldClientProxy.getOptionalFinAccount(Unknown
>>> Source)
>>>       at com.mvneco.tebio.batch.simple.MySimpleProcessor.process(MySimpleProcessor.java:37)
>>>       at org.apache.camel.processor.DelegateSyncProcessor.process(DelegateSyncProcessor.java:63)
>>>       at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
>>>       at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:542)
>>>       at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
>>>       at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
>>>       at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:460)
>>>       at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:227)
>>>       at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:191)
>>>       at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:175)
>>>       at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:102)
>>>       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
>>>       at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
>>>       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
>>>       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
>>>       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>>>       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>>>       at java.lang.Thread.run(Thread.java:745)
>>>
>>> I have to mention that my tests passes (@RunWith(CamelCdiRunner.class)).
>>>
>>> My src/main/webapp/META-INF/jboss-deployment-structure.xml is like this:
>>>
>>> <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
>>>       <deployment>
>>>               <dependencies>
>>>                       <module name="org.apache.deltaspike.core"
>>> services="export" />
>>>                       <module name="org.apache.deltaspike.modules"
>>> services="export" />
>>>                       <module name="org.apache.commons.lang3" />
>>>
>>>                       <module name="org.apache.camel.core"
>>> export="true" services="export" />
>>>                       <module name="org.apache.camel.component.ftp"
>>> export="true" services="export" />
>>>                       <module name="org.apache.camel.component.cdi"
>>> export="true" services="export" />
>>>
>>>               </dependencies>
>>>       </deployment>
>>> </jboss-deployment-structure>
>>>
>>> Every of jars declared as dependency in pom.xml have beans.xml. I have
>>> tried different wildfly module configurations without success.
>>>
>>> Any help is appreciated.
>>>
>>>
>>> Drazen Kozic
>>

Reply | Threaded
Open this post in threaded view
|

Re: Using camel-cdi on Wildfly-10.1

dkozic
Usually, in case od module missconfiguration, CNFE is thrown. Here in
my case, it seems that it is context related issue not classpath
related issue.

In the documentation of camel-cdi,  DeltaSpike is mentioned here:
http://camel.apache.org/cdi.html. My conclussion is that camel-cdi
should work well in conjuction with DeltaSpike. What is missing is
some instruction how to setup them together on WildFly :-).

Because both DeltaSpike and camel-cdi are CDI/Weld extensions I cand
say where to search for cause of error. As I mentioned before:
- when DeltaSpike Data Module based service is not called, everything works fine
- even with DeltaSpike Data Module based service tests are passing
(@RunWith(CamelCdiRunner.class))



Best regards

Drazen Kozic


On Fri, May 5, 2017 at 12:16 PM, Antonin Stefanutti
<[hidden email]> wrote:

> Ah indeed, it looks like DeltaSpike Data module impl JAR is included in:
>
> <module name="org.apache.deltaspike.modules"
> services="export" />
>
> https://github.com/apache/deltaspike/blob/a82f6ad27486756cc6d80d3a2db1695b779e36be/deltaspike/dist/full/src/main/distribution/modules-module.xml#L25-L26
>
> That being said, it is likely to be an issue at how DeltaSpike integrates with WildFly module system rather than a Camel issue. SO I would you post a question on the WildFly forum or contact DeltaSpike user group.
>
> Let us know what you think.
>
> Antonin
>
>> On 5 May 2017, at 11:35, Drazen Kozic <[hidden email]> wrote:
>>
>> Hello Antonin,
>> Thanks for the help. My assumption also was related to DeltaSpike
>> module configuration. Especially having in mind that tests are passing
>> OK.
>> I have downloaded distribution-full-1.7.2.zip of the DeltaSpike.
>> Inside it there are module.xml files for Wildfly. I didn't change
>> anything.
>>
>> Regards
>>
>>
>> Best regards
>>
>> Drazen Kozic
>>
>>
>> On Fri, May 5, 2017 at 10:34 AM, Antonin Stefanutti
>> <[hidden email]> wrote:
>>> Hi Drazen,
>>>
>>> It looks like the org.apache.deltaspike.data.impl.handler.QueryHandler class is not visible from the Camel module you’ve deployed. So it’s rather an issue of using Deltaspike data module within the WildFly module system. So you may need to add the deltaspike-data-module JARs to your module or properly create a module for Deltaspike data module.
>>>
>>> Antonin
>>>
>>>> On 5 May 2017, at 08:05, Drazen Kozic <[hidden email]> wrote:
>>>>
>>>> Hello,
>>>>
>>>> I want to use Camel 2.18.3 on WildFly-10.1.0.Final. My desired setup
>>>> is as follow:
>>>> - to use camel-cdi features
>>>> - to deploy camel and all third party dependencies as WildFly modules
>>>> - to deploy my application as war on WildFly with all internal
>>>> dependencies as jars in web-inf/lib
>>>> - I do not want to use WilfFly Camel Subsystem from
>>>> https://github.com/wildfly-extras/wildfly-camel
>>>>
>>>> I have deployed camel as module by looking at WildFly Camel Subsystem
>>>> (wildfly-camel-patch-4.6.0). I took all content starting from
>>>> modules/system/layers/fuse/org/apache/camel and put it into my Wildfly
>>>> installation into modules/system/layers/base/org/apache/camel.
>>>>
>>>> I have created some routes and processors. Everything went fine untill
>>>> moment when I modified my processor to trigger one of my services
>>>> which are using Deltaspike data module functionality. I got this log
>>>> output:
>>>>
>>>> 17:27:52,280 INFO
>>>> [com.mvneco.tebio.batch.common.BatchCamelContextProducer] (MSC service
>>>> thread 1-5) CamelContext configured: batch-camel-context
>>>> 17:27:52,297 INFO  [com.mvneco.tebio.batch.simple.MySimpleProcessor]
>>>> (MSC service thread 1-5) Processor constructed: MySimpleProcessor
>>>> 17:27:52,335 INFO  [com.mvneco.tebio.batch.simple.MySimpleRoute] (MSC
>>>> service thread 1-5) Route configured: MySimpleRoute
>>>> 17:27:52,341 INFO  [org.apache.camel.cdi.CdiCamelExtension] (MSC
>>>> service thread 1-5) Camel CDI is starting Camel context
>>>> [batch-camel-context]
>>>> 17:27:52,342 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
>>>> service thread 1-5) Apache Camel 2.18.3 (CamelContext:
>>>> batch-camel-context) is starting
>>>> 17:27:52,344 INFO
>>>> [org.apache.camel.management.ManagedManagementStrategy] (MSC service
>>>> thread 1-5) JMX is enabled
>>>> 17:27:52,455 INFO
>>>> [org.apache.camel.impl.converter.DefaultTypeConverter] (MSC service
>>>> thread 1-5) Loaded 189 type converters
>>>> 17:27:52,493 INFO
>>>> [org.apache.camel.impl.DefaultRuntimeEndpointRegistry] (MSC service
>>>> thread 1-5) Runtime endpoint registry is in extended mode gathering
>>>> usage statistics of all incoming and outgoing endpoints (cache limit:
>>>> 1000)
>>>> 17:27:52,498 WARN  [org.jboss.as.weld] (MSC service thread 1-5)
>>>> WFLYWELD0052: Using deployment classloader to load proxy classes for
>>>> module org.apache.camel.core:main. Package-private access will not
>>>> work. To fix this the module should declare dependencies on
>>>> [org.jboss.weld.core, org.jboss.weld.spi]
>>>> 17:27:52,630 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
>>>> service thread 1-5) StreamCaching is not in use. If using streams then
>>>> its recommended to enable stream caching. See more details at
>>>> http://camel.apache.org/stream-caching.html
>>>> 17:27:52,693 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
>>>> service thread 1-5) Route: MySimpleRoute started and consuming from:
>>>> file://c:/test-folder?move=.done&moveFailed=.error
>>>> 17:27:52,694 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
>>>> service thread 1-5) Total 1 routes, of which 1 are started.
>>>> 17:27:52,695 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
>>>> service thread 1-5) Apache Camel 2.18.3 (CamelContext:
>>>> batch-camel-context) started in 0.351 seconds
>>>> 17:27:52,968 INFO  [org.wildfly.extension.undertow] (ServerService
>>>> Thread Pool -- 59) WFLYUT0021: Registered web context: /tebio-batch
>>>> 17:27:53,013 INFO  [org.jboss.as.server] (ServerService Thread Pool --
>>>> 34) WFLYSRV0010: Deployed "tebio-batch.war" (runtime-name :
>>>> "tebio-batch.war")
>>>> 17:27:53,164 INFO  [org.jboss.as] (Controller Boot Thread)
>>>> WFLYSRV0060: Http management interface listening on
>>>> http://127.0.0.1:9990/management
>>>> 17:27:53,165 INFO  [org.jboss.as] (Controller Boot Thread)
>>>> WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
>>>> 17:27:53,165 INFO  [org.jboss.as] (Controller Boot Thread)
>>>> WFLYSRV0025: WildFly Full 10.1.0.Final (WildFly Core 2.2.0.Final)
>>>> started in 17385ms - Started 465 of 713 services (409 services are
>>>> lazy, passive or on-demand)
>>>> 17:28:14,328 WARN
>>>> [org.apache.camel.component.file.GenericFileOnCompletion] (Camel
>>>> (batch-camel-context) thread #0 - file://c:/test-folder) Rollback file
>>>> strategy: org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy@77ab824b
>>>> for file: GenericFile[c:\test-folder\test1.txt]
>>>> 17:28:14,337 ERROR [com.mvneco.tebio.batch] (Camel
>>>> (batch-camel-context) thread #0 - file://c:/test-folder) Failed
>>>> delivery for (MessageId: ID-dkozic-PC-58228-1493825271666-0-1 on
>>>> ExchangeId: ID-dkozic-PC-58228-1493825271666-0-2). Exhausted after
>>>> delivery attempt: 1 caught: java.lang.IllegalStateException: Could not
>>>> find beans for Type=class
>>>> org.apache.deltaspike.data.impl.handler.QueryHandler
>>>>
>>>> Message History
>>>> ---------------------------------------------------------------------------------------------------------------------------------------
>>>> RouteId              ProcessorId          Processor
>>>>                                                   Elapsed (ms)
>>>> [MySimpleRoute     ] [MySimpleRoute     ]
>>>> [file://c:/test-folder?move=.done&moveFailed=.error
>>>>       ] [        33]
>>>> [MySimpleRoute     ] [MySimpleProcessor ] [Processor@0x60f6861a
>>>>                                                 ] [        20]
>>>>
>>>> Stacktrace
>>>> ---------------------------------------------------------------------------------------------------------------------------------------:
>>>> java.lang.IllegalStateException: Could not find beans for Type=class
>>>> org.apache.deltaspike.data.impl.handler.QueryHandler
>>>>       at org.apache.deltaspike.core.api.provider.BeanProvider.getBeanDefinitions(BeanProvider.java:415)
>>>>       at org.apache.deltaspike.core.api.provider.BeanProvider.getBeanDefinitions(BeanProvider.java:398)
>>>>       at org.apache.deltaspike.proxy.api.DeltaSpikeProxyContextualLifecycle.instantiateDelegateInvocationHandler(DeltaSpikeProxyContextualLifecycle.java:124)
>>>>       at org.apache.deltaspike.proxy.api.DeltaSpikeProxyContextualLifecycle.create(DeltaSpikeProxyContextualLifecycle.java:84)
>>>>       at org.apache.deltaspike.core.util.bean.ImmutableBean.create(ImmutableBean.java:72)
>>>>       at org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:70)
>>>>       at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:101)
>>>>       at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
>>>>       at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:742)
>>>>       at org.jboss.weld.manager.BeanManagerImpl.getInjectableReference(BeanManagerImpl.java:842)
>>>>       at org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:92)
>>>>       at org.jboss.weld.util.Beans.injectBoundFields(Beans.java:364)
>>>>       at org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:375)
>>>>       at org.jboss.weld.injection.producer.ResourceInjector$1.proceed(ResourceInjector.java:70)
>>>>       at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48)
>>>>       at org.jboss.weld.injection.producer.ResourceInjector.inject(ResourceInjector.java:72)
>>>>       at org.jboss.weld.injection.producer.BasicInjectionTarget.inject(BasicInjectionTarget.java:121)
>>>>       at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:159)
>>>>       at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:96)
>>>>       at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:101)
>>>>       at org.jboss.weld.bean.ContextualInstanceStrategy$ApplicationScopedContextualInstanceStrategy.get(ContextualInstanceStrategy.java:141)
>>>>       at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
>>>>       at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:99)
>>>>       at org.jboss.weld.bean.proxy.ProxyMethodHandler.getInstance(ProxyMethodHandler.java:125)
>>>>       at com.mvneco.ecofin.service.FinAccountServiceBean$Proxy$_$$_WeldClientProxy.getOptionalFinAccount(Unknown
>>>> Source)
>>>>       at com.mvneco.tebio.batch.simple.MySimpleProcessor.process(MySimpleProcessor.java:37)
>>>>       at org.apache.camel.processor.DelegateSyncProcessor.process(DelegateSyncProcessor.java:63)
>>>>       at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
>>>>       at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:542)
>>>>       at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
>>>>       at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
>>>>       at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:460)
>>>>       at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:227)
>>>>       at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:191)
>>>>       at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:175)
>>>>       at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:102)
>>>>       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
>>>>       at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
>>>>       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
>>>>       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
>>>>       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>>>>       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>>>>       at java.lang.Thread.run(Thread.java:745)
>>>>
>>>> I have to mention that my tests passes (@RunWith(CamelCdiRunner.class)).
>>>>
>>>> My src/main/webapp/META-INF/jboss-deployment-structure.xml is like this:
>>>>
>>>> <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
>>>>       <deployment>
>>>>               <dependencies>
>>>>                       <module name="org.apache.deltaspike.core"
>>>> services="export" />
>>>>                       <module name="org.apache.deltaspike.modules"
>>>> services="export" />
>>>>                       <module name="org.apache.commons.lang3" />
>>>>
>>>>                       <module name="org.apache.camel.core"
>>>> export="true" services="export" />
>>>>                       <module name="org.apache.camel.component.ftp"
>>>> export="true" services="export" />
>>>>                       <module name="org.apache.camel.component.cdi"
>>>> export="true" services="export" />
>>>>
>>>>               </dependencies>
>>>>       </deployment>
>>>> </jboss-deployment-structure>
>>>>
>>>> Every of jars declared as dependency in pom.xml have beans.xml. I have
>>>> tried different wildfly module configurations without success.
>>>>
>>>> Any help is appreciated.
>>>>
>>>>
>>>> Drazen Kozic
>>>
>
Reply | Threaded
Open this post in threaded view
|

Re: Using camel-cdi on Wildfly-10.1

John D. Ament-2
Drazen,

Camel CDI uses DeltaSpike Container Control to start and stop a CDI
container in conjunction with having an out of the box Main class.  It
makes no other use of DeltaSpike.

Camel CDI + DeltaSpike work well together, I use them today.  I'm also the
one who wrote the module.xml's you're looking at right now.

I'd rather see this discussed on the DS User list, but can answer the
question here as well.

Make sure in your jboss-deployment-structure.xml you're referencing the
deltaspike modules, include services="import" and meta-inf="import".

John

On Fri, May 5, 2017 at 7:27 AM Drazen Kozic <[hidden email]> wrote:

> Usually, in case od module missconfiguration, CNFE is thrown. Here in
> my case, it seems that it is context related issue not classpath
> related issue.
>
> In the documentation of camel-cdi,  DeltaSpike is mentioned here:
> http://camel.apache.org/cdi.html. My conclussion is that camel-cdi
> should work well in conjuction with DeltaSpike. What is missing is
> some instruction how to setup them together on WildFly :-).
>
> Because both DeltaSpike and camel-cdi are CDI/Weld extensions I cand
> say where to search for cause of error. As I mentioned before:
> - when DeltaSpike Data Module based service is not called, everything
> works fine
> - even with DeltaSpike Data Module based service tests are passing
> (@RunWith(CamelCdiRunner.class))
>
>
>
> Best regards
>
> Drazen Kozic
>
>
> On Fri, May 5, 2017 at 12:16 PM, Antonin Stefanutti
> <[hidden email]> wrote:
> > Ah indeed, it looks like DeltaSpike Data module impl JAR is included in:
> >
> > <module name="org.apache.deltaspike.modules"
> > services="export" />
> >
> >
> https://github.com/apache/deltaspike/blob/a82f6ad27486756cc6d80d3a2db1695b779e36be/deltaspike/dist/full/src/main/distribution/modules-module.xml#L25-L26
> >
> > That being said, it is likely to be an issue at how DeltaSpike
> integrates with WildFly module system rather than a Camel issue. SO I would
> you post a question on the WildFly forum or contact DeltaSpike user group.
> >
> > Let us know what you think.
> >
> > Antonin
> >
> >> On 5 May 2017, at 11:35, Drazen Kozic <[hidden email]> wrote:
> >>
> >> Hello Antonin,
> >> Thanks for the help. My assumption also was related to DeltaSpike
> >> module configuration. Especially having in mind that tests are passing
> >> OK.
> >> I have downloaded distribution-full-1.7.2.zip of the DeltaSpike.
> >> Inside it there are module.xml files for Wildfly. I didn't change
> >> anything.
> >>
> >> Regards
> >>
> >>
> >> Best regards
> >>
> >> Drazen Kozic
> >>
> >>
> >> On Fri, May 5, 2017 at 10:34 AM, Antonin Stefanutti
> >> <[hidden email]> wrote:
> >>> Hi Drazen,
> >>>
> >>> It looks like the org.apache.deltaspike.data.impl.handler.QueryHandler
> class is not visible from the Camel module you’ve deployed. So it’s rather
> an issue of using Deltaspike data module within the WildFly module system.
> So you may need to add the deltaspike-data-module JARs to your module or
> properly create a module for Deltaspike data module.
> >>>
> >>> Antonin
> >>>
> >>>> On 5 May 2017, at 08:05, Drazen Kozic <[hidden email]> wrote:
> >>>>
> >>>> Hello,
> >>>>
> >>>> I want to use Camel 2.18.3 on WildFly-10.1.0.Final. My desired setup
> >>>> is as follow:
> >>>> - to use camel-cdi features
> >>>> - to deploy camel and all third party dependencies as WildFly modules
> >>>> - to deploy my application as war on WildFly with all internal
> >>>> dependencies as jars in web-inf/lib
> >>>> - I do not want to use WilfFly Camel Subsystem from
> >>>> https://github.com/wildfly-extras/wildfly-camel
> >>>>
> >>>> I have deployed camel as module by looking at WildFly Camel Subsystem
> >>>> (wildfly-camel-patch-4.6.0). I took all content starting from
> >>>> modules/system/layers/fuse/org/apache/camel and put it into my Wildfly
> >>>> installation into modules/system/layers/base/org/apache/camel.
> >>>>
> >>>> I have created some routes and processors. Everything went fine untill
> >>>> moment when I modified my processor to trigger one of my services
> >>>> which are using Deltaspike data module functionality. I got this log
> >>>> output:
> >>>>
> >>>> 17:27:52,280 INFO
> >>>> [com.mvneco.tebio.batch.common.BatchCamelContextProducer] (MSC service
> >>>> thread 1-5) CamelContext configured: batch-camel-context
> >>>> 17:27:52,297 INFO  [com.mvneco.tebio.batch.simple.MySimpleProcessor]
> >>>> (MSC service thread 1-5) Processor constructed: MySimpleProcessor
> >>>> 17:27:52,335 INFO  [com.mvneco.tebio.batch.simple.MySimpleRoute] (MSC
> >>>> service thread 1-5) Route configured: MySimpleRoute
> >>>> 17:27:52,341 INFO  [org.apache.camel.cdi.CdiCamelExtension] (MSC
> >>>> service thread 1-5) Camel CDI is starting Camel context
> >>>> [batch-camel-context]
> >>>> 17:27:52,342 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
> >>>> service thread 1-5) Apache Camel 2.18.3 (CamelContext:
> >>>> batch-camel-context) is starting
> >>>> 17:27:52,344 INFO
> >>>> [org.apache.camel.management.ManagedManagementStrategy] (MSC service
> >>>> thread 1-5) JMX is enabled
> >>>> 17:27:52,455 INFO
> >>>> [org.apache.camel.impl.converter.DefaultTypeConverter] (MSC service
> >>>> thread 1-5) Loaded 189 type converters
> >>>> 17:27:52,493 INFO
> >>>> [org.apache.camel.impl.DefaultRuntimeEndpointRegistry] (MSC service
> >>>> thread 1-5) Runtime endpoint registry is in extended mode gathering
> >>>> usage statistics of all incoming and outgoing endpoints (cache limit:
> >>>> 1000)
> >>>> 17:27:52,498 WARN  [org.jboss.as.weld] (MSC service thread 1-5)
> >>>> WFLYWELD0052: Using deployment classloader to load proxy classes for
> >>>> module org.apache.camel.core:main. Package-private access will not
> >>>> work. To fix this the module should declare dependencies on
> >>>> [org.jboss.weld.core, org.jboss.weld.spi]
> >>>> 17:27:52,630 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
> >>>> service thread 1-5) StreamCaching is not in use. If using streams then
> >>>> its recommended to enable stream caching. See more details at
> >>>> http://camel.apache.org/stream-caching.html
> >>>> 17:27:52,693 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
> >>>> service thread 1-5) Route: MySimpleRoute started and consuming from:
> >>>> file://c:/test-folder?move=.done&moveFailed=.error
> >>>> 17:27:52,694 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
> >>>> service thread 1-5) Total 1 routes, of which 1 are started.
> >>>> 17:27:52,695 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
> >>>> service thread 1-5) Apache Camel 2.18.3 (CamelContext:
> >>>> batch-camel-context) started in 0.351 seconds
> >>>> 17:27:52,968 INFO  [org.wildfly.extension.undertow] (ServerService
> >>>> Thread Pool -- 59) WFLYUT0021: Registered web context: /tebio-batch
> >>>> 17:27:53,013 INFO  [org.jboss.as.server] (ServerService Thread Pool --
> >>>> 34) WFLYSRV0010: Deployed "tebio-batch.war" (runtime-name :
> >>>> "tebio-batch.war")
> >>>> 17:27:53,164 INFO  [org.jboss.as] (Controller Boot Thread)
> >>>> WFLYSRV0060: Http management interface listening on
> >>>> http://127.0.0.1:9990/management
> >>>> 17:27:53,165 INFO  [org.jboss.as] (Controller Boot Thread)
> >>>> WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
> >>>> 17:27:53,165 INFO  [org.jboss.as] (Controller Boot Thread)
> >>>> WFLYSRV0025: WildFly Full 10.1.0.Final (WildFly Core 2.2.0.Final)
> >>>> started in 17385ms - Started 465 of 713 services (409 services are
> >>>> lazy, passive or on-demand)
> >>>> 17:28:14,328 WARN
> >>>> [org.apache.camel.component.file.GenericFileOnCompletion] (Camel
> >>>> (batch-camel-context) thread #0 - file://c:/test-folder) Rollback file
> >>>> strategy:
> org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy@77ab824b
> >>>> for file: GenericFile[c:\test-folder\test1.txt]
> >>>> 17:28:14,337 ERROR [com.mvneco.tebio.batch] (Camel
> >>>> (batch-camel-context) thread #0 - file://c:/test-folder) Failed
> >>>> delivery for (MessageId: ID-dkozic-PC-58228-1493825271666-0-1 on
> >>>> ExchangeId: ID-dkozic-PC-58228-1493825271666-0-2). Exhausted after
> >>>> delivery attempt: 1 caught: java.lang.IllegalStateException: Could not
> >>>> find beans for Type=class
> >>>> org.apache.deltaspike.data.impl.handler.QueryHandler
> >>>>
> >>>> Message History
> >>>>
> ---------------------------------------------------------------------------------------------------------------------------------------
> >>>> RouteId              ProcessorId          Processor
> >>>>                                                   Elapsed (ms)
> >>>> [MySimpleRoute     ] [MySimpleRoute     ]
> >>>> [file://c:/test-folder?move=.done&moveFailed=.error
> >>>>       ] [        33]
> >>>> [MySimpleRoute     ] [MySimpleProcessor ] [Processor@0x60f6861a
> >>>>                                                 ] [        20]
> >>>>
> >>>> Stacktrace
> >>>>
> ---------------------------------------------------------------------------------------------------------------------------------------:
> >>>> java.lang.IllegalStateException: Could not find beans for Type=class
> >>>> org.apache.deltaspike.data.impl.handler.QueryHandler
> >>>>       at
> org.apache.deltaspike.core.api.provider.BeanProvider.getBeanDefinitions(BeanProvider.java:415)
> >>>>       at
> org.apache.deltaspike.core.api.provider.BeanProvider.getBeanDefinitions(BeanProvider.java:398)
> >>>>       at
> org.apache.deltaspike.proxy.api.DeltaSpikeProxyContextualLifecycle.instantiateDelegateInvocationHandler(DeltaSpikeProxyContextualLifecycle.java:124)
> >>>>       at
> org.apache.deltaspike.proxy.api.DeltaSpikeProxyContextualLifecycle.create(DeltaSpikeProxyContextualLifecycle.java:84)
> >>>>       at
> org.apache.deltaspike.core.util.bean.ImmutableBean.create(ImmutableBean.java:72)
> >>>>       at
> org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:70)
> >>>>       at
> org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:101)
> >>>>       at
> org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
> >>>>       at
> org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:742)
> >>>>       at
> org.jboss.weld.manager.BeanManagerImpl.getInjectableReference(BeanManagerImpl.java:842)
> >>>>       at
> org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:92)
> >>>>       at org.jboss.weld.util.Beans.injectBoundFields(Beans.java:364)
> >>>>       at
> org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:375)
> >>>>       at
> org.jboss.weld.injection.producer.ResourceInjector$1.proceed(ResourceInjector.java:70)
> >>>>       at
> org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48)
> >>>>       at
> org.jboss.weld.injection.producer.ResourceInjector.inject(ResourceInjector.java:72)
> >>>>       at
> org.jboss.weld.injection.producer.BasicInjectionTarget.inject(BasicInjectionTarget.java:121)
> >>>>       at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:159)
> >>>>       at
> org.jboss.weld.context.AbstractContext.get(AbstractContext.java:96)
> >>>>       at
> org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:101)
> >>>>       at
> org.jboss.weld.bean.ContextualInstanceStrategy$ApplicationScopedContextualInstanceStrategy.get(ContextualInstanceStrategy.java:141)
> >>>>       at
> org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
> >>>>       at
> org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:99)
> >>>>       at
> org.jboss.weld.bean.proxy.ProxyMethodHandler.getInstance(ProxyMethodHandler.java:125)
> >>>>       at
> com.mvneco.ecofin.service.FinAccountServiceBean$Proxy$_$$_WeldClientProxy.getOptionalFinAccount(Unknown
> >>>> Source)
> >>>>       at
> com.mvneco.tebio.batch.simple.MySimpleProcessor.process(MySimpleProcessor.java:37)
> >>>>       at
> org.apache.camel.processor.DelegateSyncProcessor.process(DelegateSyncProcessor.java:63)
> >>>>       at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
> >>>>       at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:542)
> >>>>       at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
> >>>>       at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
> >>>>       at
> org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:460)
> >>>>       at
> org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:227)
> >>>>       at
> org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:191)
> >>>>       at
> org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:175)
> >>>>       at
> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:102)
> >>>>       at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
> >>>>       at
> java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
> >>>>       at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
> >>>>       at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
> >>>>       at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> >>>>       at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> >>>>       at java.lang.Thread.run(Thread.java:745)
> >>>>
> >>>> I have to mention that my tests passes
> (@RunWith(CamelCdiRunner.class)).
> >>>>
> >>>> My src/main/webapp/META-INF/jboss-deployment-structure.xml is like
> this:
> >>>>
> >>>> <jboss-deployment-structure
> xmlns="urn:jboss:deployment-structure:1.0">
> >>>>       <deployment>
> >>>>               <dependencies>
> >>>>                       <module name="org.apache.deltaspike.core"
> >>>> services="export" />
> >>>>                       <module name="org.apache.deltaspike.modules"
> >>>> services="export" />
> >>>>                       <module name="org.apache.commons.lang3" />
> >>>>
> >>>>                       <module name="org.apache.camel.core"
> >>>> export="true" services="export" />
> >>>>                       <module name="org.apache.camel.component.ftp"
> >>>> export="true" services="export" />
> >>>>                       <module name="org.apache.camel.component.cdi"
> >>>> export="true" services="export" />
> >>>>
> >>>>               </dependencies>
> >>>>       </deployment>
> >>>> </jboss-deployment-structure>
> >>>>
> >>>> Every of jars declared as dependency in pom.xml have beans.xml. I have
> >>>> tried different wildfly module configurations without success.
> >>>>
> >>>> Any help is appreciated.
> >>>>
> >>>>
> >>>> Drazen Kozic
> >>>
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Using camel-cdi on Wildfly-10.1

dkozic
Hello John,

I did what you said. My
src/main/webapp/META-INF/jboss-deployment-structure.xml is as follow:

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.3">
    <deployment>
        <dependencies>
            <module name="org.apache.deltaspike.core"
services="import" meta-inf="import" />
            <module name="org.apache.deltaspike.modules"
services="import" meta-inf="import" />

            <module name="org.apache.commons.lang3" />

            <module name="org.apache.camel.core" export="true"
services="import" meta-inf="import" />
            <module name="org.apache.camel.component.ftp"
export="true" services="import" meta-inf="import" />
            <module name="org.apache.camel.component.cdi"
export="true" services="import" meta-inf="import" />

        </dependencies>
    </deployment>
</jboss-deployment-structure>

With this setup, no success.


Best regards

Drazen Kozic


On Fri, May 5, 2017 at 1:32 PM, John D. Ament <[hidden email]> wrote:

> Drazen,
>
> Camel CDI uses DeltaSpike Container Control to start and stop a CDI
> container in conjunction with having an out of the box Main class.  It
> makes no other use of DeltaSpike.
>
> Camel CDI + DeltaSpike work well together, I use them today.  I'm also the
> one who wrote the module.xml's you're looking at right now.
>
> I'd rather see this discussed on the DS User list, but can answer the
> question here as well.
>
> Make sure in your jboss-deployment-structure.xml you're referencing the
> deltaspike modules, include services="import" and meta-inf="import".
>
> John
>
> On Fri, May 5, 2017 at 7:27 AM Drazen Kozic <[hidden email]> wrote:
>
>> Usually, in case od module missconfiguration, CNFE is thrown. Here in
>> my case, it seems that it is context related issue not classpath
>> related issue.
>>
>> In the documentation of camel-cdi,  DeltaSpike is mentioned here:
>> http://camel.apache.org/cdi.html. My conclussion is that camel-cdi
>> should work well in conjuction with DeltaSpike. What is missing is
>> some instruction how to setup them together on WildFly :-).
>>
>> Because both DeltaSpike and camel-cdi are CDI/Weld extensions I cand
>> say where to search for cause of error. As I mentioned before:
>> - when DeltaSpike Data Module based service is not called, everything
>> works fine
>> - even with DeltaSpike Data Module based service tests are passing
>> (@RunWith(CamelCdiRunner.class))
>>
>>
>>
>> Best regards
>>
>> Drazen Kozic
>>
>>
>> On Fri, May 5, 2017 at 12:16 PM, Antonin Stefanutti
>> <[hidden email]> wrote:
>> > Ah indeed, it looks like DeltaSpike Data module impl JAR is included in:
>> >
>> > <module name="org.apache.deltaspike.modules"
>> > services="export" />
>> >
>> >
>> https://github.com/apache/deltaspike/blob/a82f6ad27486756cc6d80d3a2db1695b779e36be/deltaspike/dist/full/src/main/distribution/modules-module.xml#L25-L26
>> >
>> > That being said, it is likely to be an issue at how DeltaSpike
>> integrates with WildFly module system rather than a Camel issue. SO I would
>> you post a question on the WildFly forum or contact DeltaSpike user group.
>> >
>> > Let us know what you think.
>> >
>> > Antonin
>> >
>> >> On 5 May 2017, at 11:35, Drazen Kozic <[hidden email]> wrote:
>> >>
>> >> Hello Antonin,
>> >> Thanks for the help. My assumption also was related to DeltaSpike
>> >> module configuration. Especially having in mind that tests are passing
>> >> OK.
>> >> I have downloaded distribution-full-1.7.2.zip of the DeltaSpike.
>> >> Inside it there are module.xml files for Wildfly. I didn't change
>> >> anything.
>> >>
>> >> Regards
>> >>
>> >>
>> >> Best regards
>> >>
>> >> Drazen Kozic
>> >>
>> >>
>> >> On Fri, May 5, 2017 at 10:34 AM, Antonin Stefanutti
>> >> <[hidden email]> wrote:
>> >>> Hi Drazen,
>> >>>
>> >>> It looks like the org.apache.deltaspike.data.impl.handler.QueryHandler
>> class is not visible from the Camel module you’ve deployed. So it’s rather
>> an issue of using Deltaspike data module within the WildFly module system.
>> So you may need to add the deltaspike-data-module JARs to your module or
>> properly create a module for Deltaspike data module.
>> >>>
>> >>> Antonin
>> >>>
>> >>>> On 5 May 2017, at 08:05, Drazen Kozic <[hidden email]> wrote:
>> >>>>
>> >>>> Hello,
>> >>>>
>> >>>> I want to use Camel 2.18.3 on WildFly-10.1.0.Final. My desired setup
>> >>>> is as follow:
>> >>>> - to use camel-cdi features
>> >>>> - to deploy camel and all third party dependencies as WildFly modules
>> >>>> - to deploy my application as war on WildFly with all internal
>> >>>> dependencies as jars in web-inf/lib
>> >>>> - I do not want to use WilfFly Camel Subsystem from
>> >>>> https://github.com/wildfly-extras/wildfly-camel
>> >>>>
>> >>>> I have deployed camel as module by looking at WildFly Camel Subsystem
>> >>>> (wildfly-camel-patch-4.6.0). I took all content starting from
>> >>>> modules/system/layers/fuse/org/apache/camel and put it into my Wildfly
>> >>>> installation into modules/system/layers/base/org/apache/camel.
>> >>>>
>> >>>> I have created some routes and processors. Everything went fine untill
>> >>>> moment when I modified my processor to trigger one of my services
>> >>>> which are using Deltaspike data module functionality. I got this log
>> >>>> output:
>> >>>>
>> >>>> 17:27:52,280 INFO
>> >>>> [com.mvneco.tebio.batch.common.BatchCamelContextProducer] (MSC service
>> >>>> thread 1-5) CamelContext configured: batch-camel-context
>> >>>> 17:27:52,297 INFO  [com.mvneco.tebio.batch.simple.MySimpleProcessor]
>> >>>> (MSC service thread 1-5) Processor constructed: MySimpleProcessor
>> >>>> 17:27:52,335 INFO  [com.mvneco.tebio.batch.simple.MySimpleRoute] (MSC
>> >>>> service thread 1-5) Route configured: MySimpleRoute
>> >>>> 17:27:52,341 INFO  [org.apache.camel.cdi.CdiCamelExtension] (MSC
>> >>>> service thread 1-5) Camel CDI is starting Camel context
>> >>>> [batch-camel-context]
>> >>>> 17:27:52,342 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
>> >>>> service thread 1-5) Apache Camel 2.18.3 (CamelContext:
>> >>>> batch-camel-context) is starting
>> >>>> 17:27:52,344 INFO
>> >>>> [org.apache.camel.management.ManagedManagementStrategy] (MSC service
>> >>>> thread 1-5) JMX is enabled
>> >>>> 17:27:52,455 INFO
>> >>>> [org.apache.camel.impl.converter.DefaultTypeConverter] (MSC service
>> >>>> thread 1-5) Loaded 189 type converters
>> >>>> 17:27:52,493 INFO
>> >>>> [org.apache.camel.impl.DefaultRuntimeEndpointRegistry] (MSC service
>> >>>> thread 1-5) Runtime endpoint registry is in extended mode gathering
>> >>>> usage statistics of all incoming and outgoing endpoints (cache limit:
>> >>>> 1000)
>> >>>> 17:27:52,498 WARN  [org.jboss.as.weld] (MSC service thread 1-5)
>> >>>> WFLYWELD0052: Using deployment classloader to load proxy classes for
>> >>>> module org.apache.camel.core:main. Package-private access will not
>> >>>> work. To fix this the module should declare dependencies on
>> >>>> [org.jboss.weld.core, org.jboss.weld.spi]
>> >>>> 17:27:52,630 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
>> >>>> service thread 1-5) StreamCaching is not in use. If using streams then
>> >>>> its recommended to enable stream caching. See more details at
>> >>>> http://camel.apache.org/stream-caching.html
>> >>>> 17:27:52,693 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
>> >>>> service thread 1-5) Route: MySimpleRoute started and consuming from:
>> >>>> file://c:/test-folder?move=.done&moveFailed=.error
>> >>>> 17:27:52,694 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
>> >>>> service thread 1-5) Total 1 routes, of which 1 are started.
>> >>>> 17:27:52,695 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
>> >>>> service thread 1-5) Apache Camel 2.18.3 (CamelContext:
>> >>>> batch-camel-context) started in 0.351 seconds
>> >>>> 17:27:52,968 INFO  [org.wildfly.extension.undertow] (ServerService
>> >>>> Thread Pool -- 59) WFLYUT0021: Registered web context: /tebio-batch
>> >>>> 17:27:53,013 INFO  [org.jboss.as.server] (ServerService Thread Pool --
>> >>>> 34) WFLYSRV0010: Deployed "tebio-batch.war" (runtime-name :
>> >>>> "tebio-batch.war")
>> >>>> 17:27:53,164 INFO  [org.jboss.as] (Controller Boot Thread)
>> >>>> WFLYSRV0060: Http management interface listening on
>> >>>> http://127.0.0.1:9990/management
>> >>>> 17:27:53,165 INFO  [org.jboss.as] (Controller Boot Thread)
>> >>>> WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
>> >>>> 17:27:53,165 INFO  [org.jboss.as] (Controller Boot Thread)
>> >>>> WFLYSRV0025: WildFly Full 10.1.0.Final (WildFly Core 2.2.0.Final)
>> >>>> started in 17385ms - Started 465 of 713 services (409 services are
>> >>>> lazy, passive or on-demand)
>> >>>> 17:28:14,328 WARN
>> >>>> [org.apache.camel.component.file.GenericFileOnCompletion] (Camel
>> >>>> (batch-camel-context) thread #0 - file://c:/test-folder) Rollback file
>> >>>> strategy:
>> org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy@77ab824b
>> >>>> for file: GenericFile[c:\test-folder\test1.txt]
>> >>>> 17:28:14,337 ERROR [com.mvneco.tebio.batch] (Camel
>> >>>> (batch-camel-context) thread #0 - file://c:/test-folder) Failed
>> >>>> delivery for (MessageId: ID-dkozic-PC-58228-1493825271666-0-1 on
>> >>>> ExchangeId: ID-dkozic-PC-58228-1493825271666-0-2). Exhausted after
>> >>>> delivery attempt: 1 caught: java.lang.IllegalStateException: Could not
>> >>>> find beans for Type=class
>> >>>> org.apache.deltaspike.data.impl.handler.QueryHandler
>> >>>>
>> >>>> Message History
>> >>>>
>> ---------------------------------------------------------------------------------------------------------------------------------------
>> >>>> RouteId              ProcessorId          Processor
>> >>>>                                                   Elapsed (ms)
>> >>>> [MySimpleRoute     ] [MySimpleRoute     ]
>> >>>> [file://c:/test-folder?move=.done&moveFailed=.error
>> >>>>       ] [        33]
>> >>>> [MySimpleRoute     ] [MySimpleProcessor ] [Processor@0x60f6861a
>> >>>>                                                 ] [        20]
>> >>>>
>> >>>> Stacktrace
>> >>>>
>> ---------------------------------------------------------------------------------------------------------------------------------------:
>> >>>> java.lang.IllegalStateException: Could not find beans for Type=class
>> >>>> org.apache.deltaspike.data.impl.handler.QueryHandler
>> >>>>       at
>> org.apache.deltaspike.core.api.provider.BeanProvider.getBeanDefinitions(BeanProvider.java:415)
>> >>>>       at
>> org.apache.deltaspike.core.api.provider.BeanProvider.getBeanDefinitions(BeanProvider.java:398)
>> >>>>       at
>> org.apache.deltaspike.proxy.api.DeltaSpikeProxyContextualLifecycle.instantiateDelegateInvocationHandler(DeltaSpikeProxyContextualLifecycle.java:124)
>> >>>>       at
>> org.apache.deltaspike.proxy.api.DeltaSpikeProxyContextualLifecycle.create(DeltaSpikeProxyContextualLifecycle.java:84)
>> >>>>       at
>> org.apache.deltaspike.core.util.bean.ImmutableBean.create(ImmutableBean.java:72)
>> >>>>       at
>> org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:70)
>> >>>>       at
>> org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:101)
>> >>>>       at
>> org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
>> >>>>       at
>> org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:742)
>> >>>>       at
>> org.jboss.weld.manager.BeanManagerImpl.getInjectableReference(BeanManagerImpl.java:842)
>> >>>>       at
>> org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:92)
>> >>>>       at org.jboss.weld.util.Beans.injectBoundFields(Beans.java:364)
>> >>>>       at
>> org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:375)
>> >>>>       at
>> org.jboss.weld.injection.producer.ResourceInjector$1.proceed(ResourceInjector.java:70)
>> >>>>       at
>> org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48)
>> >>>>       at
>> org.jboss.weld.injection.producer.ResourceInjector.inject(ResourceInjector.java:72)
>> >>>>       at
>> org.jboss.weld.injection.producer.BasicInjectionTarget.inject(BasicInjectionTarget.java:121)
>> >>>>       at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:159)
>> >>>>       at
>> org.jboss.weld.context.AbstractContext.get(AbstractContext.java:96)
>> >>>>       at
>> org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:101)
>> >>>>       at
>> org.jboss.weld.bean.ContextualInstanceStrategy$ApplicationScopedContextualInstanceStrategy.get(ContextualInstanceStrategy.java:141)
>> >>>>       at
>> org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
>> >>>>       at
>> org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:99)
>> >>>>       at
>> org.jboss.weld.bean.proxy.ProxyMethodHandler.getInstance(ProxyMethodHandler.java:125)
>> >>>>       at
>> com.mvneco.ecofin.service.FinAccountServiceBean$Proxy$_$$_WeldClientProxy.getOptionalFinAccount(Unknown
>> >>>> Source)
>> >>>>       at
>> com.mvneco.tebio.batch.simple.MySimpleProcessor.process(MySimpleProcessor.java:37)
>> >>>>       at
>> org.apache.camel.processor.DelegateSyncProcessor.process(DelegateSyncProcessor.java:63)
>> >>>>       at
>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
>> >>>>       at
>> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:542)
>> >>>>       at
>> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
>> >>>>       at
>> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
>> >>>>       at
>> org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:460)
>> >>>>       at
>> org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:227)
>> >>>>       at
>> org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:191)
>> >>>>       at
>> org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:175)
>> >>>>       at
>> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:102)
>> >>>>       at
>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
>> >>>>       at
>> java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
>> >>>>       at
>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
>> >>>>       at
>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
>> >>>>       at
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>> >>>>       at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>> >>>>       at java.lang.Thread.run(Thread.java:745)
>> >>>>
>> >>>> I have to mention that my tests passes
>> (@RunWith(CamelCdiRunner.class)).
>> >>>>
>> >>>> My src/main/webapp/META-INF/jboss-deployment-structure.xml is like
>> this:
>> >>>>
>> >>>> <jboss-deployment-structure
>> xmlns="urn:jboss:deployment-structure:1.0">
>> >>>>       <deployment>
>> >>>>               <dependencies>
>> >>>>                       <module name="org.apache.deltaspike.core"
>> >>>> services="export" />
>> >>>>                       <module name="org.apache.deltaspike.modules"
>> >>>> services="export" />
>> >>>>                       <module name="org.apache.commons.lang3" />
>> >>>>
>> >>>>                       <module name="org.apache.camel.core"
>> >>>> export="true" services="export" />
>> >>>>                       <module name="org.apache.camel.component.ftp"
>> >>>> export="true" services="export" />
>> >>>>                       <module name="org.apache.camel.component.cdi"
>> >>>> export="true" services="export" />
>> >>>>
>> >>>>               </dependencies>
>> >>>>       </deployment>
>> >>>> </jboss-deployment-structure>
>> >>>>
>> >>>> Every of jars declared as dependency in pom.xml have beans.xml. I have
>> >>>> tried different wildfly module configurations without success.
>> >>>>
>> >>>> Any help is appreciated.
>> >>>>
>> >>>>
>> >>>> Drazen Kozic
>> >>>
>> >
>>
Reply | Threaded
Open this post in threaded view
|

Re: Using camel-cdi on Wildfly-10.1

John D. Ament-2
Hi Drazen,

Can you modify your camel module.xml to also add these same references to
deltaspike?

John

On Fri, May 5, 2017 at 8:03 AM Drazen Kozic <[hidden email]> wrote:

> Hello John,
>
> I did what you said. My
> src/main/webapp/META-INF/jboss-deployment-structure.xml is as follow:
>
> <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.3">
>     <deployment>
>         <dependencies>
>             <module name="org.apache.deltaspike.core"
> services="import" meta-inf="import" />
>             <module name="org.apache.deltaspike.modules"
> services="import" meta-inf="import" />
>
>             <module name="org.apache.commons.lang3" />
>
>             <module name="org.apache.camel.core" export="true"
> services="import" meta-inf="import" />
>             <module name="org.apache.camel.component.ftp"
> export="true" services="import" meta-inf="import" />
>             <module name="org.apache.camel.component.cdi"
> export="true" services="import" meta-inf="import" />
>
>         </dependencies>
>     </deployment>
> </jboss-deployment-structure>
>
> With this setup, no success.
>
>
> Best regards
>
> Drazen Kozic
>
>
> On Fri, May 5, 2017 at 1:32 PM, John D. Ament <[hidden email]>
> wrote:
> > Drazen,
> >
> > Camel CDI uses DeltaSpike Container Control to start and stop a CDI
> > container in conjunction with having an out of the box Main class.  It
> > makes no other use of DeltaSpike.
> >
> > Camel CDI + DeltaSpike work well together, I use them today.  I'm also
> the
> > one who wrote the module.xml's you're looking at right now.
> >
> > I'd rather see this discussed on the DS User list, but can answer the
> > question here as well.
> >
> > Make sure in your jboss-deployment-structure.xml you're referencing the
> > deltaspike modules, include services="import" and meta-inf="import".
> >
> > John
> >
> > On Fri, May 5, 2017 at 7:27 AM Drazen Kozic <[hidden email]>
> wrote:
> >
> >> Usually, in case od module missconfiguration, CNFE is thrown. Here in
> >> my case, it seems that it is context related issue not classpath
> >> related issue.
> >>
> >> In the documentation of camel-cdi,  DeltaSpike is mentioned here:
> >> http://camel.apache.org/cdi.html. My conclussion is that camel-cdi
> >> should work well in conjuction with DeltaSpike. What is missing is
> >> some instruction how to setup them together on WildFly :-).
> >>
> >> Because both DeltaSpike and camel-cdi are CDI/Weld extensions I cand
> >> say where to search for cause of error. As I mentioned before:
> >> - when DeltaSpike Data Module based service is not called, everything
> >> works fine
> >> - even with DeltaSpike Data Module based service tests are passing
> >> (@RunWith(CamelCdiRunner.class))
> >>
> >>
> >>
> >> Best regards
> >>
> >> Drazen Kozic
> >>
> >>
> >> On Fri, May 5, 2017 at 12:16 PM, Antonin Stefanutti
> >> <[hidden email]> wrote:
> >> > Ah indeed, it looks like DeltaSpike Data module impl JAR is included
> in:
> >> >
> >> > <module name="org.apache.deltaspike.modules"
> >> > services="export" />
> >> >
> >> >
> >>
> https://github.com/apache/deltaspike/blob/a82f6ad27486756cc6d80d3a2db1695b779e36be/deltaspike/dist/full/src/main/distribution/modules-module.xml#L25-L26
> >> >
> >> > That being said, it is likely to be an issue at how DeltaSpike
> >> integrates with WildFly module system rather than a Camel issue. SO I
> would
> >> you post a question on the WildFly forum or contact DeltaSpike user
> group.
> >> >
> >> > Let us know what you think.
> >> >
> >> > Antonin
> >> >
> >> >> On 5 May 2017, at 11:35, Drazen Kozic <[hidden email]>
> wrote:
> >> >>
> >> >> Hello Antonin,
> >> >> Thanks for the help. My assumption also was related to DeltaSpike
> >> >> module configuration. Especially having in mind that tests are
> passing
> >> >> OK.
> >> >> I have downloaded distribution-full-1.7.2.zip of the DeltaSpike.
> >> >> Inside it there are module.xml files for Wildfly. I didn't change
> >> >> anything.
> >> >>
> >> >> Regards
> >> >>
> >> >>
> >> >> Best regards
> >> >>
> >> >> Drazen Kozic
> >> >>
> >> >>
> >> >> On Fri, May 5, 2017 at 10:34 AM, Antonin Stefanutti
> >> >> <[hidden email]> wrote:
> >> >>> Hi Drazen,
> >> >>>
> >> >>> It looks like the
> org.apache.deltaspike.data.impl.handler.QueryHandler
> >> class is not visible from the Camel module you’ve deployed. So it’s
> rather
> >> an issue of using Deltaspike data module within the WildFly module
> system.
> >> So you may need to add the deltaspike-data-module JARs to your module or
> >> properly create a module for Deltaspike data module.
> >> >>>
> >> >>> Antonin
> >> >>>
> >> >>>> On 5 May 2017, at 08:05, Drazen Kozic <[hidden email]>
> wrote:
> >> >>>>
> >> >>>> Hello,
> >> >>>>
> >> >>>> I want to use Camel 2.18.3 on WildFly-10.1.0.Final. My desired
> setup
> >> >>>> is as follow:
> >> >>>> - to use camel-cdi features
> >> >>>> - to deploy camel and all third party dependencies as WildFly
> modules
> >> >>>> - to deploy my application as war on WildFly with all internal
> >> >>>> dependencies as jars in web-inf/lib
> >> >>>> - I do not want to use WilfFly Camel Subsystem from
> >> >>>> https://github.com/wildfly-extras/wildfly-camel
> >> >>>>
> >> >>>> I have deployed camel as module by looking at WildFly Camel
> Subsystem
> >> >>>> (wildfly-camel-patch-4.6.0). I took all content starting from
> >> >>>> modules/system/layers/fuse/org/apache/camel and put it into my
> Wildfly
> >> >>>> installation into modules/system/layers/base/org/apache/camel.
> >> >>>>
> >> >>>> I have created some routes and processors. Everything went fine
> untill
> >> >>>> moment when I modified my processor to trigger one of my services
> >> >>>> which are using Deltaspike data module functionality. I got this
> log
> >> >>>> output:
> >> >>>>
> >> >>>> 17:27:52,280 INFO
> >> >>>> [com.mvneco.tebio.batch.common.BatchCamelContextProducer] (MSC
> service
> >> >>>> thread 1-5) CamelContext configured: batch-camel-context
> >> >>>> 17:27:52,297 INFO
> [com.mvneco.tebio.batch.simple.MySimpleProcessor]
> >> >>>> (MSC service thread 1-5) Processor constructed: MySimpleProcessor
> >> >>>> 17:27:52,335 INFO  [com.mvneco.tebio.batch.simple.MySimpleRoute]
> (MSC
> >> >>>> service thread 1-5) Route configured: MySimpleRoute
> >> >>>> 17:27:52,341 INFO  [org.apache.camel.cdi.CdiCamelExtension] (MSC
> >> >>>> service thread 1-5) Camel CDI is starting Camel context
> >> >>>> [batch-camel-context]
> >> >>>> 17:27:52,342 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
> >> >>>> service thread 1-5) Apache Camel 2.18.3 (CamelContext:
> >> >>>> batch-camel-context) is starting
> >> >>>> 17:27:52,344 INFO
> >> >>>> [org.apache.camel.management.ManagedManagementStrategy] (MSC
> service
> >> >>>> thread 1-5) JMX is enabled
> >> >>>> 17:27:52,455 INFO
> >> >>>> [org.apache.camel.impl.converter.DefaultTypeConverter] (MSC service
> >> >>>> thread 1-5) Loaded 189 type converters
> >> >>>> 17:27:52,493 INFO
> >> >>>> [org.apache.camel.impl.DefaultRuntimeEndpointRegistry] (MSC service
> >> >>>> thread 1-5) Runtime endpoint registry is in extended mode gathering
> >> >>>> usage statistics of all incoming and outgoing endpoints (cache
> limit:
> >> >>>> 1000)
> >> >>>> 17:27:52,498 WARN  [org.jboss.as.weld] (MSC service thread 1-5)
> >> >>>> WFLYWELD0052: Using deployment classloader to load proxy classes
> for
> >> >>>> module org.apache.camel.core:main. Package-private access will not
> >> >>>> work. To fix this the module should declare dependencies on
> >> >>>> [org.jboss.weld.core, org.jboss.weld.spi]
> >> >>>> 17:27:52,630 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
> >> >>>> service thread 1-5) StreamCaching is not in use. If using streams
> then
> >> >>>> its recommended to enable stream caching. See more details at
> >> >>>> http://camel.apache.org/stream-caching.html
> >> >>>> 17:27:52,693 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
> >> >>>> service thread 1-5) Route: MySimpleRoute started and consuming
> from:
> >> >>>> file://c:/test-folder?move=.done&moveFailed=.error
> >> >>>> 17:27:52,694 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
> >> >>>> service thread 1-5) Total 1 routes, of which 1 are started.
> >> >>>> 17:27:52,695 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
> >> >>>> service thread 1-5) Apache Camel 2.18.3 (CamelContext:
> >> >>>> batch-camel-context) started in 0.351 seconds
> >> >>>> 17:27:52,968 INFO  [org.wildfly.extension.undertow] (ServerService
> >> >>>> Thread Pool -- 59) WFLYUT0021: Registered web context: /tebio-batch
> >> >>>> 17:27:53,013 INFO  [org.jboss.as.server] (ServerService Thread
> Pool --
> >> >>>> 34) WFLYSRV0010: Deployed "tebio-batch.war" (runtime-name :
> >> >>>> "tebio-batch.war")
> >> >>>> 17:27:53,164 INFO  [org.jboss.as] (Controller Boot Thread)
> >> >>>> WFLYSRV0060: Http management interface listening on
> >> >>>> http://127.0.0.1:9990/management
> >> >>>> 17:27:53,165 INFO  [org.jboss.as] (Controller Boot Thread)
> >> >>>> WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
> >> >>>> 17:27:53,165 INFO  [org.jboss.as] (Controller Boot Thread)
> >> >>>> WFLYSRV0025: WildFly Full 10.1.0.Final (WildFly Core 2.2.0.Final)
> >> >>>> started in 17385ms - Started 465 of 713 services (409 services are
> >> >>>> lazy, passive or on-demand)
> >> >>>> 17:28:14,328 WARN
> >> >>>> [org.apache.camel.component.file.GenericFileOnCompletion] (Camel
> >> >>>> (batch-camel-context) thread #0 - file://c:/test-folder) Rollback
> file
> >> >>>> strategy:
> >>
> org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy@77ab824b
> >> >>>> for file: GenericFile[c:\test-folder\test1.txt]
> >> >>>> 17:28:14,337 ERROR [com.mvneco.tebio.batch] (Camel
> >> >>>> (batch-camel-context) thread #0 - file://c:/test-folder) Failed
> >> >>>> delivery for (MessageId: ID-dkozic-PC-58228-1493825271666-0-1 on
> >> >>>> ExchangeId: ID-dkozic-PC-58228-1493825271666-0-2). Exhausted after
> >> >>>> delivery attempt: 1 caught: java.lang.IllegalStateException: Could
> not
> >> >>>> find beans for Type=class
> >> >>>> org.apache.deltaspike.data.impl.handler.QueryHandler
> >> >>>>
> >> >>>> Message History
> >> >>>>
> >>
> ---------------------------------------------------------------------------------------------------------------------------------------
> >> >>>> RouteId              ProcessorId          Processor
> >> >>>>                                                   Elapsed (ms)
> >> >>>> [MySimpleRoute     ] [MySimpleRoute     ]
> >> >>>> [file://c:/test-folder?move=.done&moveFailed=.error
> >> >>>>       ] [        33]
> >> >>>> [MySimpleRoute     ] [MySimpleProcessor ] [Processor@0x60f6861a
> >> >>>>                                                 ] [        20]
> >> >>>>
> >> >>>> Stacktrace
> >> >>>>
> >>
> ---------------------------------------------------------------------------------------------------------------------------------------:
> >> >>>> java.lang.IllegalStateException: Could not find beans for
> Type=class
> >> >>>> org.apache.deltaspike.data.impl.handler.QueryHandler
> >> >>>>       at
> >>
> org.apache.deltaspike.core.api.provider.BeanProvider.getBeanDefinitions(BeanProvider.java:415)
> >> >>>>       at
> >>
> org.apache.deltaspike.core.api.provider.BeanProvider.getBeanDefinitions(BeanProvider.java:398)
> >> >>>>       at
> >>
> org.apache.deltaspike.proxy.api.DeltaSpikeProxyContextualLifecycle.instantiateDelegateInvocationHandler(DeltaSpikeProxyContextualLifecycle.java:124)
> >> >>>>       at
> >>
> org.apache.deltaspike.proxy.api.DeltaSpikeProxyContextualLifecycle.create(DeltaSpikeProxyContextualLifecycle.java:84)
> >> >>>>       at
> >>
> org.apache.deltaspike.core.util.bean.ImmutableBean.create(ImmutableBean.java:72)
> >> >>>>       at
> >>
> org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:70)
> >> >>>>       at
> >>
> org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:101)
> >> >>>>       at
> >> org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
> >> >>>>       at
> >>
> org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:742)
> >> >>>>       at
> >>
> org.jboss.weld.manager.BeanManagerImpl.getInjectableReference(BeanManagerImpl.java:842)
> >> >>>>       at
> >>
> org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:92)
> >> >>>>       at
> org.jboss.weld.util.Beans.injectBoundFields(Beans.java:364)
> >> >>>>       at
> >> org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:375)
> >> >>>>       at
> >>
> org.jboss.weld.injection.producer.ResourceInjector$1.proceed(ResourceInjector.java:70)
> >> >>>>       at
> >>
> org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48)
> >> >>>>       at
> >>
> org.jboss.weld.injection.producer.ResourceInjector.inject(ResourceInjector.java:72)
> >> >>>>       at
> >>
> org.jboss.weld.injection.producer.BasicInjectionTarget.inject(BasicInjectionTarget.java:121)
> >> >>>>       at
> org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:159)
> >> >>>>       at
> >> org.jboss.weld.context.AbstractContext.get(AbstractContext.java:96)
> >> >>>>       at
> >>
> org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:101)
> >> >>>>       at
> >>
> org.jboss.weld.bean.ContextualInstanceStrategy$ApplicationScopedContextualInstanceStrategy.get(ContextualInstanceStrategy.java:141)
> >> >>>>       at
> >> org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
> >> >>>>       at
> >>
> org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:99)
> >> >>>>       at
> >>
> org.jboss.weld.bean.proxy.ProxyMethodHandler.getInstance(ProxyMethodHandler.java:125)
> >> >>>>       at
> >>
> com.mvneco.ecofin.service.FinAccountServiceBean$Proxy$_$$_WeldClientProxy.getOptionalFinAccount(Unknown
> >> >>>> Source)
> >> >>>>       at
> >>
> com.mvneco.tebio.batch.simple.MySimpleProcessor.process(MySimpleProcessor.java:37)
> >> >>>>       at
> >>
> org.apache.camel.processor.DelegateSyncProcessor.process(DelegateSyncProcessor.java:63)
> >> >>>>       at
> >>
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
> >> >>>>       at
> >>
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:542)
> >> >>>>       at
> >>
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
> >> >>>>       at
> >>
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
> >> >>>>       at
> >>
> org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:460)
> >> >>>>       at
> >>
> org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:227)
> >> >>>>       at
> >>
> org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:191)
> >> >>>>       at
> >>
> org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:175)
> >> >>>>       at
> >>
> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:102)
> >> >>>>       at
> >> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
> >> >>>>       at
> >> java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
> >> >>>>       at
> >>
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
> >> >>>>       at
> >>
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
> >> >>>>       at
> >>
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> >> >>>>       at
> >>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> >> >>>>       at java.lang.Thread.run(Thread.java:745)
> >> >>>>
> >> >>>> I have to mention that my tests passes
> >> (@RunWith(CamelCdiRunner.class)).
> >> >>>>
> >> >>>> My src/main/webapp/META-INF/jboss-deployment-structure.xml is like
> >> this:
> >> >>>>
> >> >>>> <jboss-deployment-structure
> >> xmlns="urn:jboss:deployment-structure:1.0">
> >> >>>>       <deployment>
> >> >>>>               <dependencies>
> >> >>>>                       <module name="org.apache.deltaspike.core"
> >> >>>> services="export" />
> >> >>>>                       <module name="org.apache.deltaspike.modules"
> >> >>>> services="export" />
> >> >>>>                       <module name="org.apache.commons.lang3" />
> >> >>>>
> >> >>>>                       <module name="org.apache.camel.core"
> >> >>>> export="true" services="export" />
> >> >>>>                       <module name="org.apache.camel.component.ftp"
> >> >>>> export="true" services="export" />
> >> >>>>                       <module name="org.apache.camel.component.cdi"
> >> >>>> export="true" services="export" />
> >> >>>>
> >> >>>>               </dependencies>
> >> >>>>       </deployment>
> >> >>>> </jboss-deployment-structure>
> >> >>>>
> >> >>>> Every of jars declared as dependency in pom.xml have beans.xml. I
> have
> >> >>>> tried different wildfly module configurations without success.
> >> >>>>
> >> >>>> Any help is appreciated.
> >> >>>>
> >> >>>>
> >> >>>> Drazen Kozic
> >> >>>
> >> >
> >>
>
Reply | Threaded
Open this post in threaded view
|

Re: Using camel-cdi on Wildfly-10.1

dkozic
Hello John,

I have ammended my module.xml files of camel modules. No progress.

But I have found pattern. If I declare some other bean like this:

@ApplicationScoped
public class ApplicationLifecycleBean {

    private static final Logger logger =
LoggerFactory.getLogger(ApplicationLifecycleBean.class);

    @Inject
    private FinAccountRepository repo;

    public void init(@Observes @Initialized(ApplicationScoped.class)
Object init) {

        try {
            logger.info("Repo initialized: {}", repo);
        } catch (Exception e) {
            logger.error("Error: ", e);        }
    }

    public void destroy(@Observes @Destroyed(ApplicationScoped.class)
Object init) {
    }

}

then everything works fine. If this bean is not listener, but plain
bean then it is not initialized and error appears again.

It seams that problem is related with the fact that
FinAccountRepository is interface annotated with @Repository. It is
DeltaSpike Partial Bean. <y conclussion is that pronlem is related to
order of initialisation of CDI extensions of camel-cdi and DeltaSpike.
Some race condition appears.

The workaround is to create bean like this one above and inject all
collaborators in it. Just to have them initialised before camel uses
them.

Best regards

Drazen Kozic


On Fri, May 5, 2017 at 6:29 PM, John D. Ament <[hidden email]> wrote:

> Hi Drazen,
>
> Can you modify your camel module.xml to also add these same references to
> deltaspike?
>
> John
>
> On Fri, May 5, 2017 at 8:03 AM Drazen Kozic <[hidden email]> wrote:
>
>> Hello John,
>>
>> I did what you said. My
>> src/main/webapp/META-INF/jboss-deployment-structure.xml is as follow:
>>
>> <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.3">
>>     <deployment>
>>         <dependencies>
>>             <module name="org.apache.deltaspike.core"
>> services="import" meta-inf="import" />
>>             <module name="org.apache.deltaspike.modules"
>> services="import" meta-inf="import" />
>>
>>             <module name="org.apache.commons.lang3" />
>>
>>             <module name="org.apache.camel.core" export="true"
>> services="import" meta-inf="import" />
>>             <module name="org.apache.camel.component.ftp"
>> export="true" services="import" meta-inf="import" />
>>             <module name="org.apache.camel.component.cdi"
>> export="true" services="import" meta-inf="import" />
>>
>>         </dependencies>
>>     </deployment>
>> </jboss-deployment-structure>
>>
>> With this setup, no success.
>>
>>
>> Best regards
>>
>> Drazen Kozic
>>
>>
>> On Fri, May 5, 2017 at 1:32 PM, John D. Ament <[hidden email]>
>> wrote:
>> > Drazen,
>> >
>> > Camel CDI uses DeltaSpike Container Control to start and stop a CDI
>> > container in conjunction with having an out of the box Main class.  It
>> > makes no other use of DeltaSpike.
>> >
>> > Camel CDI + DeltaSpike work well together, I use them today.  I'm also
>> the
>> > one who wrote the module.xml's you're looking at right now.
>> >
>> > I'd rather see this discussed on the DS User list, but can answer the
>> > question here as well.
>> >
>> > Make sure in your jboss-deployment-structure.xml you're referencing the
>> > deltaspike modules, include services="import" and meta-inf="import".
>> >
>> > John
>> >
>> > On Fri, May 5, 2017 at 7:27 AM Drazen Kozic <[hidden email]>
>> wrote:
>> >
>> >> Usually, in case od module missconfiguration, CNFE is thrown. Here in
>> >> my case, it seems that it is context related issue not classpath
>> >> related issue.
>> >>
>> >> In the documentation of camel-cdi,  DeltaSpike is mentioned here:
>> >> http://camel.apache.org/cdi.html. My conclussion is that camel-cdi
>> >> should work well in conjuction with DeltaSpike. What is missing is
>> >> some instruction how to setup them together on WildFly :-).
>> >>
>> >> Because both DeltaSpike and camel-cdi are CDI/Weld extensions I cand
>> >> say where to search for cause of error. As I mentioned before:
>> >> - when DeltaSpike Data Module based service is not called, everything
>> >> works fine
>> >> - even with DeltaSpike Data Module based service tests are passing
>> >> (@RunWith(CamelCdiRunner.class))
>> >>
>> >>
>> >>
>> >> Best regards
>> >>
>> >> Drazen Kozic
>> >>
>> >>
>> >> On Fri, May 5, 2017 at 12:16 PM, Antonin Stefanutti
>> >> <[hidden email]> wrote:
>> >> > Ah indeed, it looks like DeltaSpike Data module impl JAR is included
>> in:
>> >> >
>> >> > <module name="org.apache.deltaspike.modules"
>> >> > services="export" />
>> >> >
>> >> >
>> >>
>> https://github.com/apache/deltaspike/blob/a82f6ad27486756cc6d80d3a2db1695b779e36be/deltaspike/dist/full/src/main/distribution/modules-module.xml#L25-L26
>> >> >
>> >> > That being said, it is likely to be an issue at how DeltaSpike
>> >> integrates with WildFly module system rather than a Camel issue. SO I
>> would
>> >> you post a question on the WildFly forum or contact DeltaSpike user
>> group.
>> >> >
>> >> > Let us know what you think.
>> >> >
>> >> > Antonin
>> >> >
>> >> >> On 5 May 2017, at 11:35, Drazen Kozic <[hidden email]>
>> wrote:
>> >> >>
>> >> >> Hello Antonin,
>> >> >> Thanks for the help. My assumption also was related to DeltaSpike
>> >> >> module configuration. Especially having in mind that tests are
>> passing
>> >> >> OK.
>> >> >> I have downloaded distribution-full-1.7.2.zip of the DeltaSpike.
>> >> >> Inside it there are module.xml files for Wildfly. I didn't change
>> >> >> anything.
>> >> >>
>> >> >> Regards
>> >> >>
>> >> >>
>> >> >> Best regards
>> >> >>
>> >> >> Drazen Kozic
>> >> >>
>> >> >>
>> >> >> On Fri, May 5, 2017 at 10:34 AM, Antonin Stefanutti
>> >> >> <[hidden email]> wrote:
>> >> >>> Hi Drazen,
>> >> >>>
>> >> >>> It looks like the
>> org.apache.deltaspike.data.impl.handler.QueryHandler
>> >> class is not visible from the Camel module you’ve deployed. So it’s
>> rather
>> >> an issue of using Deltaspike data module within the WildFly module
>> system.
>> >> So you may need to add the deltaspike-data-module JARs to your module or
>> >> properly create a module for Deltaspike data module.
>> >> >>>
>> >> >>> Antonin
>> >> >>>
>> >> >>>> On 5 May 2017, at 08:05, Drazen Kozic <[hidden email]>
>> wrote:
>> >> >>>>
>> >> >>>> Hello,
>> >> >>>>
>> >> >>>> I want to use Camel 2.18.3 on WildFly-10.1.0.Final. My desired
>> setup
>> >> >>>> is as follow:
>> >> >>>> - to use camel-cdi features
>> >> >>>> - to deploy camel and all third party dependencies as WildFly
>> modules
>> >> >>>> - to deploy my application as war on WildFly with all internal
>> >> >>>> dependencies as jars in web-inf/lib
>> >> >>>> - I do not want to use WilfFly Camel Subsystem from
>> >> >>>> https://github.com/wildfly-extras/wildfly-camel
>> >> >>>>
>> >> >>>> I have deployed camel as module by looking at WildFly Camel
>> Subsystem
>> >> >>>> (wildfly-camel-patch-4.6.0). I took all content starting from
>> >> >>>> modules/system/layers/fuse/org/apache/camel and put it into my
>> Wildfly
>> >> >>>> installation into modules/system/layers/base/org/apache/camel.
>> >> >>>>
>> >> >>>> I have created some routes and processors. Everything went fine
>> untill
>> >> >>>> moment when I modified my processor to trigger one of my services
>> >> >>>> which are using Deltaspike data module functionality. I got this
>> log
>> >> >>>> output:
>> >> >>>>
>> >> >>>> 17:27:52,280 INFO
>> >> >>>> [com.mvneco.tebio.batch.common.BatchCamelContextProducer] (MSC
>> service
>> >> >>>> thread 1-5) CamelContext configured: batch-camel-context
>> >> >>>> 17:27:52,297 INFO
>> [com.mvneco.tebio.batch.simple.MySimpleProcessor]
>> >> >>>> (MSC service thread 1-5) Processor constructed: MySimpleProcessor
>> >> >>>> 17:27:52,335 INFO  [com.mvneco.tebio.batch.simple.MySimpleRoute]
>> (MSC
>> >> >>>> service thread 1-5) Route configured: MySimpleRoute
>> >> >>>> 17:27:52,341 INFO  [org.apache.camel.cdi.CdiCamelExtension] (MSC
>> >> >>>> service thread 1-5) Camel CDI is starting Camel context
>> >> >>>> [batch-camel-context]
>> >> >>>> 17:27:52,342 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
>> >> >>>> service thread 1-5) Apache Camel 2.18.3 (CamelContext:
>> >> >>>> batch-camel-context) is starting
>> >> >>>> 17:27:52,344 INFO
>> >> >>>> [org.apache.camel.management.ManagedManagementStrategy] (MSC
>> service
>> >> >>>> thread 1-5) JMX is enabled
>> >> >>>> 17:27:52,455 INFO
>> >> >>>> [org.apache.camel.impl.converter.DefaultTypeConverter] (MSC service
>> >> >>>> thread 1-5) Loaded 189 type converters
>> >> >>>> 17:27:52,493 INFO
>> >> >>>> [org.apache.camel.impl.DefaultRuntimeEndpointRegistry] (MSC service
>> >> >>>> thread 1-5) Runtime endpoint registry is in extended mode gathering
>> >> >>>> usage statistics of all incoming and outgoing endpoints (cache
>> limit:
>> >> >>>> 1000)
>> >> >>>> 17:27:52,498 WARN  [org.jboss.as.weld] (MSC service thread 1-5)
>> >> >>>> WFLYWELD0052: Using deployment classloader to load proxy classes
>> for
>> >> >>>> module org.apache.camel.core:main. Package-private access will not
>> >> >>>> work. To fix this the module should declare dependencies on
>> >> >>>> [org.jboss.weld.core, org.jboss.weld.spi]
>> >> >>>> 17:27:52,630 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
>> >> >>>> service thread 1-5) StreamCaching is not in use. If using streams
>> then
>> >> >>>> its recommended to enable stream caching. See more details at
>> >> >>>> http://camel.apache.org/stream-caching.html
>> >> >>>> 17:27:52,693 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
>> >> >>>> service thread 1-5) Route: MySimpleRoute started and consuming
>> from:
>> >> >>>> file://c:/test-folder?move=.done&moveFailed=.error
>> >> >>>> 17:27:52,694 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
>> >> >>>> service thread 1-5) Total 1 routes, of which 1 are started.
>> >> >>>> 17:27:52,695 INFO  [org.apache.camel.impl.DefaultCamelContext] (MSC
>> >> >>>> service thread 1-5) Apache Camel 2.18.3 (CamelContext:
>> >> >>>> batch-camel-context) started in 0.351 seconds
>> >> >>>> 17:27:52,968 INFO  [org.wildfly.extension.undertow] (ServerService
>> >> >>>> Thread Pool -- 59) WFLYUT0021: Registered web context: /tebio-batch
>> >> >>>> 17:27:53,013 INFO  [org.jboss.as.server] (ServerService Thread
>> Pool --
>> >> >>>> 34) WFLYSRV0010: Deployed "tebio-batch.war" (runtime-name :
>> >> >>>> "tebio-batch.war")
>> >> >>>> 17:27:53,164 INFO  [org.jboss.as] (Controller Boot Thread)
>> >> >>>> WFLYSRV0060: Http management interface listening on
>> >> >>>> http://127.0.0.1:9990/management
>> >> >>>> 17:27:53,165 INFO  [org.jboss.as] (Controller Boot Thread)
>> >> >>>> WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
>> >> >>>> 17:27:53,165 INFO  [org.jboss.as] (Controller Boot Thread)
>> >> >>>> WFLYSRV0025: WildFly Full 10.1.0.Final (WildFly Core 2.2.0.Final)
>> >> >>>> started in 17385ms - Started 465 of 713 services (409 services are
>> >> >>>> lazy, passive or on-demand)
>> >> >>>> 17:28:14,328 WARN
>> >> >>>> [org.apache.camel.component.file.GenericFileOnCompletion] (Camel
>> >> >>>> (batch-camel-context) thread #0 - file://c:/test-folder) Rollback
>> file
>> >> >>>> strategy:
>> >>
>> org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy@77ab824b
>> >> >>>> for file: GenericFile[c:\test-folder\test1.txt]
>> >> >>>> 17:28:14,337 ERROR [com.mvneco.tebio.batch] (Camel
>> >> >>>> (batch-camel-context) thread #0 - file://c:/test-folder) Failed
>> >> >>>> delivery for (MessageId: ID-dkozic-PC-58228-1493825271666-0-1 on
>> >> >>>> ExchangeId: ID-dkozic-PC-58228-1493825271666-0-2). Exhausted after
>> >> >>>> delivery attempt: 1 caught: java.lang.IllegalStateException: Could
>> not
>> >> >>>> find beans for Type=class
>> >> >>>> org.apache.deltaspike.data.impl.handler.QueryHandler
>> >> >>>>
>> >> >>>> Message History
>> >> >>>>
>> >>
>> ---------------------------------------------------------------------------------------------------------------------------------------
>> >> >>>> RouteId              ProcessorId          Processor
>> >> >>>>                                                   Elapsed (ms)
>> >> >>>> [MySimpleRoute     ] [MySimpleRoute     ]
>> >> >>>> [file://c:/test-folder?move=.done&moveFailed=.error
>> >> >>>>       ] [        33]
>> >> >>>> [MySimpleRoute     ] [MySimpleProcessor ] [Processor@0x60f6861a
>> >> >>>>                                                 ] [        20]
>> >> >>>>
>> >> >>>> Stacktrace
>> >> >>>>
>> >>
>> ---------------------------------------------------------------------------------------------------------------------------------------:
>> >> >>>> java.lang.IllegalStateException: Could not find beans for
>> Type=class
>> >> >>>> org.apache.deltaspike.data.impl.handler.QueryHandler
>> >> >>>>       at
>> >>
>> org.apache.deltaspike.core.api.provider.BeanProvider.getBeanDefinitions(BeanProvider.java:415)
>> >> >>>>       at
>> >>
>> org.apache.deltaspike.core.api.provider.BeanProvider.getBeanDefinitions(BeanProvider.java:398)
>> >> >>>>       at
>> >>
>> org.apache.deltaspike.proxy.api.DeltaSpikeProxyContextualLifecycle.instantiateDelegateInvocationHandler(DeltaSpikeProxyContextualLifecycle.java:124)
>> >> >>>>       at
>> >>
>> org.apache.deltaspike.proxy.api.DeltaSpikeProxyContextualLifecycle.create(DeltaSpikeProxyContextualLifecycle.java:84)
>> >> >>>>       at
>> >>
>> org.apache.deltaspike.core.util.bean.ImmutableBean.create(ImmutableBean.java:72)
>> >> >>>>       at
>> >>
>> org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:70)
>> >> >>>>       at
>> >>
>> org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:101)
>> >> >>>>       at
>> >> org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
>> >> >>>>       at
>> >>
>> org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:742)
>> >> >>>>       at
>> >>
>> org.jboss.weld.manager.BeanManagerImpl.getInjectableReference(BeanManagerImpl.java:842)
>> >> >>>>       at
>> >>
>> org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:92)
>> >> >>>>       at
>> org.jboss.weld.util.Beans.injectBoundFields(Beans.java:364)
>> >> >>>>       at
>> >> org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:375)
>> >> >>>>       at
>> >>
>> org.jboss.weld.injection.producer.ResourceInjector$1.proceed(ResourceInjector.java:70)
>> >> >>>>       at
>> >>
>> org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48)
>> >> >>>>       at
>> >>
>> org.jboss.weld.injection.producer.ResourceInjector.inject(ResourceInjector.java:72)
>> >> >>>>       at
>> >>
>> org.jboss.weld.injection.producer.BasicInjectionTarget.inject(BasicInjectionTarget.java:121)
>> >> >>>>       at
>> org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:159)
>> >> >>>>       at
>> >> org.jboss.weld.context.AbstractContext.get(AbstractContext.java:96)
>> >> >>>>       at
>> >>
>> org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:101)
>> >> >>>>       at
>> >>
>> org.jboss.weld.bean.ContextualInstanceStrategy$ApplicationScopedContextualInstanceStrategy.get(ContextualInstanceStrategy.java:141)
>> >> >>>>       at
>> >> org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
>> >> >>>>       at
>> >>
>> org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:99)
>> >> >>>>       at
>> >>
>> org.jboss.weld.bean.proxy.ProxyMethodHandler.getInstance(ProxyMethodHandler.java:125)
>> >> >>>>       at
>> >>
>> com.mvneco.ecofin.service.FinAccountServiceBean$Proxy$_$$_WeldClientProxy.getOptionalFinAccount(Unknown
>> >> >>>> Source)
>> >> >>>>       at
>> >>
>> com.mvneco.tebio.batch.simple.MySimpleProcessor.process(MySimpleProcessor.java:37)
>> >> >>>>       at
>> >>
>> org.apache.camel.processor.DelegateSyncProcessor.process(DelegateSyncProcessor.java:63)
>> >> >>>>       at
>> >>
>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
>> >> >>>>       at
>> >>
>> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:542)
>> >> >>>>       at
>> >>
>> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
>> >> >>>>       at
>> >>
>> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
>> >> >>>>       at
>> >>
>> org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:460)
>> >> >>>>       at
>> >>
>> org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:227)
>> >> >>>>       at
>> >>
>> org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:191)
>> >> >>>>       at
>> >>
>> org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:175)
>> >> >>>>       at
>> >>
>> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:102)
>> >> >>>>       at
>> >> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
>> >> >>>>       at
>> >> java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
>> >> >>>>       at
>> >>
>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
>> >> >>>>       at
>> >>
>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
>> >> >>>>       at
>> >>
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>> >> >>>>       at
>> >>
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>> >> >>>>       at java.lang.Thread.run(Thread.java:745)
>> >> >>>>
>> >> >>>> I have to mention that my tests passes
>> >> (@RunWith(CamelCdiRunner.class)).
>> >> >>>>
>> >> >>>> My src/main/webapp/META-INF/jboss-deployment-structure.xml is like
>> >> this:
>> >> >>>>
>> >> >>>> <jboss-deployment-structure
>> >> xmlns="urn:jboss:deployment-structure:1.0">
>> >> >>>>       <deployment>
>> >> >>>>               <dependencies>
>> >> >>>>                       <module name="org.apache.deltaspike.core"
>> >> >>>> services="export" />
>> >> >>>>                       <module name="org.apache.deltaspike.modules"
>> >> >>>> services="export" />
>> >> >>>>                       <module name="org.apache.commons.lang3" />
>> >> >>>>
>> >> >>>>                       <module name="org.apache.camel.core"
>> >> >>>> export="true" services="export" />
>> >> >>>>                       <module name="org.apache.camel.component.ftp"
>> >> >>>> export="true" services="export" />
>> >> >>>>                       <module name="org.apache.camel.component.cdi"
>> >> >>>> export="true" services="export" />
>> >> >>>>
>> >> >>>>               </dependencies>
>> >> >>>>       </deployment>
>> >> >>>> </jboss-deployment-structure>
>> >> >>>>
>> >> >>>> Every of jars declared as dependency in pom.xml have beans.xml. I
>> have
>> >> >>>> tried different wildfly module configurations without success.
>> >> >>>>
>> >> >>>> Any help is appreciated.
>> >> >>>>
>> >> >>>>
>> >> >>>> Drazen Kozic
>> >> >>>
>> >> >
>> >>
>>