Re: Can't grok event driven consumer

2014-09-25 Thread Claus Ibsen
Hi

See how the direct producer is implemented if you want a behavior like that.

On Wed, Sep 24, 2014 at 11:16 PM, Tim Dudgeon tdudgeon...@gmail.com wrote:
 I'm wanting to create a Component that acts as a simple from: endpoint, just
 like, for instance, direct: does.
 I want to be able to send an Exchange to it, handle it in some way, and send
 the outcomes (plural) to the downstream processor.
 Most of it makes sense, but I just can't work out how to receive the
 incoming Exchange using DefaultConsumer. I see stuff on polling, but not how
 to handle the simple case of just receiving an event and handling it.
 DefaultConsumer [1] seems to give me nothing to override.

 Something like:

 from(mycoolcomponent:test?param=foo)
 .log(processing ${body});

 // then later

 ProducerTemplate t = camelContext.createProducerTemplate();
 t.sendBody(mycoolcomponent:test, Hello World!);




 [1] http://camel.apache.org/maven/current/camel-core/apidocs/index.html




-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/


CamelSpringDelegatingTestContextLoaderTest test run problem

2014-09-25 Thread 0l3gK
Hi,I'm trying to run the test example
*CamelSpringDelegatingTestContextLoaderTest* provided with
camel-*spring-javaconfig 2.15-snapshot* on *jdk1.8.0_11*   and keep getting
this exception : java.lang.NoSuchMethodError:
org.apache.camel.test.spring.CamelSpringJUnit4ClassRunner$CamelTestContextManager.registerTestExecutionListeners(Ljava/util/List;)V
at
org.apache.camel.test.spring.CamelSpringJUnit4ClassRunner$CamelTestContextManager.(CamelSpringJUnit4ClassRunner.java:65)
at
org.apache.camel.test.spring.CamelSpringJUnit4ClassRunner.createTestContextManager(CamelSpringJUnit4ClassRunner.java:47)
at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.(SpringJUnit4ClassRunner.java:107)
at
org.apache.camel.test.spring.CamelSpringJUnit4ClassRunner.(CamelSpringJUnit4ClassRunner.java:36)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:408)  at
org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:29)
at
org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:21)
at
org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at
org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
at
org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:26)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67)



--
View this message in context: 
http://camel.465427.n5.nabble.com/CamelSpringDelegatingTestContextLoaderTest-test-run-problem-tp5757002.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel-XmlJson dataformat and ASLV2

2014-09-25 Thread Christian Müller
Hi Charlie!

It's not complaint with the Apache rules [1]. We will fix this asap.

[1] http://www.apache.org/legal/3party.html#category-x

Best,
Christian
-

Software Integration Specialist

Apache Member
V.P. Apache Camel | Apache Camel PMC Member | Apache Camel committer
Apache Incubator PMC Member

https://www.linkedin.com/pub/christian-mueller/11/551/642

On Wed, Sep 24, 2014 at 9:28 AM, Charlie Mordant cmorda...@gmail.com
wrote:

 So, I misunderstood that page on the Apache2 license:
 http://www.apache.org/legal/resolved.html

 Can it be updated to reflect that we can use some third party licensed code
 as dependencies (only) in our ASLV2 projects without breaking the rules?
 Should I fill a Jira in the Legal commity space?

 Best too!
 Charlie

 2014-09-23 22:22 GMT+02:00 Christian Müller christian.muel...@gmail.com:

  Thanks for reporting Charlie!
  This is not indeed not complaint with the Apache rules. We will fix this
  soon.
 
  Best,
  Christian
  -
 
  Software Integration Specialist
 
  Apache Member
  V.P. Apache Camel | Apache Camel PMC Member | Apache Camel committer
  Apache Incubator PMC Member
 
  https://www.linkedin.com/pub/christian-mueller/11/551/642
 
  On Tue, Sep 23, 2014 at 9:03 PM, Charlie Mordant cmorda...@gmail.com
  wrote:
 
   Hi Camel riders!
  
   I just checked the licenses of a project I own.
   This project as a dependency to camel-xmljson dataformat, which itself
  has
   a dependency to XOM.
   The problem is that XOM as a LGPL License that is not compatible ASLv2.
  
   Any info on this? Any XOM ASL compliant alternative?
  
   Best regards,
  
   --
   Charlie Mordant
  
   Full OSGI/EE stack made with Karaf:
   https://github.com/OsgiliathEnterprise/net.osgiliath.parent
  
 



 --
 Charlie Mordant

 Full OSGI/EE stack made with Karaf:
 https://github.com/OsgiliathEnterprise/net.osgiliath.parent



