unmanaged extensions, root resource classes not found

1,909 views
Skip to first unread message

KentFitch

unread,
Dec 14, 2011, 1:54:28 AM12/14/11
to Neo4j
Hi
I'm wondering if the issued described here was resolved:

http://neo4j.org/nabble/#nabble-td3475710

I'm using version 1.5 (not a milestone). Everything "normal" works,
but I cant get the unmanaged hello world to work, running it unchanged
and placing the jar in lib and plugins and the required config in
server.config.

--
HTTP ERROR 503

Problem accessing /examples/unmanaged/helloworld/55555. Reason:

com.sun.jersey.api.container.ContainerException: The
ResourceConfig instance does not contain any root resource classes.

Caused by:

javax.servlet.UnavailableException:
com.sun.jersey.api.container.ContainerException: The ResourceConfig
instance does not contain any root resource classes.
at
org.mortbay.jetty.servlet.ServletHolder.makeUnavailable(ServletHolder.java:
415)

--
But before I even attempt to run the unmanaged url, this error happens
at startup, which I suspect is related:

..

Dec 14, 2011 4:38:42 PM com.sun.jersey.api.core.PackagesResourceConfig
init
INFO: Scanning for root resource and provider classes in the packages:
org.neo4j.server.rest.discovery
Dec 14, 2011 4:38:42 PM com.sun.jersey.api.core.ScanningResourceConfig
logClasses
INFO: Root resource classes found:
class org.neo4j.server.rest.discovery.DiscoveryService
Dec 14, 2011 4:38:42 PM com.sun.jersey.api.core.ScanningResourceConfig
init
INFO: No provider classes found.
Dec 14, 2011 4:38:42 PM com.sun.jersey.spi.service.ServiceFinder
filterServiceURLsWithVersion
FINE: Including service URL: jar:file:/home/kfitch/neo/neo4j-
community-1.5/system/lib/jersey-server-1.9.jar!/META-INF/services/
com.sun.jersey.spi.container.Web
ApplicationProvider
Dec 14, 2011 4:38:42 PM
com.sun.jersey.server.impl.ejb.EJBComponentProviderFactoryInitilizer
initialize
CONFIG: The EJB interceptor binding API is not available. JAX-RS EJB
support is disabled.
javax.naming.NoInitialContextException: Need to specify class name in
environment or system property, or as an applet parameter, or in an
application resource
file: java.naming.factory.initial
at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:
645)
at
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at
javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:
325)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at
com.sun.jersey.server.impl.ejb.EJBComponentProviderFactoryInitilizer.initialize(EJBComponentProviderFactoryInitilizer.java:
64)
at
com.sun.jersey.spi.container.servlet.WebComponent.configure(WebComponent.java:
574)
at com.sun.jersey.spi.container.servlet.ServletContainer
$InternalWebComponent.configure(ServletContainer.java:311)
at
com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:
608)
at
com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:
210)
at
com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:
373)
at
com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:
556)
at javax.servlet.GenericServlet.init(GenericServlet.java:241)
at
org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:
440)
at
org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:
263)
at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
50)
at
org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:
685)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:
140)
at
org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:
517)
at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
50)
at
org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:
152)
at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
50)
at
org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:
130)
at org.mortbay.jetty.Server.doStart(Server.java:224)
at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
50)
at
org.neo4j.server.web.Jetty6WebServer.startJetty(Jetty6WebServer.java:
168)
at
org.neo4j.server.web.Jetty6WebServer.start(Jetty6WebServer.java:105)
at
org.neo4j.server.NeoServerWithEmbeddedWebServer.startWebServer(NeoServerWithEmbeddedWebServer.java:
252)
at
org.neo4j.server.NeoServerWithEmbeddedWebServer.start(NeoServerWithEmbeddedWebServer.java:
106)
at org.neo4j.server.Bootstrapper.start(Bootstrapper.java:87)
at org.neo4j.server.Bootstrapper.main(Bootstrapper.java:52)
Dec 14, 2011 4:38:42 PM
com.sun.jersey.server.impl.cdi.CDIComponentProviderFactoryInitializer
initialize
CONFIG: The CDI BeanManager is not available. JAX-RS CDI support is
disabled.
javax.naming.NoInitialContextException: Need to specify class name in
environment or system property, or as an applet parameter, or in an
application resource
file: java.naming.factory.initial
at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:
645)
at
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at
javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:
325)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at
com.sun.jersey.server.impl.cdi.CDIComponentProviderFactoryInitializer.initialize(CDIComponentProviderFactoryInitializer.java:
66)
at
com.sun.jersey.spi.container.servlet.WebComponent.configure(WebComponent.java:
576)
at com.sun.jersey.spi.container.servlet.ServletContainer
$InternalWebComponent.configure(ServletContainer.java:311)
at
com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:
608)
at
com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:
210)
at
com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:
373)
at
com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:
556)
at javax.servlet.GenericServlet.init(GenericServlet.java:241)
at
org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:
440)
at
org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:
263)
at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
50)
at
org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:
685)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:
140)
at
org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:
517)
at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
50)
at
org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:
152)
at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
50)
at
org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:
130)
at org.mortbay.jetty.Server.doStart(Server.java:224)
at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
50)
at
org.neo4j.server.web.Jetty6WebServer.startJetty(Jetty6WebServer.java:
168)
at
org.neo4j.server.web.Jetty6WebServer.start(Jetty6WebServer.java:105)
at
org.neo4j.server.NeoServerWithEmbeddedWebServer.startWebServer(NeoServerWithEmbeddedWebServer.java:
252)
at
org.neo4j.server.NeoServerWithEmbeddedWebServer.start(NeoServerWithEmbeddedWebServer.java:
106)
at org.neo4j.server.Bootstrapper.start(Bootstrapper.java:87)
at org.neo4j.server.Bootstrapper.main(Bootstrapper.java:52)
Dec 14, 2011 4:38:42 PM
com.sun.jersey.server.impl.managedbeans.ManagedBeanComponentProviderFactoryInitilizer
initialize
CONFIG: The managed beans injection manager API is not available. JAX-
RS managed beans support is disabled.
javax.naming.NoInitialContextException: Need to specify class name in
environment or system property, or as an applet parameter, or in an
application resource
file: java.naming.factory.initial
...

