GAE/J 上的推土机对象

发布于 2024-07-25 11:26:32 字数 3614 浏览 9 评论 0原文

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

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 = new DozerBeanMapper();

如何解决此问题?

I'm trying to write application using GWT and GAE/J (Google AppEngine with Java). For my application i need to use DTO. In order to convert Pojo into JDO Entities I want to use Dozer library. So when i'm trying to convert object I'm getting following error:

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

I'm getting error when I'm just trying to instantiate mapper object inside the server:

Mapper mapper = new DozerBeanMapper();

How do I solve this problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

尤怨 2024-08-01 11:26:32

我对GAE/J不熟悉,但是错误(NoClassDefFoundError)肯定告诉你类加载器找不到推土机类。 你确定它在类路径上吗?
运行同一行:

Mapper mapper = new DozerBeanMapper();会发生什么情况?

如果您尝试在容器外部仅从普通命令行、static main 方法

I am not familiar with GAE/J, but the error (NoClassDefFoundError) definitely tells you the class loader cannot find the dozer class. Are you sure it's on the classpath?
What happens if you try to run the same line:

Mapper mapper = new DozerBeanMapper();

outside of your container, just from plain command line, static main method?

柒夜笙歌凉 2024-08-01 11:26:32

确保 jar 位于类路径和 web-inf/lib 文件夹中

Make sure the jars are in your classpath and in the web-inf/lib folder

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文