JAVA_HOME variable not defined correctly

1,689 views
Skip to first unread message

William Chaney

unread,
Jul 25, 2014, 11:50:30 AM7/25/14
to xnat_di...@googlegroups.com
The setup.sh script is giving me some problems here is the exact message.

The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
NB: JAVA_HOME should point to a JDK not a JRE


this is the path for JAVA_HOME

/usr/lib/jvm/java-1.7.0-openjdk-amd64


this is the which java result

/usr/lib/jvm/java-1.7.0-openjdk-amd64/bin/java

this is the type java result

java is /usr/lib/jvm/java-1.7.0-openjdk-amd64/bin/java

this is the java -version

java version "1.7.0_51"
OpenJDK Runtime Environment (IcedTea 2.4.6) (7u51-2.4.6-1ubuntu4)
OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)

if their is anything else you need for this darn thing to work tell me.


Herrick, Rick

unread,
Jul 25, 2014, 12:11:55 PM7/25/14
to xnat_di...@googlegroups.com

Are you getting those values from the setup.sh script output? Right as you run that script, it should output something like:

 

Using XDAT Installation: /data/tip/home/xnat_builder_1_6dev

Using JAVA_HOME:         /usr/lib/jvm/java-1.7.0

 

Verify Java Version (with java -version)

java version "1.7.0_45"

Java(TM) SE Runtime Environment (build 1.7.0_45-b18)

Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)

 

That would indicate exactly what the script is getting when invoked, which may differ from what you’re seeing running from the command line.

 

If you see the same thing there, then the only other thing I could guess would be issues with the OpenJDK version of Java 1.7. If you’re on Ubuntu, it’s easy enough to install the Oracle 1.7 JDK:

 

http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html

 

Rick Herrick

Sr. Programmer/Analyst

Neuroinformatics Research Group

Washington University School of Medicine

(314) 827-4250

--
You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xnat_discussi...@googlegroups.com.
To post to this group, send email to xnat_di...@googlegroups.com.
Visit this group at http://groups.google.com/group/xnat_discussion.
For more options, visit https://groups.google.com/d/optout.




The material in this message is private and may contain Protected Healthcare Information (PHI). If you are not the intended recipient, be advised that any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error, please immediately notify the sender via telephone or return mail.

William Chaney

unread,
Jul 25, 2014, 2:49:36 PM7/25/14
to xnat_di...@googlegroups.com
I downloaded java-7 oracle and now the script accepts the newly wrote path but it is giving me a new error my credentials should be correct with this one. I am using the database name postgres and the super users name as postgres within the build.properties file

maven.appserver.home = TOMCAT_HOME
 
xdat.project.name=xnat
xdat.project.template=xnat
xdat.project.db.name=
xdat.project.db.driver=org.postgresql.Driver
xdat.project.db.connection.string=jdbc:postgresql://localhost/xnat
xdat.project.db.user=postgres
xdat.project.db.password=xxxxxxx

and when I run the setup.sh script it now gives me this error

 
Using XDAT Installation: /home/liam/Downloads/xnat
Using JAVA_HOME:         /usr/lib/jvm/java-7-oracle

 
Verify Java Version (with java -version)
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
 
Executing /home/liam/Downloads/xnat/plugin-resources/maven-1.0.2/bin/maven xdat:setup
 __  __
|  \/  |__ _Apache__ ___
| |\/| / _` \ V / -_) ' \  ~ intelligent projects ~
|_|  |_\__,_|\_/\___|_||_|  v. 1.0.2

build:start:

xdat:setup:
    [echo] HOME: /home/liam/Downloads/xnat
Unable to connected to 'jdbc:postgresql://localhost/xnat'
Please resolve the PostgreSQL issue (specified below).

BUILD FAILED
File...... /home/liam/Downloads/xnat/maven.xml
Element... ant:TestDB
Line...... 1427
Column.... 183
Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
Total time: 1 seconds
Finished at: Fri Jul 25 13:10:05 CDT 2014

Herrick, Rick

unread,
Jul 25, 2014, 3:19:29 PM7/25/14
to xnat_di...@googlegroups.com
That just looks like you have an issue with connecting to the database. I'd suggest creating a user dedicated for the xnat database rather than using the postgres user. Something like:

[xnatdev@xnat-dev02 xnat]$ createuser -U postgres xnat
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) y
Shall the new role be allowed to create more new roles? (y/n) n
[xnatdev@xnat-dev02 xnat]$ createdb -U xnat xnat

Then you may need to modify your pg_hba.conf configuration to set the authentication method for the xnat user. If you search this group, there were a few conversations recently about how to set that up.

Rick Herrick
Sr. Programmer/Analyst
Neuroinformatics Research Group
Washington University School of Medicine
(314) 827-4250

________________________________________
From: xnat_di...@googlegroups.com [xnat_di...@googlegroups.com] on behalf of William Chaney [william...@gmail.com]
Sent: Friday, July 25, 2014 1:49 PM
To: xnat_di...@googlegroups.com
Subject: [XNAT Discussion] Re: JAVA_HOME variable not defined correctly
--
You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xnat_discussi...@googlegroups.com<mailto:xnat_discussi...@googlegroups.com>.
To post to this group, send email to xnat_di...@googlegroups.com<mailto:xnat_di...@googlegroups.com>.

William Chaney

unread,
Jul 25, 2014, 5:49:22 PM7/25/14
to xnat_di...@googlegroups.com
To tell  you the truth Dr. Herrick I am just an intern. My mentor wasn't here today so I would rather wait for him on Monday to continue this. I hope it is not too much trouble.


On Friday, July 25, 2014 10:50:30 AM UTC-5, William Chaney wrote:

William Chaney

unread,
Jul 28, 2014, 4:04:09 PM7/28/14
to xnat_di...@googlegroups.com
it is now giving me a new problem this is the text



Using XDAT Installation: /home/liam/Downloads/xnat
Using JAVA_HOME:         /usr/lib/jvm/java-7-oracle
 
Verify Java Version (with java -version)
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
 
Executing /home/liam/Downloads/xnat/plugin-resources/maven-1.0.2/bin/maven xdat:setup
 __  __
|  \/  |__ _Apache__ ___
| |\/| / _` \ V / -_) ' \  ~ intelligent projects ~
|_|  |_\__,_|\_/\___|_||_|  v. 1.0.2

build:start:

xdat:setup:
    [echo] HOME: /home/liam/Downloads/xnat
Unable to connected to 'jdbc:postgresql://localhost/xnat'
Please resolve the PostgreSQL issue (specified below).

BUILD FAILED
File...... /home/liam/Downloads/xnat/maven.xml
Element... ant:TestDB
Line...... 1429
Column.... 183
FATAL: role "postgres" does not exist
Total time: 1 seconds
Finished at: Mon Jul 28 14:42:44 CDT 2014


and I matched my pg_hba.conf file to this example
# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
local   all         all                               trust

# The same using local loopback TCP/IP connections.
#
# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
host    all         all         127.0.0.1/32          trust    

# The same as the last line but using a separate netmask column
#
# TYPE  DATABASE    USER        IP-ADDRESS    IP-MASK             METHOD
host    all         all         127.0.0.1     255.255.255.255     trust    

# Allow any user from any host with IP address 192.168.93.x to connect
# to database "postgres" as the same user name that ident reports for
# the connection (typically the Unix user name).
#
# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
host    postgres    all         192.168.93.0/24       ident sameuser

# Allow a user from host 192.168.12.10 to connect to database
# "postgres" if the user's password is correctly supplied.
#
# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
host    postgres    all         192.168.12.10/32      md5

# In the absence of preceding "host" lines, these two lines will
# reject all connection from 192.168.54.1 (since that entry will be
# matched first), but allow Kerberos 5 connections from anywhere else
# on the Internet.  The zero mask means that no bits of the host IP
# address are considered so it matches any host.
#
# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
host    all         all         192.168.54.1/32       reject
host    all         all         0.0.0.0/0             krb5

# Allow users from 192.168.x.x hosts to connect to any database, if
# they pass the ident check.  If, for example, ident says the user is
# "bryanh" and he requests to connect as PostgreSQL user "guest1", the
# connection is allowed if there is an entry in pg_ident.conf for map
# "omicron" that says "bryanh" is allowed to connect as "guest1".
#
# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
host    all         all         192.168.0.0/16        ident omicron