I wondering what jar files I need at run time. Aside from the
"usual", I've added these to /lib:

jsr311-api-1.1.1.jar
jaxb-impl-2.1.13.jar
jaxb-api-2.1.jar
commons-configuration-1.6.jar
neo4j-server-1.5.jar
server-api-1.5.jar

Thanks,

Kent Fitch

Peter Neubauer

unread,
Dec 14, 2011, 4:05:01 AM12/14/11
to ne...@googlegroups.com
Kent,
could you put the zipped Neo4j instance including the demo extension
on DropBox, so I can take a look at it?

Cheers,

/peter neubauer

TC CEO of the year - vote for Emil Eifrém!
http://crunchies2011.techcrunch.com/nominate/

Google:neubauer.peter
Skype:peter.neubauer
Phone: +46 704 106975
LinkedIn   http://www.linkedin.com/in/neubauer
Twitter      @peterneubauer

brew install neo4j && neo4j start
heroku addons:add neo4j

KentFitch

unread,
Dec 15, 2011, 4:35:04 PM12/15/11
to Neo4j
Thanks Peter,

I've tarred and gzipped our neo4j 1.5 installation and placed it here:
http://dl.dropbox.com/u/53419165/copy-neo4j-1.5.tar.gz

Our data is not stored within that directory structure (but I dont
think this is data related). The installation is standard except for
changes to the config (one of which includes the unmanaged extension
config code), the extra jars, and a change I made to the start script
to provide the full path to lsof (needed in our case). The unmanaged
extension is in myeg.jar, in both plugins and lib. The source for the
unmanaged extension is identical to the hello word example provided in
the neo4j doco, but I have also placed it here:
http://dl.dropbox.com/u/53419165/HelloWorldResource.java

Any help is gratefully appreciated,

Regards,

Kent Fitch

Peter Neubauer

unread,
Dec 15, 2011, 4:39:48 PM12/15/11
to ne...@googlegroups.com

Just tested your server with the original example jar. Works. Will check tomorrow for packaging problems with your jar.

