Re: [Neo4j] setProperty Exception

2011-08-25 Thread Chris Gioran
Hi John,

maybe you are trying to add a property that has a value of String[]
with at least one of the array members being null?. That would cause
the first exception. The second exception is most probably because you
try to success() and finish() your transaction even after the
exception.

For the first issue, always make sure that you are not adding null
values, not even as members of an array.
For the second issue, make sure that you have a try/catch block around
your transactional code that does tx.success() only when everything is
in place, with the catch block doing the tx.failure(). At the finally
block, just do tx.finish() - that should do it.

In code:

Transaction tx = db.beginTx();
try {
  // do tx stuff here
  tx.success();
}
catch (Exception e) {
  tx.failure();
}
finally {
  tx.finish();
}

Hope the above help. If your code does not conform to my assumptions
please share some more details.

cheers,
CG

On Thu, Aug 25, 2011 at 5:43 AM, John Howard johnyho...@gmail.com wrote:
 I am using embedded 1.4.1

 I get these 2 strange exceptions almost simultaneously when try to create a
 new property.

 java.lang.NullPointerException
 at
 org.neo4j.kernel.impl.nioneo.store.DynamicArrayStore.allocateFromString(DynamicArrayStore.java:142)
 at
 org.neo4j.kernel.impl.nioneo.store.DynamicArrayStore.allocateRecords(DynamicArrayStore.java:369)
 at
 org.neo4j.kernel.impl.nioneo.store.PropertyStore.allocateArrayRecords(PropertyStore.java:466)
 at
 org.neo4j.kernel.impl.nioneo.store.PropertyStore.encodeValue(PropertyStore.java:535)
 at
 org.neo4j.kernel.impl.nioneo.xa.WriteTransaction.nodeAddProperty(WriteTransaction.java:1314)
 at
 org.neo4j.kernel.impl.nioneo.xa.WriteTransaction.nodeAddProperty(WriteTransaction.java:1741)
 at
 org.neo4j.kernel.impl.persistence.PersistenceManager.nodeAddProperty(PersistenceManager.java:140)
 at
 org.neo4j.kernel.impl.core.NodeManager.nodeAddProperty(NodeManager.java:849)
 at org.neo4j.kernel.impl.core.NodeImpl.addProperty(NodeImpl.java:101)
 at org.neo4j.kernel.impl.core.Primitive.setProperty(Primitive.java:411)
 at org.neo4j.kernel.impl.core.NodeProxy.setProperty(NodeProxy.java:120)
 at graph.createProperty(graph.java:232)

 and then
 org.neo4j.graphdb.TransactionFailureException: Unable to commit transaction
 at org.neo4j.kernel.TopLevelTransaction.finish(TopLevelTransaction.java:98)
 Caused by: javax.transaction.RollbackException: Failed to commit,
 transaction rolledback
 at
 org.neo4j.kernel.impl.transaction.TxManager.rollbackCommit(TxManager.java:811)
 at org.neo4j.kernel.impl.transaction.TxManager.commit(TxManager.java:645)
 at
 org.neo4j.kernel.impl.transaction.TransactionImpl.commit(TransactionImpl.java:109)
 at org.neo4j.kernel.TopLevelTransaction.finish(TopLevelTransaction.java:85)
 ... 40 more


 TIA

 John
 ___
 Neo4j mailing list
 User@lists.neo4j.org
 https://lists.neo4j.org/mailman/listinfo/user

___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


[Neo4j] setProperty Exception

2011-08-24 Thread John Howard
I am using embedded 1.4.1

I get these 2 strange exceptions almost simultaneously when try to create a
new property.

java.lang.NullPointerException
at
org.neo4j.kernel.impl.nioneo.store.DynamicArrayStore.allocateFromString(DynamicArrayStore.java:142)
at
org.neo4j.kernel.impl.nioneo.store.DynamicArrayStore.allocateRecords(DynamicArrayStore.java:369)
at
org.neo4j.kernel.impl.nioneo.store.PropertyStore.allocateArrayRecords(PropertyStore.java:466)
at
org.neo4j.kernel.impl.nioneo.store.PropertyStore.encodeValue(PropertyStore.java:535)
at
org.neo4j.kernel.impl.nioneo.xa.WriteTransaction.nodeAddProperty(WriteTransaction.java:1314)
at
org.neo4j.kernel.impl.nioneo.xa.WriteTransaction.nodeAddProperty(WriteTransaction.java:1741)
at
org.neo4j.kernel.impl.persistence.PersistenceManager.nodeAddProperty(PersistenceManager.java:140)
at
org.neo4j.kernel.impl.core.NodeManager.nodeAddProperty(NodeManager.java:849)
at org.neo4j.kernel.impl.core.NodeImpl.addProperty(NodeImpl.java:101)
at org.neo4j.kernel.impl.core.Primitive.setProperty(Primitive.java:411)
at org.neo4j.kernel.impl.core.NodeProxy.setProperty(NodeProxy.java:120)
at graph.createProperty(graph.java:232)

and then
org.neo4j.graphdb.TransactionFailureException: Unable to commit transaction
at org.neo4j.kernel.TopLevelTransaction.finish(TopLevelTransaction.java:98)
Caused by: javax.transaction.RollbackException: Failed to commit,
transaction rolledback
at
org.neo4j.kernel.impl.transaction.TxManager.rollbackCommit(TxManager.java:811)
at org.neo4j.kernel.impl.transaction.TxManager.commit(TxManager.java:645)
at
org.neo4j.kernel.impl.transaction.TransactionImpl.commit(TransactionImpl.java:109)
at org.neo4j.kernel.TopLevelTransaction.finish(TopLevelTransaction.java:85)
... 40 more


TIA

John
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user