# If these are the only three lines for local connections, they will
# allow local users to connect only to their own databases (databases
# with the same name as their database user name) except for administrators
# and members of role "support", who can connect to all databases.  The file
# $PGDATA/admins contains a list of names of administrators.  Passwords
# are required in all cases.
#
# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
local   sameuser    all                               md5
local   all         @admins                           md5
local   all         +support                          md5

# The last two lines above can be combined into a single line:
local   all         @admins,+support                  md5

# The database column can also use lists and file names:
local   db1,db2,@demodbs  all                         md5



On Friday, July 25, 2014 10:50:30 AM UTC-5, William Chaney wrote:

Herrick, Rick

unread,
Jul 28, 2014, 4:07:35 PM7/28/14
to xnat_di...@googlegroups.com

Are you able to log into PostgreSQL through psql? This is really not an XNAT issue, but is an issue with how the PostgreSQL server is configured. You need to make sure you can connect to that before XNAT itself can connect. Like I said previously, I’d also suggest not using the postgres user for that purpose, but creating a specific xnat user and creating a config in your pg_hba.conf for that user.

 

Rick Herrick

Sr. Programmer/Analyst

Neuroinformatics Research Group

Washington University School of Medicine

(314) 827-4250

 

From: xnat_di...@googlegroups.com [mailto:xnat_di...@googlegroups.com] On Behalf Of William Chaney
Sent: Monday, July 28, 2014 3:04 PM
To: xnat_di...@googlegroups.com
Subject: [XNAT Discussion] Re: JAVA_HOME variable not defined correctly

 

it is now giving me a new problem this is the text

--
You received this message because you are subscribed to the Google Groups "xnat_discussion" group.

To unsubscribe from this group and stop receiving emails from it, send an email to xnat_discussi...@googlegroups.com.
To post to this group, send email to xnat_di...@googlegroups.com.

William Chaney

unread,
Jul 30, 2014, 11:44:05 AM7/30/14
to xnat_di...@googlegroups.com
I could not connect through psql through anyone else but postgres whenever I try to sign in to another postgres user it says their is no password entry for them I have several times gone in through users to circumvent this problem: MyUser > Root > postgres and for some reason postgres does not like my password.


On Friday, July 25, 2014 10:50:30 AM UTC-5, William Chaney wrote:

Herrick, Rick

unread,
Jul 30, 2014, 1:40:15 PM7/30/14
to xnat_di...@googlegroups.com

That’s something you’re going to need to get figured out. There’s clearly some kind of connection issue with your database. You should be able to add a user (e.g. xnat), modify the pg_hba.conf to allow that user to connect from the localhost without a password, restart postgres, and then connect with that user.

 

You can find out more about the pg_hba.conf here: http://www.postgresql.org/docs/9.2/static/auth-pg-hba-conf.html

 

You’ll want to add something like this:

 

host    xnat     xnat    127.0.0.1/32        trust

local   xnat     xnat                        trust

 

That says that on hosts starting with 127.0.0 (i.e. anything that is normally construed as localhost), the xnat user is trusted on the xnat database, so you can’t fail on login. The second line says that the same thing goes for user xnat on database xnat on the localhost (which can be different from 127.0.0.* depending on whether the connection uses the loopback network interface).

 

I think you don’t need to add the xnat role before doing that, but you want to do that anyway just in case.

 

But however you do it, you need to be able to connect to the database reliably as a prerequisite to getting XNAT to work.

 

Rick Herrick

Sr. Programmer/Analyst

Neuroinformatics Research Group

Washington University School of Medicine

(314) 827-4250

 

From: xnat_di...@googlegroups.com [mailto:xnat_di...@googlegroups.com] On Behalf Of William Chaney
Sent: Wednesday, July 30, 2014 10:44 AM
To: xnat_di...@googlegroups.com
Subject: [XNAT Discussion] Re: JAVA_HOME variable not defined correctly

 

I could not connect through psql through anyone else but postgres whenever I try to sign in to another postgres user it says their is no password entry for them I have several times gone in through users to circumvent this problem: MyUser > Root > postgres and for some reason postgres does not like my password.

--
You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xnat_discussi...@googlegroups.com.
To post to this group, send email to xnat_di...@googlegroups.com.
Visit this group at http://groups.google.com/group/xnat_discussion.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages