我已经开始使用 Dozer 将我的域对象映射到客户端的 DTO。不幸的是,它说在我的类路径上找不到 dozerBeanMapping.xml,我仔细检查了一遍并在那里。我还检查了该文件是否与其他文件一起部署在 classes 文件夹中。
我将该文件与 gwt 使用的 .gwt.xml 文件一起放入了我的主包中。
我得到以下堆栈跟踪:
com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract java.lang.Long com.ohapp.webmetalmore.client.DataService.saveAlbum(com.ohapp.webmetalmore.shared.dto.AlbumDTO)' threw an unexpected exception: org.dozer.MappingException: Unable to locate dozer mapping file [dozerBeanMapping.xml] in the classpath!
at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:389)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:579)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
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:729)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:324)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
Caused by: org.dozer.MappingException: Unable to locate dozer mapping file [dozerBeanMapping.xml] in the classpath!
at org.dozer.util.MappingUtils.throwMappingException(MappingUtils.java:87)
at org.dozer.util.MappingValidator.validateURL(MappingValidator.java:63)
at org.dozer.DozerBeanMapper.loadFromFiles(DozerBeanMapper.java:225)
at org.dozer.DozerBeanMapper.loadCustomMappings(DozerBeanMapper.java:209)
at org.dozer.DozerBeanMapper.initMappings(DozerBeanMapper.java:315)
at org.dozer.DozerBeanMapper.getMappingProcessor(DozerBeanMapper.java:192)
at org.dozer.DozerBeanMapper.map(DozerBeanMapper.java:120)
at com.ohapp.webmetalmore.server.DataServiceImpl.saveAlbum(DataServiceImpl.java:70)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:561)
该项目正在 Eclipse 中使用 maven(3.0 版)、gwt(2.5.1 版)、hibernate(4.2.7.Final)和 Dozer(5.4.0 版)进行开发。
我究竟做错了什么?
谢谢