You should check if your classpath contains jcr.jar. If not you should add jcr.jar to your classpath.
Regards Tomasz Łazarecki 2010/3/29 Rob Brown <[email protected]> > Hello, > > I'm getting the above mentioned error when trying to access a repository > from a servlet. I am not using the jackrabbit war because I want to ensure > all access to the repository goes through my application's code. > > If I do the exact same thing from a Swing window the error does not occur. > The problem seems to be related to class loading from a servlet. I have got > the same results in Tomcat 5.5 and in the eclipse embedded web server. > > To test I created a small web application. I have attached a small zip > including source code and config files (I did not include the > jackrabbit-standalone-2.0.0. > jar due to its size). The following steps will recreate the error: > > start eclipse > last tested with eclipse-jee-galileo-SR1-linux-gtk.tar.gz > create a dynamic web project: > copy index.html & repository.xml into WebContent folder > copy web.xml into WebContent/WEB-INF folder (overwrite existing) > copy log4j.xml into src source folder > create test namespace under src source folder > copy ClassDefDemoServlet.java into test namespace > add jackrabbit-standalone-2.0.0.jar to build path > run project on server > click button on index.html > exception has 2 parts: > java.lang.NoClassDefFoundError: javax/jcr/Repository > java.lang.ClassNotFoundException: javax.jcr.Repository > > I found a link to a similar issue that may relate to what's happening: > http://www.eclipse.org/forums/index.php?t=tree&goto=87658&#page_top > > The first reply to this query says: > "That can happen e.g. if your class is found but it executes a static > initialiser (i.e. a public static final assignment) that uses another class > that's not exported by the system bundle." > > I'm not using Equinox or anything other than Eclipse for EE developers. > Perhaps it's related to a bundle issue within jackrabbit. > > I would appreciate any assistance you can offer. If accessing a repository > in this way (i.e. not using the jackrabbit war) is not a good idea perhaps > there is an alternative that allows me to channel all requests exclusively > through my servlet code. > > Also thanks so much for your work on jackrabbit. In spite of the odd bump > geting started this is one of the finest libraries I have ever worked with. > I can hardly wait to finish integration testing and use it to replace our > web app's existing backend. > > Rob >
