ESGF / esgf-installer

ESGF P2P Node Installer
https://esgf.llnl.gov/
Other
20 stars 21 forks source link

esgf 3.x installer ran to completion (auto installer), but esgf-idp is failing #499

Closed nathanlcarlson closed 6 years ago

nathanlcarlson commented 6 years ago

From the Tomcat log /usr/local/tomcat/logs/catalina.out

31-Aug-2018 10:08:51.275 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal Context [/esgf-idp] startup failed due to previous errors

The previous errors refer to a NullPointerException

Caused by: java.lang.NullPointerException
        at esg.node.security.UserInfoCredentialedDAO.useCredentials(UserInfoCredentialedDAO.java:82)
        at esg.node.security.UserInfoCredentialedDAO.<init>(UserInfoCredentialedDAO.java:62)
        at esg.node.security.UserInfoCredentialedDAO.<init>(UserInfoCredentialedDAO.java:66)
        at esg.security.registration.service.impl.RegistrationServiceImpl.<init>(RegistrationServiceImpl.java:34)

Lines 81 and 82 of esg.node.security.UserInfoCredentialedDAO

user = userInfoDAO.getUserById(cred.getid());
if(!user.isValid()) { log.info("User ["+cred.getid()+"] is NOT a valid user on this system"); return false; }

getUserById is a larger function that does some database queries and is returning null. After reviewing the logs I found

ERROR [localhost-startStop-1] (UserInfoDAO.java:getUserById():587) - org.postgresql.util.PSQLException: FATAL: no pg_hba.conf entry for host "127.0.0.1", user "dbsuper", database "esgcet", SSL off
ERROR [localhost-startStop-1] (UserInfoDAO.java:getUserById():593) - org.postgresql.util.PSQLException: FATAL: no pg_hba.conf entry for host "127.0.0.1", user "dbsuper", database "esgcet", SSL off
ERROR [localhost-startStop-1] (UserInfoDAO.java:getUserById():594) - esg.node.security.ESGFDataAccessException: org.postgresql.util.PSQLException: FATAL: no pg_hba.conf entry for host "127.0.0.1", user "dbsuper", database "esgcet", SSL off

This leads me to conclude that the database queries in getUserById are failing because it cannot connect and is thus returning null.

nathanlcarlson commented 6 years ago

The pg_hba.conf file looks like this currently

local    all             postgres                    md5
local    all             all                         md5
host     all             all         ::1/128         md5

Refer to https://www.postgresql.org/docs/8.4/static/auth-pg-hba-conf.html for how this should be for Postgres 8.4. If you are reading this and 8.4 is no longer being used, make sure to switch to the correct format.

nathanlcarlson commented 6 years ago

::1/128 above is the IPv6 format for the loopback interface. From the Postgres documentation linked above

An entry given in IPv6 format will match only IPv6 connections, even if the represented address is in the IPv4-in-IPv6 range.

I think the Java Postgres client is attempting to connect using an IPv4 connection. I think this is why it is failing.

nathanlcarlson commented 6 years ago

513 resolved the lack of a IPv4 localhost entry. Another issue has now arisen. Warnings are included as they may be helpful in debugging.

WARN  [localhost-startStop-1] (DatabaseResource.java:getInstance():101) - Instance is NULL!!! "init" must be called prior to calling this method!!
WARN  [localhost-startStop-1] (ESGFProperties.java:readFromFile():150) - ESGF_HOME not set
WARN  [localhost-startStop-1] (ReloadableFileSet.java:<init>():60) - File /esg/config/esgf_ats_static.xml not found
WARN  [localhost-startStop-1] (RealmVerifier.java:setEnforceRpId():107) - RP discovery / realm validation disabled; 
WARN  [localhost-startStop-1] (RealmVerifier.java:setEnforceRpId():107) - RP discovery / realm validation disabled; 
WARN  [localhost-startStop-1] (ESGFProperties.java:readFromFile():150) - ESGF_HOME not set
ERROR [localhost-startStop-1] (UserInfoDAO.java:getUserById():587) - org.postgresql.util.PSQLException: The server requested password-based authentication, but no password was provided.
ERROR [localhost-startStop-1] (UserInfoDAO.java:getUserById():593) - org.postgresql.util.PSQLException: The server requested password-based authentication, but no password was provided.
ERROR [localhost-startStop-1] (UserInfoDAO.java:getUserById():594) - esg.node.security.ESGFDataAccessException: org.postgresql.util.PSQLException: The server requested password-based authentication, but no password was provided.
nathanlcarlson commented 6 years ago

It seems that the problem is simply the environment variable ESGF_HOME needs to be set (to /esg), probably when Tomcat is started.