/peter

Sent from my phone, please excuse typos and autocorrection.

Peter Neubauer

unread,
Dec 16, 2011, 11:24:22 AM12/16/11
to ne...@googlegroups.com
Kent,
how did you produce the jar with the extension in it? I start to
suspect packaging errors in how the .jar is produced. Could you share
your project setup?

Cheers,

/peter neubauer

TC CEO of the year - vote for Emil Eifrém!
http://crunchies2011.techcrunch.com/nominate/

Google:neubauer.peter
Skype:peter.neubauer
Phone: +46 704 106975
LinkedIn   http://www.linkedin.com/in/neubauer
Twitter      @peterneubauer

brew install neo4j && neo4j start
heroku addons:add neo4j

KentFitch

unread,
Dec 16, 2011, 11:11:48 PM12/16/11
to Neo4j
Hi Peter,

thanks for looking in to this. I've compiled and built the jar using
the unix command line.

compiled with:

javac -classpath $NEOJARS org/neo4j/examples/server/unmanaged/
HelloWorldResource.java

(where $NEOJARS is a string with the names of all jar files in the
neo4j lib directory)

jar created with:

jar -cvf myeg.jar org/neo4j/examples/server/unmanaged/
HelloWorldResource.class

I've just noticed that the doco for server plugins

http://docs.neo4j.org/chunked/stable/server-plugins.html

states that "The .jar file must include the file META-INF/services/
org.neo4j.server.plugins.ServerPlugin with the fully qualified name of
the implementation class". Maybe this is also required for umanaged
extensions?

Regards,

Kent Fitch

On Dec 17, 3:24 am, Peter Neubauer <peter.neuba...@neotechnology.com>
wrote:


> Kent,
> how did you produce the jar with the extension in it? I start to
> suspect packaging errors in how the .jar is produced. Could you share
> your project setup?
>
> Cheers,
>
> /peter neubauer
>

> TC CEO of the year - vote for Emil Eifrém!http://crunchies2011.techcrunch.com/nominate/


>
> Google:neubauer.peter
> Skype:peter.neubauer
> Phone: +46 704 106975
> LinkedIn  http://www.linkedin.com/in/neubauer
> Twitter      @peterneubauer
>
> brew install neo4j && neo4j start
> heroku addons:add neo4j
>
> On Thu, Dec 15, 2011 at 10:39 PM, Peter Neubauer
>
>
>
>
>
>
>
> <peter.neuba...@neotechnology.com> wrote:
> > Just tested your server with the original example jar. Works. Will check
> > tomorrow for packaging problems with your jar.
>
> > /peter
>
> > Sent from my phone, please excuse typos and autocorrection.
>

Peter Neubauer

unread,
Dec 17, 2011, 2:42:39 AM12/17/11
to ne...@googlegroups.com

Kent,
The services file is not required. The server-examples jar is compiled using maven. Could you please do a simple maven project and test producing the jar? I gave seen this with an export from Eclipse before... There was some setting about directory structure that needed to be set during jar export.

I would then like to know if the maven produced jar works. Seems like the maven har process us different than the pure cli version.

/peter

Sent from my phone, please excuse typos and autocorrection.

KentFitch

unread,
Dec 19, 2011, 10:27:15 PM12/19/11
to Neo4j
Hi Peter,

I created a simple maven project to compile and package the sample
unmanaged extension. There were 2 differences in the created jar:

1) using plain old jar -cvf to create the jar, the META-INF/
MANIFEST.MF file contained this:
--
Manifest-Version: 1.0
Created-By: 1.6.0_07 (Sun Microsystems Inc.)

--
(last line blank)

using mvn, the same file contained this:
--
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: kfitch
Build-Jdk: 1.6.0_07

--
(last line blank)


If I replaced the maven-created manifest in my original jar, copied it
to the plugins directory and restarted neo4j server, the unmanaged
sample extension worked.

2) The maven-created class file contained a LocalVariableTable
section, I guess because maven supplies "-g" flag to javac. This
didnt seem to matter, as all it took was the maven manifest to get it
to work.

I don't know why this makes a difference, but hopefully it helps
someone else!

Kent


On Dec 17, 6:42 pm, Peter Neubauer <peter.neuba...@neotechnology.com>
wrote:
> Kent,


> The services file is not required. The server-examples jar is compiled
> using maven. Could you please do a simple maven project and test producing
> the jar? I gave seen this with an export from Eclipse before... There was
> some setting about directory structure that needed to be set during jar
> export.
>
> I would then like to know if the maven produced jar works. Seems like the
> maven har process us different than the pure cli version.
>
> /peter
>
> Sent from my phone, please excuse typos and autocorrection.

Peter Neubauer

unread,
Dec 20, 2011, 1:03:54 AM12/20/11
to ne...@googlegroups.com
Wow,
exactly what I have seen before. Seems very odd, since this is generic
Java Service Loader stuff. If you just add line by line to the first
manifest and jar the files again, what line is making it work?

Cheers,

/peter neubauer

Google:neubauer.peter
Skype:peter.neubauer
Phone: +46 704 106975
LinkedIn   http://www.linkedin.com/in/neubauer
Twitter      @peterneubauer

brew install neo4j && neo4j start
heroku addons:add neo4j

KentFitch

unread,
Dec 20, 2011, 2:15:32 AM12/20/11
to Neo4j
Well, just trying this reveals it is nothing to do with the manifest
contents after all, but it is about the command used to create the
jar!

Orginally, I created it like this:

jar -cvf myeg.jar org/neo4j/examples/server/unmanaged/
HelloWorldResource.class

jar -tvf myeg.jar shows:

0 Wed Dec 14 14:48:50 EST 2011 META-INF/
71 Wed Dec 14 14:48:50 EST 2011 META-INF/MANIFEST.MF
1546 Wed Dec 14 14:43:12 EST 2011 org/neo4j/examples/server/
unmanaged/HelloWorldResource.class


BUT if I create it like this:

jar -cvf myeg.jar *

then
jar -tvf myeg.jar shows:

0 Tue Dec 20 17:10:30 EST 2011 META-INF/
71 Tue Dec 20 17:10:30 EST 2011 META-INF/MANIFEST.MF
0 Tue Dec 20 17:08:28 EST 2011 org/
0 Tue Dec 20 17:08:28 EST 2011 org/neo4j/
0 Tue Dec 20 17:08:28 EST 2011 org/neo4j/examples/
0 Tue Dec 20 17:08:28 EST 2011 org/neo4j/examples/server/
0 Tue Dec 20 17:08:28 EST 2011 org/neo4j/examples/server/
unmanaged/
1546 Wed Dec 14 14:43:12 EST 2011 org/neo4j/examples/server/
unmanaged/HelloWorldResource.class


I think the act of nominating a specific class (rather than an *)
causes the intermediate directories to not appear in the jar, which is
the root cause of the problem!


Regards,

Kent Fitch

On Dec 20, 5:03 pm, Peter Neubauer <peter.neuba...@neotechnology.com>
wrote:

Peter Neubauer

unread,
Dec 20, 2011, 2:25:33 AM12/20/11
to ne...@googlegroups.com
Very interesting, that is worth to keep in mind. Thanks for testing it out!

Cheers,

/peter neubauer

Google:neubauer.peter
Skype:peter.neubauer
Phone: +46 704 106975
LinkedIn   http://www.linkedin.com/in/neubauer
Twitter      @peterneubauer

brew install neo4j && neo4j start
heroku addons:add neo4j

Peter Neubauer

unread,
Dec 23, 2011, 8:12:13 AM12/23/11
to ne...@googlegroups.com
Added to the documentation.
https://github.com/neo4j/community/commit/268f57e24768fd5a17bce65c3a1f9ee6eefbf148

Cheers,

/peter neubauer

Google:neubauer.peter
Skype:peter.neubauer
Phone: +46 704 106975
LinkedIn   http://www.linkedin.com/in/neubauer
Twitter      @peterneubauer

brew install neo4j && neo4j start
heroku addons:add neo4j

Siphiwe Gwebu

unread,
Jun 12, 2013, 9:38:09 AM6/12/13
to ne...@googlegroups.com
Hi there. Apologies for reviving an old post but I am just not winning. I have the exact same problem and cannot figure out how to apply this post to solve it. I have been using eclipse (3.7.2) to export to jar. upon reading this post, I switched to using 
jar -cvf myeg.jar *
as suggested by Kent, to no avail. I have been out of the java space for a while and have never used maven (and not even sure where to start with it). I am using neo4j 1.9 and jdk1.7.0_07. Would appreciate a push in the right direction.

Thanks,
Siphiwe

Michael Hunger

unread,
Jun 12, 2013, 10:59:44 AM6/12/13
to ne...@googlegroups.com
What does 
jar tf myeg.jar

list?

Did you add the configuration to conf/neo4j-server.properties?

org.neo4j.server.thirdparty_jaxrs_classes=my.package=/url

then the endpoint should be available under http://localhost:7474/url

if you specify

@Path("/") on top of your resource class

or


for
@Path("/foo")

Cheers

Michael

--
You received this message because you are subscribed to the Google Groups "Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Cheers,

Michael

(neo4j.org) <-[:WORKS_ON]- (@mesirii) -[:TAKES_CARE_OF]-> (you) -[:WORKS_WITH]->(@Neo4j)






Siphiwe Gwebu

unread,
Jun 12, 2013, 1:15:56 PM6/12/13
to ne...@googlegroups.com
Oh my goodness, thanks a million Michael! The fault was indeed in the line: "org.neo4j.server.thirdparty_jaxrs_classes=my.package=/url" in the config!
All along, I mistook this property for key/value pair and this being a copied example, I had only edited the url and not the package. Whoa, I would have thought this type of thing would be separated into two key/value pairs, one for the package and another for the url....

Again, thank you!


--
You received this message because you are subscribed to a topic in the Google Groups "Neo4j" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/neo4j/0dNqGXvEbNg/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to neo4j+un...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Siphiwe Gwebu
C: 082 560 5911

Peter Neubauer

unread,
Jun 12, 2013, 2:15:06 PM6/12/13
to Neo4j User
Yes,

it is not quite obvious, good you found it!

/peter


Cheers,

/peter neubauer

G:  neubauer.peter
S:  peter.neubauer
P:  +46 704 106975
L:   http://www.linkedin.com/in/neubauer
T:   @peterneubauer

Kids in Malmö this summer?       - http://www.kidscraft.se
Neo4j questions? Please use SO - http://stackoverflow.com/search?q=neo4j

Siphiwe Gwebu

unread,
Jun 12, 2013, 2:32:26 PM6/12/13
to ne...@googlegroups.com
Thank goodness for this community. Was losing my mind

Michael Hunger

unread,
Jun 12, 2013, 4:25:54 PM6/12/13
to ne...@googlegroups.com, ne...@googlegroups.com
You are welcome

Feel free to write up a blog post on what you are doing with Neo. It will certainly be interesting.

Good Luck

Michael

Sent from mobile device

Siphiwe Gwebu

unread,
Jun 13, 2013, 2:10:33 AM6/13/13
to ne...@googlegroups.com
Thanx, will do so in due course.

Simei He

unread,
Jun 6, 2016, 5:41:32 AM6/6/16
to Neo4j
I've run into the same problem here.

And this is what my jar file looks like

$ jar tf unmanaged-extension-template-1.0.jar 

META-INF/

META-INF/MANIFEST.MF

com/

com/neo4j/

com/neo4j/example/

com/neo4j/example/extension/

com/neo4j/example/extension/MyService$Labels.class

com/neo4j/example/extension/MyService$RelTypes.class

com/neo4j/example/extension/MyService.class

META-INF/maven/

META-INF/maven/unmanaged-extension-template/

META-INF/maven/unmanaged-extension-template/unmanaged-extension-template/

META-INF/maven/unmanaged-extension-template/unmanaged-extension-template/pom.xml

META-INF/maven/unmanaged-extension-template/unmanaged-extension-template/pom.properties


Simei He

unread,
Jun 6, 2016, 5:41:32 AM6/6/16
to Neo4j
And how can I forget, the full log is posted here


On Wednesday, December 14, 2011 at 2:54:28 PM UTC+8, KentFitch wrote:
Reply all
Reply to author
Forward
0 new messages