Health not working with CXF and SpringBoot

2018-01-05 Thread Imran Raza Khan
Hi,
I want to extend below Camel-CXF and SpringBoot example to provide health
status on /health, i tried adding


  org.springframework.boot
  spring-boot-starter-actuator


But no success, any suggestion?

https://github.com/camelinaction/camelinaction2/tree/b6a43abf9e0d4ec4e3753ebd735bb3448f98194b/chapter10/camel-cxf-rest-spring-boot


Re: Problem with camel-aws S3 when multiPartUpload is set to true

2018-01-05 Thread Artur Jablonski
Try setting region on your AmazonS3Client bean.

On Fri, Jan 5, 2018 at 3:19 AM, kretin  wrote:

> I created a simple camel route to poll for files in a local directory and
> upload them to a Ceph (S3) server at my University. I am using apache camel
> 2.20.0 with the camel-aws S3 component, when I set multiPartUpload=false
> (the default) in the uri, everything works fine, but if I change to
> multiPartUpload=true, it fails.
>
> I know there is nothing wrong with my s3 secret or s3 access key because
> when I set multiPartUpload=false, everything works (there are no crazy plus
> (+) characters that need to be escaped in the keys).
>
> Here is the stack trace:
>
> com.amazonaws.services.s3.model.AmazonS3Exception: null (Service: Amazon
> S3; Status Code: 403; Error Code: SignatureDoesNotMatch; Request ID:
> tx002e9edee-005a4ed3d2-2213a2-uky-campus-1; S3 Extended
> Request ID: 2213a2-uky-campus-1-uky)
> at com.amazonaws.http.AmazonHttpClient$RequestExecutor.
> handleErrorResponse(AmazonHttpClient.java:1592)
> ~[aws-java-sdk-core-1.11.186.jar:?]
> at com.amazonaws.http.AmazonHttpClient$RequestExecutor.
> executeOneRequest(AmazonHttpClient.java:1257)
> ~[aws-java-sdk-core-1.11.186.jar:?]
> at 
> com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1029)
> ~[aws-java-sdk-core-1.11.186.jar:?]
> at 
> com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:741)
> ~[aws-java-sdk-core-1.11.186.jar:?]
> at com.amazonaws.http.AmazonHttpClient$RequestExecutor.
> executeWithTimer(AmazonHttpClient.java:715) ~[aws-java-sdk-core-1.11.186.
> jar:?]
> at 
> com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:697)
> ~[aws-java-sdk-core-1.11.186.jar:?]
> at 
> com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:665)
> ~[aws-java-sdk-core-1.11.186.jar:?]
> at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.
> execute(AmazonHttpClient.java:647) ~[aws-java-sdk-core-1.11.186.jar:?]
> at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:511)
> ~[aws-java-sdk-core-1.11.186.jar:?]
> at 
> com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:4227)
> ~[aws-java-sdk-s3-1.11.186.jar:?]
> at 
> com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:4174)
> ~[aws-java-sdk-s3-1.11.186.jar:?]
> at 
> com.amazonaws.services.s3.AmazonS3Client.abortMultipartUpload(AmazonS3Client.java:2928)
> ~[aws-java-sdk-s3-1.11.186.jar:?]
> at org.apache.camel.component.aws.s3.S3Producer.
> processMultiPart(S3Producer.java:181) ~[camel-aws-2.20.0.jar:2.20.0]
> at 
> org.apache.camel.component.aws.s3.S3Producer.process(S3Producer.java:84)
> ~[camel-aws-2.20.0.jar:2.20.0]
> at ...
>
> My camel-context.xml looks like:
>
> 
> http://www.springframework.org/schema/beans;
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
> xsi:schemaLocation="
>http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans.xsd
>http://camel.apache.org/schema/spring http://camel.apache.org/
> schema/spring/camel-spring.xsd">
>
>  class="org.apache.camel.component.properties.PropertiesComponent">
> 
> 
>
>  class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfi
> gurer">
>  value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
> 
> 
>
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>
> http://camel.apache.org/schema/spring;>
> 
> 
>
> 
>
> 
> testMultiPart/${in.header.CamelFileName}
> 
> 
>
> 
> ${in.header.CamelFileLength}
> 
> 
>
> 
>
>  uri="aws-s3://{{s3Bucket}}?amazonS3Client=#amazonClientmultiPartUpload=true"
> />
>
> 
>
> 
> 
> 
>
> Again, everything works fine if I set multiPartUpload=false in the above
> camel-context.xml
>
> I have tried a lot of things like:
>
> • setting the CamelAwsS3ContentMD5 header to the MD5 hash of the
> file (which doesn't make sense for multi-part files)
> • various settings for the partSize parameter
> • different sized files from very large to very small
> • setting the system parameter: System.setProperty("com.
> amazonaws.services.s3.disablePutObjectMD5Validation", "true");
>
> If I turn on trace debugging for camel, it doesnt help much:
>
> [d #2 - file://target/sendToS3/] S3Producer TRACE
> Initiating multipart upload [com.amazonaws.services.s3.model.
> InitiateMultipartUploadRequest@3731147a] from exchange
> [Exchange[ID-Toucan-local-1515115111374-0-1]]...
> [d #2 - 

Re: Apache camel with spring 5.x

2018-01-05 Thread Andrea Cosentino
No, 2.20.x is based on spring 4.
--Andrea Cosentino --Apache Camel PMC 
MemberApache Karaf CommitterApache Servicemix PMC MemberEmail: 
ancosen1985@yahoo.comTwitter: @oscerd2Github: oscerd 

On Friday, January 5, 2018, 12:58:14 PM GMT+1, Sujay Bawaskar 
 wrote:  
 
 Hi,

Is camel 20.x compatible with spring 5.x? Or do we have to wait for a
release?

-- 
Thanks,
Sujay P Bawaskar
M:+91-77091 53669
  

Re: Apache camel with spring 5.x

2018-01-05 Thread Sujay Bawaskar
Thanks Andrea! Any plan to upgrade to 5.x? I see even spring boot is also
not available with spring 5x.

On Fri, Jan 5, 2018 at 5:29 PM, Andrea Cosentino <
ancosen1...@yahoo.com.invalid> wrote:

> No, 2.20.x is based on spring 4.
> --Andrea Cosentino --Apache Camel PMC
> MemberApache Karaf CommitterApache Servicemix PMC MemberEmail:
> ancosen1985@yahoo.comTwitter: @oscerd2Github: oscerd
>
> On Friday, January 5, 2018, 12:58:14 PM GMT+1, Sujay Bawaskar <
> sujaybawas...@gmail.com> wrote:
>
>  Hi,
>
> Is camel 20.x compatible with spring 5.x? Or do we have to wait for a
> release?
>
> --
> Thanks,
> Sujay P Bawaskar
> M:+91-77091 53669
>




-- 
Thanks,
Sujay P Bawaskar
M:+91-77091 53669


Re: Error sending email from Camel application

2018-01-05 Thread Claus Ibsen
Hi

>From the stacktrace it seems its some kind of header that is causing
this jackson conversion as its .toString method is called.
What objects do you store in the headers? Maybe use tracer, or debug
your Camel application and see which header has the problem.



On Thu, Jan 4, 2018 at 8:01 PM, Charles Berger
 wrote:
> Anyone able to help with this please?
>
> On Thu, Dec 21, 2017 at 6:03 PM, Charles Berger
>  wrote:
>> Hi,
>>
>> I have the following route in my application which sends an email
>> based on a template filled out with data from the SingleImageModel
>> class:
>>
>> from(ACTIVEMQ_EMAIL_QUEUE)
>> .routeId(ROUTE_EMAIL_NOTIFICATIONS)
>> .convertBodyTo(SingleImageModel.class)
>> // set subject, from address & to address
>> .setHeader("subject", constant(EMAIL_SUBJECT))
>> .setHeader("to", simple("${body.email}"))
>> .setHeader("from", constant(EMAIL_FROM))
>> // format the message body
>> .to(VELOCITY_EMAIL)
>> .log("${body}")
>> // send email
>> .to(SMTP_URL)
>> .end();
>>
>> When it tries to execute the SMTP step the message fails with the
>> following error:
>>
>> 2017-12-21 17:30:08,034 []
>> org.apache.camel.processor.DefaultErrorHandler ERROR - Failed delivery
>> for (MessageId: ID-iusa16025-local-1513877322283-0-13 on ExchangeId:
>> ID-iusa16025-local-1513877322283-0-11). Exhausted after delivery
>> attempt: 1 caught: org.apache.camel.TypeConversionException: Error
>> during type conversion from type: java.lang.String to the required
>> type: java.lang.String with value queue://emailQueue due
>> com.fasterxml.jackson.databind.JsonMappingException: No serializer
>> found for class java.util.Vector$1 and no properties discovered to
>> create BeanSerializer (to avoid exception, disable
>> SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain:
>> org.apache.activemq.command.ActiveMQQueue["reference"]->javax.naming.Reference["all"])
>>
>> The stacktrace is:
>>
>> org.apache.camel.TypeConversionException: Error during type conversion
>> from type: java.lang.String to the required type: java.lang.String
>> with value queue://emailQueue due
>> com.fasterxml.jackson.databind.JsonMappingException: No serializer
>> found for class java.util.Vector$1 and no properties discovered to
>> create BeanSerializer (to avoid exception, disable
>> SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain:
>> org.apache.activemq.command.ActiveMQQueue["reference"]->javax.naming.Reference["all"])
>> at 
>> org.apache.camel.impl.converter.BaseTypeConverterRegistry.createTypeConversionException(BaseTypeConverterRegistry.java:667)
>> at 
>> org.apache.camel.impl.converter.BaseTypeConverterRegistry.convertTo(BaseTypeConverterRegistry.java:158)
>> at org.apache.camel.component.mail.MailBinding.asString(MailBinding.java:717)
>> at 
>> org.apache.camel.component.mail.MailBinding.appendHeadersFromCamelMessage(MailBinding.java:398)
>> at 
>> org.apache.camel.component.mail.MailBinding.populateMailMessage(MailBinding.java:117)
>> at org.apache.camel.component.mail.MailProducer.process(MailProducer.java:58)
>> at 
>> org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
>> at 
>> org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:178)
>> at 
>> org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:445)
>> at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:173)
>> at 
>> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:181)
>> at 
>> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
>> at 
>> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
>> at org.apache.camel.processor.Pipeline.process(Pipeline.java:138)
>> at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
>> at 
>> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
>> at 
>> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:97)
>> at 
>> org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:112)
>> at 
>> org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:719)
>> at 
>> org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:679)
>> at 
>> org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:649)
>> at 
>> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:317)
>> at 
>> 

Re: Apache camel with spring 5.x

2018-01-05 Thread Claus Ibsen
Hi

You can try using Spring 5, I don't think there is any problems using
it with Camel 2.20.x etc.
However Spring Boot 2 is not API compatible and you cannot use it with
Camel yet.

Support for this will come later (Camel 2.22 or later).



On Fri, Jan 5, 2018 at 12:58 PM, Sujay Bawaskar  wrote:
> Hi,
>
> Is camel 20.x compatible with spring 5.x? Or do we have to wait for a
> release?
>
> --
> Thanks,
> Sujay P Bawaskar
> M:+91-77091 53669



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Re: Error sending email from Camel application

2018-01-05 Thread Charles Berger
The route is taking properties from a POJO and building up a message
to use to send an email.  I add the from, to & subject headers in the
route which are just string values.  The message body is created using
a Velocity template which extracts some values from the POJO.

I included some tracers in the route and here is the info that is
logged by Camel immediately before calling the SMTP endpoint (I've
anonymised some of the data):

2018-01-05 11:42:09,265 []
org.apache.camel.processor.interceptor.Tracer  INFO -
ID-iusa16025-local-1515152339856-0-11 >>> (emailNotifications)
log[body] --> smtp://localhost <<< Pattern:InOnly,
Headers:{breadcrumbId=ID-iusa16025-local-1515152339856-0-11,
Content-Type=application/json, downloadSuccessful=false,
from=nore...@xxx.com, JMSCorrelationID=null,
JMSCorrelationIDAsBytes=null, JMSDeliveryMode=2,
JMSDestination=queue://emailQueue, JMSExpiration=0,
JMSMessageID=ID:iusa16025.local-64140-1515152341226-7:1:2:1:1,
JMSPriority=4, JMSRedelivered=false, JMSReplyTo=null,
JMSTimestamp=1515152529152, JMSType=null, JMSXGroupID=null,
JMSXUserID=null, subject=EDM Image Manager Alert, to=x...@yyy.com},
BodyType:String, Body:Hi,

