Re: NoClassDefFoundError accessing jackrabbit jar from servlet [SEC=UNCLASSIFIED]

2010-03-30 Thread Rob Brown
Good question - this results in a different error:

java.lang.NoClassDefFoundError: org/apache/jackrabbit/core/TransientRepository




On Mon, Mar 29, 2010 at 11:46 PM, ross.dy...@ipaustralia.gov.au wrote:

 What happens if you put the specific jar file jcr-2.0.jar in the
 WEB-INF/lib directory?




 Rob Brown rlb.so...@gmail.com wrote on 30/03/2010 03:13:34 PM:

  From: Rob Brown rlb.so...@gmail.com
  To: users@jackrabbit.apache.org
  Date: 30/03/2010 03:14 PM
  Subject: NoClassDefFoundError accessing jackrabbit jar from servlet
 
  Hello,
 
  My first attempt at sending this failed b/c I attached a zip file. Sorry
 if
  this is a duplicate message for some.
 
  I'm getting the above mentioned error when trying to access a repository
  using jackrabbit-standalone-2.0.0.jar from a servlet. I didn't use the
  jackrabbit war because I already have a thick client app working and I
 want
  to reuse as much code as possible. I just assumed doing this was
 possible.
 
  If I do the exact same thing from a thick client (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. Since I cannot attach a zip
 file
  I will just copy the doPost() method below:
 
  protected void doPost(HttpServletRequest request, HttpServletResponse
  response) throws ServletException, IOException {
 
  Repository repository = new TransientRepository(
  repository.xml, //embedded within the war
  path/to/home/dir);
  Session session = null;
  try {
  session = repository.login();
  System.out.println(root node identifier:  +
  session.getRootNode().getIdentifier());
  } catch (Exception e) {
  e.printStackTrace();
  } finally {
  session.logout();
  }
  }
 
  When I post to this servlet from an html form the 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=treegoto=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.
 
  Is accessing a repository in this way from a servlet (i.e. using the
  jackrabbit jar not war) not a supported function, or just not a good idea
 in
  general? My goals are to keep the code as simple as possible and minimize
  the attack surface for troublemakers (i.e. I do not want to expose REST
 or
  any other jackrabbit servlet api to an experienced hacker who might
  recognize what library I am using). I'm handling all user authentication
 in
  my app already and only want my java domain objects to make calls to the
  repository.
 
  Thanks in advance for any assistance you can offer. Comments about the
  security implications of this approach vs. the jackrabbit war are also
 most
  welcome.
 
  Rob


 --
 This message contains privileged and confidential information only
 for use by the intended recipient.  If you are not the intended
 recipient of this message, you must not disseminate, copy or use
 it in any manner.  If you have received this message in error,
 please advise the sender by reply e-mail.  Please ensure all
 e-mail attachments are scanned for viruses prior to opening or
 using.




Re: NoClassDefFoundError accessing jackrabbit jar from servlet [SEC=UNCLASSIFIED]

2010-03-30 Thread Ross . Dyson
Righto, then add jackrabbit-api-2.0.0.jar and 
jackrabbit-jcr-commons-2.0.0.jar into the same directory and see what 
happens.

(This is what I have in my servlet application).

Rob Brown rlb.so...@gmail.com wrote on 30/03/2010 05:39:49 PM:

 From: Rob Brown rlb.so...@gmail.com
 To: users@jackrabbit.apache.org
 Date: 30/03/2010 05:40 PM
 Subject: Re: NoClassDefFoundError accessing jackrabbit jar from 
 servlet  [SEC=UNCLASSIFIED]
 
 Good question - this results in a different error:
 
 java.lang.NoClassDefFoundError: 
org/apache/jackrabbit/core/TransientRepository
 
 
 
 
 On Mon, Mar 29, 2010 at 11:46 PM, ross.dy...@ipaustralia.gov.au wrote:
 
  What happens if you put the specific jar file jcr-2.0.jar in the
  WEB-INF/lib directory?
 
 
 
 
  Rob Brown rlb.so...@gmail.com wrote on 30/03/2010 03:13:34 PM:
 
   From: Rob Brown rlb.so...@gmail.com
   To: users@jackrabbit.apache.org
   Date: 30/03/2010 03:14 PM
   Subject: NoClassDefFoundError accessing jackrabbit jar from servlet
  
   Hello,
  
   My first attempt at sending this failed b/c I attached a zip file. 
Sorry
  if
   this is a duplicate message for some.
  
   I'm getting the above mentioned error when trying to access a 
repository
   using jackrabbit-standalone-2.0.0.jar from a servlet. I didn't use 
the
   jackrabbit war because I already have a thick client app working and 
I
  want
   to reuse as much code as possible. I just assumed doing this was
  possible.
  
   If I do the exact same thing from a thick client (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. Since I cannot attach a 
zip
  file
   I will just copy the doPost() method below:
  
   protected void doPost(HttpServletRequest request, 
HttpServletResponse
   response) throws ServletException, IOException {
  
   Repository repository = new TransientRepository(
   repository.xml, //embedded within the war
   path/to/home/dir);
   Session session = null;
   try {
   session = repository.login();
   System.out.println(root node identifier:  +
   session.getRootNode().getIdentifier());
   } catch (Exception e) {
   e.printStackTrace();
   } finally {
   session.logout();
   }
   }
  
   When I post to this servlet from an html form the 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=treegoto=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.
  
   Is accessing a repository in this way from a servlet (i.e. using the
   jackrabbit jar not war) not a supported function, or just not a good 
idea
  in
   general? My goals are to keep the code as simple as possible and 
minimize
   the attack surface for troublemakers (i.e. I do not want to expose 
REST
  or
   any other jackrabbit servlet api to an experienced hacker who might
   recognize what library I am using). I'm handling all user 
authentication
  in
   my app already and only want my java domain objects to make calls to 
the
   repository.
  
   Thanks in advance for any assistance you can offer. Comments about 
the
   security implications of this approach vs. the jackrabbit war are 
also
  most
   welcome.
  
   Rob
 
 
  --
  This message contains privileged and confidential information only
  for use by the intended recipient.  If you are not the intended
  recipient of this message, you must not disseminate, copy or use
  it in any manner.  If you have received this message in error,
  please advise the sender by reply e-mail.  Please ensure all
  e-mail attachments are scanned for viruses prior to opening or
  using.
 
 

--
This message contains privileged and confidential information only 
for use by the intended recipient.  If you are not the intended 
recipient of this message, you must not disseminate, copy or use 
it in any manner.  If you have received this message in error, 
please advise the sender by reply e-mail.  Please ensure all 
e-mail attachments are scanned for viruses prior to opening or 
using.


Re: NoClassDefFoundError accessing jackrabbit jar from servlet [SEC=UNCLASSIFIED]

2010-03-30 Thread Rob Brown
Seems to cause the same error. I'll test some more tomorrow but it's getting
late here...

Thanks for the suggestion.


On Tue, Mar 30, 2010 at 12:44 AM, ross.dy...@ipaustralia.gov.au wrote:

 Righto, then add jackrabbit-api-2.0.0.jar and
 jackrabbit-jcr-commons-2.0.0.jar into the same directory and see what
 happens.

 (This is what I have in my servlet application).

 Rob Brown rlb.so...@gmail.com wrote on 30/03/2010 05:39:49 PM:


  From: Rob Brown rlb.so...@gmail.com

  To: users@jackrabbit.apache.org
  Date: 30/03/2010 05:40 PM
  Subject: Re: NoClassDefFoundError accessing jackrabbit jar from
  servlet  [SEC=UNCLASSIFIED]
 
  Good question - this results in a different error:
 
  java.lang.NoClassDefFoundError:
 org/apache/jackrabbit/core/TransientRepository
 
 
 
 
  On Mon, Mar 29, 2010 at 11:46 PM, ross.dy...@ipaustralia.gov.au wrote:
 
   What happens if you put the specific jar file jcr-2.0.jar in the
   WEB-INF/lib directory?
  
  
  
  
   Rob Brown rlb.so...@gmail.com wrote on 30/03/2010 03:13:34 PM:
  
From: Rob Brown rlb.so...@gmail.com
To: users@jackrabbit.apache.org
Date: 30/03/2010 03:14 PM
Subject: NoClassDefFoundError accessing jackrabbit jar from servlet
   
Hello,
   
My first attempt at sending this failed b/c I attached a zip file.
 Sorry
   if
this is a duplicate message for some.
   
I'm getting the above mentioned error when trying to access a
 repository
using jackrabbit-standalone-2.0.0.jar from a servlet. I didn't use
 the
jackrabbit war because I already have a thick client app working and
 I
   want
to reuse as much code as possible. I just assumed doing this was
   possible.
   
If I do the exact same thing from a thick client (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. Since I cannot attach a
 zip
   file
I will just copy the doPost() method below:
   
protected void doPost(HttpServletRequest request,
 HttpServletResponse
response) throws ServletException, IOException {
   
Repository repository = new TransientRepository(
repository.xml, //embedded within the war
path/to/home/dir);
Session session = null;
try {
session = repository.login();
System.out.println(root node identifier:  +
session.getRootNode().getIdentifier());
} catch (Exception e) {
e.printStackTrace();
} finally {
session.logout();
}
}
   
When I post to this servlet from an html form the 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=treegoto=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.
   
Is accessing a repository in this way from a servlet (i.e. using the
jackrabbit jar not war) not a supported function, or just not a good
 idea
   in
general? My goals are to keep the code as simple as possible and
 minimize
the attack surface for troublemakers (i.e. I do not want to expose
 REST
   or
any other jackrabbit servlet api to an experienced hacker who might
recognize what library I am using). I'm handling all user
 authentication
   in
my app already and only want my java domain objects to make calls to
 the
repository.
   
Thanks in advance for any assistance you can offer. Comments about
 the
security implications of this approach vs. the jackrabbit war are
 also
   most
welcome.
   
Rob
  
  
   --
   This message contains privileged and confidential information only
   for use by the intended recipient.  If you are not the intended
   recipient of this message, you must not disseminate, copy or use
   it in any manner.  If you have received this message in error,
   please advise the sender by reply e-mail.  Please ensure all
   e-mail attachments are scanned for viruses prior to opening or
   using.
  
  


 --
 This message contains privileged and confidential information only
 for use by the intended recipient.  If you are not the intended
 recipient of this message, you must not disseminate, copy or use
 it in any manner.  If you have received this message in error,
 please advise the sender by reply e-mail.  Please

Re: NoClassDefFoundError accessing jackrabbit jar from servlet [SEC=UNCLASSIFIED]

2010-03-30 Thread Ross . Dyson
Also better add jackrabbit-core-2.0.0.jar.



Rob Brown rlb.so...@gmail.com wrote on 30/03/2010 06:05:29 PM:

 From: Rob Brown rlb.so...@gmail.com
 To: users@jackrabbit.apache.org
 Date: 30/03/2010 06:06 PM
 Subject: Re: NoClassDefFoundError accessing jackrabbit jar from 
 servlet  [SEC=UNCLASSIFIED]
 
 Seems to cause the same error. I'll test some more tomorrow but it's 
getting
 late here...
 
 Thanks for the suggestion.
 
 
 On Tue, Mar 30, 2010 at 12:44 AM, ross.dy...@ipaustralia.gov.au wrote:
 
  Righto, then add jackrabbit-api-2.0.0.jar and
  jackrabbit-jcr-commons-2.0.0.jar into the same directory and see what
  happens.
 
  (This is what I have in my servlet application).
 
  Rob Brown rlb.so...@gmail.com wrote on 30/03/2010 05:39:49 PM:
 
 
   From: Rob Brown rlb.so...@gmail.com
 
   To: users@jackrabbit.apache.org
   Date: 30/03/2010 05:40 PM
   Subject: Re: NoClassDefFoundError accessing jackrabbit jar from
   servlet  [SEC=UNCLASSIFIED]
  
   Good question - this results in a different error:
  
   java.lang.NoClassDefFoundError:
  org/apache/jackrabbit/core/TransientRepository
  
  
  
  
   On Mon, Mar 29, 2010 at 11:46 PM, ross.dy...@ipaustralia.gov.au 
wrote:
  
What happens if you put the specific jar file jcr-2.0.jar in the
WEB-INF/lib directory?
   
   
   
   
Rob Brown rlb.so...@gmail.com wrote on 30/03/2010 03:13:34 PM:
   
 From: Rob Brown rlb.so...@gmail.com
 To: users@jackrabbit.apache.org
 Date: 30/03/2010 03:14 PM
 Subject: NoClassDefFoundError accessing jackrabbit jar from 
servlet

 Hello,

 My first attempt at sending this failed b/c I attached a zip 
file.
  Sorry
if
 this is a duplicate message for some.

 I'm getting the above mentioned error when trying to access a
  repository
 using jackrabbit-standalone-2.0.0.jar from a servlet. I didn't 
use
  the
 jackrabbit war because I already have a thick client app working 
and
  I
want
 to reuse as much code as possible. I just assumed doing this was
possible.

 If I do the exact same thing from a thick client (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. Since I cannot attach 
a
  zip
file
 I will just copy the doPost() method below:

 protected void doPost(HttpServletRequest request,
  HttpServletResponse
 response) throws ServletException, IOException {

 Repository repository = new TransientRepository(
 repository.xml, //embedded within the war
 path/to/home/dir);
 Session session = null;
 try {
 session = repository.login();
 System.out.println(root node identifier:  +
 session.getRootNode().getIdentifier());
 } catch (Exception e) {
 e.printStackTrace();
 } finally {
 session.logout();
 }
 }

 When I post to this servlet from an html form the 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=treegoto=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.

 Is accessing a repository in this way from a servlet (i.e. using 
the
 jackrabbit jar not war) not a supported function, or just not a 
good
  idea
in
 general? My goals are to keep the code as simple as possible and
  minimize
 the attack surface for troublemakers (i.e. I do not want to 
expose
  REST
or
 any other jackrabbit servlet api to an experienced hacker who 
might
 recognize what library I am using). I'm handling all user
  authentication
in
 my app already and only want my java domain objects to make 
calls to
  the
 repository.

 Thanks in advance for any assistance you can offer. Comments 
about
  the
 security implications of this approach vs. the jackrabbit war 
are
  also
most
 welcome.

 Rob
   
   
--
This message contains privileged and confidential information only
for use by the intended recipient.  If you are not the intended
recipient of this message, you must not disseminate, copy or use
it in any manner.  If you have received this message

Re: NoClassDefFoundError accessing jackrabbit jar from servlet [SEC=UNCLASSIFIED]

2010-03-30 Thread Rob Brown
I was able to get it working by expanding the jar list as you suggested. I
found a list online of the v2.0 jars pulled in by maven and then added a
couple more that seem to be needed. Here is the full list of jars that I had
to put in WEB-INF/lib:

//[INFO] +- org.apache.jackrabbit:jackrabbit-core:jar:2.0-beta4:compile
//[INFO] | +- concurrent:concurrent:jar:1.3.4:compile
//[INFO] | +- commons-collections:commons-collections:jar:3.2.1:compile
//[INFO] | +- commons-io:commons-io:jar:1.4:compile
//[INFO] | +- commons-dbcp:commons-dbcp:jar:1.2.2:compile
//[INFO] | | \- commons-pool:commons-pool:jar:1.3:compile
//[INFO] | +- org.apache.jackrabbit:jackrabbit-api:jar:2.0-beta4:compile
//[INFO] | +-
org.apache.jackrabbit:jackrabbit-jcr-commons:jar:2.0-beta4:compile
//[INFO] | +-
org.apache.jackrabbit:jackrabbit-spi-commons:jar:2.0-beta4:compile
//[INFO] | +- org.apache.jackrabbit:jackrabbit-spi:jar:2.0-beta4:compile
//[INFO] | +- org.apache.tika:tika-parsers:jar:0.5:compile
//[INFO] | | +- org.apache.tika:tika-core:jar:0.5:compile
//[INFO] | | +- org.apache.commons:commons-compress:jar:1.0:compile
//[INFO] | | +- org.apache.pdfbox:pdfbox:jar:0.8.0-incubating:compile
//[INFO] | | | +- org.apache.pdfbox:fontbox:jar:0.8.0-incubator:compile
//[INFO] | | | \- org.apache.pdfbox:jempbox:jar:0.8.0-incubator:compile
//[INFO] | | +- org.apache.poi:poi:jar:3.5-FINAL:compile
//[INFO] | | +- org.apache.poi:poi-scratchpad:jar:3.5-FINAL:compile
//[INFO] | | +- org.apache.poi:poi-ooxml:jar:3.5-FINAL:compile
//[INFO] | | | \- org.apache.poi:ooxml-schemas:jar:1.0:compile
//[INFO] | | | \- org.apache.xmlbeans:xmlbeans:jar:2.3.0:compile
//[INFO] | | +-
org.apache.geronimo.specs:geronimo-stax-api_1.0_spec:jar:1.0.1:compile
//[INFO] | | +- org.ccil.cowan.tagsoup:tagsoup:jar:1.2:compile
//[INFO] | | +- asm:asm:jar:3.1:compile
//[INFO] | | \-
com.drewnoakes:metadata-extractor:jar:2.4.0-beta-1:compile
//[INFO] | +- org.slf4j:slf4j-api:jar:1.5.8:compile
//[INFO] | +- org.slf4j:jcl-over-slf4j:jar:1.5.8:compile
//[INFO] | +- org.apache.lucene:lucene-core:jar:2.4.1:compile
//[INFO] | \- org.apache.derby:derby:jar:10.5.3.0_1:compile

These 2 are also needed or else you get runtime errors in the servlet:

//log4j-1.2.14.jar
//slf4j-log4j12-1.5.8.jar

Thanks so much for your help!!

Rob

On Tue, Mar 30, 2010 at 6:59 PM, ross.dy...@ipaustralia.gov.au wrote:

 Also better add jackrabbit-core-2.0.0.jar.



 Rob Brown rlb.so...@gmail.com wrote on 30/03/2010 06:05:29 PM:


  From: Rob Brown rlb.so...@gmail.com

  To: users@jackrabbit.apache.org
  Date: 30/03/2010 06:06 PM
  Subject: Re: NoClassDefFoundError accessing jackrabbit jar from
  servlet  [SEC=UNCLASSIFIED]
 
  Seems to cause the same error. I'll test some more tomorrow but it's
 getting
  late here...
 
  Thanks for the suggestion.
 
 
  On Tue, Mar 30, 2010 at 12:44 AM, ross.dy...@ipaustralia.gov.au wrote:
 
   Righto, then add jackrabbit-api-2.0.0.jar and
   jackrabbit-jcr-commons-2.0.0.jar into the same directory and see what
   happens.
  
   (This is what I have in my servlet application).
  
   Rob Brown rlb.so...@gmail.com wrote on 30/03/2010 05:39:49 PM:
  
  
From: Rob Brown rlb.so...@gmail.com
  
To: users@jackrabbit.apache.org
Date: 30/03/2010 05:40 PM
Subject: Re: NoClassDefFoundError accessing jackrabbit jar from
servlet  [SEC=UNCLASSIFIED]
   
Good question - this results in a different error:
   
java.lang.NoClassDefFoundError:
   org/apache/jackrabbit/core/TransientRepository
   
   
   
   
On Mon, Mar 29, 2010 at 11:46 PM, ross.dy...@ipaustralia.gov.au
 wrote:
   
 What happens if you put the specific jar file jcr-2.0.jar in the
 WEB-INF/lib directory?




 Rob Brown rlb.so...@gmail.com wrote on 30/03/2010 03:13:34 PM:

  From: Rob Brown rlb.so...@gmail.com
  To: users@jackrabbit.apache.org
  Date: 30/03/2010 03:14 PM
  Subject: NoClassDefFoundError accessing jackrabbit jar from
 servlet
 
  Hello,
 
  My first attempt at sending this failed b/c I attached a zip
 file.
   Sorry
 if
  this is a duplicate message for some.
 
  I'm getting the above mentioned error when trying to access a
   repository
  using jackrabbit-standalone-2.0.0.jar from a servlet. I didn't
 use
   the
  jackrabbit war because I already have a thick client app working
 and
   I
 want
  to reuse as much code as possible. I just assumed doing this was
 possible.
 
  If I do the exact same thing from a thick client (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. Since I cannot attach
 a
   zip
 file
  I will just

Re: NoClassDefFoundError accessing jackrabbit jar from servlet [SEC=UNCLASSIFIED]

2010-03-29 Thread Ross . Dyson
What happens if you put the specific jar file jcr-2.0.jar in the 
WEB-INF/lib directory?




Rob Brown rlb.so...@gmail.com wrote on 30/03/2010 03:13:34 PM:

 From: Rob Brown rlb.so...@gmail.com
 To: users@jackrabbit.apache.org
 Date: 30/03/2010 03:14 PM
 Subject: NoClassDefFoundError accessing jackrabbit jar from servlet
 
 Hello,
 
 My first attempt at sending this failed b/c I attached a zip file. Sorry 
if
 this is a duplicate message for some.
 
 I'm getting the above mentioned error when trying to access a repository
 using jackrabbit-standalone-2.0.0.jar from a servlet. I didn't use the
 jackrabbit war because I already have a thick client app working and I 
want
 to reuse as much code as possible. I just assumed doing this was 
possible.
 
 If I do the exact same thing from a thick client (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. Since I cannot attach a zip 
file
 I will just copy the doPost() method below:
 
 protected void doPost(HttpServletRequest request, 
HttpServletResponse
 response) throws ServletException, IOException {
 
 Repository repository = new TransientRepository(
 repository.xml, //embedded within the war
 path/to/home/dir);
 Session session = null;
 try {
 session = repository.login();
 System.out.println(root node identifier:  +
 session.getRootNode().getIdentifier());
 } catch (Exception e) {
 e.printStackTrace();
 } finally {
 session.logout();
 }
 }
 
 When I post to this servlet from an html form the 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=treegoto=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.
 
 Is accessing a repository in this way from a servlet (i.e. using the
 jackrabbit jar not war) not a supported function, or just not a good 
idea in
 general? My goals are to keep the code as simple as possible and 
minimize
 the attack surface for troublemakers (i.e. I do not want to expose REST 
or
 any other jackrabbit servlet api to an experienced hacker who might
 recognize what library I am using). I'm handling all user authentication 
in
 my app already and only want my java domain objects to make calls to the
 repository.
 
 Thanks in advance for any assistance you can offer. Comments about the
 security implications of this approach vs. the jackrabbit war are also 
most
 welcome.
 
 Rob

--
This message contains privileged and confidential information only 
for use by the intended recipient.  If you are not the intended 
recipient of this message, you must not disseminate, copy or use 
it in any manner.  If you have received this message in error, 
please advise the sender by reply e-mail.  Please ensure all 
e-mail attachments are scanned for viruses prior to opening or 
using.