Hi All,
I'm making some test on the "validation" example from the gwt source code samples,
it runs ok from Eclipse, but when I deploy to both Glassfish or Apache Karaf (a OSGi container), I get the following NoClassDefFoundError:
[In Glassfish]
Exception while dispatching incoming RPC call com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract com.google.gwt.safehtml.shared.SafeHtml com.google.gwt.sample.validation.client.GreetingService.greetServer(com.google.gwt.sample.validation.shared.Person) throws java.lang.IllegalArgumentException,javax.validation.ConstraintViolationException' threw an unexpected exception: java.lang.NoClassDefFoundError: com/google/gwt/thirdparty/streamhtmlparser/ParseException
at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:389)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:579)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
....
[In Apache Karaf]
Caused by: java.lang.NoClassDefFoundError: com/google/gwt/thirdparty/streamhtmlparser/ParseException
at com.google.gwt.safehtml.shared.SafeHtmlBuilder.appendHtmlConstant(SafeHtmlBuilder.java:214)[230:com.google.gwt.gwt-servlet:2.6.0.rc1]
at com.google.gwt.sample.validation.server.GreetingServiceImpl.greetServer(GreetingServiceImpl.java:68)[231:gwt-karaf-validation:1.0.0.SNAPSHOT]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.7.0_40]
....
The problem is that the class com.google.gwt.thirdparty.streamhtmlparser.ParseException is missing on gwt-servlet.jar
(see below the filters on the classes selected to be included into the jar).
When running into eclipse, the example works as it resolve the class from gwt-user.jar
So, I ask you:
1. should gwt-servlet also include com.google.gwt.thirdparty.streamhtmlparser classes?
2. or should the validation example be adapted to avoid using that class?
The ParseException is used by com.google.gwt.safehtml.shared.SafeHtmlHostedModeUtils
and maybe it should not depend on com.google.gwt.thirdparty.* as these are not available on gwt-servlet,
but changing this dependency is probably hard and then the package should be then included... but then there could be other issues coming from this modification
For your convenience of inspection, here is the rules for selecting what is included in gwt-servlet.jar:
<fileset dir="${gwt.dev.bin}">
<include name="com/google/gwt/dev/asm/**" />
<include name="com/google/gwt/dev/util/Name*.class" />
<include name="com/google/gwt/dev/util/StringKey.class" />
<include name="com/google/gwt/util/tools/shared/**" />
<include name="com/google/gwt/core/shared/**" />
<!-- CHECK: do we need to add this rule? <include name="com/google/gwt/thirdparty/streamhtmlparser/**" /> -->
</fileset>
<fileset dir="${gwt.user.bin}">
<exclude name="**/rebind/**" />
<exclude name="**/tools/**" />
<exclude name="**/super/**" />
<exclude name="com/google/gwt/json/**" />
<exclude name="com/google/gwt/junit/*" />
<exclude name="com/google/gwt/junit/client/GWTTestCase.*" />
<exclude name="com/google/gwt/junit/remote/**" />
<exclude name="com/google/gwt/junit/server/**" />
<exclude name="com/google/gwt/benchmarks/*" />
<exclude name="**/*.gwtar" />
</fileset>
Thank you,
Cristiano