To configure tomcat to provide a common repository to multiple web apps, Jackrabbit repository is added as a global resource, which requires jcr-1.0.jar as well as other jackrabbit jars in common/lib. If jcr-1.0 is not there, tomcat will complain during startup.
Since BinableRepository implements javax.jcr.Repository, it should be fine to cast BindableRepository to javax.jcr.Repository. It's unclear to me why the exception is thrown. I also prefer to keep jackrabbit jars in WEB-INF/lib. In fact, I would like to run a separate web app to provide jackrabbit repository to multiple web apps in the same tomcat container. Using this approach, how do I make the repository available to multiple web apps? The JNDI tree can not be modified from a web app. Thanks, -aj On 9/16/07, Jukka Zitting <[EMAIL PROTECTED]> wrote: > > Hi, > > On 9/15/07, AJ Chen <[EMAIL PROTECTED]> wrote: > > But, it throws an exception: java.lang.ClassCastException: > > org.apache.jackrabbit.core.jndi.BindableRepository > > > > Any idea why? > > Do you have the jcr-1.0.jar included in your webapp? That could > explain the ClassCastException, i.e. if BindableRepository implements > the javax.jcr.Repository interface loaded from common/lib, but your > application is trying to cast it to javax.jcr.Repository loaded from > within your webapp's WEB-INF/lib. > > The best practice for JCR webapps is to only include the jcr-1.0.jar > file in WEB-INF/lib if you also embed the repository implementation in > your webapp. > > BR, > > Jukka Zitting > -- AJ Chen, PhD Co-Chair, SDForum Semantic Web SIG http://web2express.org http://healthline.com
