无法在类路径中找到dozer映射文件dozerBeanMapping.xml

时间:2013-11-08 16:36:25

标签: hibernate gwt dozer

我已经开始使用Dozer将我的域对象映射到客户端的DTO。不幸的是,它说在我的类路径上找不到dozerBeanMapping.xml,我仔细检查过它。我还检查了文件是否与其他文件一起部署在classes文件夹中。

我把文件放在我的主包中,以及gwt使用的.gwt.xml文件。

我得到以下stacktrace:

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)。

我做错了什么?

由于

1 个答案:

答案 0 :(得分:2)

我正在使用另一个以前版本的推土机,但无论如何,我有dozerBeanMapping.xml:

src/main/resources/