Javax / validation / GWT path Java Maven conversionstion

I use GWT in my project. I recently tried to convert a manual compilation of GWT + Java + tomcat into a maven project., Almost I can successfully pack it into a war., BUt, when I deployed to tomcat I got the following error:

EVERE: exception when sending an incoming RPC call java.lang.NoClassDefFoundError: javax / validation / Path in java.lang.ClassLoader.defineClass1 (native method) in java.lang.ClassLoader.defineClassCond (ClassLoader.java:632) in java.lang .ClassLoader.defineClass (ClassLoader.java:616) in java.security.SecureClassLoader.defineClass (SecureClassLoader.java:141) at org.apache.catalina.loader.WebappClassLoader.findClassInternal (WebappClassLoader.java2818. catalina.loader.WebappClassLoader.findClass (WebappClassLoader.java:1159) at org.apache.catalina.loader.WebappClassLoader.loadClass (WebappClassLoader.java:1647) at org.apache.catalina.loader.WebappClassLoader.load 1526) in java.lang.Class.forName0 (native method) in java.lang.Class.forName (class .java: 247) on com.google.gw t.user.server.rpc.SerializationPolicyLoader.loadFromStream (SerializationPolicyLoader.java:196) at com.google.gwt.user.server.rpc.RemoteServiceServlet.loadSerializationPolicy (RemoteServiceServlet.java:90) at com.google. server. impl.ServerSerializationStreamReader.prepareToRead (ServerSerializationStreamReader.java:455)

Here is what I added for my addition to my pom.xml :

 <dependency> <groupId>com.google.gwt</groupId> <artifactId>gwt-servlet</artifactId> <version>${gwt.version}</version> <scope>compile</scope> </dependency> <dependency> <groupId>com.google.gwt</groupId> <artifactId>gwt-user</artifactId> <version>${gwt.version}</version> <scope>provided</scope> </dependency> 

as dependencies.

Please help me.

What do I need to add to solve the problem?

+4
source share
1 answer

This is the dependency area that causes the problem. compile actually the default scope, so this can be omitted from the first dependency if you want.

The problem is the second artifact, declared as provided . This means that the application expects the web container to provide this library / classes. It doesn't seem to provide the required classes, which leads to a NoClassDefFoundError .

Removing <scope>provided</scope> will tell Maven to package this library with the application, and Tomcat should be able to pass this error.

There are no compile-time errors since gwt-user is available at compile time. It is simply not available at Tomcat runtime.

+4
source

Source: https://habr.com/ru/post/1388415/


All Articles