Re: Re: Why does Bindy prohibit empty files?

2014-09-25 Thread a_blithe
Hi Charles,

I've created the requested ticket: 
https://issues.apache.org/jira/browse/CAMEL-7862
Thank you in advance.
I've implemented the onException() method already to log and handle other 
occurring exceptions in that route. Therefore I'd like to avoid the 
IllegalArgumentException if possible.

@Claus,

Thank you for your suggestions. I will test them.

-Ursprüngliche Nachricht-
Gesendet: Wednesday, 24 September 2014 um 19:18:06 Uhr
Von: Charles Moulliard ch0...@gmail.com
An: users@camel.apache.org
Betreff: Re: Why does Bindy prohibit empty files?
Hi,

We could certainly improve Bindy and implements what you suggest. Could you
please raise a ticket concerning your request ?

Until now, I suggest that you add a onException() to handle the exception
throws by Bindy when the data stream is empty

Regards,


On Wed, Sep 24, 2014 at 5:36 PM, a_bli...@web.de wrote:

 Prolog: Camel Bindy will throw an IllegalArgumentException if the current
 InputStream doesn't contain any data (see
 https://fisheye6.atlassian.com/browse/camel-git/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java?hb=true
 at line 174 and 200).

 I have the following scenario:
 An external program provides my program with csv files containing some
 data. My program grabs that data, fills in missing entries and writes
 everything to a storage. If the external program provides an empty file to
 signalize no new data, my program should still fill the missing data,
 because now every expected entry is missing.
 Currently I bypassed the exception of the unmarshal process with a choice
 and an expression to check the file length which is kind of unpleasant.
 .choice().when(simple(${body.length} == 0))
   .setBody(constant(ImmutableList.of()))
 .otherwise()
   .unmarshal(format)
   

 I know it is a good idea to check if any data is available at that stream,
 but why should that method throw an Exception instead of return an empty
 collection? The calling method could handle that if it wants to. Or if it
 is mandatory that the Exception gets thrown in the unmarshal method, then
 an additional annotation would be great to explicitly allow empty files to
 be parsed (and get an empty collection in return). Something like
 @CsvRecord(allowEmptyFiles = true).

 Thanks in advance for any feedback.




-- 
Charles Moulliard
Apache Committer / Architect @RedHat
Twitter : @cmoulliard | Blog :  http://cmoulliard.github.io


AW: timer to Route - nothing happen

2014-09-25 Thread Stiefel, Daniel
Thanks,
that helped.


Confusing cxf log messages after upgrading to 2.14.0

2014-09-25 Thread Preben.Asmussen
After upgrade the CXF producer info logs like
CxfProducerINFO  CxfProducer cannot find the
operationName from message header, try to use the defaultOperationName

This is due to change in in https://issues.apache.org/jira/browse/CAMEL-7503 
https://fisheye6.atlassian.com/changelog/camel-git?cs=75dfe61edc1d6f9e2837056189dea5f7e20f1090

The defaultOperationName is actually set on my endpoint like
cxf:bean:mybean?synchronous=trueamp;DefaultOperationName=MyDefaultOperationName

The Info log statement i kind of misleading you to think something is
broken.
IMHO the log statment should be debug or trace at best, or even better see
only log if the defaultOperationName is not present as a header or set as a
endpoint DefaultOperationName option.


Best,
Preben



--
View this message in context: 
http://camel.465427.n5.nabble.com/Confusing-cxf-log-messages-after-upgrading-to-2-14-0-tp5757014.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Confusing cxf log messages after upgrading to 2.14.0

2014-09-25 Thread Claus Ibsen
Hi

Yeah INFO logging per message is a bad idea. Feel free to log a JIRA
so we can tone it down. And also if you get that option set, then
there is a bug in that code check.

Maybe there is a case sensitive issue with DefaultXXX vs defaultXXX


