user3371140
user3371140

Reputation: 21

Neo4J Server Installation Linux AWS Centos OS -- service user cannot find java

I have downloaded Neo4J enterprise from the Neo site and have untar'd it under /opt

I have successfully downloaded and installed the Java 7 Server edition from the Oracle web site. Note after indicating I want a server JRE, Oracle downloads this : jdk1.7.0_51

I have untar'd both under /opt giving me /opt/neo4j-2.0.0 and /opt/jdk1.7.0_51

I have successfully installed Neo4J 2.O on AWS with Centos Linux, such that it should run as a Service under a service account. To do this I used the Neo install command. The command ran successfully

I can successfully start Neo4J as myself. After editing my ~/.bash_profile to define JAVA_HOME and exporting.

export JAVA_HOME="/opt/jdk1.7.0_51/"
export NEO4J_HOME="/opt/neo4j-2.0.0"
export PATH=$JAVA_HOME/bin:$NEO4J_HOME:$PATH

Apply source ~/.bash_profile

cd /$NEO$J_HOME
bin/neo4j start

Works just fine.

However, we are not able to successfully get Neo to start as a service

sudo service neo4j-service start

which: no java in (/sbin:/usr/sbin:/bin:/usr/bin)
ERROR: Unable to find java. (Cannot execute )
* Please use Oracle(R) Java(TM) 7 to run Neo4j Server. Download "Java Platform (JDK) 7" from:
 http://www.oracle.com/technetwork/java/javase/downloads/index.html
* Please see http://docs.neo4j.org/ for Neo4j Server installation instructions.

If I echo $JAVA_HOME it returns as expected If I echo $PATH it returns as expected

by as expected we can see java on the path.

If I simply type java -version before I run sudo service neo4j-service start the response shows the java version.

A bit of background: the Linux service command is not available unless I first run a special script per our normal it policies. However, the script clobbers the exports that I would otherwise use.

Accordingly the command service neo4j-service start

returns -bash: neo4j-service: command not found

indicating that the 'service' command cannot be found

So sudo is required in our environment to execute the service command

We have tried simply placing jdk1.7.0_51 under /sbin/jdk1.7.0_51 that does not work. We have also tried extracting the jre folder from jdk1.7.0_51 and placing it under /sbin/jre

Also tried creating a java.sh file under /etc/profile.d/

Still no success.

So the simple question....

Where is Neo4J 2.0.0 looking for Java when running as a service? Is it using the environment variable JAVA_HOME, or is it looking in one of the following locations as the Neo4J server error message would seem to indicate? "no java in (/sbin:/usr/sbin:/bin:/usr/bin)"

Under my installation configuration the neo4j service is intended to run under the account neo4jservice. Is this as simple as making sure JAVA_HOME is available to the neo4jservice accound? Why the error message "no java in (/sbin:/usr/sbin:/bin:/usr/bin)"?

Thanks in advance

Upvotes: 0

Views: 2185

Answers (2)

user3371140
user3371140

Reputation: 21

Not quite the answer I was hoping for... as the answer seems to disregard this part of the original POST: "So sudo is required in our environment to execute the service command"

What does seem to work is modifying the neo4j-service script to include the exports.

neo4j-service is found at /etc/init.d

Upvotes: 0

usr242
usr242

Reputation: 61

I ran a test on my solaris and Linux Mint install and this seems to work for me Perhaps it's not elegant, but it will get you going. Just drop the sudo part for your startup script.

sudo NEO4J_HOME="/opt/neo4j" JAVA_HOME="/usr/java" /opt/neo4j/bin/neo4j start

Obviously, modify the environment variables to your situation:

JAVA_HOME="/opt/jdk1.7.0_51/" NEO4J_HOME="/opt/neo4j-2.0.0" service neo4j-service start

Upvotes: 1

Related Questions