问题描述:

I am working on a webapp project using GWT 2.5.1 and the requestfactory with a maven config. Actually, I began the project out of maven as a standalone project in eclipse and it still works fine.

But for integration purpose I had to integrate the project as a maven module and to use IntelliJ IDE. And now, when I launch the project on dev mode it works, but as soon as I use the requestfactory I get an Error500. I have found many topic on this subject but I still can not fix it.

I guess this error is either related to annotating processing or to pom.xml config.

About annotationg processing with gwt requestfactory-apt.jar configuration, I can not get the rep .apt_generated with my new configuration with maven in IntelliJ like I did in eclipse and I don't understand why.

Here is my maven config pom.xml:

<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">

<parent>

<artifactId>toolkit2</artifactId>

<groupId>somepackage</groupId>

<version>v2-maven-alpha</version>

</parent>

<modelVersion>4.0.0</modelVersion>

<artifactId>docentryeditor</artifactId>

<packaging>war</packaging>

<name>doc-entry-editor</name>

<url>http://maven.apache.org</url>

<repositories>

<repository>

<id>gwt-maven</id>

<url>http://gwt-maven.googlecode.com/svn/trunk/mavenrepo/</url>

</repository>

</repositories>

<!-- include pluginRepository and repository for GWT-Maven -->

<pluginrepositories>

<pluginrepository>

<id>gwt-maven-plugins</id>

<url>http://gwt-maven.googlecode.com/svn/trunk/mavenrepo/</url>

</pluginrepository>

</pluginrepositories>

<dependencies>

<dependency>

<groupId>junit</groupId>

<artifactId>junit</artifactId>

<scope>test</scope>

</dependency>

<dependency>

<groupId>com.sencha.gxt</groupId>

<artifactId>gxt</artifactId>

<version>3.0.1</version>

</dependency>

<dependency>

<groupId>com.google.gwt</groupId>

<artifactId>gwt-servlet</artifactId>

<classifier>deps</classifier>

<version>2.5.1</version>

</dependency>

<dependency>

<groupId>com.google.gwt</groupId>

<artifactId>gwt-user</artifactId>

<version>2.5.1</version>

<scope>provided</scope>

<exclusions>

<exclusion>

<groupId>javax.validation</groupId>

<artifactId>validation-api</artifactId>

</exclusion>

</exclusions>

</dependency>

<dependency>

<groupId>com.google.web.bindery</groupId>

<artifactId>requestfactory-server</artifactId>

<version>2.5.1</version>

</dependency>

<dependency>

<groupId>com.google.web.bindery</groupId>

<artifactId>requestfactory-apt</artifactId>

<version>2.5.1</version>

</dependency>

<dependency>

<groupId>aopalliance</groupId>

<artifactId>aopalliance</artifactId>

<version>1.0</version>

</dependency>

<dependency>

<groupId>com.google.gwt.inject</groupId>

<artifactId>gin</artifactId>

<version>1.5.0</version>

</dependency>

<dependency>

<groupId>com.google.inject</groupId>

<artifactId>guice</artifactId>

<version>3.0</version>

</dependency>

<dependency>

<groupId>com.google.inject.extensions</groupId>

<artifactId>guice-servlet</artifactId>

<version>3.0</version>

</dependency>

<dependency>

<groupId>com.google.inject.extensions</groupId>

<artifactId>guice-assistedinject</artifactId>

<version>3.0</version>

</dependency>

<dependency>

<groupId>org.hibernate</groupId>

<artifactId>hibernate-validator</artifactId>

<version>5.1.1.Final</version>

</dependency>

<dependency>

<groupId>javax.annotation</groupId>

<artifactId>jsr250-api</artifactId>

<version>1.0-20050927.133100</version>

</dependency>

<dependency>

<groupId>javax.validation</groupId>

<artifactId>validation-api</artifactId>

<version>1.0.0.GA</version>

</dependency>

<dependency>

<groupId>javax.validation</groupId>

<artifactId>validation-api</artifactId>

<version>1.0.0.GA</version>

<classifier>sources</classifier>

</dependency>

<dependency>

<groupId>org.slf4j</groupId>

<artifactId>slf4j-api</artifactId>

<version>1.7.7</version>

</dependency>

<dependency>

<groupId>org.slf4j</groupId>

<artifactId>slf4j-log4j12</artifactId>

<version>1.7.7</version>

</dependency>

<dependency>

<groupId>log4j</groupId>

<artifactId>log4j</artifactId>

<version>1.2.17</version>

</dependency>

<dependency>

<groupId>commons-fileupload</groupId>

<artifactId>commons-fileupload</artifactId>

<version>1.3.1</version>

</dependency>

<dependency>

<groupId>commons-io</groupId>

<artifactId>commons-io</artifactId>

<version>2.4</version>

</dependency>

</dependencies>

<build>

<finalName>docentryeditor</finalName>

<!-- Generate compiled stuff in the folder used for developing mode -->

<!--<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>-->

<plugins>

<!-- GWT Maven Plugin -->

<plugin>

<groupId>org.codehaus.mojo</groupId>

<artifactId>gwt-maven-plugin</artifactId>

<version>2.5.1</version>

<executions>

<execution>

<goals>

<goal>compile</goal>

<goal>test</goal>

<goal>i18n</goal>

<goal>generateAsync</goal>

</goals>

</execution>

</executions>

<!-- Plugin configuration. There are many available options, see gwt-maven-plugin

documentation at codehaus.org -->

<configuration>

<runTarget>XDS-MetadataEditor.html</runTarget>

<hostedWebapp>${webappDirectory}</hostedWebapp>

</configuration>

</plugin>

<!-- Copy static web files before executing gwt:run -->

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-war-plugin</artifactId>

<version>2.1.1</version>

<executions>

<execution>

<phase>compile</phase>

<goals>

<goal>exploded</goal>

</goals>

</execution>

</executions>

<configuration>

<webappDirectory>${webappDirectory}</webappDirectory>

</configuration>

</plugin>

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-compiler-plugin</artifactId>

<version>2.3.2</version>

<configuration>

<source>1.7</source>

<target>1.7</target>

</configuration>

</plugin>

<!-- RequestFactory Validation jar -->

<plugin>

<artifactId>maven-compiler-plugin</artifactId>

<version>2.5.1</version>

<configuration>

<source>1.6</source>

<target>1.6</target>

</configuration>

<dependencies>

<dependency>

<groupId>com.google.web.bindery</groupId>

<artifactId>requestfactory-apt</artifactId>

<version>2.5.1</version>

</dependency>

</dependencies>

</plugin>

</plugins>

<resources>

<resource>

<directory>src/main/java</directory>

<includes>

<include>**/client/**</include>

<include>**/*.gwt.xml</include>

</includes>

</resource>

</resources>

</build>

Here is my annotation processing config:

And, eventually, this is the error I get:

SEVERE: Server Error 500 <html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>

<title>Error 500 javax/validation/ParameterNameProvider</title>

</head>

<body><h2>HTTP ERROR: 500</h2><pre>javax/validation/ParameterNameProvider</pre>

<p>RequestURI=/gwtRequest</p><h3>Caused by:</h3><pre>java.lang.NoClassDefFoundError: javax/validation/ParameterNameProvider

at org.hibernate.validator.HibernateValidator.createGenericConfiguration(HibernateValidator.java:41)

at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:269)

at javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)

at com.google.web.bindery.requestfactory.server.ReflectiveServiceLayer.<clinit>(ReflectiveServiceLayer.java:60)

at com.google.web.bindery.requestfactory.server.ServiceLayer.create(ServiceLayer.java:75)

at com.google.web.bindery.requestfactory.server.RequestFactoryServlet.<init>(RequestFactoryServlet.java:103)

at com.google.web.bindery.requestfactory.server.RequestFactoryServlet.<init>(RequestFactoryServlet.java:89)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.lang.reflect.Constructor.newInstance(Constructor.java:526)

at java.lang.Class.newInstance(Class.java:374)

at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153)

at org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:339)

at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:463)

at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)

at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)

at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)

at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)

at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)

at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)

at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)

at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)

at org.mortbay.jetty.Server.handle(Server.java:324)

at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)

at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)

at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)

at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)

at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)

at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)

at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)

Caused by: java.lang.ClassNotFoundException: javax.validation.ParameterNameProvider

at java.lang.ClassLoader.findClass(ClassLoader.java:531)

at java.lang.ClassLoader.loadClass(ClassLoader.java:425)

at java.lang.ClassLoader.loadClass(ClassLoader.java:358)

at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:352)

at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337)

... 31 more

</pre>

<h3>Caused by:</h3><pre>java.lang.ClassNotFoundException: javax.validation.ParameterNameProvider

at java.lang.ClassLoader.findClass(ClassLoader.java:531)

at java.lang.ClassLoader.loadClass(ClassLoader.java:425)

at java.lang.ClassLoader.loadClass(ClassLoader.java:358)

at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:352)

at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337)

at org.hibernate.validator.HibernateValidator.createGenericConfiguration(HibernateValidator.java:41)

at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:269)

at javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)

at com.google.web.bindery.requestfactory.server.ReflectiveServiceLayer.<clinit>(ReflectiveServiceLayer.java:60)

at com.google.web.bindery.requestfactory.server.ServiceLayer.create(ServiceLayer.java:75)

at com.google.web.bindery.requestfactory.server.RequestFactoryServlet.<init>(RequestFactoryServlet.java:103)

at com.google.web.bindery.requestfactory.server.RequestFactoryServlet.<init>(RequestFactoryServlet.java:89)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.lang.reflect.Constructor.newInstance(Constructor.java:526)

at java.lang.Class.newInstance(Class.java:374)

at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153)

at org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:339)

at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:463)

at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)

at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)

at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)

at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)

at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)

at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)

at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)

at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)

at org.mortbay.jetty.Server.handle(Server.java:324)

at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)

at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)

at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)

at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)

at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)

at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)

at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)

</pre>

<p><i><small><a href="http://jetty.mortbay.org/">Powered by Jetty://</a></small></i></p><br/>

<br/>

<br/>

<br/>

<br/>

<br/>

<br/>

<br/>

<br/>

<br/>

<br/>

<br/>

<br/>

<br/>

<br/>

<br/>

<br/>

<br/>

<br/>

<br/>

</body>

</html>

ERROR: Uncaught exception escaped

com.google.web.bindery.event.shared.UmbrellaException: Exception caught: Server Error 500 <html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>

<title>Error 500 javax/validation/ParameterNameProvider</title>

</head>

<body><h2>HTTP ERROR: 500</h2><pre>javax/validation/ParameterNameProvider</pre>

<p>RequestURI=/gwtRequest</p><h3>Caused by:</h3><pre>java.lang.NoClassDefFoundError: javax/validation/ParameterNameProvider

at org.hibernate.validator.HibernateValidator.createGenericConfiguration(HibernateValidator.java:41)

at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:269)

at javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)

at com.google.web.bindery.requestfactory.server.ReflectiveServiceLayer.<clinit>(ReflectiveServiceLayer.java:60)

at com.google.web.bindery.requestfactory.server.ServiceLayer.create(ServiceLayer.java:75)

at com.google.web.bindery.requestfactory.server.RequestFactoryServlet.<init>(RequestFactoryServlet.java:103)

at com.google.web.bindery.requestfactory.server.RequestFactoryServlet.<init>(RequestFactoryServlet.java:89)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.lang.reflect.Constructor.newInstance(Constructor.java:526)

at java.lang.Class.newInstance(Class.java:374)

at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153)

at org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:339)

at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:463)

at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)

at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)

at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)

at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)

at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)

at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)

at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)

at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)

at org.mortbay.jetty.Server.handle(Server.java:324)

at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)

at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)

at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)

at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)

at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)

at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)

at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)

Caused by: java.lang.ClassNotFoundException: javax.validation.ParameterNameProvider

at java.lang.ClassLoader.findClass(ClassLoader.java:531)

at java.lang.ClassLoader.loadClass(ClassLoader.java:425)

at java.lang.ClassLoader.loadClass(ClassLoader.java:358)

at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:352)

at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337)

... 31 more

</pre>

<h3>Caused by:</h3><pre>java.lang.ClassNotFoundException: javax.validation.ParameterNameProvider

I would be really thankful if someone could help me get through this.

网友答案:

I finally solved it.

It seems I was all wrong about the problem. Indeed, my problem was related to maven config in pom.xml for bean validation. I was using a version of hibernate which is too recent, just had to downgrade to hibernate 4.3.1.

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-validator</artifactId>
    <version>4.3.1.Final</version>
</dependency> 
相关阅读:
Top