Saturday, November 24, 2012

Re: Keep getting ClassNotFoundException for a server-side class from inherited project?

Actually I spoke too soon, now getting the error again.

    // base project
    com.me.test.server.Foo

    // other project (zebra)
    com.me.zebra.server.Bar


And Bar.java looks like:

    class Bar extends Foo {
    }

compiles fine in eclipse, and the GWT compilation process reports no errors. However now as soon as I deploy to a local server instance via eclipse (Run As -> Web Application) I get a NoClassDefFoundError exception:

    java.lang.NoClassDefFoundError: com/me/test/server/Foo
        at java.lang.ClassLoader.defineClass1(Native Method)
        ...

stumped here - gwt compile shows no problems, and I have the base project marked as exported in the zebra project which uses it. Any ideas what's going on here? It just seems like the class file for Foo is not getting exported with the deploy,

Thanks




On Saturday, 24 November 2012 17:05:32 UTC-5, markww wrote:
Ok the error was a dependent class that wasn't in the /shared folder. I set the gwt compile log level to "all", and then in there searched for errors, which pointed to it:

Validating units:
      Errors in 'file:/src/com/me/test/shared/Foo.java'
         Line 72: No source code is available for type Bar; did you forget to inherit a required module?

I thought these used to block compilation, I can't remember.

Thanks



On Saturday, 24 November 2012 16:40:24 UTC-5, markww wrote:
Hi,

I have a gwt project, called "base". It has a class in its "server" package, Foo.java:

    com.me.test.server.Foo;

I have another gwt project called "zebra", which references project "base". This is done in eclipse, in the Java Build Path settings.

I'm trying to use the Foo class server-side in the "zebra" project. Both projects compile and deploy fine, but "zebra" throws a ClassNotFoundException for the Foo class when I try to use it at runtime (all server side).

I chose the option in eclipse to export "base" (in the Order and Export settings), but still no luck. The "zebra" project also imports "base" via the gwt module xml file, but I don't think that matters here since this is server-side code. All the clientside classes that are inherited from "base" work fine:

    // in zebra's gwt.xml file:
    <inherits name='com.me.test.Base' />

Do we need a special directive to get "zebra" to also include the server classes from "base" when it is deployed? Everything compiles fine.

Thank you

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/RI5woEk8xfgJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment