[Neo4j] [neo4j] Running the web admin inside Tomcat

670 views
Skip to first unread message

Ian Forsey

unread,
Dec 8, 2011, 10:46:34 AM12/8/11
to us...@lists.neo4j.org
Is anybody using the neo4j webadmin in embedded mode via
the WrappingNeoServerBootstrapper in Tomcat 6?

I have it successfully running within jetty and I just tried deploying to
Tomcat. The web admin loads up sometimes in tomcat, but if I keep
refreshing I get the following errors about half of the time:

SEVERE: /webadmin/css/style.css
java.lang.IllegalStateException: zip file closed
at java.util.zip.ZipFile.ensureOpen(ZipFile.java:415)
at java.util.zip.ZipFile.access$100(ZipFile.java:31)
at java.util.zip.ZipFile$2.hasMoreElements(ZipFile.java:315)
at java.util.jar.JarFile$1.hasMoreElements(JarFile.java:222)
at org.mortbay.resource.JarFileResource.exists(JarFileResource.java:157)
at org.mortbay.jetty.servlet.DefaultServlet.doGet(DefaultServlet.java:400)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
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:440)
at
org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
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.headerComplete(HttpConnection.java:926)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
at
org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

I see the same with Tomcat 6.0.35 on both JDK6 and JDK7. I was wondering if
anyone else has experienced the same and found a fix?
_______________________________________________
NOTICE: THIS MAILING LIST IS BEING SWITCHED TO GOOGLE GROUPS, please register and consider posting at https://groups.google.com/forum/#!forum/neo4j

Neo4j mailing list
Us...@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Ian Forsey

unread,
Dec 8, 2011, 12:57:41 PM12/8/11
to ne...@googlegroups.com, Neo4j user discussions
It's ok, I figured a work around for this.

Maven was creating a WAR with the web admin JARs in WEB-INF/lib. If I
instead extracted the web admin static JAR so the contents were directly in
the WAR, it worked.

I had to first tell maven not to package the JAR by specifying provided as
the scope.

<dependency>
<groupId>org.neo4j.app</groupId>
<artifactId>neo4j-server</artifactId>
<version>1.5</version>
<classifier>static-web</classifier>
<scope>provided</scope>
</dependency>

Then used the maven unpack dependencies plugin to unpack the JAR into the
WAR:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<phase>process-resources</phase>
</execution>
</executions>
<configuration>
<includeGroupIds>org.neo4j.app</includeGroupIds>
<includeArtifactIds>neo4j-server</includeArtifactIds>
<includeClassifiers>static-web</includeClassifiers>
<includes>webadmin-html/**</includes>

<outputDirectory>target/graphdemo-1.0/WEB-INF/classes</outputDirectory>
</configuration>
</plugin>

Peter Neubauer

unread,
Dec 8, 2011, 3:37:19 PM12/8/11
to ne...@googlegroups.com, Neo4j user discussions
Mmh, thanks for the feedback! This sounds like a note in the docs, or
some example project setup to make sure this is documented somewhere.
Care to set up a maven project with a testcase that we could pull into
the main build system to avoid further problems? I would like to have
a WAR based project anyway in order to demonstrate servlet-based use
of Neo4j wich I could add in there ...

Cheers,

/peter neubauer

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

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

Ian Forsey

unread,
Dec 9, 2011, 6:27:26 AM12/9/11
to ne...@googlegroups.com, Neo4j user discussions
Hi Peter,

I wasn't sure what you meant by test case, since I don't think this something that fits in a unit test, but I've created the following repo with an example. The readme.MD explains how to build a war with the issue and one without. I'm using spring data neo4j, so have included this along with spring in the project, but other than that it is pretty bare-bones.

Peter Neubauer

unread,
Dec 27, 2011, 4:44:17 AM12/27/11
to ne...@googlegroups.com, Neo4j user discussions
Thanks Ian for putting this together, good to know for future
reference! Now we need to find a place in the manual to put this in :)

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

Darrell Berry

unread,
Jan 5, 2013, 9:23:28 AM1/5/13
to ne...@googlegroups.com, Neo4j user discussions
Hi - I'm seeing the same error (java.lang.IllegalStateException: zip file closed) using maven and 1.8.1

Is there any other way around this, that doesn't involve hardcoding expansion paths in the POM (the outputDirectory specifier)?

D

_______________________________________________
NOTICE: THIS MAILING LIST IS BEING SWITCHED TO GOOGLE GROUPS, please register and consider posting at https://groups.google.com/forum/#!forum/neo4j

Peter Neubauer

unread,
Jan 5, 2013, 2:22:21 PM1/5/13
to Neo4j User, Neo4j user discussions
Darrell,
do you think the example at
https://github.com/theon/neo4j-war-with-webadmin resembles your setup,
or we could add a testcase there and update it for future reference?

/peter

Cheers,

/peter neubauer

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

Neo4j 1.8 GA - http://www.dzone.com/links/neo4j_18_release_fluent_graph_literacy.html
> --
>
>

Jordi Aranda

unread,
May 9, 2013, 7:43:19 AM5/9/13
to ne...@googlegroups.com, Neo4j user discussions
This really helped me, thank you!

Peter Neubauer

unread,
May 13, 2013, 10:01:33 AM5/13/13
to Neo4j User, Neo4j user discussions
Jordi,
if you have any additional comments or so, maybe you can update the
project to a later Neo4j version so others have a better time getting
this to work?

/peter

Cheers,

/peter neubauer

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

The authoritative book on graph databases - http://graphdatabases.com
Neo4j questions? Please use SO - http://stackoverflow.com/search?q=neo4j
> --
> 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.
>
>

Pavel Niedoba

unread,
Feb 17, 2015, 11:43:47 AM2/17/15
to ne...@googlegroups.com
Would it bee possible to run it without embedded jetty?

  Hi don't like the idea running web server inside web server. I understand that neo4j needs http server if running as server, but I'm fine with embedded with webadmin. 
  Did anyone managed to run this as webapp without another webserver ?


Michael Hunger

unread,
Feb 18, 2015, 3:52:39 AM2/18/15
to ne...@googlegroups.com
What is the goal you want to achieve?

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/d/optout.

Pavel Niedoba

unread,
Feb 26, 2015, 4:14:08 PM2/26/15
to ne...@googlegroups.com
Hallo

  First I would like to solve this problem, because this solution doesn't work for me. (I have multi module maven project running on tomcat8) Maybe I could get it to work somehow with jetty, but another problem is the size of my WAR file, whis is over 100MB. I develop the app so I nee to restart tomcat frequently and it's getting slow with big WAR. Simply put I would like to run Neo embedded and REST as webapp, if there's easy way to do it.

Pavel

Michael Hunger

unread,
Feb 26, 2015, 4:29:26 PM2/26/15
to ne...@googlegroups.com
Not that I know of,

depending on which endpoints you want to you use, you can have a look at the Jersey Resources we register and register the same resources within your tomcat application instead. check the module community/server in the org.neo4j.server.rest package.

Michael
Reply all
Reply to author
Forward
0 new messages