You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by simer anand <si...@gmail.com> on 2009/07/21 09:17:54 UTC

Re: Exception in thread "main" java.lang.NoClassDefFoundError: javax/jcr/Repository

ya
but i do have have jcr-1.0.jar in my classpath
and javax/jcr/respository.class is within it

Re: Exception in thread "main" java.lang.NoClassDefFoundError: javax/jcr/Repository

Posted by Ian Boston <ie...@tfd.co.uk>.
On 21 Jul 2009, at 12:03, simer anand wrote:

> On 7/21/09, Ian Boston <ie...@tfd.co.uk> wrote:
>>
>> What classloader environment are you running in ? OSGi ?
>>
>> NoClassDefFoundError means that the Class was found but the byte  
>> array
>> associated with the class could not be loaded (hence no definition).
>> If the class is not in your classpath, then you will normally get a
>> ClassNotFoundException.
>>
>> The only time I have seen a NoClassDefFoundError is
>> a) when the jar is corrupt or
>> b) in OSGi where there is no bundle import (in the manifest)  on the
>> package in question.
>>
>> OSGi classloaders apply rules to finding and loading classes, you  
>> may be in
>> an environment with similar rules.
>>
>> HTH
>> Ian
>>
>>
>> On 21 Jul 2009, at 08:17, simer anand wrote:
>>
>> ya
>>> but i do have have jcr-1.0.jar in my classpath
>>> and javax/jcr/respository.class is within it
>>
>>
>
> how to know what class loader i'm using


What are you running ?
a java application  (eg java -jar myjar.jar)
a webapp inside tomcat or some other container
something else, like eclipse.


Re: Exception in thread "main" java.lang.NoClassDefFoundError: javax/jcr/Repository

Posted by simer anand <si...@gmail.com>.
sir

I'm working on linux(mandriva)
and following is the command

<b>
[sda_tr1@cad44 hop files]$ javac FirstHop.java

[sda_tr1@cad44 hop files]$ java FirstHop

Exception in thread "main" java.lang.NoClassDefFoundError: FirstHop
Caused by: java.lang.ClassNotFoundException: FirstHop
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: FirstHop.  Program will exit.
</b>

and then when i execute with this command

<b>
[sda_tr1@cad44 hop files]$ java -classpath . FirstHop

Exception in thread "main" java.lang.NoClassDefFoundError:
javax/jcr/Repository
Caused by: java.lang.ClassNotFoundException: javax.jcr.Repository
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: FirstHop.  Program will exit.
</b>

and further my .cshrc file's classpath is :