On Thu, Sep 25, 2014 at 2:56 PM, Preben.Asmussen p...@dr.dk wrote:
 After upgrade the CXF producer info logs like
 CxfProducerINFO  CxfProducer cannot find the
 operationName from message header, try to use the defaultOperationName

 This is due to change in in https://issues.apache.org/jira/browse/CAMEL-7503
 https://fisheye6.atlassian.com/changelog/camel-git?cs=75dfe61edc1d6f9e2837056189dea5f7e20f1090

 The defaultOperationName is actually set on my endpoint like
 cxf:bean:mybean?synchronous=trueamp;DefaultOperationName=MyDefaultOperationName

 The Info log statement i kind of misleading you to think something is
 broken.
 IMHO the log statment should be debug or trace at best, or even better see
 only log if the defaultOperationName is not present as a header or set as a
 endpoint DefaultOperationName option.


 Best,
 Preben



 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Confusing-cxf-log-messages-after-upgrading-to-2-14-0-tp5757014.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/


Re: Confusing cxf log messages after upgrading to 2.14.0

2014-09-25 Thread Raul Kripalani
Yep, perhaps try setting it as a cxf:property / in your bean...

*Raúl Kripalani*
Apache Camel PMC Member  Committer | Enterprise Architect, Open Source
Integration specialist
http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
http://blog.raulkr.net | twitter: @raulvk

On Thu, Sep 25, 2014 at 3:12 PM, Claus Ibsen claus.ib...@gmail.com wrote:

 Hi

 Yeah INFO logging per message is a bad idea. Feel free to log a JIRA
 so we can tone it down. And also if you get that option set, then
 there is a bug in that code check.

 Maybe there is a case sensitive issue with DefaultXXX vs defaultXXX


 On Thu, Sep 25, 2014 at 2:56 PM, Preben.Asmussen p...@dr.dk wrote:
  After upgrade the CXF producer info logs like
  CxfProducerINFO  CxfProducer cannot find the
  operationName from message header, try to use the defaultOperationName
 
  This is due to change in in
 https://issues.apache.org/jira/browse/CAMEL-7503
 
 https://fisheye6.atlassian.com/changelog/camel-git?cs=75dfe61edc1d6f9e2837056189dea5f7e20f1090
 
  The defaultOperationName is actually set on my endpoint like
 
 cxf:bean:mybean?synchronous=trueamp;DefaultOperationName=MyDefaultOperationName
 
  The Info log statement i kind of misleading you to think something is
  broken.
  IMHO the log statment should be debug or trace at best, or even better
 see
  only log if the defaultOperationName is not present as a header or set
 as a
  endpoint DefaultOperationName option.
 
 
  Best,
  Preben
 
 
 
  --
  View this message in context:
 http://camel.465427.n5.nabble.com/Confusing-cxf-log-messages-after-upgrading-to-2-14-0-tp5757014.html
  Sent from the Camel - Users mailing list archive at Nabble.com.



 --
 Claus Ibsen
 -
 Red Hat, Inc.
 Email: cib...@redhat.com
 Twitter: davsclaus
 Blog: http://davsclaus.com
 Author of Camel in Action: http://www.manning.com/ibsen
 hawtio: http://hawt.io/
 fabric8: http://fabric8.io/



Re: Confusing cxf log messages after upgrading to 2.14.0

2014-09-25 Thread Preben.Asmussen
Hi

created https://issues.apache.org/jira/browse/CAMEL-7863

I actually still works as expected when setting the DefaultOperationName as
an endpoint option, so there is no new bug.

But to avoid the info logging pr. message you currently have to set a header
'operationName' too.

Best,
Preben



--
View this message in context: 
http://camel.465427.n5.nabble.com/Confusing-cxf-log-messages-after-upgrading-to-2-14-0-tp5757014p5757017.html
Sent from the Camel - Users mailing list archive at Nabble.com.


FIS Connectivity usingApache Camel

2014-09-25 Thread Ravi Gupta 7
How we can connect with FIS system using apache camel. FIS system understand 
the request on cobol format?

Thanks  Regards
Ravi Gupta



Re: Corrupt pdf from classpath

2014-09-25 Thread scottdawson
Hello,
I wrote a component based on the code shown here: 
http://code.notsoclever.cc/writing-camel-component-camel-static-resource/
http://code.notsoclever.cc/writing-camel-component-camel-static-resource/  
to deliver static files, mostly PNG files in my case but I see no reason why
it won't work for PDFs.

The first code sample in the article gives everything needed to deliver
static files and it detects the type of the file to set the HTTP
Content-Type header correctly.

