Missing part in JPA component documentation

2016-08-30 Thread Alberto

Hello,
I'm trying to set up a JPA idempotent repository. Some details are
missing in the documention, where appears an error:

Error formatting macro: snippet: java.lang.IndexOutOfBoundsException:
Index: 20, Size: 20

instead of JpaTemplate configuration.

Best regards

Alberto




http 415 error in cxf rest service

2016-08-30 Thread cacert
I am trying to build some rest and soap services using camel cxf-rs module.
Soap part is fine, in rest part i have one GET and one POST methods with
following signature. GET method working fine but POST method(which expects a
customer json object ) get HTTP status of 415 with error "No message body
reader has been found for class".Can anybody tell what is missing here ?

Rest interface:

@WebService
@Path("/bookstore")
@Consumes("application/json")
@Produces("application/json")
public interface BookStore {

@WebMethod
@GET
@Path("/{id}")
@Consumes("*/*")
Book getBook(@PathParam("id") @WebParam(name = "id") Long id) throws
Exception;

@WebMethod
@POST
@Path("/books")
Book addBook(@WebParam(name = "book") Book book);

}

PS: Here is the sample curl command:

curl -H "Content-Type: application/json" -X POST -d
'{"name":"xyz","isbn":"xyz"}'
http://localhost:8080/api/servlet/rest/bookstore/books




--
View this message in context: 
http://camel.465427.n5.nabble.com/http-415-error-in-cxf-rest-service-tp5786955.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Route elements - Loop

2016-08-30 Thread Robert Lario
I am new to camel.


I have a file that needs to be processed each day.  It contains a list of 
members and it is in CSV (rob,12.30,yes,1).  I want to iterate over each row in 
the file and insert the information into a sql DB.


I am looking at using "unmarshal" and the "JDBC" in the route.  What I am 
unsure on is the pattern for iterating over each line to do the insert.  Should 
I be using "loop".  Anybody got an example of iterating over a CSV file 
inserting rows into a DB?


Thanks for your help.


Re: Route elements - Loop

2016-08-30 Thread Allan C.
The people at Fuse and Camel has made available tons of materials and
samples for reference. Try this
https://github.com/FuseByExample/camel-persistence-part2

Regards,
Allan C.

On Tue, Aug 30, 2016 at 5:11 AM, Robert Lario 
wrote:

> I am new to camel.
>
>
> I have a file that needs to be processed each day.  It contains a list of
> members and it is in CSV (rob,12.30,yes,1).  I want to iterate over each
> row in the file and insert the information into a sql DB.
>
>
> I am looking at using "unmarshal" and the "JDBC" in the route.  What I am
> unsure on is the pattern for iterating over each line to do the insert.
> Should I be using "loop".  Anybody got an example of iterating over a CSV
> file inserting rows into a DB?
>
>
> Thanks for your help.
>


Re: http 415 error in cxf rest service

2016-08-30 Thread Sergey Beryozkin

Hi Brad

Thanks, FYI explicitly configuring CXF JSONProvider with a property 
unmarshalAsJaxbElement may fix it or adding Jackson provider (while 
excluding a jettison dependency) should work...


Cheers, Sergey
On 30/08/16 03:01, Ranx wrote:

I assume you have a JSONProvider configured?  That usually causes the error
you are seeing.

Does your Book class have an @XmlRootElement at its top?  If you're using
JAXB that is required even for JSON.

Brad



--
View this message in context: 
http://camel.465427.n5.nabble.com/http-415-error-in-cxf-rest-service-tp5786955p5786966.html
Sent from the Camel - Users mailing list archive at Nabble.com.





Re: ERROR No message body reader has been found for class, ContentType: application/json' in CXF JAXRS - 2.17.3

2016-08-30 Thread Sergey Beryozkin

If so - do you have a jettison dependency on the classpath ?

Sergey

On 30/08/16 05:23, imranrazakhan wrote:

HI,

Yes it has @XmlRootElement annotation.

Regards,



--
View this message in context: 
http://camel.465427.n5.nabble.com/ERROR-No-message-body-reader-has-been-found-for-class-ContentType-application-json-in-CXF-JAXRS-2-173-tp5786940p5786968.html
Sent from the Camel - Users mailing list archive at Nabble.com.




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


XML Security - Is it possible to change transform algorithm on KeyInfo-object and SignedProperties?

2016-08-30 Thread salkin
*I'm trying to generate an XML-signature using Apache Camel Xml-Security
component. My RouteBuilder and configuration looks like this:
*
/
private void createRouteBuilders() throws Exception {
/**
 *  Sign XML with enveloping signature
 *  
 *  JndiRegistry is used to bind signature variables
 *  
 *  Key accessor = Use organisation X509Certificate
 *  Signature algorithm =
http://www.w3.org/2001/04/xmldsig-more#rsa-sha256&;
 *  Canonicalization method =  http://www.w3.org/2001/10/xml-exc-c14n#
 *  Transform method = http://www.w3.org/2001/10/xml-exc-c14n#
 *  Xades signature = defined in xadesProperties
 *  
 * */
context.addRoutes(new RouteBuilder() {
public void configure() throws Exception {
//TODO: Handle exception
from("direct:xml-signature")
.convertBodyTo(String.class)
.to("xmlsecurity:sign://enveloping?"
+ "keyAccessor=#accessor&"
+
"signatureAlgorithm=http://www.w3.org/2001/04/xmldsig-more#rsa-sha256&";
+ "canonicalizationMethod=#canonicalizationMethod1&"
+ "transformMethods=#transformMethods&"
+ "properties=#xadesProperties")
.convertBodyTo(Document.class);
}
});
}

private JndiRegistry createRegistry() throws Exception {
JndiRegistry registry = new JndiRegistry();

registry.bind("accessor", getKeyAccessor(keyPair.getPrivate()));
registry.bind("canonicalizationMethod1", getCanonicalizationMethod());
registry.bind("transformMethods", getTransformMethods());
registry.bind("xadesProperties", getXadesProperties());

return registry;
}

private XAdESSignatureProperties getXadesProperties() {
XAdESSignatureProperties props = new XAdESSignatureProperties();

props.setNamespace("http://uri.etsi.org/01903/v1.3.2#";);
props.setPrefix("xades");
props.setAddSigningTime(true);

return props;
}

private AlgorithmMethod getCanonicalizationMethod() {
return
XmlSignatureHelper.getCanonicalizationMethod(CanonicalizationMethod.EXCLUSIVE);
}

private List getTransformMethods() {
ArrayList transformMethods = new
ArrayList();
transformMethods.add(getCanonicalizationMethod());
return transformMethods;
}/

*The resulting XML looks like this:*
/
http://www.w3.org/2000/09/xmldsig#";
Id="_78256618-6394-43fb-a551-45013f9df404">

http://www.w3.org/2001/10/xml-exc-c14n#"/>
http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>


http://www.w3.org/2001/10/xml-exc-c14n#"/>

http://www.w3.org/2001/04/xmlenc#sha256"/>
   
KKcHfq+gpUlD9ltfvxUJC0DRLySRKeZqKebHrjxz1aI=



http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>

http://www.w3.org/2001/04/xmlenc#sha256"/>
   
g6DR+ETW13DssymC5AHS2CsPwUFAlBKQeTHH81b+w/c=

http://uri.etsi.org/01903#SignedProperties";
URI="#_f6ff95f0-42af-41f0-a4d7-37d9c7070bb6">
http://www.w3.org/2001/04/xmlenc#sha256"/>
   
w+s0PSrSzE1bfGZYt2U3mipZMYv+ETcdB6eK6DtqB48=


JOxBA0/9+hoxI7azTMemZfijEF4BoOU1wMmdzYtTSQchxDxr2LerQswNG2/26ANVAmWgmvMnrd5a8yxJsUw9EbkpQfAaJXX+ccXWLQVLxFSKYOVZqOG0UR1uPRN/Gs9LYjpDYsdKHbWzycfaSiKwSvFFUxrdt40xev4YEHh0xMVDpUQwruXEOrSfw1ceWLpJYTrLWAPcM3Ynd1/lXfEPylUJhHZPZ38ALk6QopOJ4D5jqndvzzGnWyXF1n0YImFut4OeviD+pHujRga6I3BN16ADErtEJQaQOR6CAVDkQvaiC12qrPwTm3vD4k5zgdtkdYPWWexxl3IiRJlcqoVuSQ==











http://uri.etsi.org/01903/v1.3.2#";
Target="#_78256618-6394-43fb-a551-45013f9df404">


   
2016-08-25T14:43:39+02:00



/
*
I want my chosen transform algorithm (Exclusive Canonicalization) to also
apply on the KeyInfo and the SignedProperties objects. Is this possible? If
it is, how do I achieve this? *



--
View this message in context: 
http://camel.465427.n5.nabble.com/XML-Security-Is-it-possible-to-change-transform-algorithm-on-KeyInfo-object-and-SignedProperties-tp5786982.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: camel-cdi projects as fat jar

2016-08-30 Thread a746076drdrb
Used maven-shade-plugin version 1.7.1

import javax.inject.Inject;

import org.apache.camel.Endpoint;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.cdi.Uri;

public class MyRoutes extends RouteBuilder {

@Inject
@Uri("timer:foo?period=5000")
private Endpoint inputEndpoint;

@Inject
@Uri("log:output")
private Endpoint resultEndpoint;

@Inject
private SomeBean someBean;

@Override
public void configure() {
from(inputEndpoint)
.bean(someBean)
.to(resultEndpoint);
}

}



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-cdi-projects-as-fat-jar-tp5786762p5786980.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: camel-cdi projects as fat jar

2016-08-30 Thread a746076drdrb
Used maven-shade-plugin version 1.7.1 and weld 2.2.15.Final. Now tried
2.3.5.Final with 

Exception in thread "main" org.jboss.weld.exceptions.DeploymentException:
javax/servlet/http/HttpServletRequest
at
org.jboss.weld.executor.AbstractExecutorServices.checkForExceptions(AbstractExecutorServices.java:66)
at
org.jboss.weld.executor.AbstractExecutorServices.invokeAllAndCheckForExceptions(AbstractExecutorServices.java:43)
at
org.jboss.weld.executor.AbstractExecutorServices.invokeAllAndCheckForExceptions(AbstractExecutorServices.java:51)
at
org.jboss.weld.bootstrap.ConcurrentBeanDeployer.createClassBeans(ConcurrentBeanDeployer.java:75)
at
org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:256)
at
org.jboss.weld.bootstrap.WeldStartup.deployBeans(WeldStartup.java:396)
at
org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:83)
at org.jboss.weld.environment.se.Weld.initialize(Weld.java:589)
at
org.apache.deltaspike.cdise.weld.WeldContainerControl.boot(WeldContainerControl.java:68)
at org.apache.camel.cdi.Main.doStart(Main.java:95)
at
org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
at org.apache.camel.main.MainSupport.run(MainSupport.java:138)
at org.apache.camel.main.MainSupport.run(MainSupport.java:390)
at org.apache.camel.cdi.Main.main(Main.java:57)
Caused by: java.lang.NoClassDefFoundError:
javax/servlet/http/HttpServletRequest
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2688)
at java.lang.Class.getDeclaredMethods(Class.java:1962)
at java.lang.Class.getEnclosingMethod(Class.java:1032)
at
org.jboss.weld.util.reflection.Reflections.isStaticNestedClass(Reflections.java:402)
at
org.jboss.weld.util.reflection.Reflections.isTopLevelOrStaticNestedClass(Reflections.java:422)
at
org.jboss.weld.util.Beans.isTypeManagedBeanOrDecoratorOrInterceptor(Beans.java:507)
at
org.jboss.weld.bootstrap.BeanDeployer.createClassBean(BeanDeployer.java:214)
at
org.jboss.weld.bootstrap.ConcurrentBeanDeployer$2.doWork(ConcurrentBeanDeployer.java:78)
at
org.jboss.weld.bootstrap.ConcurrentBeanDeployer$2.doWork(ConcurrentBeanDeployer.java:75)
at
org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:63)
at
org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:56)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
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)
Caused by: java.lang.ClassNotFoundException:
javax.servlet.http.HttpServletRequest
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-cdi-projects-as-fat-jar-tp5786762p5786981.html
Sent from the Camel - Users mailing list archive at Nabble.com.


sql vs jdbc component after Camel 2.16

2016-08-30 Thread Rajith Muditha Attapattu
The difference between the two is that with jdbc the query is in the
message body vs the as an endpoint property in sql.

But it seems from Camel 2.16 onwards, the sql component can do the same.
>From the looks of it, both could do what I want.

I'm just trying to figure out the best component to use.

What other differences are there btw the components?
I know sql component uses spring jdbc templates. Wondering if sql
component has an advantage over jdbc here.

Your feedback is greatly appreciated.

Regards,

Rajith Muditha Attapattu


Re: Route elements - Loop

2016-08-30 Thread raercules
Thanks for the tip.  Unfortunately, the one area I was interested in "Data"
is empty. 



--
View this message in context: 
http://camel.465427.n5.nabble.com/Route-elements-Loop-tp5786975p5786992.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: sql vs jdbc component after Camel 2.16

2016-08-30 Thread Matt Sicker
The jdbc component doesn't require Spring as a dependency. That's the main
advantage it has that I know of.

On 30 August 2016 at 08:15, Rajith Muditha Attapattu 
wrote:

> The difference between the two is that with jdbc the query is in the
> message body vs the as an endpoint property in sql.
>
> But it seems from Camel 2.16 onwards, the sql component can do the same.
> From the looks of it, both could do what I want.
>
> I'm just trying to figure out the best component to use.
>
> What other differences are there btw the components?
> I know sql component uses spring jdbc templates. Wondering if sql
> component has an advantage over jdbc here.
>
> Your feedback is greatly appreciated.
>
> Regards,
>
> Rajith Muditha Attapattu
>



-- 
Matt Sicker 


Re: Triggering choice-when block when no Exchanges make it through

2016-08-30 Thread Quinn Stevenson
If any files are found, the processor and choice condition will be executed, so 
could the fileProcessor be messing with the headers?

Also, believe with this configuration that Camel will only set the 
CamelBatchComplete header to true on the last file it found during the last 
poll - is that what you’re after?

> On Aug 12, 2016, at 6:09 AM, JSmith  wrote:
> 
> Hey all,
> 
> So I have a block of code set up in Spring that goes like:
> 
>   
>   
>   
>   
>   
>   
>   
>   ${headers.CamelBatchComplete} 
> == true 
>method="setTime"/>
>   
>   
>   
>   
> 
> 
> During the initial polling, a handful of files will be found but after the
> Processor they all get dropped.  That breaks the block because the
> CamelBatchComplete is set on the last Exchange, but there are no Exchanges
> making it through (right?).
> 
> What could I do to trigger that "setTime" method?
> 
> 
> 
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Triggering-choice-when-block-when-no-Exchanges-make-it-through-tp5786357.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



Re: Binary Data Structure Marshalling and Unmarshalling

2016-08-30 Thread Quinn Stevenson
If the data formats you’ve listed don’t work, I’d guess you’ll need to write 
your own DataFormat (http://camel.apache.org/custom-dataformat.html 
)

> On Aug 17, 2016, at 5:41 AM, Pratik Thacker  wrote:
> 
> We need to decode and encode binary data structure.
> We explored several data formats available in
> http://camel.apache.org/data-format.html. But couldn't find relevant data
> format for binary structured record.
> 
> For example:
> If my data structure of a record is like:
> SampleStructure bytes(12){
>   int num1: bytes(1);
>   int num2: bytes(2);
>   string results: bytes(9);
> }
> And Data is like:
> Record-1{
>  num1: 100;
>  num2: 300;
>  results: "Test_Test";
> }
> For above sample data, file would be of 12 bytes containing one record.
> * 1st byte representing byte form of integer 100.
> * 2nd and 3rd byte representing byte form of integer 300. Here, it would be
> great if we have choice to choose among big-endian and little-endian format.
> * next 9 bytes representing byte form of ascii value of each character of
> the string "Test_Test".
> 
> Similarly a file can contain multiple consecutive records.
> 
> Please suggest if we can unmarshal such formats and directly get a POJO
> object, just like we get it for the csv, xml or flat file formats. Here are
> the references we already explored and found it to be non-relevant for our
> case.
>   1. Bindy : http://camel.apache.org/bindy.html
>   2. Bean IO: http://camel.apache.org/beanio.html
>   3. Flatpack : http://camel.apache.org/flatpack-dataformat.html
> 
> 
> 
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Binary-Data-Structure-Marshalling-and-Unmarshalling-tp5786529.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



ApacheCon Seville CFP closes September 9th

2016-08-30 Thread Rich Bowen
It's traditional. We wait for the last minute to get our talk proposals
in for conferences.

Well, the last minute has arrived. The CFP for ApacheCon Seville closes
on September 9th, which is less than 2 weeks away. It's time to get your
talks in, so that we can make this the best ApacheCon yet.

