You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Charlee Chitsuk <ch...@gmail.com> on 2014/09/26 05:51:19 UTC

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

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

Posted by Charlee Chitsuk <ch...@gmail.com>.
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 <ch...@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]
>
>

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

Posted by Charlee Chitsuk <ch...@gmail.com>.
   Hi,

   I've created the pull request to the [1] as [2].

   Best Regards,

   Charlee Ch

[1] https://github.com/apache/camel/tree/camel-2.14.x

[2] https://github.com/apache/camel/pull/287

--


2014-09-28 19:50 GMT+07:00 Claus Ibsen <cl...@gmail.com>:

> Hi
>
> The @user mailing list is the best place.
>
> On Sun, Sep 28, 2014 at 2:32 PM, Charlee Chitsuk <ch...@gmail.com>
> wrote:
> >    Hi Claus,
> >
> >       Thank you very much for your reply. I've forked the Apache Camel
> from
> > GitHub and started to remove this limitation. Anyhow I would like your
> help
> > to advise further as if I found some trouble during the development, I'm
> > not sure if I should post the question here or at the developer list.
> >
> >    Best Regards,
> >
> >    Charlee Ch
> >
> > --
> >
> >
> > 2014-09-28 15:06 GMT+07:00 Claus Ibsen <cl...@gmail.com>:
> >
> >> Hi
> >>
> >> Yeah looks like you found a limitation. You are welcome to log a JIRA
> >> ticket to improved this.
> >> Also we love contributions, so you are welcome to implement the needed
> >> code, and provide a patch or PR
> >> http://camel.apache.org/contributing.html
> >>
> >> On Fri, Sep 26, 2014 at 5:51 AM, Charlee Chitsuk <ch...@gmail.com>
> >> wrote:
> >> > 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]
> >>
> >>
> >>
> >> --
> >> Claus Ibsen
> >> -----------------
> >> Red Hat, Inc.
> >> Email: cibsen@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/
> >>
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> Email: cibsen@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: [camel-jcr] The trouble about the JCR multi-valued property when using JCR_GET_BY_ID

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

The @user mailing list is the best place.

On Sun, Sep 28, 2014 at 2:32 PM, Charlee Chitsuk <ch...@gmail.com> wrote:
>    Hi Claus,
>
>       Thank you very much for your reply. I've forked the Apache Camel from
> GitHub and started to remove this limitation. Anyhow I would like your help
> to advise further as if I found some trouble during the development, I'm
> not sure if I should post the question here or at the developer list.
>
>    Best Regards,
>
>    Charlee Ch
>
> --
>
>
> 2014-09-28 15:06 GMT+07:00 Claus Ibsen <cl...@gmail.com>:
>
>> Hi
>>
>> Yeah looks like you found a limitation. You are welcome to log a JIRA
>> ticket to improved this.
>> Also we love contributions, so you are welcome to implement the needed
>> code, and provide a patch or PR
>> http://camel.apache.org/contributing.html
>>
>> On Fri, Sep 26, 2014 at 5:51 AM, Charlee Chitsuk <ch...@gmail.com>
>> wrote:
>> > 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]
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> Red Hat, Inc.
>> Email: cibsen@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/
>>



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@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: [camel-jcr] The trouble about the JCR multi-valued property when using JCR_GET_BY_ID

Posted by Charlee Chitsuk <ch...@gmail.com>.
   Hi Claus,

      Thank you very much for your reply. I've forked the Apache Camel from
GitHub and started to remove this limitation. Anyhow I would like your help
to advise further as if I found some trouble during the development, I'm
not sure if I should post the question here or at the developer list.

   Best Regards,

   Charlee Ch

--


2014-09-28 15:06 GMT+07:00 Claus Ibsen <cl...@gmail.com>:

> Hi
>
> Yeah looks like you found a limitation. You are welcome to log a JIRA
> ticket to improved this.
> Also we love contributions, so you are welcome to implement the needed
> code, and provide a patch or PR
> http://camel.apache.org/contributing.html
>
> On Fri, Sep 26, 2014 at 5:51 AM, Charlee Chitsuk <ch...@gmail.com>
> wrote:
> > 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]
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> Email: cibsen@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: [camel-jcr] The trouble about the JCR multi-valued property when using JCR_GET_BY_ID

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Yeah looks like you found a limitation. You are welcome to log a JIRA
ticket to improved this.
Also we love contributions, so you are welcome to implement the needed
code, and provide a patch or PR
http://camel.apache.org/contributing.html

On Fri, Sep 26, 2014 at 5:51 AM, Charlee Chitsuk <ch...@gmail.com> wrote:
> 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]



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@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/