2015-06-15 13 views
5

Tôi đang trải qua những "cổ điển" The ResourceConfig instance does not contain any root resource classes lỗi từ HelloWorldResource.javaNeo4j phần mở rộng không được quản lý: Các ví dụ ResourceConfig không chứa bất kỳ lớp nguồn gốc

Tôi đã theo Unmanaged Extensions hướng dẫn:

  • Added tập tin JAR trong plugins thư mục
  • Set org.neo4j.server.thirdparty_jaxrs_classes = org.neo4j.examples.server.unmanaged =/ví dụ/không được quản lý

Và đây là đoạn code:

package org.neo4j.examples.server.unmanaged; 

import ... 

@Path("/helloworld") 
public class HelloWorldResource { 

    //private final GraphDatabaseService database; 

    //public HelloWorldResource(@Context GraphDatabaseService database) 
    //{ 
    // this.database = database; 
    //} 

    @GET 
    @Produces(MediaType.TEXT_PLAIN) 
    @Path("/{nodeId}") 
    public Response hello(@PathParam("nodeId") long nodeId) 
    { 
     // Do stuff with the database 
     return Response.status(Status.OK).entity(
       ("Hello World, nodeId=" + nodeId).getBytes(Charset.forName("UTF-8"))).build(); 
    } 
} 

Tôi đang sử dụng Windows 8.1 và DOANH NGHIỆP 2.2.0_M02, khi chạy bin\Neo4j.bat tôi nhận được lỗi.

C:\Users\user\Dropbox\MyDBs\neo4j\dbmusicovery3>bin\Neo4j.bat 
    2015-06-15 23:14:58.889+0000 INFO [API] Setting startup timeout to: 120000ms based on 120000 
    2015-06-15 23:15:05.397+0000 INFO [API] Successfully started database 
    2015-06-15 23:15:05.477+0000 INFO [API] Starting HTTP on port :7474 with 4 threads available 
    2015-06-15 23:15:05.724+0000 INFO [API] Enabling HTTPS on port :7473 
    2015-06-15 23:15:05.856+0000 INFO [API] Mounted REST API at: /db/manage 
    2015-06-15 23:15:05.875+0000 INFO [API] Mounted unmanaged extension [neo4j.unmanaged] at [/examples/unmanaged] 
    01:15:05.894 [main] INFO org.eclipse.jetty.util.log - Logging initialized @8256ms 
    2015-06-15 23:15:05.956+0000 INFO [API] Mounting static content at [/webadmin] from [webadmin-html] 
    2015-06-15 23:15:06.015+0000 INFO [API] Mounting static content at [/browser] from [browser] 
    01:15:06.019 [main] INFO org.eclipse.jetty.server.Server - jetty-9.2.1.v20140609 
    01:15:06.065 [main] INFO o.e.j.server.handler.ContextHandler - Started [email protected]{/,null,AVAILABLE} 
    01:15:06.206 [main] INFO o.e.j.w.StandardDescriptorProcessor - NO JSP Support for /webadmin, did not find org.apache.jasper.servlet.JspServlet 
    01:15:06.226 [main] INFO o.e.j.server.handler.ContextHandler - Started [email protected]{/webadmin,jar:file:/C:/Users/user/Dropbox/MyDBs/neo4j/dbmusico 
    very3/system/lib/neo4j-server-2.2.0-M02-static-web.jar!/webadmin-html,AVAILABLE} 
    01:15:06.764 [main] WARN /examples/unmanaged - unavailable 
com.sun.jersey.api.container.ContainerException: The ResourceConfig instance does not contain any root resource classes. 
... 
... FAILED [email protected]{/examples/unmanaged,null,STARTING}: 
... 

Một số bản ghi:

juin 16, 2015 9:51:26 AM com.sun.jersey.api.core.PackagesResourceConfig init 
INFOS: Scanning for root resource and provider classes in the packages: 
    neo4j.unmanaged 
juin 16, 2015 9:51:26 AM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate 
INFOS: Initiating Jersey application, version 'Jersey: 1.18.1 02/19/2014 03:28 AM' 
juin 16, 2015 9:51:26 AM com.sun.jersey.server.impl.application.RootResourceUriRules <init> 
GRAVE: The ResourceConfig instance does not contain any root resource classes. 

jar nhanh của JAR:

C:\...\plugins>jar tf myapp.jar 
META-INF/MANIFEST.MF 
pom.xml 
.project 
org/neo4j/examples/server/unmanaged/AppTest.class 
org/neo4j/examples/server/unmanaged/HelloWorldResource.class 
target/test-classes/org/neo4j/examples/server/unmanaged/AppTest.class 
.classpath 
+0

Tôi đã có cùng một vấn đề. Bạn đã giải quyết vấn đề này chưa? –

+0

Có cùng một vấn đề ... Bất kỳ ai tìm ra cách giải quyết nó? – wael34218

Trả lời

0

Nó có vẻ là một vấn đề với các tập tin JAR. Tôi đã thử nghiệm dmontag/neo4j-unmanaged-extension-template trên cả hai máy chủ cục bộ: 7474 (Windows 8.1) và AWS EC2 (Ubuntu 14.04) và nó hoạt động tốt. Do đó, tôi sẽ cố gắng dính vào mẫu này. Bằng cách này, nó không phải là "cuộn tròn http://localhost:7474/example/helloworld" đó là "cuộn tròn http://localhost:7474/example/dịch vụ/helloworld" thay vào đó, và đừng quên tiêu đề ủy quyền, curl -H "Authorization: Basic <Base64 of user:password>" hoặc curl -u ":<token>"

Các vấn đề liên quan