You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by rokham <so...@gmail.com> on 2008/04/09 18:24:11 UTC

Jackrabbit OCM insert error

Hi all,

My problem with OCM is basically this: (Note: I have followed the
instructions on http://jackrabbit.apache.org/5-with-jackrabbit-ocm.html)

1. I have created a very simple persistent class as follows:
@Node
public class CurnitOtmlImpl{
	
	// Unique number defining each curnit
	@Field(path=true) String number;
	
	// Name given to the curnit by the author
	@Field String name;
        
        // getter and setter methods
}

2. Then I try the following and I fail at ocm.insert(curnit)
   CurnitOtmlImpl cur = new CurnitOtmlImpl();
   cur.setNumber("/123curnit");
   cur.setName("name");
  
   repository = new TransientRepository();
   session = repository.login(new SimpleCredentials("username",
		"password".toCharArray()));
			
			
    List<Class> classes = new ArrayList<Class>();	
    classes.add(CurnitOtmlImpl.class); // Call this method for each
persistent class
					
    Mapper mapper = new AnnotationMapperImpl(classes);
    ocm =  new ObjectContentManagerImpl(session, mapper);

    ocm.insert(curnit);
    ocm.save();

This is the error I get:

1957 [main] INFO org.apache.jackrabbit.core.TransientRepository - Transient
repository shut down
Exception in thread "main"
org.apache.jackrabbit.ocm.exception.RepositoryException: Impossible to
insert the object at /123curnit; nested exception is
javax.jcr.RepositoryException: this session has been closed
javax.jcr.RepositoryException: this session has been closed
	at org.apache.jackrabbit.core.SessionImpl.sanityCheck(SessionImpl.java:358)
	at org.apache.jackrabbit.core.SessionImpl.itemExists(SessionImpl.java:870)
	at
org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl.insert(ObjectContentManagerImpl.java:391)
	at
net.sf.sail.cms.curnit.CurnitManagementImpl.createCurnit(CurnitManagementImpl.java:33)
	at net.sf.sail.cms.curnit.Test.main(Test.java:14)
-- 
View this message in context: http://www.nabble.com/Jackrabbit-OCM-insert-error-tp16590532p16590532.html
Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.