Why java.lang.NoClassDefFoundError: org/netbeans/modules/parsing/spi/ParseException for JavaSource.forFileObject(fileObj);

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Why java.lang.NoClassDefFoundError: org/netbeans/modules/parsing/spi/ParseException for JavaSource.forFileObject(fileObj);

Gabriele Kahlout
java.lang.NoClassDefFoundError: org/netbeans/modules/parsing/spi/ParseException


 File srcFile = new File(srcDir, includedFiles[0]);
            if(!srcFile.exists()){
                msgr.printMessage(Kind.ERROR, "file?" + e);
            }
            FileObject fileObj = FileUtil.toFileObject(srcFile);
            final JavaSource classSource = JavaSource.forFileObject(fileObj);

I've no idea why the bold line throws this exception. It smells of C!

--
Regards,
K. Gabriele

--- unchanged since 20/9/10 ---
P.S. If the subject contains "[LON]" or the addressee acknowledges the receipt within 48 hours then I don't resend the email.
subject(this) ∈ L(LON*) ∨ ∃x. (x ∈ MyInbox ∧ Acknowledges(x, this) ∧ time(x) < Now + 48h) ⇒ ¬resend(I, this).

If an email is sent by a sender that is not a trusted contact or the email does not contain a valid code then the email is not received. A valid code starts with a hyphen and ends with "X".
∀x. x ∈ MyInbox ⇒ from(x) ∈ MySafeSenderList ∨ (∃y. y ∈ subject(x) ∧ y ∈ L(-[a-z]+[0-9]X)).

Reply | Threaded
Open this post in threaded view
|

Re: Why java.lang.NoClassDefFoundError: org/netbeans/modules/parsing/spi/ParseException for JavaSource.forFileObject(fileObj);

Edvin Syse
Does this module have access to org-openide-text, org-openide-loaders, org-openide-filesystems, org-netbeans-api-annotations-common, and are you using Sun/Oracle JDK, not OpenJDK?

-- Edvin

Den 21. des. 2010 kl. 10.34 skrev Gabriele Kahlout:

> java.lang.NoClassDefFoundError: org/netbeans/modules/parsing/spi/ParseException
>
>
>  File srcFile = new File(srcDir, includedFiles[0]);
>             if(!srcFile.exists()){
>                 msgr.printMessage(Kind.ERROR, "file?" + e);
>             }
>             FileObject fileObj = FileUtil.toFileObject(srcFile);
>             final JavaSource classSource = JavaSource.forFileObject(fileObj);
>
> I've no idea why the bold line throws this exception. It smells of C!
>
> --
> Regards,
> K. Gabriele
>
> --- unchanged since 20/9/10 ---
> P.S. If the subject contains "[LON]" or the addressee acknowledges the receipt within 48 hours then I don't resend the email.
> subject(this) ∈ L(LON*) ∨ ∃x. (x ∈ MyInbox ∧ Acknowledges(x, this) ∧ time(x) < Now + 48h) ⇒ ¬resend(I, this).
>
> If an email is sent by a sender that is not a trusted contact or the email does not contain a valid code then the email is not received. A valid code starts with a hyphen and ends with "X".
> ∀x. x ∈ MyInbox ⇒ from(x) ∈ MySafeSenderList ∨ (∃y. y ∈ subject(x) ∧ y ∈ L(-[a-z]+[0-9]X)).
>

Reply | Threaded
Open this post in threaded view
|

Re: Why java.lang.NoClassDefFoundError: org/netbeans/modules/parsing/spi/ParseException for JavaSource.forFileObject(fileObj);

Gabriele Kahlout
I daresay yes to all.  This is the pom and the mentioned dependencies are transative:

"JAVA_HOME=C:\\Program Files\\Java\\jdk1.6.0_18"

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.mysimpatico.se</groupId>
    <artifactId>DemoAnn</artifactId>
    <name>DemoAnn</name>
    <packaging>jar</packaging>
    <version>1.0-SNAPSHOT</version>
    <url>http://maven.apache.org</url>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <compilerArgument>-proc:none</compilerArgument>
                    <encoding>${project.build.sourceEncoding}</encoding>
                </configuration>
                <executions>
                    <execution>
                        <id>run-annotation-processor-only</id>
                        <phase>process-test-resources</phase>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                        <configuration>
                            <compilerArgument>-proc:only</compilerArgument>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.4.3</version>
                <configuration>
                    <encoding>${project.build.sourceEncoding}</encoding>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.8.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-utils</artifactId>
            <version>2.0.5</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>org.netbeans.api</groupId>
            <artifactId>org-netbeans-modules-java-source</artifactId>
            <version>RELEASE691</version>
        </dependency>
    </dependencies>
   
     <repositories>
        <!--
        Repository hosting NetBeans modules, especially APIs.
        Versions are based on IDE releases, e.g.: RELEASE691
        To create your own repository, use: nbm:populate-repository
        -->
        <repository>
            <id>netbeans</id>
            <name>NetBeans</name>
            <url>http://bits.netbeans.org/maven2/</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>
   
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

</project>



On 21 December 2010 12:44, [hidden email] <[hidden email]> wrote:
Does this module have access to org-openide-text, org-openide-loaders, org-openide-filesystems, org-netbeans-api-annotations-common, and are you using Sun/Oracle JDK, not OpenJDK?

-- Edvin

Den 21. des. 2010 kl. 10.34 skrev Gabriele Kahlout:

> java.lang.NoClassDefFoundError: org/netbeans/modules/parsing/spi/ParseException
>
>
>  File srcFile = new File(srcDir, includedFiles[0]);
>             if(!srcFile.exists()){
>                 msgr.printMessage(Kind.ERROR, "file?" + e);
>             }
>             FileObject fileObj = FileUtil.toFileObject(srcFile);
>             final JavaSource classSource = JavaSource.forFileObject(fileObj);
>
> I've no idea why the bold line throws this exception. It smells of C!
>
> --
> Regards,
> K. Gabriele
>
> --- unchanged since 20/9/10 ---
> P.S. If the subject contains "[LON]" or the addressee acknowledges the receipt within 48 hours then I don't resend the email.
> subject(this) ∈ L(LON*) ∨ ∃x. (x ∈ MyInbox ∧ Acknowledges(x, this) ∧ time(x) < Now + 48h) ⇒ ¬resend(I, this).
>
> If an email is sent by a sender that is not a trusted contact or the email does not contain a valid code then the email is not received. A valid code starts with a hyphen and ends with "X".
> ∀x. x ∈ MyInbox ⇒ from(x) ∈ MySafeSenderList ∨ (∃y. y ∈ subject(x) ∧ y ∈ L(-[a-z]+[0-9]X)).
>




--
Regards,
K. Gabriele

--- unchanged since 20/9/10 ---
P.S. If the subject contains "[LON]" or the addressee acknowledges the receipt within 48 hours then I don't resend the email.
subject(this) ∈ L(LON*) ∨ ∃x. (x ∈ MyInbox ∧ Acknowledges(x, this) ∧ time(x) < Now + 48h) ⇒ ¬resend(I, this).

If an email is sent by a sender that is not a trusted contact or the email does not contain a valid code then the email is not received. A valid code starts with a hyphen and ends with "X".
∀x. x ∈ MyInbox ⇒ from(x) ∈ MySafeSenderList ∨ (∃y. y ∈ subject(x) ∧ y ∈ L(-[a-z]+[0-9]X)).

Reply | Threaded
Open this post in threaded view
|

Re: Why java.lang.NoClassDefFoundError: org/netbeans/modules/parsing/spi/ParseException for JavaSource.forFileObject(fileObj);

Edvin Syse
Hmm.. from http://mojo.codehaus.org/nbm-maven-plugin/:

"There are important differences between Maven's dependency mechanism and NetBeans runtime dependencies. Maven's dependencies are transitive, so at compile time you get not only direct dependencies you declared, but also dependencies of dependencies etc. In NetBeans, the module dependencies are non-transitive by nature, you have to explicitly declare all at runtime."

Are you sure they are on your classpath at runtime?

Den 21. des. 2010 kl. 11.15 skrev Gabriele Kahlout:

> I daresay yes to all.  This is the pom and the mentioned dependencies are transative:
>
> "JAVA_HOME=C:\\Program Files\\Java\\jdk1.6.0_18"
>
> <?xml version="1.0" encoding="UTF-8"?>
> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
>     <modelVersion>4.0.0</modelVersion>
>     <groupId>com.mysimpatico.se</groupId>
>     <artifactId>DemoAnn</artifactId>
>     <name>DemoAnn</name>
>     <packaging>jar</packaging>
>     <version>1.0-SNAPSHOT</version>
>     <url>http://maven.apache.org</url>
>     <build>
>         <plugins>
>             <plugin>
>                 <artifactId>maven-compiler-plugin</artifactId>
>                 <version>2.3.2</version>
>                 <configuration>
>                     <source>1.6</source>
>                     <target>1.6</target>
>                     <compilerArgument>-proc:none</compilerArgument>
>                     <encoding>${project.build.sourceEncoding}</encoding>
>                 </configuration>
>                 <executions>
>                     <execution>
>                         <id>run-annotation-processor-only</id>
>                         <phase>process-test-resources</phase>
>                         <goals>
>                             <goal>testCompile</goal>
>                         </goals>
>                         <configuration>
>                             <compilerArgument>-proc:only</compilerArgument>
>                         </configuration>
>                     </execution>
>                 </executions>
>             </plugin>
>             <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-resources-plugin</artifactId>
>                 <version>2.4.3</version>
>                 <configuration>
>                     <encoding>${project.build.sourceEncoding}</encoding>
>                 </configuration>
>             </plugin>
>         </plugins>
>     </build>
>     <dependencies>
>         <dependency>
>             <groupId>junit</groupId>
>             <artifactId>junit</artifactId>
>             <version>4.8.2</version>
>             <scope>test</scope>
>         </dependency>
>         <dependency>
>             <groupId>org.codehaus.plexus</groupId>
>             <artifactId>plexus-utils</artifactId>
>             <version>2.0.5</version>
>             <type>jar</type>
>         </dependency>
>         <dependency>
>             <groupId>org.netbeans.api</groupId>
>             <artifactId>org-netbeans-modules-java-source</artifactId>
>             <version>RELEASE691</version>
>         </dependency>
>     </dependencies>
>    
>      <repositories>
>         <!--
>         Repository hosting NetBeans modules, especially APIs.
>         Versions are based on IDE releases, e.g.: RELEASE691
>         To create your own repository, use: nbm:populate-repository
>         -->
>         <repository>
>             <id>netbeans</id>
>             <name>NetBeans</name>
>             <url>http://bits.netbeans.org/maven2/</url>
>             <snapshots>
>                 <enabled>false</enabled>
>             </snapshots>
>         </repository>
>     </repositories>
>    
>     <properties>
>         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
>     </properties>
>
> </project>
>
>
>
> On 21 December 2010 12:44, [hidden email] <[hidden email]> wrote:
> Does this module have access to org-openide-text, org-openide-loaders, org-openide-filesystems, org-netbeans-api-annotations-common, and are you using Sun/Oracle JDK, not OpenJDK?
>
> -- Edvin
>
> Den 21. des. 2010 kl. 10.34 skrev Gabriele Kahlout:
>
> > java.lang.NoClassDefFoundError: org/netbeans/modules/parsing/spi/ParseException
> >
> >
> >  File srcFile = new File(srcDir, includedFiles[0]);
> >             if(!srcFile.exists()){
> >                 msgr.printMessage(Kind.ERROR, "file?" + e);
> >             }
> >             FileObject fileObj = FileUtil.toFileObject(srcFile);
> >             final JavaSource classSource = JavaSource.forFileObject(fileObj);
> >
> > I've no idea why the bold line throws this exception. It smells of C!
> >
> > --
> > Regards,
> > K. Gabriele
> >
> > --- unchanged since 20/9/10 ---
> > P.S. If the subject contains "[LON]" or the addressee acknowledges the receipt within 48 hours then I don't resend the email.
> > subject(this) ∈ L(LON*) ∨ ∃x. (x ∈ MyInbox ∧ Acknowledges(x, this) ∧ time(x) < Now + 48h) ⇒ ¬resend(I, this).
> >
> > If an email is sent by a sender that is not a trusted contact or the email does not contain a valid code then the email is not received. A valid code starts with a hyphen and ends with "X".
> > ∀x. x ∈ MyInbox ⇒ from(x) ∈ MySafeSenderList ∨ (∃y. y ∈ subject(x) ∧ y ∈ L(-[a-z]+[0-9]X)).
> >
>
>
>
>
> --
> Regards,
> K. Gabriele
>
> --- unchanged since 20/9/10 ---
> P.S. If the subject contains "[LON]" or the addressee acknowledges the receipt within 48 hours then I don't resend the email.
> subject(this) ∈ L(LON*) ∨ ∃x. (x ∈ MyInbox ∧ Acknowledges(x, this) ∧ time(x) < Now + 48h) ⇒ ¬resend(I, this).
>
> If an email is sent by a sender that is not a trusted contact or the email does not contain a valid code then the email is not received. A valid code starts with a hyphen and ends with "X".
> ∀x. x ∈ MyInbox ⇒ from(x) ∈ MySafeSenderList ∨ (∃y. y ∈ subject(x) ∧ y ∈ L(-[a-z]+[0-9]X)).
>