Image https://i.xxx.com/zzz.png for template Sample Template failed to
upload to the CDN.

XXX Image Manager team.

The error message logged is this:

2018-01-05 11:42:09,312 []
org.apache.camel.processor.DefaultErrorHandler ERROR - Failed delivery
for (MessageId: ID-iusa16025-local-1515152339856-0-13 on ExchangeId:
ID-iusa16025-local-1515152339856-0-11). Exhausted after delivery
attempt: 1 caught: org.apache.camel.TypeConversionException: Error
during type conversion from type: java.lang.String to the required
type: java.lang.String with value queue://emailQueue due
com.fasterxml.jackson.databind.JsonMappingException: No serializer
found for class java.util.Vector$1 and no properties discovered to
create BeanSerializer (to avoid exception, disable
SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain:
org.apache.activemq.command.ActiveMQQueue["reference"]->javax.naming.Reference["all"])

Message History
---
RouteId  ProcessorId  Processor
Elapsed (ms)
[emailNotifications] [emailNotifications] [activemq://emailQueue
  ] [   153]
[emailNotifications] [convertBodyTo4]
[convertBodyTo[com.yesmail.edmimagebridge.model.SingleImageModel]
] [ 2]
[emailNotifications] [setHeader1] [setHeader[subject]
  ] [ 0]
