cancel
Showing results for 
Search instead for 
Did you mean: 

Doubts on JCR-RMI

rcortesr
Star Contributor
Star Contributor
Hi,

For to use JCR-RMI I must install jackrabbit? How I can do it?
There is some example for to add nodes in de repository using RMI?

I have another doubt: why it appears the following error when execute my code?

ERROR:
[size=75]Exception in thread "main" java.lang.NullPointerException
   at org.alfresco.jcr.item.PropertyImpl.checkSingleValued(PropertyImpl.java:630)
   at org.alfresco.jcr.item.PropertyImpl.setPropertyValue(PropertyImpl.java:509)
   at org.alfresco.jcr.item.NodeImpl.setProperty(NodeImpl.java:354)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.alfresco.jcr.util.JCRProxyFactory$SessionContextInvocationHandler.invoke(JCRProxyFactory.java:130)
   at $Proxy68.setProperty(Unknown Source)
   at org.alfresco.sample.jcr.Main.main(Main.java:61)[/size]


MY CODE:
[size=75]Node facturas = myNode.addNode("fac:facturas", "cm:folder");
            facturas.setProperty("cm:name", "Facturas");
               facturas.setProperty("cm:description", "");
              
               Node fac1 = facturas.addNode("fac:entry1", "fac:factura");
               fac1.setProperty("cm:name", "Factura1");
               fac1.setProperty("cm:description", "pruebaaaaa");
               fac1.setProperty("cm:title", "mi primera factura");
               fac1.setProperty("cm:content", "hola holaaaaaaaa");
               fac1.setProperty("fac:NIF_proveedor", "13434");[/size]


fac is the prefix of my custom model of content. The problems appears when I set a custom property.

Thanks.
3 REPLIES 3

davidc
Star Contributor
Star Contributor
No, you don't need to install Jackrabbit.  You do need a Jackrabbit jar though.

Have you seen http://wiki.alfresco.com/wiki/JCR-RMI_Extension ?

The exception generally indicates you haven't registered a model (which declares the fac namespace, facturas type and NIF_proveedor property).

rcortesr
Star Contributor
Star Contributor
Hi,

I believe that I have registered the new model because I can add new documents of the type facturas. And I can set the common properties (name, title, description…).
The problem is to set the customized properties.

Somebody can help me?

davidc
Star Contributor
Star Contributor
org.alfresco.jcr.item.PropertyImpl.checkSingleValued(PropertyImpl.java:630)

This line is looking for the property description in the model.  It's failing with a NPE because the property does not exist.