Creating a module from files in javax subpackage

1 view
Skip to first unread message

C2RIK

unread,
Aug 5, 2008, 2:21:40 PM8/5/08
to Google Web Toolkit
Hello,
I'm using GWT 1.5RC-1 and I'd like to create a module with code source
in a javax subpackage, javax.validation.

I have created in javax package a validation.gwt.xml describing my
module, specifying where to find the classes to compile, and created a
sample class in javax.validation subpackage.
Here's the module definition:

<module>
<source path="validation"/>
</module>

And here's the test class:

package javax.validation;

public class TestClass {
private String testString;

public String getTestString() {
return this.testString;
}

public void setTestString(String testString) {
this.testString = testString;
}
}

When I inherit this module and try to instantiate the test class, I've
got NoClassDefFoundError:
Here's the stacktrace:

java.lang.NoClassDefFoundError: javax/validation/TestClass
at
com.mycompany.testval.client.TestValidation.onModuleLoad(TestValidation.java:
13)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:303)
at
com.google.gwt.dev.shell.BrowserWidget.attachModuleSpace(BrowserWidget.java:
324)
at com.google.gwt.dev.shell.ie.BrowserWidgetIE6.access
$200(BrowserWidgetIE6.java:37)
at
com.google.gwt.dev.shell.ie.BrowserWidgetIE6$External.gwtOnLoad(BrowserWidgetIE6.java:
71)
at
com.google.gwt.dev.shell.ie.BrowserWidgetIE6$External.invoke(BrowserWidgetIE6.java:
128)
at
com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke(IDispatchImpl.java:
294)

If I put the same classes in a different package, let's say
com.mycompany.validation, with the same module description in the
parent package com.mycompany and inherits it, all is working as
expected, I don't have the NoClassDefFoundError.

I've been searching around in the group and on the web, but didn't
find anything that could give me directions

What am I doing wrong?

Thanks,
Cedric.

Thomas Broyer

unread,
Aug 6, 2008, 6:03:54 PM8/6/08
to Google Web Toolkit

On Aug 5, 8:21 pm, C2RIK wrote:
> Hello,
> I'm using GWT 1.5RC-1 and I'd like to create a module with code source
> in a javax subpackage, javax.validation.
>
> I have created in javax package a validation.gwt.xml describing my
> module, specifying where to find the classes to compile, and created a
> sample class in javax.validation subpackage.

Bad idea (in general).

Create a module anywhere you like and use <super-source>
http://code.google.com/docreader/#p(google-web-toolkit-doc-1-5)t(DevGuideModuleXml)

Not sure it'll fix your problem (looks like a classpath issue) but
it's the "blessed" way of doing things; except if you have the source
for the classes and they only use emulated JRE classes:
http://code.google.com/docreader/#p(google-web-toolkit-doc-1-5)t(RefJreEmulation)
Given that javax.validation uses reflection (from what I understood
from some API overlook), I doubt it would compile out-of-the-box with
GWT, so you would have to provide some Generator to generate
Validator<T> subclasses; in this case, <super-source> is the way to go
(IMO).

C2RIK

unread,
Aug 7, 2008, 3:23:15 PM8/7/08
to Google Web Toolkit
Hi,
there are only some (two) default validators that use reflection, the
rest of the package compiles with GWT. The javax.validation is the api
part. For the implementation stuff I'm already using generators.

Thanks for the links,
Cedric.

On 6 ago, 19:03, Thomas Broyer <t.bro...@gmail.com> wrote:
> On Aug 5, 8:21 pm, C2RIK wrote:
>
> > Hello,
> > I'm using GWT 1.5RC-1 and I'd like to create a module with code source
> > in ajavaxsubpackage,javax.validation.
>
> > I have created injavaxpackagea validation.gwt.xml describing my
> > module, specifying where to find the classes to compile, and created a
> > sample class injavax.validation subpackage.
>
> Bad idea (in general).
>
> Create a module anywhere you like and use <super-source>http://code.google.com/docreader/#p(google-web-toolkit-doc-1-5)t(DevG...)
>
> Not sure it'll fix your problem (looks like a classpath issue) but
> it's the "blessed" way of doing things; except if you have the source
> for the classes and they only use emulated JRE classes:http://code.google.com/docreader/#p(google-web-toolkit-doc-1-5)t(RefJ...)
> Given thatjavax.validation uses reflection (from what I understood

C2RIK

unread,
Aug 14, 2008, 9:43:00 PM8/14/08
to Google Web Toolkit
Hi,
back to work on GWT.
I've found what was wrong reading the second link:
<< One caveat specific to overriding JRE classes in this way is that
they will never actually be used in hosted mode. In hosted mode, the
native JRE classes always supersede classes compiled from source. >>

But for the moment javax.validation has not been integrated in the
JRE, this is why I got the NoClassDefFoundError.
For now I'll use other another package.

Thanks,
Cédric.

On 7 ago, 16:23, C2RIK <cedric.lama...@gmail.com> wrote:
> Hi,
> there are only some (two) default validators that use reflection, the
> rest of the package compiles with GWT. Thejavax.validationis the api

MN

unread,
Aug 21, 2008, 4:14:23 AM8/21/08
to Google Web Toolkit
which package you use for validation?

On 15 Aug., 03:43, C2RIK <cedric.lama...@gmail.com> wrote:
> Hi,
> back to work on GWT.
> I've found what was wrong reading the second link:
> << One caveat specific to overriding JRE classes in this way is that
> they will never actually be used in hosted mode. In hosted mode, the
> native JRE classes always supersede classes compiled from source. >>
>
> But for the moment javax.validationhas not been integrated in the
> JRE, this is why I got the NoClassDefFoundError.
> For now I'll use other another package.
>
> Thanks,
> Cédric.
>
> On 7 ago, 16:23, C2RIK <cedric.lama...@gmail.com> wrote:
>
> > Hi,
> > there are only some (two) default validators that use reflection, the
> > rest of the package compiles with GWT. Thejavax.validationis the api
> > part. For the implementation stuff I'm already using generators.
>
> > Thanks for the links,
> > Cedric.
>
> > On 6 ago, 19:03, Thomas Broyer <t.bro...@gmail.com> wrote:
>
> > > On Aug 5, 8:21 pm, C2RIK wrote:
>
> > > > Hello,
> > > > I'm using GWT 1.5RC-1 and I'd like to create a module with code source
> > > > in ajavaxsubpackage,javax.validation.
>
> > > > I have created injavaxpackageavalidation.gwt.xml describing my
> > > > module, specifying where to find the classes to compile, and created a
> > > > sample class injavax.validationsubpackage.
>
> > > Bad idea (in general).
>
> > > Create a module anywhere you like and use <super-source>http://code.google.com/docreader/#p(google-web-toolkit-doc-1-5)t(DevG...)
>
> > > Not sure it'll fix your problem (looks like a classpath issue) but
> > > it's the "blessed" way of doing things; except if you have the source
> > > for the classes and they only use emulated JRE classes:http://code.google.com/docreader/#p(google-web-toolkit-doc-1-5)t(RefJ...)
> > > Given thatjavax.validationuses reflection (from what I understood
Reply all
Reply to author
Forward
0 new messages