Reply | Threaded
Open this post in threaded view
|

Re: Why java.lang.NoClassDefFoundError: org/netbeans/modules/parsing/spi/ParseException for JavaSource.forFileObject(fileObj);

Gabriele Kahlout
     <dependency>
            <groupId>org.netbeans.api</groupId>
            <artifactId>org-netbeans-modules-parsing-api</artifactId>
            <version>RELEASE691</version>
        </dependency>

was the dependency I missed. Thank you.

On 21 December 2010 13:18, [hidden email] <[hidden email]> wrote:
Hmm.. from http://mojo.codehaus.org/nbm-maven-plugin/:

"There are important differences between Maven's dependency mechanism and NetBeans runtime dependencies. Maven's dependencies are transitive, so at compile time you get not only direct dependencies you declared, but also dependencies of dependencies etc. In NetBeans, the module dependencies are non-transitive by nature, you have to explicitly declare all at runtime."

Are you sure they are on your classpath at runtime?

Den 21. des. 2010 kl. 11.15 skrev Gabriele Kahlout:

> I daresay yes to all.  This is the pom and the mentioned dependencies are transative:
>
> "JAVA_HOME=C:\\Program Files\\Java\\jdk1.6.0_18"
>
> <?xml version="1.0" encoding="UTF-8"?>
> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
>     <modelVersion>4.0.0</modelVersion>
>     <groupId>com.mysimpatico.se</groupId>
>     <artifactId>DemoAnn</artifactId>
>     <name>DemoAnn</name>
>     <packaging>jar</packaging>
>     <version>1.0-SNAPSHOT</version>
>     <url>http://maven.apache.org</url>
>     <build>
>         <plugins>
>             <plugin>
>                 <artifactId>maven-compiler-plugin</artifactId>
>                 <version>2.3.2</version>
>                 <configuration>
>                     <source>1.6</source>
>                     <target>1.6</target>
>                     <compilerArgument>-proc:none</compilerArgument>
>                     <encoding>${project.build.sourceEncoding}</encoding>
>                 </configuration>
>                 <executions>
>                     <execution>
>                         <id>run-annotation-processor-only</id>
>                         <phase>process-test-resources</phase>
>                         <goals>
>                             <goal>testCompile</goal>
>                         </goals>
>                         <configuration>
>                             <compilerArgument>-proc:only</compilerArgument>
>                         </configuration>
>                     </execution>
>                 </executions>
>             </plugin>
>             <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-resources-plugin</artifactId>
>                 <version>2.4.3</version>
>                 <configuration>
>                     <encoding>${project.build.sourceEncoding}</encoding>
>                 </configuration>
>             </plugin>
>         </plugins>
>     </build>
>     <dependencies>
>         <dependency>
>             <groupId>junit</groupId>
>             <artifactId>junit</artifactId>
>             <version>4.8.2</version>
>             <scope>test</scope>
>         </dependency>
>         <dependency>
>             <groupId>org.codehaus.plexus</groupId>
>             <artifactId>plexus-utils</artifactId>
>             <version>2.0.5</version>
>             <type>jar</type>
>         </dependency>
>         <dependency>
>             <groupId>org.netbeans.api</groupId>
>             <artifactId>org-netbeans-modules-java-source</artifactId>
>             <version>RELEASE691</version>
>         </dependency>
>     </dependencies>
>
>      <repositories>
>         <!--
>         Repository hosting NetBeans modules, especially APIs.
>         Versions are based on IDE releases, e.g.: RELEASE691
>         To create your own repository, use: nbm:populate-repository
>         -->
>         <repository>
>             <id>netbeans</id>
>             <name>NetBeans</name>
>             <url>http://bits.netbeans.org/maven2/</url>
>             <snapshots>
>                 <enabled>false</enabled>
>             </snapshots>
>         </repository>
>     </repositories>
>
>     <properties>
>         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
>     </properties>
>
> </project>
>
>
>
> On 21 December 2010 12:44, [hidden email] <[hidden email]> wrote:
> Does this module have access to org-openide-text, org-openide-loaders, org-openide-filesystems, org-netbeans-api-annotations-common, and are you using Sun/Oracle JDK, not OpenJDK?
>
> -- Edvin
>
> Den 21. des. 2010 kl. 10.34 skrev Gabriele Kahlout:
>
> > java.lang.NoClassDefFoundError: org/netbeans/modules/parsing/spi/ParseException
> >
> >
> >  File srcFile = new File(srcDir, includedFiles[0]);
> >             if(!srcFile.exists()){
> >                 msgr.printMessage(Kind.ERROR, "file?" + e);
> >             }
> >             FileObject fileObj = FileUtil.toFileObject(srcFile);
> >             final JavaSource classSource = JavaSource.forFileObject(fileObj);
> >
> > I've no idea why the bold line throws this exception. It smells of C!
> >
> > --
> > Regards,
> > K. Gabriele
> >
> > --- unchanged since 20/9/10 ---
> > P.S. If the subject contains "[LON]" or the addressee acknowledges the receipt within 48 hours then I don't resend the email.
> > subject(this) ∈ L(LON*) ∨ ∃x. (x ∈ MyInbox ∧ Acknowledges(x, this) ∧ time(x) < Now + 48h) ⇒ ¬resend(I, this).
> >
> > If an email is sent by a sender that is not a trusted contact or the email does not contain a valid code then the email is not received. A valid code starts with a hyphen and ends with "X".
> > ∀x. x ∈ MyInbox ⇒ from(x) ∈ MySafeSenderList ∨ (∃y. y ∈ subject(x) ∧ y ∈ L(-[a-z]+[0-9]X)).
> >
>
>
>
>
> --
> Regards,
> K. Gabriele
>
> --- unchanged since 20/9/10 ---
> P.S. If the subject contains "[LON]" or the addressee acknowledges the receipt within 48 hours then I don't resend the email.
> subject(this) ∈ L(LON*) ∨ ∃x. (x ∈ MyInbox ∧ Acknowledges(x, this) ∧ time(x) < Now + 48h) ⇒ ¬resend(I, this).
>
> If an email is sent by a sender that is not a trusted contact or the email does not contain a valid code then the email is not received. A valid code starts with a hyphen and ends with "X".
> ∀x. x ∈ MyInbox ⇒ from(x) ∈ MySafeSenderList ∨ (∃y. y ∈ subject(x) ∧ y ∈ L(-[a-z]+[0-9]X)).
>




