我遇到来自The ResourceConfig instance does not contain any root resource classes
HelloWorldResource.java
错误
我已按照Unmanaged Extensions说明操作:
这是代码:
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();
}
}
我正在使用Windows 8.1和ENTERPRISE 2.2.0_M02,在运行bin\Neo4j.bat
时出现错误。
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 o.e.j.s.h.MovedContextHandler@3827eac9{/,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 o.e.j.w.WebAppContext@2aea41c2{/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 o.e.j.s.ServletContextHandler@1f7bd4dd{/examples/unmanaged,null,STARTING}:
...
一些日志:
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的快速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 :(得分:0)
这似乎是JAR文件的问题。我已经在localhost:7474(Windows 8.1)和AWS EC2(Ubuntu 14.04)上测试了dmontag/neo4j-unmanaged-extension-template,它运行正常。因此,我会尝试坚持这个模板。顺便说一句,它不是&#34; curl http://localhost:7474/example/helloworld&#34;它&#34;卷曲http://localhost:7474/example/ 服务 / helloworld&#34;相反,不要忘记授权标题curl -H "Authorization: Basic <Base64 of user:password>"
或curl -u ":<token>"