[emailNotifications] [setHeader2] [setHeader[to]
  ] [ 4]
[emailNotifications] [setHeader3] [setHeader[from]
  ] [ 0]
[emailNotifications] [to9   ] [velocity:errorEmailBody.vm
  ] [   101]
[emailNotifications] [log10 ] [log
  ] [ 0]
[emailNotifications] [to10  ] [smtp://localhost
  ] [46]

Stacktrace
---
org.apache.camel.TypeConversionException: Error during type conversion
from type: java.lang.String to the required type: java.lang.String
with value queue://emailQueue due
com.fasterxml.jackson.databind.JsonMappingException: No serializer
found for class java.util.Vector$1 and no properties discovered to
create BeanSerializer (to avoid exception, disable
SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain:
org.apache.activemq.command.ActiveMQQueue["reference"]->javax.naming.Reference["all"])

The message suggests that I should disable
SerializationFeature.FAIL_ON_EMPTY_BEANS but I'm not sure how to
achieve that.  I'm researching that just now and I was looking at
doing something like this:

JacksonDataFormat df = new JacksonDataFormat(java.util.Vector.class);
df.disableFeature(SerializationFeature.FAIL_ON_EMPTY_BEANS);

in beforeStart method of my CamelContextLifecycle class.


Apache camel with spring 5.x

