AnsweredAssumed Answered

Copied from private message - JCR for school project

Question asked by rdanner on Apr 1, 2006
Hi Russ,

Thanks for your concern.  I have some more information on the errors I get while starting Alfresco.  This is what my console window shows when trying to access Alfresco through a java application:

- could not create proxy factory for:org.alfresco.repo.domain.hibernate.ChildAssocImpl
org.hibernate.HibernateException: CGLIB Enhancement failed: org.alfresco.repo.domain.hibernate.ChildAssocImpl
   at org.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:132)
   at org.hibernate.proxy.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:41)
   at

Steve

My last message appears to have gotten cut off due to the length of the quoted stack trace.

Have you made any progress with the model.

I cannot give you too much help with your stack trace because I do not know the context you are working in.  You say its on startup? Or when you invoke your code?  Have you modified anything (code / configuration) or are you just trying to use the out of the box distro. It looks like an AOP issue spawned from a data or configuration issue.

How did you set up alfresco for JCR?  I have had to copy the JCR jar and configuration in order to get it to work (Distro, or HEAD from svn – didnt seem to matter).

If you are still just trying to prove JCR works try this. Keep it simple. Make a JSP file in the web-inf director and put these contents in it




<%@page import="org.springframework.*"%>
<%@page import="javax.jcr.*"%>

<%

System.setProperty("java.rmi.server.useCodebaseOnly", "true");
org.springframework.context.ApplicationContext context = new org.springframework.context.support.ClassPathXmlApplicationContext("classpath:alfresco/jcr-context.xml");
Repository repository = (Repository)context.getBean("JCR.Repository");
javax.jcr.Session jcrSession = repository.login(new SimpleCredentials("admin", "admin".toCharArray()), null);

try{
Node rn = jcrSession.getRootNode().getNode("app:company_home");;

//Node testNode = rn.addNode("Test2");
//testNode.addNode("Test4");

Node testNode = rn.addNode("Test2", "cm:folder");
testNode.addNode("Test4","cm:content");
jcrSession.save();

}
catch (Exception eJcrRepository)
{
   eJcrRepository.printStackTrace();
}


%>

This code should work.  you will see new folder and document in the web client if you hit the jsp file.

Once you prove JCR is working then create a new alfresco model.  Your project doesnt sound like it needs the webclient.  Take the core, repository code, and the JCR code.

Let me know how the model building is going (post in the forums).  People will help you (including myself) and others will learn later from the work you are doing (including myself).

Its really good to see someone using alfresco for an academic purpose.  I hope you will share your work with us when it has been completed/submitted.

I am going to move this message to the forum

Outcomes