2012-04-12 24 views
1

私はEclipseを使用しています。私はRESTfulプロジェクト(WarehouseService)を構築しており、ビルドパスには別のプロジェクト(WarehouseEntity)が含まれています。 WarehouseServiceは、WarehouseEntity(以下同様)から StockTakeServiceJavaプロジェクトが別のプロジェクトを参照できません

@POST 
@Consumes("application/xml") 
public Response updateStockTake(String input){ 
    warehouse.entity.StockTake st = null; 

    try{ 
     StockTakeService sts = new StockTakeService(); 

     SAXParserFactory saxFactory = SAXParserFactory.newInstance(); 
     SAXParser saxParser = saxFactory.newSAXParser(); 

をクラスのオブジェクトをインスタンス化するとき、私は以下のエラーを取得します。

Apr 13, 2012 12:41:31 AM com.sun.jersey.spi.container.ContainerResponse mapMappableContainerException 
SEVERE: The exception contained within MappableContainerException could not be mapped to a response, re-throwing to the HTTP container 
java.lang.NoClassDefFoundError: service/warehouse/entity/StockTakeService 
    at warehouseservice.jaxrs.StockTake.updateStockTake(StockTake.java:36) 
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.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:187) 
at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:70) 
at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:279) 
at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:86) 
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:136) 
at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:74) 
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1357) 
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1289) 
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1239) 
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1229) 
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:420) 
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:497) 
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:684) 
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) 
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) 
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) 
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) 
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) 
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) 
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) 
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859) 
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602) 
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) 
at java.lang.Thread.run(Unknown Source) 
Caused by: java.lang.ClassNotFoundException: service.warehouse.entity.StockTakeService 
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680) 
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526) 
... 31 more 

Apr 13, 2012 12:41:31 AM org.apache.catalina.core.StandardWrapperValve invoke 
SEVERE: Servlet.service() for servlet JAX-RS Servlet threw exception 
java.lang.ClassNotFoundException: service.warehouse.entity.StockTakeService 
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680) 
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526) 
at warehouseservice.jaxrs.StockTake.updateStockTake(StockTake.java:36) 
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.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:187) 
at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:70) 
at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:279) 
at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:86) 
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:136) 
at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:74) 
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1357) 
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1289) 
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1239) 
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1229) 
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:420) 
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:497) 
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:684) 
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) 
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) 
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) 
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) 
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) 
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) 
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) 
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859) 
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602) 
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) 
at java.lang.Thread.run(Unknown Source) 

WarehouseServiceは私のRESTfulプロジェクトであり、WarehouseEntityは私のJPAプロジェクトです。

私はanohterプロジェクト(WarehouseDBSync)を組み込み、WarehouseDBSyncからクラスのオブジェクトをインスタンス化しようとしました。同じ時が来る。

RESTfulとJPAの新機能です。何かを構成する必要があるかどうかはわかりません。ビルドパスにプロジェクトを含めるのはうまくいきませんが、他に何ができるのか分かりません。

答えて

2

Eclipseに別のプロジェクトを組み込むと(Javaビルドパス - >プロジェクト)、クラスはコンパイル時に利用できます。 Jarをサーバー(おそらくlibディレクトリ)にデプロイしたい場合は、 "Java Build Path"と同じメニューの "Deploy Assembly"にもエントリを書き込む必要があります。