2018-01-05 Thread Sujay Bawaskar
Hi,

Is camel 20.x compatible with spring 5.x? Or do we have to wait for a
release?

-- 
Thanks,
Sujay P Bawaskar
M:+91-77091 53669


Re: Problem with camel-aws S3 when multiPartUpload is set to true

2018-01-05 Thread kretin
I tried adding a region like this and it still fails with the same error: 



> On Jan 5, 2018, at 4:23 AM, Artur Jablonski  wrote:
> 
> Try setting region on your AmazonS3Client bean.
> 
> On Fri, Jan 5, 2018 at 3:19 AM, kretin  wrote:
> 
>> I created a simple camel route to poll for files in a local directory and
>> upload them to a Ceph (S3) server at my University. I am using apache camel
>> 2.20.0 with the camel-aws S3 component, when I set multiPartUpload=false
>> (the default) in the uri, everything works fine, but if I change to
>> multiPartUpload=true, it fails.
>> 
>> I know there is nothing wrong with my s3 secret or s3 access key because
>> when I set multiPartUpload=false, everything works (there are no crazy plus
>> (+) characters that need to be escaped in the keys).
>> 
>> Here is the stack trace:
>> 
>> com.amazonaws.services.s3.model.AmazonS3Exception: null (Service: Amazon
>> S3; Status Code: 403; Error Code: SignatureDoesNotMatch; Request ID:
>> tx002e9edee-005a4ed3d2-2213a2-uky-campus-1; S3 Extended
>> Request ID: 2213a2-uky-campus-1-uky)
>>at com.amazonaws.http.AmazonHttpClient$RequestExecutor.
>> handleErrorResponse(AmazonHttpClient.java:1592)
>> ~[aws-java-sdk-core-1.11.186.jar:?]
>>at com.amazonaws.http.AmazonHttpClient$RequestExecutor.
>> executeOneRequest(AmazonHttpClient.java:1257)
>> ~[aws-java-sdk-core-1.11.186.jar:?]
>>at 
>> com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1029)
>> ~[aws-java-sdk-core-1.11.186.jar:?]
>>at 
>> com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:741)
>> ~[aws-java-sdk-core-1.11.186.jar:?]
>>at com.amazonaws.http.AmazonHttpClient$RequestExecutor.
>> executeWithTimer(AmazonHttpClient.java:715) ~[aws-java-sdk-core-1.11.186.
>> jar:?]
>>at 
>> com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:697)
>> ~[aws-java-sdk-core-1.11.186.jar:?]
>>at 
>> com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:665)
>> ~[aws-java-sdk-core-1.11.186.jar:?]
>>at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.
>> execute(AmazonHttpClient.java:647) ~[aws-java-sdk-core-1.11.186.jar:?]
>>at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:511)
>> ~[aws-java-sdk-core-1.11.186.jar:?]
>>at 
>> com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:4227)
>> ~[aws-java-sdk-s3-1.11.186.jar:?]
>>at 
>> com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:4174)
>> ~[aws-java-sdk-s3-1.11.186.jar:?]
>>at 
>> com.amazonaws.services.s3.AmazonS3Client.abortMultipartUpload(AmazonS3Client.java:2928)
>> ~[aws-java-sdk-s3-1.11.186.jar:?]
>>at org.apache.camel.component.aws.s3.S3Producer.
>> processMultiPart(S3Producer.java:181) ~[camel-aws-2.20.0.jar:2.20.0]
>>at 
>> org.apache.camel.component.aws.s3.S3Producer.process(S3Producer.java:84)
>> ~[camel-aws-2.20.0.jar:2.20.0]
>>at ...
>> 
>> My camel-context.xml looks like:
>> 
>> 
>> http://www.springframework.org/schema/beans;
>>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
>>xsi:schemaLocation="
>>   http://www.springframework.org/schema/beans
>> http://www.springframework.org/schema/beans/spring-beans.xsd
>>   http://camel.apache.org/schema/spring http://camel.apache.org/
>> schema/spring/camel-spring.xsd">
>> 
>>>class="org.apache.camel.component.properties.PropertiesComponent">
>>
>>
>> 
>>>class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfi
>> gurer">
>>> value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
>>
>>
>> 
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> 
>>http://camel.apache.org/schema/spring;>
>>
>>
>> 
>>
>> 
>>
>>testMultiPart/${in.header.CamelFileName}
>>
>>
>> 
>>
>>${in.header.CamelFileLength}
>>
>>
>> 
>>
>> 
>>> uri="aws-s3://{{s3Bucket}}?amazonS3Client=#amazonClientmultiPartUpload=true"
>> />
>> 
>>
>> 
>>
>>
>> 
>> 
>> Again, everything works fine if I set multiPartUpload=false in the above
>> camel-context.xml
>> 
>> I have tried a lot of things like:
>> 
>>• setting the CamelAwsS3ContentMD5 header to the MD5 hash of the
>> file (which doesn't make sense for multi-part files)
>>• various settings for the partSize parameter
>>• different sized files from very large to very small
>>• setting the system parameter: System.setProperty("com.
>> amazonaws.services.s3.disablePutObjectMD5Validation", "true");
>> 
>> If I turn on trace debugging for camel, it doesnt 

Re: Problem with camel-aws S3 when multiPartUpload is set to true

2018-01-05 Thread Andrea Cosentino
If you are passing the client as bean from registry, it makes no sense to 
define the region, you can set the region directly on the client you're passing.

--
Andrea Cosentino 
--
Apache Camel PMC Member
Apache Karaf Committer
Apache Servicemix PMC Member
Email: ancosen1...@yahoo.com
Twitter: @oscerd2
Github: oscerd






On Friday, January 5, 2018, 2:24:53 PM GMT+1, kretin  wrote: 





I tried adding a region like this and it still fails with the same error: 



> On Jan 5, 2018, at 4:23 AM, Artur Jablonski  wrote:
> 
> Try setting region on your AmazonS3Client bean.
> 
> On Fri, Jan 5, 2018 at 3:19 AM, kretin  wrote:
> 
>> I created a simple camel route to poll for files in a local directory and
>> upload them to a Ceph (S3) server at my University. I am using apache camel
>> 2.20.0 with the camel-aws S3 component, when I set multiPartUpload=false
>> (the default) in the uri, everything works fine, but if I change to
>> multiPartUpload=true, it fails.
>> 
>> I know there is nothing wrong with my s3 secret or s3 access key because
>> when I set multiPartUpload=false, everything works (there are no crazy plus
>> (+) characters that need to be escaped in the keys).
>> 
>> Here is the stack trace:
>> 
>> com.amazonaws.services.s3.model.AmazonS3Exception: null (Service: Amazon
>> S3; Status Code: 403; Error Code: SignatureDoesNotMatch; Request ID:
>> tx002e9edee-005a4ed3d2-2213a2-uky-campus-1; S3 Extended
>> Request ID: 2213a2-uky-campus-1-uky)
>>    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.
>> handleErrorResponse(AmazonHttpClient.java:1592)
>> ~[aws-java-sdk-core-1.11.186.jar:?]
>>    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.
>> executeOneRequest(AmazonHttpClient.java:1257)
>> ~[aws-java-sdk-core-1.11.186.jar:?]
>>    at 
>>com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1029)
>> ~[aws-java-sdk-core-1.11.186.jar:?]
>>    at 
>>com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:741)
>> ~[aws-java-sdk-core-1.11.186.jar:?]
>>    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.
>> executeWithTimer(AmazonHttpClient.java:715) ~[aws-java-sdk-core-1.11.186.
>> jar:?]
>>    at 
>>com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:697)
>> ~[aws-java-sdk-core-1.11.186.jar:?]
>>    at 
>>com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:665)
>> ~[aws-java-sdk-core-1.11.186.jar:?]
>>    at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.
>> execute(AmazonHttpClient.java:647) ~[aws-java-sdk-core-1.11.186.jar:?]
>>    at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:511)
>> ~[aws-java-sdk-core-1.11.186.jar:?]
>>    at 
>>com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:4227)
>> ~[aws-java-sdk-s3-1.11.186.jar:?]
>>    at 
>>com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:4174)
>> ~[aws-java-sdk-s3-1.11.186.jar:?]
>>    at 
>>com.amazonaws.services.s3.AmazonS3Client.abortMultipartUpload(AmazonS3Client.java:2928)
>> ~[aws-java-sdk-s3-1.11.186.jar:?]
>>    at org.apache.camel.component.aws.s3.S3Producer.
>> processMultiPart(S3Producer.java:181) ~[camel-aws-2.20.0.jar:2.20.0]
>>    at 
>>org.apache.camel.component.aws.s3.S3Producer.process(S3Producer.java:84)
>> ~[camel-aws-2.20.0.jar:2.20.0]
>>    at ...
>> 
>> My camel-context.xml looks like:
>> 
>> 
>> http://www.springframework.org/schema/beans;
>>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
>>    xsi:schemaLocation="
>>      http://www.springframework.org/schema/beans
>> http://www.springframework.org/schema/beans/spring-beans.xsd
>>      http://camel.apache.org/schema/spring http://camel.apache.org/
>> schema/spring/camel-spring.xsd">
>> 
>>    >        class="org.apache.camel.component.properties.PropertiesComponent">
>>        
>>    
>> 
>>    >        class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfi
>> gurer">
>>        > value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
>>        
>>    
>> 
>>    
>>        
>>            
>>                
>>                
>>            
>>        
>>        
>>            
>>                
>>            
>>        
>>        
>>    
>> 
>>    http://camel.apache.org/schema/spring;>
>>        
>>            
>> 
>>            
>> 
>>            
>>                testMultiPart/${in.header.CamelFileName}
>>                
>>            
>> 
>>            
>>                ${in.header.CamelFileLength}
>>                
>>            
>> 
>>            
>> 
>>            >uri="aws-s3://{{s3Bucket}}?amazonS3Client=#amazonClientmultiPartUpload=true"
>> />
>> 
>>            
>> 
>>        
>>    
>> 
>> 
>> Again, everything works fine if I set multiPartUpload=false in the above
>> camel-context.xml
>> 
>> I have tried a lot of things like:
>> 
>>        • 

Re: Error sending email from Camel application

2018-01-05 Thread Charles Berger
Looks like I've managed to fix this, with some help from this post on
StackOverflow:

https://stackoverflow.com/questions/33397359/how-to-configure-jackson-objectmapper-for-camel-in-spring-boot

What I did is to create a new ObjectMapper instance and disabled the
SerializationFeature.FAIL_ON_EMPTY_BEANS feature:

private static ObjectMapper getCustomObjectMapper() {
ObjectMapper om = new ObjectMapper();
om.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
return om;
}

I then added this instance to the JNDI registry using the name "json-jackson":

registry.bind("json-jackson", getCustomObjectMapper());

This code is executed in the CameContextLifecycle.beforeStart method.

I also had to modify the Content-Type of the request to text/plain so
that the message text was included in the email body rather than as an
attachment.


AW: Error sending email from Camel application

2018-01-05 Thread christian.jacob
Hi Charles,

I'm not sure if I can help you out, but a couple of days ago I had an error 
with sending multiple REST requests to a remote server. I aggregated the 
responses values of each request in a complicated Map of Map of Maps structure 
that resided in the Camel header. After a couple of requests, the http 
handshake threw an exception. After some debugging I figured out: Camel uses 
the complete Camel Header to setup the http header. So the toString() result of 
my Map of Map of Maps went into the http request as a header, and that grew too 
large. What helped me out was to implement a custom headerFilterStrategy in 
which I managed to keep all of my custom header values out of the way.

