jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rokham <somebodyik...@gmail.com>
Subject Jackrabbit OCM insert error
Date Wed, 09 Apr 2008 16:26:17 GMT

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-tp16590540p16590540.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Mime
View raw message