Regards,
Scott



--
View this message in context: 
http://camel.465427.n5.nabble.com/Corrupt-pdf-from-classpath-tp5756921p5757022.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Camel's Swagger vs. Spring MVC Swagger

2014-09-25 Thread Matt Raible
Hey all,

I'm starting to develop a new application and I'm researching using Camel's 
REST DSL vs. Spring Boot and it's REST support. The last application I wrote 
used Apache Camel + Spring Boot, but I only used the external properties 
support from Boot. For this new application, I have a skeleton of the previous 
project. The new project needs to do REST (XML-based). Looking at a HelloWorld 
example in Spring MVC vs. Camel, I'm leaning towards using Spring MVC.

Camel

@Component
public class HelloWorldRoute extends RouteBuilder {
@Override
public void configure() throws Exception {
// servlet is configured in Application.java

restConfiguration().component(servlet).bindingMode(RestBindingMode.json);

rest(/say)
.get(/hello)
.to(direct:talk);
from(direct:talk)
.process(exchange - {
HelloWorld hw = 
HelloWorld.builder().message(Howdy World!).build();
exchange.getIn().setBody(hw);
});
}
}


Spring MVC

@RestController
@Api(Hello)
public class HelloWorldController {

@RequestMapping(value = /api/hello, method = RequestMethod.GET)
public HelloWorld sayHello() {
return HelloWorld.builder().message(Hello World).build();
}
}


I was able to get Swagger working for both services, albeit with different 
endpoints. One issue I found is that the base.path has to be configured or 
calling the methods by clicking on buttons in Swagger UI doesn't work. With 
Spring Boot, I'm able to configure Swagger with the following:

@Configuration
@EnableSwagger
public class SwaggerConfig implements EnvironmentAware {
public static final String DEFAULT_INCLUDE_PATTERN = /api/.*;

private RelaxedPropertyResolver propertyResolver;

@Override
public void setEnvironment(Environment environment) {
this.propertyResolver = new 
RelaxedPropertyResolver(environment, swagger.);
}

/**
 * Swagger Spring MVC configuration
 */
@Bean
public SwaggerSpringMvcPlugin 
swaggerSpringMvcPlugin(SpringSwaggerConfig springSwaggerConfig) {
return new SwaggerSpringMvcPlugin(springSwaggerConfig)
.apiInfo(apiInfo())
.genericModelSubstitutes(ResponseEntity.class)
.includePatterns(DEFAULT_INCLUDE_PATTERN);
}

/**
 * API Info as it appears on the swagger-ui page
 */
private ApiInfo apiInfo() {
return new ApiInfo(
propertyResolver.getProperty(title),
propertyResolver.getProperty(description),

propertyResolver.getProperty(termsOfServiceUrl),
propertyResolver.getProperty(contact),
propertyResolver.getProperty(license),
propertyResolver.getProperty(licenseUrl));
}
}

With Camel, it's a bit less code, but if I don't override the base.path, it 
defaults to localhost:8080. The Spring MVC Swagger implementation figures out 
the correct base path on its own.

/**
 * Swagger Camel Configuration
 */