--
Regards,
K. Gabriele

--- unchanged since 20/9/10 ---
P.S. If the subject contains "[LON]" or the addressee acknowledges the receipt within 48 hours then I don't resend the email.
subject(this) ∈ L(LON*) ∨ ∃x. (x ∈ MyInbox ∧ Acknowledges(x, this) ∧ time(x) < Now + 48h) ⇒ ¬resend(I, this).

If an email is sent by a sender that is not a trusted contact or the email does not contain a valid code then the email is not received. A valid code starts with a hyphen and ends with "X".
∀x. x ∈ MyInbox ⇒ from(x) ∈ MySafeSenderList ∨ (∃y. y ∈ subject(x) ∧ y ∈ L(-[a-z]+[0-9]X)).

Reply | Threaded
Open this post in threaded view
|

Re: Why java.lang.NoClassDefFoundError: org/netbeans/modules/parsing/spi/ParseException for JavaSource.forFileObject(fileObj);

Edvin Syse

Den 21. des. 2010 kl. 11.29 skrev Gabriele Kahlout:

>      <dependency>
>             <groupId>org.netbeans.api</groupId>
>             <artifactId>org-netbeans-modules-parsing-api</artifactId>
>             <version>RELEASE691</version>
>         </dependency>
>
> was the dependency I missed. Thank you.

You're welcome :) Too bad that transitive deps don't work as normal with NBP, that would be a HUGE improvement. Maybe someone can shed some light as to why NBP support is implemented differently?