jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rokham <somebodyik...@gmail.com>
Subject Re: 5' with Jackrabbit OCM
Date Wed, 09 Apr 2008 16:19:03 GMT


I'm trying to post a problem I'm facing with inserting a very very simple
object into jackrabbit using the OCM api. I'm trying to find out how I can
post a new message but I cannot figure out how.

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:
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();
   repository = new TransientRepository();
   session = repository.login(new SimpleCredentials("username",
    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);


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 net.sf.sail.cms.curnit.Test.main(Test.java:14)

Any help is appreciated.

Christophe Lombart wrote:
> Hi all,
> I just added a very small tutorial on Jackrabbit OCM [1]. This is still a
> draft. Please, give me your comments (sorry for my bad english).
> I plan to write other tutorials.
> As you can see, it should be nice to drop the step 2 & 3 (Create the node
> type ocm:discriminator & Initialize the JCR repository).
> br,
> Christophe
> [1] http://jackrabbit.apache.org/JCR/5-with-jackrabbit-ocm.html.

View this message in context: http://www.nabble.com/5%27-with-Jackrabbit-OCM-tp15329247p16590218.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

View raw message