neo4j-apoc-procedures: Apoc 3.3.0.2 with spring boot + embedded neo4j leads to stack overflow

We have several problems using apoc 3.3.0.2 in an embedded neo4j due to this line of code:

public class ApocKernelExtensionFactory extends KernelExtensionFactory<ApocKernelExtensionFactory.Dependencies>{

    static {
        URL.setURLStreamHandlerFactory(new ApocUrlStreamHandlerFactory());
    }

The biggest issue is that spring boot won’t start due to the stack overflow below.

The second one is that embedded tomcat will also set URL.setURLStreamHandlerFactory which will fail as this can only be called once. Workaround here is to use TomcatURLStreamHandlerFactory.disable(); Still, it looks like APOC shouldn’t configure the URL class …

at org.springframework.boot.loader.LaunchedURLClassLoader.doLoadClass(LaunchedURLClassLoader.java:170) at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:142) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at apoc.util.ApocUrlStreamHandlerFactory.createURLStreamHandler(ApocUrlStreamHandlerFactory.java:13) at java.net.URL.getURLStreamHandler(URL.java:1142) at java.net.URL.<init>(URL.java:599) at java.net.URL.<init>(URL.java:490) at java.net.URL.<init>(URL.java:439) at java.net.JarURLConnection.parseSpecs(JarURLConnection.java:175) at java.net.JarURLConnection.<init>(JarURLConnection.java:158) at org.springframework.boot.loader.jar.JarURLConnection.<init>(JarURLConnection.java:76) at org.springframework.boot.loader.jar.Handler.openConnection(Handler.java:88) at java.net.URL.openConnection(URL.java:979) at sun.misc.URLClassPath$Loader.getResource(URLClassPath.java:736) at sun.misc.URLClassPath.getResource(URLClassPath.java:239) at java.net.URLClassLoader$1.run(URLClassLoader.java:365) at java.net.URLClassLoader$1.run(URLClassLoader.java:362) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:361) at org.springframework.boot.loader.LaunchedURLClassLoader.doLoadClass(LaunchedURLClassLoader.java:170) at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:142) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at apoc.util.ApocUrlStreamHandlerFactory.createURLStreamHandler(ApocUrlStreamHandlerFactory.java:13) at java.net.URL.getURLStreamHandler(URL.java:1142) at java.net.URL.<init>(URL.java:599) at java.net.URL.<init>(URL.java:490) at java.net.URL.<init>(URL.java:439) at java.net.JarURLConnection.parseSpecs(JarURLConnection.java:175) at java.net.JarURLConnection.<init>(JarURLConnection.java:158) at org.springframework.boot.loader.jar.JarURLConnection.<init>(JarURLConnection.java:76) at org.springframework.boot.loader.jar.Handler.openConnection(Handler.java:88) at java.net.URL.openConnection(URL.java:979) at sun.misc.URLClassPath$Loader.getResource(URLClassPath.java:736) at sun.misc.URLClassPath.getResource(URLClassPath.java:239) at java.net.URLClassLoader$1.run(URLClassLoader.java:365) at java.net.URLClassLoader$1.run(URLClassLoader.java:362) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:361) at org.springframework.boot.loader.LaunchedURLClassLoader.doLoadClass(LaunchedURLClassLoader.java:170) at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:142) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at apoc.util.ApocUrlStreamHandlerFactory.createURLStreamHandler(ApocUrlStreamHandlerFactory.java:13) at java.net.URL.getURLStreamHandler(URL.java:1142) at java.net.URL.<init>(URL.java:599) at java.net.URL.<init>(URL.java:490) at java.net.URL.<init>(URL.java:439) at java.net.JarURLConnection.parseSpecs(JarURLConnection.java:175) at java.net.JarURLConnection.<init>(JarURLConnection.java:158) at org.springframework.boot.loader.jar.JarURLConnection.<init>(JarURLConnection.java:76) at org.springframework.boot.loader.jar.Handler.openConnection(Handler.java:88) at java.net.URL.openConnection(URL.java:979) at sun.misc.URLClassPath$Loader.getResource(URLClassPath.java:736) at sun.misc.URLClassPath.getResource(URLClassPath.java:239) at java.net.URLClassLoader$1.run(URLClassLoader.java:365) at java.net.URLClassLoader$1.run(URLClassLoader.java:362) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:361) at org.springframework.boot.loader.LaunchedURLClassLoader.doLoadClass(LaunchedURLClassLoader.java:170)

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 16 (8 by maintainers)

Commits related to this issue

Most upvoted comments

@sarmbruster @MarkPAndrews @lilianaziolek

Perhaps we could make it . configurable so that you can disable it e.g. with a system property?