GAE / J上的推土机对象

时间:2009-06-23 19:21:21

标签: java google-app-engine dto dozer

我正在尝试使用GWT和GAE / J(Google AppEngine with Java)编写应用程序。对于我的应用程序,我需要使用DTO。为了将Pojo转换为JDO实体,我想使用Dozer library。因此,当我试图转换对象时,我遇到了以下错误:

Jun 23, 2009 7:12:30 PM com.google.appengine.tools.development.ApiProxyLocalImpl log
SEVERE: [1245784350843000] javax.servlet.ServletContext log: Exception while dispatching incoming RPC call
com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract com.athena.client.entities.Person com.athena.client.GreetingService.getPerson(com.athena.client.entities.Person)' threw an unexpected exception: java.lang.NoClassDefFoundError: org/dozer/DozerBeanMapper
    at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:360)
    at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:546)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:166)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:86)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093)
    at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
    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:712)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
    at com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:54)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
    at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:306)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
    at org.mortbay.jetty.Server.handle(Server.java:313)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506)
    at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:844)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:644)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:205)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396)
    at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
Caused by: java.lang.NoClassDefFoundError: org/dozer/DozerBeanMapper
    at com.athena.server.GreetingServiceImpl.getPerson(GreetingServiceImpl.java:38)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:527)
    ... 25 more

当我只是想在服务器中实例化mapper对象时,我遇到了错误:

Mapper mapper = new DozerBeanMapper();

如何解决这个问题?

2 个答案:

答案 0 :(得分:2)

我不熟悉GAE / J,但错误(NoClassDefFoundError)肯定告诉你类加载器找不到dozer类。你确定它在类路径上吗? 如果您尝试运行相同的行,会发生什么:

Mapper mapper = new DozerBeanMapper();

在容器之外,只是从普通命令行static main方法?

答案 1 :(得分:1)

确保罐子在你的类路径和web-inf / lib文件夹中