It's also time to discuss with your developer and user community whether
there's a track of talks that you might want to propose, so that you
have more complete coverage of your project than a talk or two.

For Apache Big Data, the relevant URLs are:
Event details:
http://events.linuxfoundation.org/events/apache-big-data-europe
CFP:
http://events.linuxfoundation.org/events/apache-big-data-europe/program/cfp

For ApacheCon Europe, the relevant URLs are:
Event details: http://events.linuxfoundation.org/events/apachecon-europe
CFP: http://events.linuxfoundation.org/events/apachecon-europe/program/cfp

This year, we'll be reviewing papers "blind" - that is, looking at the
abstracts without knowing who the speaker is. This has been shown to
eliminate the "me and my buddies" nature of many tech conferences,
producing more diversity, and more new speakers. So make sure your
abstracts clearly explain what you'll be talking about.

For further updated about ApacheCon, follow us on Twitter, @ApacheCon,
or drop by our IRC channel, #apachecon on the Freenode IRC network.

-- 
Rich Bowen
WWW: http://apachecon.com/
Twitter: @ApacheCon


Re: Exception when suspending splitter

2016-08-30 Thread Brad Johnson
There are a couple of items I might suggest.  One is to use a
ThrottlingRoutePolicy with your throttler.  That can permit to write your
own control so you can turn it up or down when you need to.

http://camel.apache.org/route-throttling-example.html

Notice how it has a percent of maximum and resume max percent.  So you can
set upper and lower thresholds.  But if you wanted you could either write
your own or extend it and make it so you could set it.

Or his another example that sort of segregates what the
ThrottlingRoutePolicy does. http://camel.apache.org/routepolicy.html

Notice how the policy refs can be chained together.



 
 
 
 
 

 
 
 

 http://camel.apache.org/schema/spring";>
 
 
 
 
 


On Tue, Aug 30, 2016 at 12:10 AM, saw  wrote:

> The route is suspended from another thread by calling
>
>
> Our use case is such that we need this functionality. The file needs to be
> parsed at a controlled rate and processed only at certain times. So every
> once in a while parsing needs to be paused and resumed later.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.
> com/Exception-when-suspending-splitter-tp5786964p5786969.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


Re: ERROR No message body reader has been found for class, ContentType: application/json' in CXF JAXRS - 2.17.3

2016-08-30 Thread Brad Johnson
What Sergey suggested is what I've used in the past.  I don't recall if
that's the version with my BOM but you're using the latest version of Camel



org.codehaus.jettison
jettison
1.3.8



On Tue, Aug 30, 2016 at 2:51 AM, Sergey Beryozkin 
wrote:

> If so - do you have a jettison dependency on the classpath ?
>
> Sergey
>
>
> On 30/08/16 05:23, imranrazakhan wrote:
>
>> HI,
>>
>> Yes it has @XmlRootElement annotation.
>>
>> Regards,
>>
>>
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.
>> com/ERROR-No-message-body-reader-has-been-found-for-class-
>> ContentType-application-json-in-CXF-JAXRS-2-173-tp5786940p5786968.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>
> --
> Sergey Beryozkin
>
> Talend Community Coders
> http://coders.talend.com/
>


Re: Route elements - Loop

2016-08-30 Thread Brad Johnson
from("file://foo.txt").split().tokenize("\n").streaming().to(...)

I'll commonly send them to a SEDA queue for processing. Then you can
specify a thread pool on the SEDA queue and consume from it to insert into
the database.

Brad

On Tue, Aug 30, 2016 at 8:27 AM, raercules 
wrote:

> Thanks for the tip.  Unfortunately, the one area I was interested in "Data"
> is empty.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.
> com/Route-elements-Loop-tp5786975p5786992.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


Re: camel-cdi projects as fat jar

2016-08-30 Thread Brad Johnson
Interesting that is failing on not finding
javax.servlet.http.HttpServletRequest
as you aren't using in your route.

On Tue, Aug 30, 2016 at 3:29 AM, a746076drdrb  wrote:

> Used maven-shade-plugin version 1.7.1 and weld 2.2.15.Final. Now tried
> 2.3.5.Final with
>
> Exception in thread "main" org.jboss.weld.exceptions.DeploymentException:
> javax/servlet/http/HttpServletRequest
> at
> org.jboss.weld.executor.AbstractExecutorServices.checkForExceptions(
> AbstractExecutorServices.java:66)
> at
> org.jboss.weld.executor.AbstractExecutorServices.
> invokeAllAndCheckForExceptions(AbstractExecutorServices.java:43)
> at
> org.jboss.weld.executor.AbstractExecutorServices.
> invokeAllAndCheckForExceptions(AbstractExecutorServices.java:51)
> at
> org.jboss.weld.bootstrap.ConcurrentBeanDeployer.createClassBeans(
> ConcurrentBeanDeployer.java:75)
> at
> org.jboss.weld.bootstrap.BeanDeployment.createBeans(
> BeanDeployment.java:256)
> at
> org.jboss.weld.bootstrap.WeldStartup.deployBeans(WeldStartup.java:396)
> at
> org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:83)
> at org.jboss.weld.environment.se.Weld.initialize(Weld.java:589)
> at
> org.apache.deltaspike.cdise.weld.WeldContainerControl.
> boot(WeldContainerControl.java:68)
> at org.apache.camel.cdi.Main.doStart(Main.java:95)
> at
> org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
> at org.apache.camel.main.MainSupport.run(MainSupport.java:138)
> at org.apache.camel.main.MainSupport.run(MainSupport.java:390)
> at org.apache.camel.cdi.Main.main(Main.java:57)
> Caused by: java.lang.NoClassDefFoundError:
> javax/servlet/http/HttpServletRequest
> at java.lang.Class.getDeclaredMethods0(Native Method)
> at java.lang.Class.privateGetDeclaredMethods(Class.java:2688)
> at java.lang.Class.getDeclaredMethods(Class.java:1962)
> at java.lang.Class.getEnclosingMethod(Class.java:1032)
> at
> org.jboss.weld.util.reflection.Reflections.isStaticNestedClass(
> Reflections.java:402)
> at
> org.jboss.weld.util.reflection.Reflections.isTopLevelOrStaticNestedClass(
> Reflections.java:422)
> at
> org.jboss.weld.util.Beans.isTypeManagedBeanOrDecoratorOr
> Interceptor(Beans.java:507)
> at
> org.jboss.weld.bootstrap.BeanDeployer.createClassBean(
> BeanDeployer.java:214)
> at
> org.jboss.weld.bootstrap.ConcurrentBeanDeployer$2.
> doWork(ConcurrentBeanDeployer.java:78)
> at
> org.jboss.weld.bootstrap.ConcurrentBeanDeployer$2.
> doWork(ConcurrentBeanDeployer.java:75)
> at
> org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(
> IterativeWorkerTaskFactory.java:63)
> at
> org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(
> IterativeWorkerTaskFactory.java:56)
> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> 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)
> Caused by: java.lang.ClassNotFoundException:
> javax.servlet.http.HttpServletRequest
> at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.
> com/camel-cdi-projects-as-fat-jar-tp5786762p5786981.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


Re: sql vs jdbc component after Camel 2.16

2016-08-30 Thread Rajith Muditha Attapattu
Thanks Matt, in some environments thats a significant advantage.

On Tue, Aug 30, 2016 at 10:08 AM, Matt Sicker  wrote:
> The jdbc component doesn't require Spring as a dependency. That's the main
> advantage it has that I know of.
>
> On 30 August 2016 at 08:15, Rajith Muditha Attapattu 
> wrote:
>
>> The difference between the two is that with jdbc the query is in the
>> message body vs the as an endpoint property in sql.
>>
>> But it seems from Camel 2.16 onwards, the sql component can do the same.
>> From the looks of it, both could do what I want.
>>
>> I'm just trying to figure out the best component to use.
>>
>> What other differences are there btw the components?
>> I know sql component uses spring jdbc templates. Wondering if sql
>> component has an advantage over jdbc here.
>>
>> Your feedback is greatly appreciated.
>>
>> Regards,
>>
>> Rajith Muditha Attapattu
>>
>
>
>
> --
> Matt Sicker 



-- 
Regards,

Rajith Muditha Attapattu


Re: Exception when suspending splitter

2016-08-30 Thread saw
Ranx thank you for your suggestions but what i was looking for was some
insight into the original problem, not a workaround.

I would really just like to know if the splitter supports suspend/resume and
if i'm doing something wrong in the route configuration that are causing the
exceptions.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Exception-when-suspending-splitter-tp5786964p5787007.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Camel BeanIODataFormat Configure ErrorHandler for BeanIO Reader

2016-08-30 Thread spurcell
I am working on a camel project in which we use the BeanIODataFormat to
unmarshall a CSV file. I want to add a custom Error Handler class
(implements BeanReaderErrorHandler) but cannot figure out how this can be
accomplished.

I have a camel route:
 from(INBOUND_PROCESSING_ROUTE)
.routeId("inBoundProcessingRoute")
.process(getProcessor(CREATE_FILE_FROM_DATABASE))
.unmarshal(getCsvUnmarshaller())
.to(FILE_SPLITTER);
which calls:
 private DataFormat getCsvUnmarshaller() {
//return new
BeanIODataFormat("beanio-request.xml?beanReaderErrorhandler=ErrorHandler.class",
"transferRequests");
return new BeanIODataFormat("beanio-request.xml",
"transferRequests");
}


The BeanIO Docs say you can add a custom ErrorHandler to the reader, but I
cannot find any examples or help on this. Has anyone done this? I tried
adding to the beanio.xml file, but no support there.

If you need to handle an exception and continue processing, it may be
simpler to register a BeanReaderErrorHandler using the
beanReader.setErrorHandler() method. The BeanReaderErrorHandler interface is
shown below. Any exception thrown by the error handler will be rethrown by
the BeanReader.

Thanks



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-BeanIODataFormat-Configure-ErrorHandler-for-BeanIO-Reader-tp5787005.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Problem with objects not being released from memory.

2016-08-30 Thread litian
Hi All,

I have a problem with a program where it appears that objects are never
released from memory. We are using Apache Camel and the HL7 component to
read in HL7 messages. Everything is working, however after a few thousand
messages, the program slows down and eventually stops working. We use
JProfiler to determine where the issue may be coming from. We noticed that
there are Object[], ArrayList, and other HL7 objects that are never cleaned
by the GC and they just kept on growing. When the message gets unmarshaled
it creates all of the objects like arrays, etc.

Currently we are using Camel 2.15.0 with Hapi 2.2.

The code we have for the message processing:

HL7DataFormat hl7 = new HL7DataFormat();

HapiContext hapiContext = new DefaultHapiContext();
hapiContext.getParserConfiguration().setValidating(false);
hl7.setHapiContext(hapiContext);

from("mina2:tcp://" + server + ":" + port +
"?sync=true&codec=#hl7codec")
.unmarshal(hl7)
.onException(Exception.class)
.handled(true)
.transform(ack())
.end()
.validate(messageConforms())
.choice()
   
.when(header("CamelHL7TriggerEvent").isEqualTo("A01")).to("mock:a01").beanRef("adtMessageHandler",
"handleAdmit").to("mock:a19").transform(ack())
   
.when(header("CamelHL7TriggerEvent").isEqualTo("A02")).to("mock:a02").beanRef("adtMessageHandler",
"handleTransfer").to("mock:a19").transform(ack()) 
   
.when(header("CamelHL7TriggerEvent").isEqualTo("A03")).to("mock:a03").beanRef("adtMessageHandler",
"handleDischarge").to("mock:a19").transform(ack())

...

.end()
.marshal(hl7);

We tried many things like onCompletion() and process() but the objects
continue to stay in memory. Any suggestions would be greatly appreciated.
Thank you in advance. 



--
View this message in context: 
http://camel.465427.n5.nabble.com/Problem-with-objects-not-being-released-from-memory-tp5787010.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Exception when suspending splitter

2016-08-30 Thread Brad Johnson
I suspect it's the streaming that's creating the problem but I can't be
sure without testing.  If you test it by removing the streaming does the
route suspend/stop successfully?

The reason I suggested using the ThrottlingRoutePolicy is you should be
able to set that maxInflightExchanges to 0 when you want.  But I certainly
understand if you don't want to try that.

On Tue, Aug 30, 2016 at 12:44 PM, saw  wrote:

> Ranx thank you for your suggestions but what i was looking for was some
> insight into the original problem, not a workaround.
>
> I would really just like to know if the splitter supports suspend/resume
> and
> if i'm doing something wrong in the route configuration that are causing
> the
> exceptions.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.
> com/Exception-when-suspending-splitter-tp5786964p5787007.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


Re: Camel BeanIODataFormat Configure ErrorHandler for BeanIO Reader

2016-08-30 Thread Ranx
Why are you trying to handle the error?  There are a couple of settings with
BeanIO that permit you to ignore exceptions or to skip unknown record types. 
That may not be what you want though if you are sending the bad things to a
DLQ.

Brad



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-BeanIODataFormat-Configure-ErrorHandler-for-BeanIO-Reader-tp5787005p5787012.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel BeanIODataFormat Configure ErrorHandler for BeanIO Reader

2016-08-30 Thread Brad Johnson
Then the ignoreUnidentifiedRecords  probably wouldn't work for you. There's
another one like it but I don't recall it right now.  I'm more used to
doing this in Blueprint so it takes me awhile to make the change from one
to the other. What stack trace are you seeing with this?

Brad

On Tue, Aug 30, 2016 at 12:29 PM, spurcell 
wrote:

> I am working on a camel project in which we use the BeanIODataFormat to
> unmarshall a CSV file. I want to add a custom Error Handler class
> (implements BeanReaderErrorHandler) but cannot figure out how this can be
> accomplished.
>
> I have a camel route:
>  from(INBOUND_PROCESSING_ROUTE)
> .routeId("inBoundProcessingRoute")
> .process(getProcessor(CREATE_FILE_FROM_DATABASE))
> .unmarshal(getCsvUnmarshaller())
> .to(FILE_SPLITTER);
> which calls:
>  private DataFormat getCsvUnmarshaller() {
> //return new
> BeanIODataFormat("beanio-request.xml?beanReaderErrorhandler=
> ErrorHandler.class",
> "transferRequests");
> return new BeanIODataFormat("beanio-request.xml",
> "transferRequests");
> }
>
>
> The BeanIO Docs say you can add a custom ErrorHandler to the reader, but I
> cannot find any examples or help on this. Has anyone done this? I tried
> adding to the beanio.xml file, but no support there.
>
> If you need to handle an exception and continue processing, it may be
> simpler to register a BeanReaderErrorHandler using the
> beanReader.setErrorHandler() method. The BeanReaderErrorHandler interface
> is
> shown below. Any exception thrown by the error handler will be rethrown by
> the BeanReader.
>
> Thanks
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.
> com/Camel-BeanIODataFormat-Configure-ErrorHandler-for-
> BeanIO-Reader-tp5787005.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


First time create SFTP File and then Append to same in loop.

2016-08-30 Thread Goyal, Arpit
Hi Colleagues,

We have the following route:

from("xxx:inbound").process(new 
MyProcessor()).choice(when(header("record_count").isGreaterThan(0)).to("sftp://xyx[?options]";).to("xxx:inbound").otherwise(new
 MyEndProcessor())

It is a simple loop condition using choice where one branch process data and 
send to SFTP server and then loop back where else other branch would end the 
process.

Question: In FIRST SFTP write we want the FILE to be created. When second call 
comes, then we want APPEND to happen. How can we achieve this? Was searching 
for some header where I can toggle the value of 'fileExists'.

Can I change end point configuration using some custom bean? Please help.

Regards,
Arpit.


Re: ERROR No message body reader has been found for class, ContentType: application/json' in CXF JAXRS - 2.17.3

2016-08-30 Thread imranrazakhan

@sergery/ranx,

addition of jettision didn't resolve problem.


@cacert,

Thanks, Your suggestion worked perfectly. 




--
View this message in context: 
http://camel.465427.n5.nabble.com/ERROR-No-message-body-reader-has-been-found-for-class-ContentType-application-json-in-CXF-JAXRS-2-173-tp5786940p5787019.html
Sent from the Camel - Users mailing list archive at Nabble.com.


when to call start() and stop() on ProducerTemplate?

2016-08-30 Thread atluris
Hi,

Based on below article, we are creating single producer template instance
and using it as and when needed to execute the camel route explicitly.

http://camel.apache.org/why-does-camel-use-too-many-threads-with-producertemplate.html

We are calling start() during server startup and stop() during shutdown. Is
that fine, or do we need to call start() and stop() during each message
invocation?

Thanks & Regards,
Srinivas Atluri.



--
View this message in context: 
http://camel.465427.n5.nabble.com/when-to-call-start-and-stop-on-ProducerTemplate-tp5787020.html
Sent from the Camel - Users mailing list archive at Nabble.com.