Bug 814669 - camel cannot find type converters when deployed on jboss
Summary: camel cannot find type converters when deployed on jboss
Keywords:
Status: ASSIGNED
Alias: None
Product: JBoss Enterprise BRMS Platform 5
Classification: JBoss
Component: BRE (Expert, Fusion)
Version: BRMS 5.3.0.GA
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
: ---
Assignee: Mario Fusco
QA Contact: Radovan Synek
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-04-20 11:29 UTC by Radovan Synek
Modified: 2022-08-12 04:38 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Camel cannot find type converters for String to InputStream conversions when deployed on JBoss, preventing commands being sent in JAXB, JSON or XStream.
Clone Of:
Environment:
Last Closed:
Type: Bug


Attachments (Terms of Use)
maven web app reproducer (25.27 KB, application/zip)
2012-04-20 11:29 UTC, Radovan Synek
no flags Details

Description Radovan Synek 2012-04-20 11:29:28 UTC
Created attachment 578964 [details]
maven web app reproducer

Description of problem:
Camel is missing type converters for String->InputStream conversion.

root cause stacktrace:

org.apache.camel.NoTypeConversionAvailableException: No type converter available to convert from type: java.lang.String to the required type: java.io.InputStream with value [B@63a68375
	org.apache.camel.impl.converter.DefaultTypeConverter.mandatoryConvertTo(DefaultTypeConverter.java:132)
	org.apache.camel.impl.MessageSupport.getMandatoryBody(MessageSupport.java:101)
	org.apache.camel.util.ExchangeHelper.getMandatoryInBody(ExchangeHelper.java:115)
	org.apache.camel.processor.UnmarshalProcessor.process(UnmarshalProcessor.java:44)
	org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:50)
	org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)
	org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
	org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
	org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:99)
	org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)
	org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:290)
	org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:202)
	org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:256)
	org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)
	org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
	org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
	org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)
	org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
	org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
	org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:99)
	org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)
	org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:290)
	org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:202)
	org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:256)
	org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:113)
	org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)
	org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
	org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
	org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)
	org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)
	org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:61)
	org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:99)
	org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:91)
	org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:85)
	org.apache.camel.processor.UnitOfWorkProducer.process(UnitOfWorkProducer.java:63)
	org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:333)
	org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:304)
	org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:208)
	org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:303)
	org.apache.camel.impl.ProducerCache.send(ProducerCache.java:171)
	org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:114)
	org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:118)
	org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:135)
	org.apache.camel.impl.DefaultProducerTemplate.requestBody(DefaultProducerTemplate.java:283)
	org.jboss.qa.brms.cameljboss.tools.XstreamCommandExecutor.getObjects(XstreamCommandExecutor.java:78)
	org.jboss.qa.brms.cameljboss.controllers.CamelIntegrationController.runScenario(CamelIntegrationController.java:49)
	org.jboss.qa.brms.cameljboss.controllers.CamelIntegrationController.handleRequestInternal(CamelIntegrationController.java:75)
	org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
	org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
	org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
	org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807)
	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
	org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
--------------------------------------------------------------------------

This problem is probably connected with known issue:
http://camel.apache.org/camel-jboss.html

How reproducible:
see an attachment for the reproducer - web app with Camel configured to send commands to drools in Jaxb, Json, Xtream or Object format. Test scenario inserts fact into stateful knowledge session and then tries to obtain all objects from session through getObjects command.

Steps to Reproduce:
1. build reproducer as maven web application
2. deploy on jboss (ideally eap 5.1.2)
3. run in browser: localhost:8080/cameljboss

Comment 1 Mario Fusco 2012-04-23 10:17:30 UTC
Yes, the problem is definitively related with the issue reported here: http://camel.apache.org/camel-jboss.html

Also note that the correct solution, suggested in that page, has been already implemented in a commented out line of the provided attachment (i.e. AbstractCamelCommandExecutor#63)

I don't think this solution is embeddable in our Camel integration module though, because, as reported in the same article, it is dependent on the used JBoss version. More precisely if you're running JBoss 6.x you need a different version of that jar, so it means that should be up to end user to put that suggested solution at work using the right jar corresponding to the JBoss version he is using.

I also tested that solution under JBoss-as-7 and I must say that unfortunately it doesn't work there because you got an error like:

java.lang.NoSuchFieldError: log
        at org.apachextras.camel.jboss.JBossPackageScanClassResolver.find(JBossPackageScanClassResolver.java:24) [camel-jboss6-2.8.0.jar:2.8.0]

At the moment it seems that it doesn't exist a version of that jar working with JBoss-as-7. For what I know the only way to make it work with JBoss-as-7 is to use a version of Camel >= 2.8. Indeed starting from Camel 2.8 they allow to define the converter classes by specifying their FQN class name as reported here: http://camel.apache.org/type-converter.html instead of relying on the @Converter annotation.

BRMS 5.3 currently uses Camel 2.4, while Drools 5.4 already integrates Camel 2.9.

Comment 2 Prakash Aradhya 2012-04-30 16:09:33 UTC
Mario, 
Lets keep this focused on BRMS 5.3 which only runs on AS 5.x (EAP 512).
Lets document the work around for this issue in the release notes.

Comment 5 lcarlon 2012-06-07 23:58:24 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Camel cannot find type converters for String to InputStream conversions when deployed on JBoss, preventing commands being sent in JAXB, JSON, Xtream or Object format.

Comment 6 Radovan Synek 2012-06-08 06:20:35 UTC
Hi Lee,

I have made a small change in the technical note - problem is with commands in JAXB, JSON or XStream format, Object format does not seem to need this conversion and works.

Comment 7 Radovan Synek 2012-06-08 06:20:35 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1 +1 @@
-Camel cannot find type converters for String to InputStream conversions when deployed on JBoss, preventing commands being sent in JAXB, JSON, Xtream or Object format.+Camel cannot find type converters for String to InputStream conversions when deployed on JBoss, preventing commands being sent in JAXB, JSON or XStream.

Comment 8 lcarlon 2012-06-11 22:43:25 UTC
Thanks Radovan!

Comment 11 Radovan Synek 2012-09-24 07:56:03 UTC
This issue is still unresolved for EAP6/JBoss-as-7 - throwing the same org.apache.camel.NoTypeConversionAvailableException with or without using the JBossPackageScanClassResolver.


Note You need to log in before you can comment on or make changes to this bug.