我将Apache Camle version 2.14.0与Apache Jackrabbit 2.8.0一起使用,当节点包含multi-valued property时,发现了一些与JCR_GET_BY_ID有关的问题,如下所示:
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
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]我还有机会对camel-jcr源代码org.apache.camel.component.jcr.JcrProducer进行调查,发现它使用了以下内容:-
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);
}如果我错了,请纠正我。因为代码使用了Value.class和property.getValue(),这是用于non-multi-valued的。这是否意味着camel-jcr不提供对multi-valued的支持
我们有什么办法支持多重价值吗?目前,我考虑用我自己的临时修复来代替JcrProducer。无论如何,我认为这可能不是一种恰当的方式,我希望你能提供进一步的建议。
发布于 2014-09-28 17:35:22
我在骆驼用户组上发了帖子,发现这是当前camel-jcr:2.14.0的一个限制。我已经确定为拉请求了。
我希望这会对其他面对同样问题的人有所帮助。
https://stackoverflow.com/questions/26051930
复制相似问题