I changed my code to use value factory:

        FileInputStream in = null;


                    try {
                        in = new FileInputStream(fileName);

                        binary = 
session.getValueFactory().createBinary(in);

                        node.setProperty("jcr:data", binary);
 



From:   bokie <[email protected]>
To:     [email protected]
Date:   10/04/2011 05:02 AM
Subject:        prop.setProperty("jcr:data", Bianary)



Hi,

I am currently playing around with Jackrabbit 2.2.5 and my test is 
throwing
the exception shown below when calling: 
  node.setProperty("jcr:data", new BinaryValue(new
FileInputStream(file)).getBinary());
but is working fine when calling:
  node.setProperty("jcr:data", new BinaryValue(new
FileInputStream(file)).getStream());

NOTE:
Node.setProperty(String, InputStream) is marked as deprecated.

############### Exception start #####################
org.apache.jackrabbit.rmi.client.RemoteRepositoryException:
java.rmi.MarshalException: error marshalling arguments; nested exception 
is: 
                 java.io.NotSerializableException: 
org.apache.jackrabbit.value.BinaryImpl
                 at
org.apache.jackrabbit.rmi.client.ClientNode.setProperty(ClientNode.java:134)
                 at
org.apache.jackrabbit.rmi.client.ClientNode.setProperty(ClientNode.java:236)
                 at jmdsc.jackrabbit.Main.addFileNode(Main.java:72)
                 at jmdsc.jackrabbit.Main.test1(Main.java:38)
                 at jmdsc.jackrabbit.Main.main(Main.java:21)
Caused by: java.rmi.MarshalException: error marshalling arguments; nested
exception is: 
                 java.io.NotSerializableException: 
org.apache.jackrabbit.value.BinaryImpl
                 at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:138)
                 at 
org.apache.jackrabbit.rmi.server.ServerNode_Stub.setProperty(Unknown
Source)
                 at
org.apache.jackrabbit.rmi.client.ClientNode.setProperty(ClientNode.java:129)
                 ... 4 more
Caused by: java.io.NotSerializableException:
org.apache.jackrabbit.value.BinaryImpl
                 at 
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1164)
                 at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)
                 at 
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483)
                 at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
                 at 
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
                 at 
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330)
                 at 
sun.rmi.server.UnicastRef.marshalValue(UnicastRef.java:274)
                 at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
############### Exception end #####################


--
View this message in context: 
http://jackrabbit.510166.n4.nabble.com/prop-setProperty-jcr-data-Bianary-tp3438835p3438835.html

Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

--
This message contains privileged and confidential information only 
for use by the intended recipient.  If you are not the intended 
recipient of this message, you must not disseminate, copy or use 
it in any manner.  If you have received this message in error, 
please advise the sender by reply e-mail.  Please ensure all 
e-mail attachments are scanned for viruses prior to opening or 
using.

Reply via email to