Google app engine 使用GWT RPC的GAE上的ClassNotFoundException
我正在使用PlayN开发一个游戏。它包含一个类型,Google app engine 使用GWT RPC的GAE上的ClassNotFoundException,google-app-engine,gwt,gwt-rpc,playn,Google App Engine,Gwt,Gwt Rpc,Playn,我正在使用PlayN开发一个游戏。它包含一个类型,GameEvent,在mygamecore项目中定义。我的GWT和GAE代码存在于我的游戏html中,它将我的游戏核心作为Maven依赖项 以下是服务impl: package com.mygame.html.server; import com.mygame.core.event.GameEvent; import com.mygame.html.client.ServerEventHandlerService; import com.goo
GameEvent
,在mygamecore
项目中定义。我的GWT和GAE代码存在于我的游戏html
中,它将我的游戏核心
作为Maven依赖项
以下是服务impl:
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!";
}
}
这个编译得很好。但是,当我尝试在本地dev服务器上运行时调用该服务时,出现以下错误:
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
如果我取出GameEvent
并用String
之类的类型替换它,一切都会正常工作
我在这里做错了什么<代码>游戏事件有一个默认构造函数
更新:以下是*html项目的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/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>
<!-- we need class metadata, override PlayN's disabling of such -->
<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>
4.0.0
我的游戏
com.mygame
0.0.1-快照
..
我的游戏
战争
我的游戏html构建
com.mygame.MygameGame
游戏
com.mygame
我的游戏核心
${project.version}
com.googlecode.playn
播放html
1.0-快照
src
war/WEB-INF/classes
org.apache.maven.plugins
maven战争插件
2.1.1
战争
org.codehaus.mojo
GWTMaven插件
假的
maven eclipse插件
2.8
真的
假的
2
com.google.gwt.eclipse.core.gwtProjectValidator
com.google.gwt.eclipse.core.gwtNature
更新2:在war/WEB-INF/lib
中,我有:
- appengine-api-1.0-sdk-1.5.4.jar
- appengine-api-1.0-sdk-1.5.5.jar
- appengine-api-labs-1.5.4.jar
- appengine-api-labs-1.5.5.jar
- appengine-jsr107cache-1.5.4.jar
- appengine-jsr107cache-1.5.5.jar
- datanucleus-appengine-1.0.9.final.jar
- datanucleus-core-1.1.5.jar
- datanucleus-jpa-1.1.5.jar
- geronimo-jpa_3.0_spec-1.1.1.jar
- geronimo-jta_1.1_spec-1.1.1.jar
- gwt-servlet.jar
- jdo2-api-2.3-eb.jar
- jsr107cache-1.1.jar
还要检查运行配置中的classpath选项卡。是否使用Maven构建GAE war文件?如果是这样的话,
pom.xml
文件可能与此相关。听起来Maven显然没有把你的my game core
依赖关系放在正确的位置(即WEB-INF/lib
)。如果在存档查看器中打开war文件,war/WEB-INF/lib的内容是什么?war文件是什么?我有一本战争指南。我添加了pom.xml。在哪里可以更改运行时类路径?我转到运行配置>>类路径选项卡并添加了*-核心项目,但它没有解决问题。这是您的runtimeclasspath。。。还可以查看一下您的war目录。您在WEB-INF/lib下有哪些lib查看您的my game core.jar
必须在WEB-INF/lib
中。