jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ye, Forest \(MAN-Corporate\)" <Forest...@manheim.com>
Subject RE: Problem reading from Repository useing ocm
Date Fri, 23 Jan 2009 14:05:17 GMT
It seems you do not have a default constructor.





-----Original Message-----
From: Kurz Wolfgang [mailto:wolfgang.kurz@gwvs.de] 
Sent: Friday, January 23, 2009 5:27 AM
To: users@jackrabbit.apache.org
Subject: Problem reading from Repository useing ocm

Hello everyone,

I have a problem readign my content from the repository useing ocm.

This is what I do:

I create a entry like this:

private boolean createArtikelContent(JCRArtikelContent entry) {		
		try {
			ObjectContentManager ocm =
ocmFactory.createObjectContentManager();			
			ocm.insert(entry);
			ocm.save();		
			
			return true;
		} catch (RepositoryException e) {
			logger.error(e.getLocalizedMessage(), e);
			return false;
		} catch (ObjectContentManagerException e) {
			logger.error(e.getLocalizedMessage(), e);
			return false;
		}		
	}

When I check with the WebdaV browser in the jackrabbit web application I
can see it created a Artikel node.

Then I try to read from the repository:

private List<JCRContentNode> getContentEntrysByMenuId(final long menuId,
final boolean all, final boolean article,
			final boolean document, final boolean form,
final boolean report, final boolean independentDocumentsOnly) {		
			
		try{			
						
			ObjectContentManager ocm =
ocmFactory.createObjectContentManager();
						
			org.apache.jackrabbit.ocm.query.QueryManager
queryManager = ocm.getQueryManager();
						
			Filter filter =
queryManager.createFilter(JCRArtikelContent.class);
	

			org.apache.jackrabbit.ocm.query.Query query =
queryManager.createQuery(filter);
						
			List<JCRArtikelContent> artikelList =
(List<JCRArtikelContent>)ocm.getObjects(query);			
			
			
		} catch (Exception e) {			
						
			e.printStackTrace();
			logger.error(e.getLocalizedMessage(), e);
			return null;
		}		
		return null;
}

And I get the following error:

org.apache.jackrabbit.ocm.exception.JcrMappingException: Cannot create
instance for class
de.gwvs.tos.commons.jackrabbit.domain.JCRArtikelContent; nested
exception is java.lang.InstantiationException:
de.gwvs.tos.commons.jackrabbit.domain.JCRArtikelContent
java.lang.InstantiationException:
de.gwvs.tos.commons.jackrabbit.domain.JCRArtikelContent
	at java.lang.Class.newInstance0(Unknown Source)
	at java.lang.Class.newInstance(Unknown Source)
	at
org.apache.jackrabbit.ocm.reflection.ReflectionUtils.newInstance(Reflect
ionUtils.java:172)
	at
org.apache.jackrabbit.ocm.manager.objectconverter.impl.ObjectConverterIm
pl.getObject(ObjectConverterImpl.java:388)
	at
org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl.getObjec
ts(ObjectContentManagerImpl.java:624)
	at
org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl.getObjec
ts(ObjectContentManagerImpl.java:548)
	at
de.gwvs.tos.commons.jackrabbit.dao.jcr.JCRDaoImpl.getContentEntrysByMenu
Id(JCRDaoImpl.java:1262)



Anyone have an idea what I am doing wrong?

Thx a lot in Advance!

Mime
View raw message