您能告诉我Could not find method in implementation com.mine.courierApp.server.dao.OrderDao matching descriptor (Ljava/lang/Long;)V for operation OjO7dPbbLTZAEEKwSdsHj5v6Hzw=
是什么意思以及如何解决它?
这是完整的调用堆栈:
Feb 27, 2012 2:07:13 AM com.google.web.bindery.requestfactory.server.ServiceLayerDecorator die
SEVERE: Could not find method in implementation com.mine.courierApp.server.dao.OrderDao matching descriptor (Ljava/lang/Long;)V for operation OjO7dPbbLTZAEEKwSdsHj5v6Hzw=
java.lang.NoSuchMethodException: com.mine.courierApp.server.dao.OrderDao.delete(java.lang.Long)
at java.lang.Class.getMethod(Class.java:1605)
at com.google.web.bindery.requestfactory.server.ResolverServiceLayer.resolveDomainMethod(ResolverServiceLayer.java:138)
at com.google.web.bindery.requestfactory.server.ServiceLayerDecorator.resolveDomainMethod(ServiceLayerDecorator.java:152)
at com.google.web.bindery.requestfactory.server.FindServiceLayer.resolveDomainMethod(FindServiceLayer.java:46)
at com.google.web.bindery.requestfactory.server.ServiceLayerDecorator.resolveDomainMethod(ServiceLayerDecorator.java:152)
at com.google.web.bindery.requestfactory.server.ServiceLayerDecorator.resolveDomainMethod(ServiceLayerDecorator.java:152)
at com.google.web.bindery.requestfactory.server.ServiceLayerDecorator.resolveDomainMethod(ServiceLayerDecorator.java:152)
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.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:104)
at com.google.web.bindery.requestfactory.server.ServiceLayerCache.getOrCache(ServiceLayerCache.java:233)
at com.google.web.bindery.requestfactory.server.ServiceLayerCache.resolveDomainMethod(ServiceLayerCache.java:176)
at com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.processInvocationMessages(SimpleRequestProcessor.java:440)
at com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.process(SimpleRequestProcessor.java:225)
at com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.process(SimpleRequestProcessor.java:127)
at com.google.web.bindery.requestfactory.server.RequestFactoryServlet.doPost(RequestFactoryServlet.java:133)
at com.mine.courierApp.server.CustomRequestFactoryServlet.doPost(CustomRequestFactoryServlet.java:43)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:263)
at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:178)
at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91)
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:62)
at com.googlecode.objectify.cache.AsyncCacheFilter.doFilter(AsyncCacheFilter.java:57)
at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163)
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)
at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118)
at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:35)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:60)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:122)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.tools.development.BackendServersFilter.doFilter(BackendServersFilter.java:97)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
at com.google.appengine.tools.development.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:78)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:363)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:938)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
我很困惑,因为我的RequestContext接口的某些方法工作得很好。这是我的界面:
public interface AdminRequestFactory extends RequestFactory
{
// value = interface on server side, locator = class that returns instance of the object that implements "value"
@Service(value = OrderDao.class, locator = InjectingServiceLocator.class)
public interface OrderRequestContext extends RequestContext
{
Request<List<OrderProxy>> listAll();
Request<Void> saveOrder(OrderProxy order);
Request<Void> delete(Long id);
Request<Void> saveOrganization(OrganizationProxy organization);
Request<OrganizationProxy> findOrganizationById(long id);
}
OrderRequestContext contextOrder();
}
saveOrder和saveOrganization工作但调用listAll,delete和findOrganizationById导致上面显示的异常。从异常的模糊语言我明白接口中方法的定义与实现类中的方法不匹配。但我认为工作方法没有任何区别!
以下是我的Dao课程的样子:
public class OrderDao
{
@Inject Ofy ofy;
public OrderDao()
{
System.out.println("");
}
List<Order> listAll()
{
return ofy.load().type(Order.class).list();
}
void delete(Long id)
{
ofy.delete(Key.create(Order.class, id));
}
public void saveOrder(final Order order)
{
ofy.transact(new Ofy.VoidWork()
{
@Override
public void vrun(Ofy ofy)
{
ofy.save(order);
}
});
}
public void saveOrganization(final Organization organization)
{
ofy.transact(new Ofy.VoidWork()
{
@Override
public void vrun(Ofy ofy)
{
Key<Organization> key = ofy.fact().allocateId(Organization.class);
organization.setId(key.getId());
ofy.save(organization.getContactPerson());
ofy.save(organization);
}
});
}
public Organization findOrganizationById(long id)
{
return ofy.load(Organization.class, id);
}
}
最后,我将在客户端代码中进行调用:
orderRequestContext.delete(1L).fire(new Receiver<Void>()
{
@Override
public void onSuccess(Void arg0)
{
createConfirmationDialogBox("Deleted!").center();
}
@Override
public void onFailure(ServerFailure error)
{
createConfirmationDialogBox(error.getMessage()).center();
}
});
有什么想法吗?
答案 0 :(得分:2)
(Ljava/lang/Long;)V
表示采用单个Long
参数且返回类型为void
的方法。
符合此定义的delete
方法不是public
,这是问题(listAll
方法有同样的问题)