jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fernando Cabredo <fcabred...@yahoo.com>
Subject Re: NoClassDefFoundError on OCM Test
Date Tue, 03 Mar 2009 13:01:45 GMT
Yes, I was able to fix the previous problem by adding the required jar files. However, this
time I had a new error which is listed below:

Exception in thread "main" org.apache.jackrabbit.ocm.exception.ObjectContentManagerException:
Cannot create new node of type nt:unstructured from mapped class class com.daraga.jackrabbit.model.Article;
nested exception is javax.jcr.NamespaceException: ocm: is not a registered namespace prefix.
javax.jcr.NamespaceException: ocm: is not a registered namespace prefix.
    at org.apache.jackrabbit.rmi.server.ServerObject.getRepositoryException(ServerObject.java:120)
    at org.apache.jackrabbit.rmi.server.ServerNode.addMixin(ServerNode.java:273)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
    at sun.rmi.transport.Transport$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Unknown Source)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
    at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
    at sun.rmi.server.UnicastRef.invoke(Unknown Source)
    at org.apache.jackrabbit.rmi.server.ServerNode_Stub.addMixin(Unknown Source)
    at org.apache.jackrabbit.rmi.client.ClientNode.addMixin(ClientNode.java:373)
    at org.apache.jackrabbit.ocm.manager.objectconverter.impl.ObjectConverterImpl.insert(ObjectConverterImpl.java:206)
    at org.apache.jackrabbit.ocm.manager.objectconverter.impl.ObjectConverterImpl.insert(ObjectConverterImpl.java:146)
    at org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl.insert(ObjectContentManagerImpl.java:406)
    at com.daraga.jackrabbit.Main.main(Main.java:103)


Thank you,

Fernando T. Cabredo




________________________________
From: Dave Brosius <dbrosius@mebigfatguy.com>
To: users@jackrabbit.apache.org
Sent: Tuesday, March 3, 2009 11:19:46 AM
Subject: Re: NoClassDefFoundError on OCM Test

Do you have a cglib.jar on your classpath?

----- Original Message ----- 
From: "Fernando Cabredo" <fcabredoph@yahoo.com>
To: <users@jackrabbit.apache.org>
Sent: Monday, March 02, 2009 8:50 PM
Subject: NoClassDefFoundError on OCM Test


> Hi,
>
> I would like to get some help that is causing my OCM test.
>
> Here is the error:
>
> Exception in thread "main" java.lang.NoClassDefFoundError: 
> net/sf/cglib/proxy/Callback
>    at 
> org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl.<init>(ObjectContentManagerImpl.java:125)
>    at com.daraga.jackrabbit.Main.main(Main.java:97)
> Caused by: java.lang.ClassNotFoundException: net.sf.cglib.proxy.Callback
>    at java.net.URLClassLoader$1.run(Unknown Source)
>    at java.security.AccessController.doPrivileged(Native Method)
>    at java.net.URLClassLoader.findClass(Unknown Source)
>    at java.lang.ClassLoader.loadClass(Unknown Source)
>    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
>    at java.lang.ClassLoader.loadClass(Unknown Source)
>    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
>    ... 2 more
>
> And my code are as follows:
>
> import java.net.MalformedURLException;
> import java.util.ArrayList;
> import java.util.Date;
> import java.util.List;
>
> import javax.jcr.LoginException;
> import javax.jcr.Repository;
> import javax.jcr.Session;
> import javax.jcr.SimpleCredentials;
> import javax.servlet.ServletException;
>
> import org.apache.jackrabbit.ocm.exception.RepositoryException;
> import org.apache.jackrabbit.ocm.manager.ObjectContentManager;
> import org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl;
> import org.apache.jackrabbit.ocm.mapper.Mapper;
> import 
> org.apache.jackrabbit.ocm.mapper.impl.annotation.AnnotationMapperImpl;
> import com.daraga.jackrabbit.model.Article;
> import com.daraga.jackrabbit.model.ArticlePhotos;
> import com.daraga.jackrabbit.model.Author;
> import com.daraga.jackrabbit.model.Category;
> import com.daraga.jackrabbit.model.Photos;
> import com.daraga.jackrabbit.model.Section;
> import org.apache.jackrabbit.rmi.repository.URLRemoteRepository;
>
>
> public class Main {
>    private static Session session;
>
>    public String loginRepository (String repositoryUrl, String username, 
> String password){
>        String str;
>        System.out.println("<------------JackrabbitService---------->");
>        try {
>            SimpleCredentials cred = new SimpleCredentials(username,
>                     password.toCharArray());
>            Repository repository = new URLRemoteRepository(repositoryUrl);
>            try {
>                session = repository.login(cred, null);
>            } catch (LoginException e) {
>                throw new ServletException(e);
>            } catch (RepositoryException e) {
>                throw new ServletException(e);
>            }
>        } catch (Exception e) {
>            e.toString();
>            // TODO: handle exception
>        }
>        try {
>            String user = session.getUserID();
>            str = "[Status]Login Successful[/Status]";
>        }finally{
>            //TODO on Login of user
>        }
>        return str;
>    }
>    public static void main(String[] args) {
>
>        String repositoryUrl = 
> "http://localhost:8080/jackrabbit-webapp-1.5.2/rmi";
>        String username = "admin";
>        String password = "admin";
>        try {
>            SimpleCredentials cred = new SimpleCredentials(username,
>                     password.toCharArray());
>            Repository repository = new URLRemoteRepository(repositoryUrl);
>            try {
>                session = repository.login(cred, null);
>            } catch (LoginException e) {
>                throw new ServletException(e);
>            } catch (RepositoryException e) {
>                throw new ServletException(e);
>            }
>        } catch (Exception e) {
>            e.toString();
>        }
>        String str;
>        try {
>            String user = session.getUserID();
>            System.out.println("str --->"+user);
>            str = "[Status]Login Successful[/Status]";
>        }finally{
>            //TODO on Login of user
>        }
>
>        List<Class> myclasses = new ArrayList<Class>();
>
>        myclasses.add(Article.class);
>
>        myclasses.add(ArticlePhotos.class);
>        myclasses.add(Author.class);
>        myclasses.add(Category.class);
>        myclasses.add(Photos.class);
>        myclasses.add(Section.class);
>
>
>        Mapper mapper = new AnnotationMapperImpl(myclasses);
>        ObjectContentManager ocm = new ObjectContentManagerImpl(session, 
> mapper);
>
>        Article article = new Article();
>        article.setPath("/articles");
>        article.setTitle("Public Announcement");
>        article.setContent("Urgently Needed");
>        article.setAuthorid(100);
>        article.setSectionid(1);
>        article.setDatecreated(new Date());
>        ocm.insert(article);
>        ocm.save();
>
>        System.out.println("Retrieve a press release from the repository");
>        article = (Article) ocm.getObject("/articles");
>        System.out.println("Article title : " + article.getTitle());
>    }
>
> }
>
> Any help will be much appreciated.
>
> Fernando Cabredo
>
>
> 


      
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message