Monday, September 14, 2015

GWT and Spring Boot with gwt-maven-plugin

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

<modelVersion>4.0.0</modelVersion>

<parent>
<artifactId>kurento-room</artifactId>
<groupId>org.kurento</groupId>
<version>6.1.1-SNAPSHOT</version>
</parent>

<artifactId>kurento-room-gwt</artifactId>
<packaging>jar</packaging>
<name>Kurento Room GWT</name>

<licenses>
<license>
<name>GNU Lesser General Public License</name>
<url>http://www.gnu.org/licenses/lgpl-2.1.txt</url>
<distribution>repo</distribution>
</license>
</licenses>

<organization>
<name>Kurento</name>
<url>http://www.kurento.org</url>
</organization>

<scm>
<url>${kurento-room.scm.url}</url>
<connection>scm:git:${kurento-room.scm.connection}</connection>
<developerConnection>scm:git:${kurento-room.scm.connection}</developerConnection>
<tag>develop</tag>
</scm>

<properties>
<!-- Convenience property to set the GWT version -->
<gwtVersion>2.8.0-SNAPSHOT</gwtVersion>

<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<start-class>org.kurento.room.gwt.server.KurentoRoomDemoApp</start-class>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt</artifactId>
<version>${gwtVersion}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>banner.txt</include>
</includes>
</resource>
</resources>

<plugins>
<!-- GWT Maven Plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.7.0</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<configuration>
<extraJvmArgs>-Xmx6g </extraJvmArgs>
<logLevel>INFO</logLevel>
<style>${gwt.style}</style>
<bindAddress>0.0.0.0</bindAddress>
<webappDirectory>src/main/resources/static</webappDirectory>
<supoerDevMode>true</supoerDevMode>
<runTarget>index.html</runTarget>
<draftCompile>true</draftCompile>
<jsInteropMode>JS</jsInteropMode>
<enableAssertions>false</enableAssertions>
<modules>
<module>org.kurento.room.gwt.KurentoRoomGwt</module>
</modules>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>${start-class}</mainClass>
<layout>ZIP</layout>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>java</id>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>${start-class}</mainClass>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptor>src/assembly/bin.xml</descriptor>
<finalName>${project.artifactId}-${project.version}</finalName>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<configuration>
<tasks>
<copy
file="${project.build.directory}/target/${project.artifactId}-${project.version}-bin.zip"
tofile="${project.build.directory}/target/${project.artifactId}-${project.version}.zip" />
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.kurento</groupId>
<artifactId>kurento-room-server</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.commons</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.kurento</groupId>
<artifactId>kurento-room-client-js</artifactId>
<version>6.1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j</artifactId>
</dependency>

</dependencies>


</project>
Hi all,

I am trying to integrate GWT in a given spring boot project (Kurento Room). Everything looks good until I launch SpringBoot. The error that I see is:

Caused by: java.lang.IncompatibleClassChangeError: Implementing class


over some server classes. After googling a bit, normally that is because I have two versions of the same library/classes in my Tomcat. So far so good.

The thing is if I comment in my pom.xml everything related gwt (gwt-maven-plugin, gwt's dependencies...) the problem disappears.  The gwt classes are minimal, just an empty EntryPoint with an:
 
Window.alert("Hello World"); 
 
So, I imagine is something related with gwt-maven-plugin. What am I missing? Can you give me some ideas?

Some notes:
I have searched inside the final jar and using "find" command only shows one class.
I have run the duplicate-maven-plugin and there is no strange things related with the classes.
I am running in GWT 2.8-SNAPSHOT with 2.7.0 maven plugin. Java 1.8 
I have attached pom.xml and exception stack strace( https://docs.google.com/document/d/1LuJ5oJ4rwbMl9Wbx881XyN5GwI2mCdhKk6L_RdIIoCM/edit?usp=sharing ) just in case I am missing something. 

Thanks in advance,

Adolfo. 

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment