lucene-pylucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andi Vajda <va...@apache.org>
Subject Re: real reason for java.lang.NoClassDefFoundError ?
Date Wed, 09 Mar 2011 17:39:44 GMT

On Wed, 9 Mar 2011, Anton Korosov wrote:

> I'm trying to use BEAM/Visat software in Python. It is a large project
> with > 100 JARs. I try to 'convert' these JARs into Python specifying each
> after --jar option:
> python -m jcc.__init__ \
> --python testbeam \
> --jar /host/local/beam-4.8/modules/beam-landsat-reader-1.2.1.jar \
> --jar /host/local/beam-4.8/modules/beam-meris-boreal-lakes-1.4.2.jar \
> --jar /host/local/beam-4.8/modules/beam-meris-case2-core-1.4.2.jar \
> --jar /host/local/beam-4.8/modules/beam-meris-case2-regional-1.4.2.jar \
> --jar /host/local/beam-4.8/modules/beam-meris-cloud-1.5.203.jar \
> --jar /host/local/beam-4.8/modules/beam-meris-eutrophic-lakes-1.4.2.jar \
> --jar /host/local/beam-4.8/modules/beam-merisl3-reader-1.1.jar \
> ...

If any of these jar files depend on other jar files not listed with --jar, 
such as lucene's (as you hint below with QueryParser not being found) then 
you must list lucene's jar on --classpath or ensure it's on the CLASSPATH 
env var.

Also, you only need to list --jar files whose public classes you want to 
make accessible from Python. Dependencies can be listed with --classpath or 
--include.
See output of 'python -m jcc.__main__' for details about JCC's command line 
flags.

Andi..

>
> However I immediately got error:
> While loading com/jidesoft/lucene/c$1
> Traceback (most recent call last):
>  File "/usr/lib/python2.6/runpy.py", line 122, in _run_module_as_main
>    "__main__", fname, loader, pkg_name)
>  File "/usr/lib/python2.6/runpy.py", line 34, in _run_code
>    exec code in run_globals
>  File
> "/usr/local/lib/python2.6/dist-packages/JCC-2.7-py2.6-linux-x86_64.egg/jcc/__init__.py",
> line 32, in <module>
>    import jcc.__main__
>  File
> "/usr/local/lib/python2.6/dist-packages/JCC-2.7-py2.6-linux-x86_64.egg/jcc/__main__.py",
> line 98, in <module>
>    cpp.jcc(sys.argv)
>  File
> "/usr/local/lib/python2.6/dist-packages/JCC-2.7-py2.6-linux-x86_64.egg/jcc/cpp.py",
> line 501, in jcc
>    cls = findClass(className.replace('.', '/'), iii)
>  File
> "/usr/local/lib/python2.6/dist-packages/JCC-2.7-py2.6-linux-x86_64.egg/jcc/cpp.py",
> line 73, in findClass
>    cls = _findClass(className)
> jcc.cpp.JavaError: java.lang.NoClassDefFoundError:
> org/apache/lucene/queryParser/QueryParser
> Java stacktrace:
> java.lang.NoClassDefFoundError: org/apache/lucene/queryParser/QueryParser
> 	at java.lang.ClassLoader.defineClass1(Native Method)
> 	at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
> 	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
> 	at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
> 	at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
> 	at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
> 	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
> Caused by: java.lang.ClassNotFoundException:
> org.apache.lucene.queryParser.QueryParser
> 	at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
> 	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
> 	... 11 more
>
> Why is that? Does that mean that the class com/jidesoft/lucene/c$1 has
> reference to a class org/apache/lucene/queryParser/QueryParser but the
> latter is not given in any JAR?
>
> How can such situation occur if Beam/Visat works perfectly? Could it be
> that Beam/Visat simply don't call
> org/apache/lucene/queryParser/QueryParser ?
>
> What should I do? Download a JAR with
> org/apache/lucene/queryParser/QueryParser or rather --exclude
> com/jidesoft/lucene/c ? Will it influence performance of the Python
> module?
>
> Thank you very much for any ideas/suggestions!
> Anton
>

Mime
View raw message