I use PlayN to develop a game. It contains the type GameEventdefined in the project my-game-core. My GWT and GAE code is in my-game-html, which has my-game-corea dependency on Maven.
Here is the impl service:
package com.mygame.html.server;
import com.mygame.core.event.GameEvent;
import com.mygame.html.client.ServerEventHandlerService;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
@SuppressWarnings("serial")
public class ServerEventHandlerServiceImpl extends RemoteServiceServlet
implements ServerEventHandlerService {
@Override
public String handleEvent(final GameEvent event) {
return "holy porkchops batman!";
}
}
This compiles just fine. However, when I try to call the service at runtime on the local dev server, I get the following error:
SEVERE: javax.servlet.ServletContext log: Exception while dispatching incoming RPC call
java.lang.NoClassDefFoundError: com/mygame/core/event/GameEvent
...
Caused by: java.lang.ClassNotFoundException: com.mygame.core.event.GameEvent
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.google.appengine.tools.development.IsolatedAppClassLoader.loadClass(IsolatedAppClassLoader.java:176)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 39 more
If you take it out GameEventand replace it with a type type String, everything will be fine.
What can i do wrong? GameEventhas a default constructor.
Update : here is the pom.xml for the * -html project:
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>mygame-game</artifactId>
<groupId>com.mygame</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>mygame-game-html</artifactId>
<packaging>war</packaging>
<name>my game html build</name>
<properties>
<gwt.module>com.mygame.MygameGame</gwt.module>
<gwt.name>mygame</gwt.name>
</properties>
<dependencies>
<dependency>
<groupId>com.mygame</groupId>
<artifactId>mygame-game-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.googlecode.playn</groupId>
<artifactId>playn-html</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<outputDirectory>war/WEB-INF/classes</outputDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<warSourceDirectory>war</warSourceDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<configuration>
<disableClassMetadata>false</disableClassMetadata>
</configuration>
</plugin>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.8</version>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>false</downloadJavadocs>
<wtpversion>2.0</wtpversion>
<additionalBuildcommands>
<buildCommand>
<name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
</buildCommand>
</additionalBuildcommands>
<additionalProjectnatures>
<projectnature>com.google.gwt.eclipse.core.gwtNature</projectnature>
</additionalProjectnatures>
</configuration>
</plugin>
</plugins>
</build>
</project>
Update 2 : In war/WEB-INF/libI have:
- AppEngine-api-1.0-sdk-1.5.4.jar
- AppEngine-api-1.0-sdk-1.5.5.jar
- AppEngine-API-Lab-1.5.4.jar
- AppEngine-API--1.5.5.jar
- AppEngine-jsr107cache-1.5.4.jar
- AppEngine-jsr107cache-1.5.5.jar
- DataNucleus-AppEngine-1.0.9.final.jar
- DataNucleus--1.1.5.jar
- DataNucleus-JPA-1.1.5.jar
- -jpa_3.0_spec-1.1.1.jar
- -jta_1.1_spec-1.1.1.jar
- GWT-servlet.jar
- jdo2--2,3-eb.jar
- jsr107cache-1.1.jar