[Netbeans] errore di java.lang.NoClassDefFoundError[Risolto]

di il
1 risposte

[Netbeans] errore di java.lang.NoClassDefFoundError[Risolto]

Buonasera. Ho appena installato Netbeans 8.2 in sostituzione della 7.4 e non riesco a compilare un programma java che prima funzionava.
L'errore è il seguente:

.............
Created dir: /home/sanp/Pubblici/Netbeans/MieiProgetti/kcd11/build/empty
Created dir: /home/sanp/Pubblici/Netbeans/MieiProgetti/kcd11/build/generated-sources/ap-source-output
Compiling 38 source files to /home/sanp/Pubblici/Netbeans/MieiProgetti/kcd11/build/classes
warning: [options] bootstrap class path not set in conjunction with -source 1.6
error: Bad service configuration file, or exception thrown while constructing Processor object: javax.annotation.processing.Processor: Provider org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor could not be instantiated: java.lang.NoClassDefFoundError: org/eclipse/persistence/internal/sessions/AbstractSession
/home/sanp/Pubblici/Netbeans/MieiProgetti/kcd11/nbproject/build-impl.xml:920: The following error occurred while executing this line:
/home/sanp/Pubblici/Netbeans/MieiProgetti/kcd11/nbproject/build-impl.xml:260: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 0 seconds)


Riporto le 2 istruzioni citate:

build-impl.xml:920:
    </target>
       <target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources" name="-do-compile">
920      <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>
           <copy todir="${build.classes.dir}">
               <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
           </copy>
       </target>
build-impl.xml:260:

            <sequential>
                <property location="${build.dir}/empty" name="empty.dir"/>
                <mkdir dir="${empty.dir}"/>
                <mkdir dir="@{apgeneratedsrcdir}"/>
260            <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
                    <src>
                        <dirset dir="@{gensrcdir}" erroronmissingdir="false">
                            <include name="*"/>
                        </dirset>
                    </src>
                    <classpath>
                        <path path="@{classpath}"/>
                    </classpath>
                    <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
                    <compilerarg line="${javac.profile.cmd.line.arg}"/>
                    <compilerarg line="${javac.compilerargs}"/>
                    <compilerarg value="-processorpath"/>
                    <compilerarg path="@{processorpath}:${empty.dir}"/>
                    <compilerarg line="${ap.processors.internal}"/>
                    <compilerarg line="${annotation.processing.processor.options}"/>
                    <compilerarg value="-s"/>
                    <compilerarg path="@{apgeneratedsrcdir}"/>
                    <compilerarg line="${ap.proc.none.internal}"/>
                    <customize/>
                </javac>
            </sequential>
Per quanto riguarda la classe AbstractSession è presente in EclipseLink.jar quindi non mi spiego l'errore:
error: Bad service configuration file, or exception thrown while constructing Processor object: javax.annotation.processing.Processor: Provider org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor could not be instantiated: java.lang.NoClassDefFoundError: org/eclipse/persistence/internal/sessions/AbstractSession
di cui sopra.
Grazie.

1 Risposte

  • Re: [Netbeans] errore di java.lang.NoClassDefFoundError[Risolto]

    Mi rispondo da solo... ho trovato la soluzione.

    Solution:
    - Edit nbprojec/project.properties file:
    - Search for javac.processorpath, and change it to:
    javac.processorpath=\
    ${javac.classpath}:\
    ${libs.eclipselink.classpath}
Devi accedere o registrarti per scrivere nel forum
1 risposte