@Bean
public ServletRegistrationBean swaggerServlet() {
ServletRegistrationBean swagger = new 
ServletRegistrationBean(new SpringRestSwaggerApiDeclarationServlet(), 
/swagger/*);
MapString, String params = new HashMap();
params.put(base.path, https://localhost:8443/rest;);
params.put(api.title, propertyResolver.getProperty(title));
params.put(api.description, 
propertyResolver.getProperty(description));
params.put(api.termsOfServiceUrl, 
propertyResolver.getProperty(termsOfServiceUrl));
params.put(api.version, 
propertyResolver.getProperty(version));
params.put(api.license, 
propertyResolver.getProperty(license));
params.put(api.licenseUrl, 
propertyResolver.getProperty(licenseUrl));
swagger.setInitParameters(params);
return swagger;
}

Is it possible to improve the SpringRestSwaggerApiDeclarationServlet so it gets 
the path from CamelServlet and it doesn't have to be hardcoded?

Thanks,

Matt

Re: JMS - asyncConsumer threads

2014-09-25 Thread Andrew Thorburn
I'd be happy to update the docs, though I've haven't signed the agreement
yet. Can I take it that I understand what's going on correctly, regarding
the asyncConsumer option?

Thanks,

- Andrew

On Thu, Sep 25, 2014 at 7:35 PM, Claus Ibsen claus.ib...@gmail.com wrote:

 Hi

 You are welcome to improve the docs, eg add some details about this to
 the asyncConsumer option.
 http://camel.apache.org/jms

 Though maybe its best placed be on the async routing engine page, as
 it applies to how it works and under which circumstances.
 http://camel.apache.org/asynchronous-routing-engine.html

 And then you can refer to this page from the jms page, for more details.

 And lets keep the option name as is, as this is the naming convention
 used by Camel and in the source code as well.

 We love contributions
 http://camel.apache.org/contributing.html

 And here is how to help edit the docs
 http://camel.apache.org/how-do-i-edit-the-website.html

 On Thu, Sep 25, 2014 at 4:07 AM, Andrew Thorburn nzi...@gmail.com wrote:
  Hey guys,
 
  Just want to clarify that I understand how this works correctly:
 
  Setting the asyncConsumer option to true on a JMS Consumer does not,
 in
  and of itself, mean that messages are guaranteed to be processed
  asynchronously, but it does mean that if an endpoint supports
 asynchronous
  behaviour, the Camel JMS consumer will allow that.
 
  In other words, if you set asyncConsumer to true, but none of your
  endpoints in your pipeline allow asynchronous processing, it will all get
  processed synchronously anyway.
 
  In that case, you would need to wrap everything you wanted processed
  asynchronously in a threads tag (or a threads() call), which would
 allow
  you to control the number of threads, the queue size, etc.
 
  Conversely, even if you provide a threads wrapper, if asyncConsumer is
  set to false, it will get processed synchronously.
 
  Is that correct? It appears to be, based on what I can see in the source
  code (looking at Threads, JMS Configuration, JMS Consumer,
  EndpointMessageListener, etc).
 
  If that's correct, wouldn't it make sense to rename the option
  asyncConsumer to asyncAllowed (or maybe asyncConsumerAllowed)?
  asyncConsumer implies, at least to me, that the consumer will somehow
  magically run everything asynchronously without the need for further
  configuration, when that does not appear to be true. asyncAllowed is
 closer
  to what actually happens - in that setting the option does not magically
  make everything asynchronous, but if you *want* to make it asynchronous
  yourself, you can.
 
  Also, this implies that the example at the bottom of
  http://camel.apache.org/async.html is, if not wrong, then at least
 missing
  information, as it does not show that the JMS consumer has had the
  asyncConsumer option set on it anywhere.
 
  FWIW, as I'm integrating with WebSphere MQ, and the queue I'm consuming
  from is set to EXCLUSIVE_OPEN (or something along those lines), I don't
  believe that I can make any use of the
  concurrentConsumers/maxConcurrentConsumers options on the JMS endpoint.
 
  Thanks,
 
  - Andrew Thorburn



 --
 Claus Ibsen
 -
 Red Hat, Inc.
 Email: cib...@redhat.com
 Twitter: davsclaus
 Blog: http://davsclaus.com
 Author of Camel in Action: http://www.manning.com/ibsen
 hawtio: http://hawt.io/
 fabric8: http://fabric8.io/



Re: Confusing cxf log messages after upgrading to 2.14.0

2014-09-25 Thread Willem Jiang
The info log is try to tell the user that the CxfProducer is looking up the 
operation name.
I’m OK to change the log level to DEBUG, I will update the Java doc and Wiki 
page for operation name look up processing.


--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On September 26, 2014 at 12:06:21 AM, Preben.Asmussen (p...@dr.dk) wrote:
 Hi
  
 created https://issues.apache.org/jira/browse/CAMEL-7863
  
 I actually still works as expected when setting the DefaultOperationName as
 an endpoint option, so there is no new bug.
  
 But to avoid the info logging pr. message you currently have to set a header
 'operationName' too.
  
 Best,
 Preben
  
  
  
 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Confusing-cxf-log-messages-after-upgrading-to-2-14-0-tp5757014p5757017.html
   
 Sent from the Camel - Users mailing list archive at Nabble.com.
  



[camel-jcr] The trouble about the JCR multi-valued property when using JCR_GET_BY_ID

2014-09-25 Thread Charlee Chitsuk
Hi,

  I'm using the Apache Camle version 2.14.0 and have found some trouble
about the camel-jcr with JCR_GET_BY_ID when the node contains multi-valued
property as [1].

  I also have a chance to investigate to the camel-jcr source code, the
org.apache.camel.component.jcr.JcrProducer, and found that it use the
following:-

if (JcrConstants.JCR_INSERT.equals(operation)) {
...
for (String key : headers.keySet()) {
Value value = converter.convertTo(Value.class,
exchange, message.getHeader(key));
...
}
...
} else if (JcrConstants.JCR_GET_BY_ID.equals(operation)) {
...
while (properties.hasNext()) {
Property property = properties.nextProperty();
Class? aClass = classForJCRType(property);
Object value = converter.convertTo(aClass, exchange,
property.getValue());
...
}
} else {
throw new RuntimeException(Unsupported operation:  +
operation);
}

  Please correct me if I'm wrong. Since the code uses the Value.class
and property.getValue() which is for the non-multi-valued. Does it mean
that the camel-jcr does not provide the support to the muli-valued?

  Do we have any workaround for supporting the multi-valued? At the
moment I consider to replace the JcrProducer with my own interim fixing.
Anyhow I thought that it may not be a proper way and would like your help
to advise further?

  Thank you very much for your help in advance. I'm looking forward to
hearing from you soon.

Best Regards,

Charlee Ch.



[1] The stack trace

2014-09-26 10:19:21.604 [Client Event Poller] [] ERROR
o.a.c.processor.DefaultErrorHandler   - 215 log Failed delivery for
(MessageId: ID-CharleeCh-53350-1411701537295-3-1 on ExchangeId:
ID-CharleeCh-53350-1411701537295-3-12). Exhausted after delivery attempt: 1
caught: javax.jcr.ValueFormatException: property
/my-parent3/my-child31/myMuliple is a multi-valued property, so it's values
can only be retrieved as an array

Message History
// some message history

Stacktrace
---
javax.jcr.ValueFormatException: property /my-parent3/my-child31/myMuliple
is a multi-valued property, so it's values can only be retrieved as an array
at
org.apache.jackrabbit.rmi.server.ServerObject.getRepositoryException(ServerObject.java:139)
~[jackrabbit-jcr-rmi-2.8.0.jar:na]
at
org.apache.jackrabbit.rmi.server.ServerProperty.getValue(ServerProperty.java:62)
~[jackrabbit-jcr-rmi-2.8.0.jar:na]
at sun.reflect.GeneratedMethodAccessor12.invoke(Unknown Source) ~[na:na]
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
~[na:1.7.0_65]
at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_65]
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
~[na:1.7.0_65]
at sun.rmi.transport.Transport$1.run(Transport.java:177) ~[na:1.7.0_65]
at sun.rmi.transport.Transport$1.run(Transport.java:174) ~[na:1.7.0_65]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.7.0_65]
at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
~[na:1.7.0_65]
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:556)
~[na:1.7.0_65]
at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:811)
~[na:1.7.0_65]
at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:670)
~[na:1.7.0_65]
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
~[na:1.7.0_65]
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
~[na:1.7.0_65]
at java.lang.Thread.run(Thread.java:745) ~[na:1.7.0_65]
at
sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:275)
~[na:1.7.0_65]
at
sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:252)
~[na:1.7.0_65]
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:161) ~[na:1.7.0_65]
at org.apache.jackrabbit.rmi.server.ServerProperty_Stub.getValue(Unknown
Source) ~[jackrabbit-jcr-rmi-2.8.0.jar:na]
at
org.apache.jackrabbit.rmi.client.ClientProperty.getValue(ClientProperty.java:164)
~[jackrabbit-jcr-rmi-2.8.0.jar:na]
at org.apache.camel.component.jcr.JcrProducer.process(JcrProducer.java:69)
~[camel-jcr-2.14.0.jar:2.14.0]


Re: [camel-jcr] The trouble about the JCR multi-valued property when using JCR_GET_BY_ID

2014-09-25 Thread Charlee Chitsuk
Hi,

Here is a StackOverflow question [1].

Best Regards,

Charlee Ch.

[1]
http://stackoverflow.com/questions/26051930/the-trouble-about-the-jcr-multi-valued-property-when-using-jcr-get-by-id

--

2014-09-26 10:51 GMT+07:00 Charlee Chitsuk charlee...@gmail.com:

 Hi,

   I'm using the Apache Camle version 2.14.0 and have found some
 trouble about the camel-jcr with JCR_GET_BY_ID when the node
 contains multi-valued property as [1].

   I also have a chance to investigate to the camel-jcr source code,
 the org.apache.camel.component.jcr.JcrProducer, and found that it use the
 following:-

 if (JcrConstants.JCR_INSERT.equals(operation)) {
 ...
 for (String key : headers.keySet()) {
 Value value = converter.convertTo(Value.class,
 exchange, message.getHeader(key));
 ...
 }
 ...
 } else if (JcrConstants.JCR_GET_BY_ID.equals(operation)) {
 ...
 while (properties.hasNext()) {
 Property property = properties.nextProperty();
 Class? aClass = classForJCRType(property);
 Object value = converter.convertTo(aClass, exchange,
 property.getValue());
 ...
 }
 } else {
 throw new RuntimeException(Unsupported operation:  +
 operation);
 }

   Please correct me if I'm wrong. Since the code uses the Value.class
 and property.getValue() which is for the non-multi-valued. Does it mean
 that the camel-jcr does not provide the support to the muli-valued?

   Do we have any workaround for supporting the multi-valued? At the
 moment I consider to replace the JcrProducer with my own interim fixing.
 Anyhow I thought that it may not be a proper way and would like your help
 to advise further?

   Thank you very much for your help in advance. I'm looking forward to
 hearing from you soon.

 Best Regards,

 Charlee Ch.



 [1] The stack trace

 2014-09-26 10:19:21.604 [Client Event Poller] [] ERROR
 o.a.c.processor.DefaultErrorHandler   - 215 log Failed delivery for
 (MessageId: ID-CharleeCh-53350-1411701537295-3-1 on ExchangeId:
 ID-CharleeCh-53350-1411701537295-3-12). Exhausted after delivery attempt: 1
 caught: javax.jcr.ValueFormatException: property
 /my-parent3/my-child31/myMuliple is a multi-valued property, so it's values
 can only be retrieved as an array

 Message History
 // some message history

 Stacktrace

 ---
 javax.jcr.ValueFormatException: property /my-parent3/my-child31/myMuliple
 is a multi-valued property, so it's values can only be retrieved as an array
 at
 org.apache.jackrabbit.rmi.server.ServerObject.getRepositoryException(ServerObject.java:139)
 ~[jackrabbit-jcr-rmi-2.8.0.jar:na]
 at
 org.apache.jackrabbit.rmi.server.ServerProperty.getValue(ServerProperty.java:62)
 ~[jackrabbit-jcr-rmi-2.8.0.jar:na]
 at sun.reflect.GeneratedMethodAccessor12.invoke(Unknown Source) ~[na:na]
 at
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 ~[na:1.7.0_65]
 at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_65]
 at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
 ~[na:1.7.0_65]
 at sun.rmi.transport.Transport$1.run(Transport.java:177) ~[na:1.7.0_65]
 at sun.rmi.transport.Transport$1.run(Transport.java:174) ~[na:1.7.0_65]
 at java.security.AccessController.doPrivileged(Native Method)
 ~[na:1.7.0_65]
 at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
 ~[na:1.7.0_65]
 at
 sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:556)
 ~[na:1.7.0_65]
 at
 sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:811)
 ~[na:1.7.0_65]
 at
 sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:670)
 ~[na:1.7.0_65]
 at
 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
 ~[na:1.7.0_65]
 at
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
 ~[na:1.7.0_65]
 at java.lang.Thread.run(Thread.java:745) ~[na:1.7.0_65]
 at
 sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:275)
 ~[na:1.7.0_65]
 at
 sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:252)
 ~[na:1.7.0_65]
 at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:161) ~[na:1.7.0_65]
 at org.apache.jackrabbit.rmi.server.ServerProperty_Stub.getValue(Unknown
 Source) ~[jackrabbit-jcr-rmi-2.8.0.jar:na]
 at
 org.apache.jackrabbit.rmi.client.ClientProperty.getValue(ClientProperty.java:164)
 ~[jackrabbit-jcr-rmi-2.8.0.jar:na]
 at org.apache.camel.component.jcr.JcrProducer.process(JcrProducer.java:69)
 ~[camel-jcr-2.14.0.jar:2.14.0]