#1016 java.lang.NoClassDefFoundError: org/jaxen/Function

PMD-5.0.3
not-reproducible
pmd (543)
PMD
3-Major
Bug
2014-12-23
2012-07-19
No

Bug id: 3545810: Not fixed. I only told there was a copy paste error when reporting the bug!.. Sorry if I meant it wrong...

The build.xml is as follows:

<target name="init_build" depends="clean">
<property environment="env"/>
<property name="srcDir" value="${basedir}"/>
<property name="libraryDir" value="${basedir}/lib"/>
<property name="deployDir" value="${basedir}/deploy"/>
<property name="jarDeployDirName" value="jarfiledir"/>
<property name="jarDeployDir" value="${deployDir}/${jarDeployDirName}"/>
<property name="manifestFileName" value="MANIFEST.MF"/>
<mkdir dir="${deployDir}"/>
<mkdir dir="${jarDeployDir}"/>
<property name="pmdLibraryDir" value="/opt/software_tools/pmd/lib/"/>

    <path id="compile.classpath">
        <fileset dir="${libraryDir}">
            <include name="**/*.jar" />
        </fileset>
    </path>

    <path id="pmd.classpath">
            <pathelement location="${srcDir}"/>
            <fileset dir="${pmdLibraryDir}">
            <include name="**/*.jar" />
        </fileset>
    </path>

<target name="pmd" description="Static analysis of code with PMD">
    <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd.classpath"/>
    <pmd rulesetfiles="rulesets/java/basic.xml">
    <formatter type="xml" toFile="${ant.project.name}_pmd.xml"/>
        <fileset dir="${basedir}">
            <include name="**/*.java"/>
        </fileset>
    </pmd>
</target>

==========
The output is:
pmd:
[echo] /home/build/cougar:/opt/software_tools/pmd/lib/ant-1.8.1.jar:/opt/software_tools/pmd/lib/ant-launcher-1.8.1.jar:/opt/software_tools/pmd/lib/ant-testutil-1.7.1.jar:/opt/software_tools/pmd/lib/asm-3.2.jar:/opt/software_tools/pmd/lib/dom4j-1.6.1.jar:/opt/software_tools/pmd/lib/icu4j-2.6.1.jar:/opt/software_tools/pmd/lib/javacc-4.1.jar:/opt/software_tools/pmd/lib/jaxen-1.1.4.jar:/opt/software_tools/pmd/lib/jdom-1.0.jar:/opt/software_tools/pmd/lib/junit-4.4.jar:/opt/software_tools/pmd/lib/pmd-5.0.0.jar:/opt/software_tools/pmd/lib/rhino-1.7R3.jar:/opt/software_tools/pmd/lib/saxon-9.1.0.8.jar:/opt/software_tools/pmd/lib/xalan-2.6.0.jar:/opt/software_tools/pmd/lib/xercesImpl-2.9.1.jar:/opt/software_tools/pmd/lib/xml-apis-1.3.02.jar:/opt/software_tools/pmd/lib/xmlParserAPIs-2.6.2.jar:/opt/software_tools/pmd/lib/xom-1.0.jar

BUILD FAILED
java.lang.NoClassDefFoundError: org/jaxen/Function
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 java.lang.ClassLoader.loadClass(ClassLoader.java:266)
at net.sourceforge.pmd.lang.xpath.Initializer.initializeGlobal(Initializer.java:49)
at net.sourceforge.pmd.lang.xpath.Initializer.<clinit>(Initializer.java:44)
at net.sourceforge.pmd.SourceCodeProcessor.processSourceCode(SourceCodeProcessor.java:69)
at net.sourceforge.pmd.SourceCodeProcessor.processSourceCode(SourceCodeProcessor.java:42)
at net.sourceforge.pmd.processor.PmdRunnable.call(PmdRunnable.java:75)
at net.sourceforge.pmd.processor.PmdRunnable.call(PmdRunnable.java:22)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:679)
Caused by: java.lang.ClassNotFoundException: org.jaxen.Function
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 java.lang.ClassLoader.loadClass(ClassLoader.java:266)
... 21 more

=======

java.lang.NoClassDefFoundError: org/jaxen/Function: Occurs everytime. As I told, I tried every trick, put still I am getting the above exception. Kindly provide a fix at the earliest.

Discussion

  • Romain PELISSE

    Romain PELISSE - 2012-07-19

    Can you check if the jaxen jar is not corrupted ?

    $ file /opt.../jaxen-1.1.4.jar

    And also check that the "missing class" is indeed in the jar:

    $ unzip -t /opt/.../jaxen-1.1.4.jar | grep 'org/jaxen/Function'

     
  • Rathnadhar.K.V

    Rathnadhar.K.V - 2012-07-19

    unzip -t /opt/.../jaxen-1.1.4.jar
    No errors detected in compressed data of jaxen-1.1.4.jar.
    ================
    unzip -t /opt/.../jaxen-1.1.4.jar | grep 'org/jaxen/Function'
    testing: org/jaxen/Function.class OK
    testing: org/jaxen/FunctionCallException.class OK
    testing: org/jaxen/FunctionContext.class OK
    =====
    Jaxen seems to be OK...

     
  • Andreas Dangel

    Andreas Dangel - 2013-01-26

    Which version of PMD are you using? Is it pmd 5.0.0?

    What I don't understand is, from where jaxen-1.1.4 is coming from. We ship PMD still with jaxen-1.1.1 (although we should probably update, but that's another story).

    Did you maybe copy manually the jaxen-1.1.4 jar into pmd/lib directory? If so, this may or may not work... depending of which depencies jaxen itself needs. However, I can't reproduce the problem, even if I replace jaxen.

    Do you have anything under your ${srcDir} classpath? That's the only classpath element, I didn't use. Can you try to remove this from pmd.classpath?

     
  • Romain PELISSE

    Romain PELISSE - 2013-01-26
    • status: open --> pending
    • assigned_to: Tom Copeland --> Andreas Dangel
     
  • Andreas Dangel

    Andreas Dangel - 2013-03-17
    • status: pending --> more-info-needed
    • module: --> PMD
    • milestone: PMD-5.0.x --> PMD-5.0.3
    • priority: 5 --> 3-Major
    • type: --> Bug
    • affects_version: -->
     
  • Andreas Dangel

    Andreas Dangel - 2013-04-05
    • status: more-info-needed --> not-reproducible
     

Log in to post a comment.