setenv CLASSPATH
/home/sda_tr1/Desktop/simer/apache-tomcat-6.0.20/webapps/jackrabbit-webapp-1.5.6/WEB-INF/lib/<b>jcr-1.0.jar</b>:/
home/sda_tr1/Desktop/simer/apache-tomcat-6.0.20/webapps/jackrabbit-webapp-1.5.6/WEB-INF/lib/<b>jackrabbit-api-1.5.0.jar</b>:/home/
sda_tr1/Desktop/simer/apache-tomcat-6.0.20/webapps/jackrabbit-webapp-1.5.6/WEB-INF/lib/<b>jackrabbit-core-1.5.6.jar</b>:/home/sda_
tr1/Desktop/simer/apache-tomcat-6.0.20/webapps/jackrabbit-webapp-1.5.6/WEB-INF/lib/<b>jackrabbit-jcr-commons-1.5.5.jar</b>:/home/s
da_tr1/Desktop/simer/apache-tomcat-6.0.20/webapps/jackrabbit-webapp-1.5.6/WEB-INF/lib/<b>jackrabbit-spi-1.5.0.jar</b>:/home/sda_tr
1/Desktop/simer/apache-tomcat-6.0.20/webapps/jackrabbit-webapp-1.5.6/WEB-INF/lib/<b>jackrabbit-spi-commons-1.5.5.jar</b>:/home/sda
_tr1/Desktop/simer/apache-tomcat-6.0.20/webapps/jackrabbit-webapp-1.5.6/WEB-INF/lib/<b>jackrabbit-text-extractors-1.5.0.jar</b>:/h
ome/sda_tr1/Desktop/simer/apache-tomcat-6.0.20/webapps/jackrabbit-webapp-1.5.6/WEB-INF/lib/<b>slf4j-api-1.5.3.jar</b>:/home/sda_tr
1/Desktop/simer/apache-tomcat-6.0.20/webapps/jackrabbit-webapp-1.5.6/WEB-INF/lib/<b>slf4j-simple-1.3.0.jar</b>:/home/sda_tr1/Deskt
op/simer/apache-tomcat-6.0.20/webapps/jackrabbit-webapp-1.5.6/WEB-INF/lib/webapps/jackrabbit-webapp-1.5.6/WEB-INF/lib/<b>commo
ns-collections-3.1.jar</b>:/home/sda_tr1/Desktop/simer/apache-tomcat-6.0.20/webapps/jackrabbit-webapp-1.5.6/WEB-INF/lib/<b>lucene-
core-2.3.2.jar</b>:/home/sda_tr1/Desktop/simer/apache-tomcat-6.0.20/webapps/jackrabbit-webapp-1.5.6/WEB-INF/lib/<b>derby-10.2.1.6.
jar</b>:/home/sda_tr1/Desktop/simer/apache-tomcat-6.0.20/webapps/jackrabbit-webapp-1.5.6/WEB-INF/lib/<b>concurrent-1.3.4.jar</b>:/home
/sda_tr1/Desktop/simer/apache-tomcat-6.0.20/webapps/jackrabbit-webapp-1.5.6/WEB-INF/lib/<b>log4j-1.2.14.jar</b>

and what i have found is when i execute both the programs then bug is coming
from javax package
javax/jcr/repository  and javax/jcr/credential
and both class files are within javax package and that package is within
jcr-1.0.jar file

please please tell i'm waiting for your reply
and please tell me in detail


Thank you
simer

Re: Exception in thread "main" java.lang.NoClassDefFoundError: javax/jcr/Repository

Posted by simer anand <si...@gmail.com>.
yeah
i hope you are talking about the defalut repository created by the
FirstHop program and since i have one after running the FirstHop program
 but its empty now and along with creating it is also showing some error
:
:
588 [main] WARN org.apache.jackrabbit.core.config.ConfigurationErrorHandler
- Fatal error parsing the configuration at line 1 using system id
file:/home/sda_tr1/Desktop/program_files/repository.xml:
org.xml.sax.SAXParseException: Premature end of file.
Exception in thread "main" javax.jcr.RepositoryException: Invalid repository
configuration: repository.xml: Configuration file syntax error. (Line: 1
Column: 1): Premature end of file.: Configuration file syntax error. (Line:
1 Column: 1): Premature end of file.: Premature end of file .


 Kristian Rink :last message
> Well... no, but it should of course have a working / accessible instance of
> some object implementing Repository at hand to work... What is your
> "repository" defined like? What's the rest of this code that has these
> lines
> in it?
>
>
> K.
>
> --
> Kristian Rink
> http://pictorial.zimmer428.net # kawazu@jabber.org
> "What was once thought can never be unthought."
> (Duerrenmatt - 'Die Physiker')
>

Re: Exception in thread "main" java.lang.NoClassDefFoundError: javax/jcr/Repository

Posted by Kristian Rink <ka...@zimmer428.net>.
simer anand schrieb:
> no no
> i just wanted to ask is it a standalone program
> does his method getDescriptor require to call any other program or
> repository

Well... no, but it should of course have a working / accessible instance of
some object implementing Repository at hand to work... What is your
"repository" defined like? What's the rest of this code that has these lines
in it?

K.

-- 
Kristian Rink
http://pictorial.zimmer428.net # kawazu@jabber.org
"What was once thought can never be unthought."
(Duerrenmatt - 'Die Physiker')

Re: Exception in thread "main" java.lang.NoClassDefFoundError: javax/jcr/Repository

Posted by simer anand <si...@gmail.com>.
no no
i just wanted to ask is it a standalone program
does his method getDescriptor require to call any other program or
repository

On 7/22/09, Kristian Rink <ka...@zimmer428.net> wrote:
>
> simer anand schrieb:
> [...]
> >   *String* user = session.getUserID();
>
> >   *String* name = repository.getDescriptor(Repository.REP_NAME_DESC);
> >
> > these get methods
> > and i want to know from where these commands are getting the parameter
> data
> > getDescriptor (Respository.REP_NAME_DESC);
>
>
> Not exactly sure what your problem with these lines of code might be, as it
> seems pretty much self-explanatory - Repository.REP_NAME_DESC is a constant
> public field provided by Repository... Is that what you mean?
>
>
> > and i'm not able to execute the program
> > so please tell either this program to be substitute with other program or
> > repository
>
>
> What means "i'm not able to execute the program"? What happens?
>
>
> K.
>
>
> --
> Kristian Rink
> http://pictorial.zimmer428.net # kawazu@jabber.org
> "What was once thought can never be unthought."
> (Duerrenmatt - 'Die Physiker')
>

Re: Exception in thread "main" java.lang.NoClassDefFoundError: javax/jcr/Repository

Posted by Kristian Rink <ka...@zimmer428.net>.
simer anand schrieb:
[...]
>   *String* user = session.getUserID();
>   *String* name = repository.getDescriptor(Repository.REP_NAME_DESC);
> 
> these get methods
> and i want to know from where these commands are getting the parameter data
> getDescriptor (Respository.REP_NAME_DESC);

Not exactly sure what your problem with these lines of code might be, as it
seems pretty much self-explanatory - Repository.REP_NAME_DESC is a constant
public field provided by Repository... Is that what you mean?

> and i'm not able to execute the program
> so please tell either this program to be substitute with other program or
> repository

What means "i'm not able to execute the program"? What happens?

K.

-- 
Kristian Rink
http://pictorial.zimmer428.net # kawazu@jabber.org
"What was once thought can never be unthought."
(Duerrenmatt - 'Die Physiker')

Re: Exception in thread "main" java.lang.NoClassDefFoundError: javax/jcr/Repository

Posted by simer anand <si...@gmail.com>.
hi users

i was trying executing the hop1 program and found

  *String* user = session.getUserID();
            *String* name = repository.getDescriptor(Repository.REP_NAME_DESC);

these get methods
and i want to know from where these commands are getting the parameter data
getDescriptor (Respository.REP_NAME_DESC);

and i'm not able to execute the program
so please tell either this program to be substitute with other program or
repository

please reply soon if possible as it is an very simple query

Re: Exception in thread "main" java.lang.NoClassDefFoundError: javax/jcr/Repository

Posted by Ian Boston <ie...@tfd.co.uk>.
Shouting will not help, it tends to distort your voice and no one can  
hear what you are saying :). fortunately I turned the volume down  
before opening your email (just this once).

The you are having is a classpath problem.

IIRC
"java -cp ."

will remove $CLASSPATH from the classpath

try adding . to the start of the CLASSPATH.

If that fails read [1] or [2]

[1] http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/java.html
[2] http://java.sun.com/docs/books/tutorial/essential/environment/cmdLineArgs.html


On 22 Jul 2009, at 08:24, simer anand wrote:

> IS THERE NO ONE WHO CAN HELP ME IN THIS CASE
>
>
> On 7/22/09, simer anand <si...@gmail.com> wrote:
>>
>> sir
>>
>> I'm working on linux(mandriva)
>> and following is the command
>>
>>
>> [sda_tr1@cad44 hop files]$ javac FirstHop.java
>>
>> [sda_tr1@cad44 hop files]$ java FirstHop
>>
>> Exception in thread "main" java.lang. NoClassDefFoundError: FirstHop
>> Caused by: java.lang.ClassNotFoundException: FirstHop
>>        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
>>        at java.security.AccessController.doPrivileged(Native Method)
>>        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
>>        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java: 
>> 301)
>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
>>        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java: 
>> 320)
>> Could not find the main class: FirstHop.  Program will exit.
>>
>>
>> and then when i execute with this command
>>
>>
>> [sda_tr1@cad44 hop files]$ java -classpath . FirstHop
>>
>> Exception in thread "main" java.lang.NoClassDefFoundError:javax/jcr/ 
>> Repository
>> Caused by: java.lang.ClassNotFoundException: javax.jcr.Repository
>>        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
>>        at java.security.AccessController.doPrivileged(Native Method)
>>        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
>>        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java: 
>> 301)
>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
>>        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java: 
>> 320)
>> Could not find the main class: FirstHop.  Program will exit.
>>
>>
>> and further my .cshrc file's classpath is :
>>
>> setenv CLASSPATH
>>
>> /home/sda_tr1/Desktop/simer/apache-tomcat-6.0.20/webapps/jackrabbit- 
>> webapp-1.5.6/WEB-INF/lib/
>> jcr-1.0.jar
>> :/home/sda_tr1/Desktop/simer/apache-tomcat-6.0.20/webapps/ 
>> jackrabbit-webapp-1.5.6/WEB-INF/lib/
>> jackrabbit-api-1.5.0.jar:/home/
>>
>> sda_tr1/Desktop/simer/apache-tomcat-6.0.20/webapps/jackrabbit- 
>> webapp-1.5.6/WEB-INF/lib/
>> jackrabbit-core-1.5.6.jar:/home/sda_
>>
>> tr1/Desktop/simer/apache-tomcat-6.0.20/webapps/jackrabbit- 
>> webapp-1.5.6/WEB-INF/lib/
>> jackrabbit-jcr-commons-1.5.5.jar:/home/s
>>
>> da_tr1/Desktop/simer/apache-tomcat-6.0.20/webapps/jackrabbit- 
>> webapp-1.5.6/WEB-INF/lib/
>> jackrabbit-spi-1.5.0.jar:/home/sda_tr
>>
>> 1/Desktop/simer/apache-tomcat-6.0.20/webapps/jackrabbit- 
>> webapp-1.5.6/WEB-INF/lib/
>> jackrabbit-spi-commons-1.5.5.jar:/home/sda
>>
>> _tr1/Desktop/simer/apache-tomcat-6.0.20/webapps/jackrabbit- 
>> webapp-1.5.6/WEB-INF/lib/
>> jackrabbit-text-extractors-1.5.0.jar:/h
>>
>> ome/sda_tr1/Desktop/simer/apache-tomcat-6.0.20/webapps/jackrabbit- 
>> webapp-1.5.6/WEB-INF/lib/
>> slf4j-api-1.5.3.jar:/home/sda_tr
>>
>> 1/Desktop/simer/apache-tomcat-6.0.20/webapps/jackrabbit- 
>> webapp-1.5.6/WEB-INF/lib/
>> slf4j-simple-1.3.0.jar:/home/sda_tr1/Deskt
>>
>> op/simer/apache-tomcat-6.0.20/webapps/jackrabbit-webapp-1.5.6/WEB- 
>> INF/lib/webapps/jackrabbit-webapp-1.5.6/WEB-INF/lib/commo
>>
>> ns-collections-3.1.jar
>> :/home/sda_tr1/Desktop/simer/apache-tomcat-6.0.20/webapps/ 
>> jackrabbit-webapp-1.5.6/WEB-INF/lib/lucene-
>>
>> core-2.3.2.jar
>> :/home/sda_tr1/Desktop/simer/apache-tomcat-6.0.20/webapps/ 
>> jackrabbit-webapp-1.5.6/WEB-INF/lib/derby-10.2.1.6.
>>
>> jar
>> :/home/sda_tr1/Desktop/simer/apache-tomcat-6.0.20/webapps/ 
>> jackrabbit-webapp-1.5.6/WEB-INF/lib/
>> concurrent-1.3.4.jar:/home
>>
>> /sda_tr1/Desktop/simer/apache-tomcat-6.0.20/webapps/jackrabbit- 
>> webapp-1.5.6/WEB-INF/lib/
>> log4j-1.2.14.jar
>>
>> and what i have found is when i execute both the programs then bug is
>> coming
>> from javax package
>> javax/jcr/repository  and javax/jcr/credential
>> and both class files are within javax package and that package is  
>> within
>> jcr-1.0.jar file
>>
>> please please tell i'm waiting for your reply
>> and please tell me in detail
>>
>>
>> Thank you
>> simer
>>


Re: Exception in thread "main" java.lang.NoClassDefFoundError: javax/jcr/Repository

Posted by Kristian Rink <ka...@zimmer428.net>.
Hi there;

simer anand schrieb:

>> and then when i execute with this command
>>
>>
>> [sda_tr1@cad44 hop files]$ java -classpath . FirstHop

Tried something like "java -classpath $CLASSPATH:. FirstHop" ? I am not sure
at the moment whether the "-classpath" option adds to a predefined CLASSPATH
variable or rather replaces it...

Cheers,
Kristian


-- 
Kristian Rink
http://pictorial.zimmer428.net # kawazu@jabber.org
"What was once thought can never be unthought."
(Duerrenmatt - 'Die Physiker')

Re: Exception in thread "main" java.lang.NoClassDefFoundError: javax/jcr/Repository

Posted by simer anand <si...@gmail.com>.
IS THERE NO ONE WHO CAN HELP ME IN THIS CASE


On 7/22/09, simer anand <si...@gmail.com> wrote:
>
> sir
>
> I'm working on linux(mandriva)
> and following is the command
>
>
> [sda_tr1@cad44 hop files]$ javac FirstHop.java
>
> [sda_tr1@cad44 hop files]$ java FirstHop
>
> Exception in thread "main" java.lang. NoClassDefFoundError: FirstHop
> Caused by: java.lang.ClassNotFoundException: FirstHop
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
>         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
> Could not find the main class: FirstHop.  Program will exit.
>
>
> and then when i execute with this command
>
>
> [sda_tr1@cad44 hop files]$ java -classpath . FirstHop
>
> Exception in thread "main" java.lang.NoClassDefFoundError:javax/jcr/Repository
> Caused by: java.lang.ClassNotFoundException: javax.jcr.Repository
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
>         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
> Could not find the main class: FirstHop.  Program will exit.
>
>
> and further my .cshrc file's classpath is :
>
> setenv CLASSPATH
>
> /home/sda_tr1/Desktop/simer/apache-tomcat-6.0.20/webapps/jackrabbit-webapp-1.5.6/WEB-INF/lib/
> jcr-1.0.jar
> :/home/sda_tr1/Desktop/simer/apache-tomcat-6.0.20/webapps/jackrabbit-webapp-1.5.6/WEB-INF/lib/
> jackrabbit-api-1.5.0.jar:/home/
>
> sda_tr1/Desktop/simer/apache-tomcat-6.0.20/webapps/jackrabbit-webapp-1.5.6/WEB-INF/lib/
> jackrabbit-core-1.5.6.jar:/home/sda_
>
> tr1/Desktop/simer/apache-tomcat-6.0.20/webapps/jackrabbit-webapp-1.5.6/WEB-INF/lib/
> jackrabbit-jcr-commons-1.5.5.jar:/home/s
>
> da_tr1/Desktop/simer/apache-tomcat-6.0.20/webapps/jackrabbit-webapp-1.5.6/WEB-INF/lib/
> jackrabbit-spi-1.5.0.jar:/home/sda_tr
>
> 1/Desktop/simer/apache-tomcat-6.0.20/webapps/jackrabbit-webapp-1.5.6/WEB-INF/lib/
> jackrabbit-spi-commons-1.5.5.jar:/home/sda
>
> _tr1/Desktop/simer/apache-tomcat-6.0.20/webapps/jackrabbit-webapp-1.5.6/WEB-INF/lib/
> jackrabbit-text-extractors-1.5.0.jar:/h
>
> ome/sda_tr1/Desktop/simer/apache-tomcat-6.0.20/webapps/jackrabbit-webapp-1.5.6/WEB-INF/lib/
> slf4j-api-1.5.3.jar:/home/sda_tr
>
> 1/Desktop/simer/apache-tomcat-6.0.20/webapps/jackrabbit-webapp-1.5.6/WEB-INF/lib/
> slf4j-simple-1.3.0.jar:/home/sda_tr1/Deskt
>
> op/simer/apache-tomcat-6.0.20/webapps/jackrabbit-webapp-1.5.6/WEB-INF/lib/webapps/jackrabbit-webapp-1.5.6/WEB-INF/lib/commo
>
> ns-collections-3.1.jar
> :/home/sda_tr1/Desktop/simer/apache-tomcat-6.0.20/webapps/jackrabbit-webapp-1.5.6/WEB-INF/lib/lucene-
>
> core-2.3.2.jar
> :/home/sda_tr1/Desktop/simer/apache-tomcat-6.0.20/webapps/jackrabbit-webapp-1.5.6/WEB-INF/lib/derby-10.2.1.6.
>
> jar
> :/home/sda_tr1/Desktop/simer/apache-tomcat-6.0.20/webapps/jackrabbit-webapp-1.5.6/WEB-INF/lib/
> concurrent-1.3.4.jar:/home
>
> /sda_tr1/Desktop/simer/apache-tomcat-6.0.20/webapps/jackrabbit-webapp-1.5.6/WEB-INF/lib/
> log4j-1.2.14.jar
>
> and what i have found is when i execute both the programs then bug is
> coming
> from javax package
> javax/jcr/repository  and javax/jcr/credential
> and both class files are within javax package and that package is within
> jcr-1.0.jar file
>
> please please tell i'm waiting for your reply
> and please tell me in detail
>
>
> Thank you
> simer
>

Re: Exception in thread "main" java.lang.NoClassDefFoundError: javax/jcr/Repository

Posted by simer anand <si...@gmail.com>.
On 7/21/09, Ian Boston <ie...@tfd.co.uk> wrote:
>
> What classloader environment are you running in ? OSGi ?
>
> NoClassDefFoundError means that the Class was found but the byte array
> associated with the class could not be loaded (hence no definition).
> If the class is not in your classpath, then you will normally get a
> ClassNotFoundException.
>
> The only time I have seen a NoClassDefFoundError is
> a) when the jar is corrupt or
> b) in OSGi where there is no bundle import (in the manifest)  on the
> package in question.
>
> OSGi classloaders apply rules to finding and loading classes, you may be in
> an environment with similar rules.
>
> HTH
> Ian
>
>
> On 21 Jul 2009, at 08:17, simer anand wrote:
>
>  ya
>> but i do have have jcr-1.0.jar in my classpath
>> and javax/jcr/respository.class is within it
>
>

how to know what class loader i'm using

Re: Exception in thread "main" java.lang.NoClassDefFoundError: javax/jcr/Repository

Posted by Ian Boston <ie...@tfd.co.uk>.
What classloader environment are you running in ? OSGi ?

NoClassDefFoundError means that the Class was found but the byte array  
associated with the class could not be loaded (hence no definition).
If the class is not in your classpath, then you will normally get a  
ClassNotFoundException.

The only time I have seen a NoClassDefFoundError is
a) when the jar is corrupt or
b) in OSGi where there is no bundle import (in the manifest)  on the  
package in question.

OSGi classloaders apply rules to finding and loading classes, you may  
be in an environment with similar rules.

HTH
Ian


On 21 Jul 2009, at 08:17, simer anand wrote:

> ya
> but i do have have jcr-1.0.jar in my classpath
> and javax/jcr/respository.class is within it