Announcement Announcement Module
Collapse
No announcement yet.
[neo4j] How to get WrappingNeoServerBootstrapper to listen on 0.0.0.0 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • [neo4j] How to get WrappingNeoServerBootstrapper to listen on 0.0.0.0

    I posted this on StackOverflow. Hoping someone here can help.
    http://stackoverflow.com/questions/1...isten-on-0-0-0

    Been trying to get the WrappingNeoServerBootstrapper to start the Neo4j WebAdmin interface on 0.0.0.0 instead of localhost. Tried everything form specifying JAVA_OPTS (E.g., -Dorg.neo4j.server.webserver.address=0.0.0.0), to passing my own Config in the second constructor argument of WrappingNeoServerBootstrapper - but it always listens on localhost. Hoping someone has a solutions or an example. Here is my Spring config - back to basics. Thanks in advance.

    Code:
    <bean id="graphDatabaseService" class="org.neo4j.kernel.EmbeddedGraphDatabase" destroy-method="shutdown">
        <constructor-arg index="0" value="${com.calendr.neo4jDataDir}"/>
        <constructor-arg index="1">
            <map>
                <entry key="allow_store_upgrade" value="true"/>
                <entry key="enable_remote_shell" value="true"/>
            </map>
        </constructor-arg> 
    </bean>
    
    <bean id="serverWrapper" class="org.neo4j.server.WrappingNeoServerBootstrapper" init-method="start" destroy-method="stop">
         <constructor-arg ref="graphDatabaseService"/>
    </bean>
    Last edited by MAndrews; Nov 17th, 2012, 06:35 PM.

  • #2
    I figured it out after reading through the Neo code. Here is my final working config.

    Code:
    <neo4j:config graphDatabaseService="graphDatabaseService"/>
    
    <bean id="graphDatabaseService" class="org.neo4j.kernel.EmbeddedGraphDatabase" destroy-method="shutdown">
        <constructor-arg index="0" value="${com.mycompany.neo4jDataDir}"/>
        <constructor-arg index="1">
            <map>
                <entry key="allow_store_upgrade" value="true"/>
                <entry key="enable_remote_shell" value="true"/>
            </map>
        </constructor-arg> 
    </bean>
    
    <bean id="config" class="com.mycompany.Neo4jServerConfig">
        <constructor-arg> 
            <map>
                <entry key="org.neo4j.server.webserver.address" value="0.0.0.0"/>
            </map>
        </constructor-arg>     
    </bean>
    
    <bean id="serverWrapper" class="org.neo4j.server.WrappingNeoServerBootstrapper" init-method="start" destroy-method="stop">
        <constructor-arg index="0" ref="graphDatabaseService"/>
        <constructor-arg index="1" ref="config"/>
    </bean>
    And here is the config class:

    Code:
    public class Neo4jServerConfig implements Configurator {
    
        private Configuration config;
    
        public Ne4jServerConfig(Map<String, String> config) {
            this.config = new MapConfiguration(config);
        }
    
        @Override
        public Configuration configuration() {
            return config; 
        }
    
        @Override
        public Map<String, String> getDatabaseTuningProperties() {
            return null;
        }
    
        @Override
        public Set<ThirdPartyJaxRsPackage> getThirdpartyJaxRsClasses() {
            return new HashSet<>();
        }
    }
    Last edited by MAndrews; Nov 17th, 2012, 06:36 PM.

    Comment

    Working...
    X