Maybe this will help you...

Regards,
Christian

-Ursprüngliche Nachricht-
Von: Charles Berger [mailto:charlesb.yesm...@googlemail.com]
Gesendet: Freitag, 5. Januar 2018 13:30
An: users@camel.apache.org
Betreff: Re: Error sending email from Camel application

The route is taking properties from a POJO and building up a message to use to 
send an email.  I add the from, to & subject headers in the route which are 
just string values.  The message body is created using a Velocity template 
which extracts some values from the POJO.

I included some tracers in the route and here is the info that is logged by 
Camel immediately before calling the SMTP endpoint (I've anonymised some of the 
data):

2018-01-05 11:42:09,265 []
org.apache.camel.processor.interceptor.Tracer  INFO -
ID-iusa16025-local-1515152339856-0-11 >>> (emailNotifications) log[body] --> 
smtp://localhost <<< Pattern:InOnly, 
Headers:{breadcrumbId=ID-iusa16025-local-1515152339856-0-11,
Content-Type=application/json, downloadSuccessful=false, from=nore...@xxx.com, 
JMSCorrelationID=null, JMSCorrelationIDAsBytes=null, JMSDeliveryMode=2, 
JMSDestination=queue://emailQueue, JMSExpiration=0, 
JMSMessageID=ID:iusa16025.local-64140-1515152341226-7:1:2:1:1,
JMSPriority=4, JMSRedelivered=false, JMSReplyTo=null, 
JMSTimestamp=1515152529152, JMSType=null, JMSXGroupID=null, JMSXUserID=null, 
subject=EDM Image Manager Alert, to=x...@yyy.com}, BodyType:String, Body:Hi,

Image https://i.xxx.com/zzz.png for template Sample Template failed to upload 
to the CDN.

XXX Image Manager team.

The error message logged is this:

2018-01-05 11:42:09,312 []
org.apache.camel.processor.DefaultErrorHandler ERROR - Failed delivery for 
(MessageId: ID-iusa16025-local-1515152339856-0-13 on ExchangeId:
ID-iusa16025-local-1515152339856-0-11). Exhausted after delivery
attempt: 1 caught: org.apache.camel.TypeConversionException: Error during type 
conversion from type: java.lang.String to the required
type: java.lang.String with value queue://emailQueue due
com.fasterxml.jackson.databind.JsonMappingException: No serializer found for 
class java.util.Vector$1 and no properties discovered to create BeanSerializer 
(to avoid exception, disable
SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain:
org.apache.activemq.command.ActiveMQQueue["reference"]->javax.naming.Reference["all"])

Message History
---
RouteId  ProcessorId  Processor
Elapsed (ms) 
[emailNotifications] [emailNotifications] [activemq://emailQueue
  ] [   153]
[emailNotifications] [convertBodyTo4]
[convertBodyTo[com.yesmail.edmimagebridge.model.SingleImageModel]
] [ 2]
[emailNotifications] [setHeader1] [setHeader[subject]
  ] [ 0]
[emailNotifications] [setHeader2] [setHeader[to]
  ] [ 4]
[emailNotifications] [setHeader3] [setHeader[from]
  ] [ 0]
[emailNotifications] [to9   ] [velocity:errorEmailBody.vm
  ] [   101]
[emailNotifications] [log10 ] [log
  ] [ 0]
[emailNotifications] [to10  ] [smtp://localhost
  ] [46]

Stacktrace
---
org.apache.camel.TypeConversionException: Error during type conversion from 
type: java.lang.String to the required type: java.lang.String with value 
queue://emailQueue due
com.fasterxml.jackson.databind.JsonMappingException: No serializer found for 
class java.util.Vector$1 and no properties discovered to create BeanSerializer 
(to avoid exception, disable
SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: