jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ross.Dy...@ipaustralia.gov.au
Subject Re: prop.setProperty("jcr:data", Bianary) [SEC=UNCLASSIFIED]
Date Mon, 11 Apr 2011 06:29:54 GMT
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 <jms.cercas@gmail.com>
To:     users@jackrabbit.apache.org
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.


Mime
View raw message