gwtrequestfactory

java.lang.RuntimeException: The RequestFactory ValidationTool must be run


I have been bogged down by this whole day. I went through almost all the links available for this issue. I also followed the instructions on https://code.google.com/p/google-web-toolkit/wiki/RequestFactoryInterfaceValidation#ValidationTool

I still am getting that error no idea why.

I am just going crazy here. Please help. Is there anything else that am missing here??

This is my pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<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">

    <!-- POM file generated with GWT webAppCreator -->
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.kivar.lumina</groupId>
    <artifactId>client</artifactId>
    <packaging>war</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>GWT Maven Archetype</name>

    <properties>
        <!-- Convenience property to set the GWT version -->
        <gwtVersion>2.5.1</gwtVersion>
        <!-- GWT needs at least java 1.5 -->
        <webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-servlet</artifactId>
            <version>${gwtVersion}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-user</artifactId>
            <version>${gwtVersion}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.7</version>
            <scope>test</scope>
        </dependency>

        <!-- RequestFactory server -->

        <dependency>
            <groupId>com.google.web.bindery</groupId>
            <artifactId>requestfactory-server</artifactId>
            <version>${gwtVersion}</version>
        </dependency>

        <!-- Hibernate dependencies -->
        <!-- <dependency> <groupId>javax.validation</groupId> <artifactId>validation-api</artifactId> 
            <version>1.0.0.GA</version> </dependency> <dependency> <groupId>org.hibernate</groupId> 
            <artifactId>hibernate-entitymanager</artifactId> <version>4.2.1.Final</version> 
            </dependency> -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>4.2.1.Final</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>4.3.1.Final</version>
        </dependency>
        <!-- Required by Hibernate validator because slf4j-log4j is optional in 
            the hibernate-validator POM -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.6.1</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.6.1</version>
        </dependency>

        <!-- Oracle JDBC driver -->
        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc6</artifactId>
            <version>11.2.0.3</version>
        </dependency>


    </dependencies>

    <repositories>
        <repository>
            <id>codelds</id>
            <url>https://code.lds.org/nexus/content/groups/main-repo</url>
        </repository>
    </repositories>

    <build>
        <!-- Generate compiled stuff in the folder used for developing mode -->
        <outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>

        <pluginManagement>
            <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>Application.html</runTarget>
                        <hostedWebapp>${webappDirectory}</hostedWebapp>
                        <i18nMessagesBundle>com.kivar.lumina.client.Messages</i18nMessagesBundle>
                    </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>${gwtVersion}</version>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

</project>

Is there anything else that am missing here??


Solution

  • As mentioned in comments you need to have "YourRequestFactory"DeobfuscatorBuilder.class file in order to run it. I had similar problem and wanted non-Eclipse dependent solution. I solved it with:

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.5.1</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <annotationProcessors>
                         <annotationProcessor>com.google.web.bindery.requestfactory.apt.RfValidator</annotationProcessor>
                    </annotationProcessors>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>com.google.web.bindery</groupId>
                        <artifactId>requestfactory-apt</artifactId>
                        <version>${gwtVersion}</version>
                    </dependency>
                </dependencies>
            </plugin>
    

    Another option is to use the com.google.web.bindery.requestfactory.apt.ValidationTool tool directly. You need to run it from JDK java (not JRE) and to have

    requestfactory-apt-2.5.1.jar
    requestfactory-server-2.5.1.jar
    your wanna-be RequestFactory classes and their dependencies

    on classpath. Replace 2.5.1 with ${gwtVersion}. You run it simply

    java -cp <your_set_classpath> com.google.web.bindery.requestfactory.apt.ValidationTool <your wanna-be RequestFactory class to be validated> <another wannae-be factory>...
    

    Example for windows .bat file (cd-ed to JDK directory to run JDk java instead of JRE java):

    set loc=d:\coding\java\workspace\j2ee\beg_1\Allo\web\src\main\java\
    set tool=d:\coding\tools\Maven\.m2\repository\com\google\web\bindery\requestfactory-apt\2.5.1\requestfactory-apt-2.5.1.jar
    set server=d:\coding\tools\Maven\.m2\repository\com\google\web\bindery\requestfactory-server\2.5.1\requestfactory-server-2.5.1.jar
    set lib=d:\coding\tools\Maven\.m2\repository\bbc\juniperus\allo-entities\1.0\allo-entities-1.0.jar
    set lib2=d:\coding\tools\Maven\.m2\repository\org\hibernate\javax\persistence\hibernate-jpa-2.0-api\1.0.1.Final\hibernate-jpa-2.0-api-1.0.1.Final.jar
    
    set CP=%loc%;%tool%;%server%;%lib%;%lib2%
    
    cd %JAVA_HOME%/bin
    
    java -cp %CP% com.google.web.bindery.requestfactory.apt.ValidationTool d:/output.jar bbc.juniperus.allo.web.gwt.client.CalendarRequestFactory"
    

    Also even though I am not Maven guru I am not sure if having double maven-compiler-plugin declaration in Maven could not somehow contribute to validation not being run when building.