ant fresh_install vs postgres

1,000 views
Skip to first unread message

Walter Rutherford

unread,
Jan 27, 2017, 4:58:56 PM1/27/17
to DSpace Technical Support

I've proceeded through the DSpace installation but have been stuck during the 'ant fresh_install'.
It doesn't get very far into test_database before it has a cascade of errors.

[root@irtest dspace-installer]# ant fresh_install
Buildfile: /home/dspace/dspace-6.0-src-release/dspace/target/dspace-installer/build.xml

init_installation:

prepare_configs:
    [mkdir] Created dir: /home/dspace/dspace-6.0-src-release/dspace/target/dspace-installer/config-temp
     [copy] Copying 157 files to /home/dspace/dspace-6.0-src-release/dspace/target/dspace-installer/config-temp
     [copy] Copying 1 file to /home/dspace/dspace-6.0-src-release/dspace/target/dspace-installer/config-temp
     [copy] Copying 16 files to /home/dspace/dspace-6.0-src-release/dspace/target/dspace-installer/config-temp

init_configs:
     [copy] Copying 1 file to /home/dspace/config
   [delete] Deleting directory /home/dspace/dspace-6.0-src-release/dspace/target/dspace-installer/config-temp

test_database:
     [java] 2017-01-27 12:25:08,822 WARN  org.dspace.services.email.EmailServiceImpl @ Couldn't get an email session from environment:  Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial
     [java] 
     [java] Error running 'test': 
     [java]  - java.sql.SQLException: Cannot create PoolableConnectionFactory (The connection attempt failed.)
     [java] 
     [java] Please see the DSpace documentation for assistance.
     [java] 
     [java] java.sql.SQLException: Cannot create PoolableConnectionFactory (The connection attempt failed.)
...

 I suspect there's something wrong with accessing the postgres database. I can access it from
the command-line (with or without specifying the database) but only if I don't specify localhost.
[root@irtest dspace-installer]# psql -U dspace -h localhost
psql: FATAL:  Ident authentication failed for user "dspace"

[root@irtest dspace-installer]# psql -U dspace -W -h localhost
Password for user dspace: 
psql: FATAL:  Ident authentication failed for user "dspace"

[root@irtest dspace-installer]# psql -U dspace
psql (9.5.5)
Type "help" for help.
dspace=> \q

[root@irtest dspace-installer]# psql -U dspace -d dspace --list
                                  List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   
-----------+----------+----------+-------------+-------------+-----------------------
 dspace    | dspace   | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
(4 rows)

Here are the uncommented lines from pg_hba.conf. If I recall it was failing as 'peer' so I set local to 'trust'
[root@irtest data]# egrep -v "^#|^$" /var/lib/pgsql/9.5/data/pg_hba.conf
local   all             all                                     trust
host    all             all             127.0.0.1/32            ident
host    all             all             ::1/128                 ident

I had had file ownership issues initially but I think I've caught all those.

Any assistance is greatly appreciated. Thank you.

Luiz dos Santos

unread,
Jan 27, 2017, 5:07:38 PM1/27/17
to Walter Rutherford, DSpace Technical Support
You should create the dspace database, using the lines below. You are installing the dspace with the root user, what is wrong, you should use a not superuser instead, most likely the user dspace.

You should see this playlist: https://www.youtube.com/playlist?list=PLlOglq06moTsd63OaJn6zK2g1fV4sSwYv , it is pretty strait forward.

createuser --username=postgres --no-superuser --pwprompt dspace
createdb --username=postgres --owner=dspace --encoding=UNICODE dspace

Best
Luiz Claudio Santos
http://luizclaudiosantos.me/

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

Walter Rutherford

unread,
Jan 27, 2017, 7:37:06 PM1/27/17
to DSpace Technical Support
Thanks Luiz. I didn't recall if I created the user and DB as root so I dropped them both while logged in as 'dspace'.
I'm still getting the same errors which seem to stem from this:
 
 Caused by: java.net.UnknownHostException: <hostname>

I've verified the hostname resolves in DNS and even added it to the /etc/hosts file and tried
using the IP address for dspace.hostname in my local.cfg file. Nothing has worked so far.

I'm stumped..

Walter Rutherford

unread,
Jan 30, 2017, 5:56:01 PM1/30/17
to DSpace Technical Support
This is the output from the 'ant fresh-install' command. I believe the first error is just a non-fatal WARNing, the fatal
problems come when it tries to access the postgres database. But I can't tell if the problem stems from postgres,
java, Maven (that created the ant files), ant, DNS, etc..

I'm new enough to both java and postgres that the error messages don't tell me anything.

[dspace@irtest dspace]$ cd target/dspace-installer/
[dspace@irtest dspace-installer]$ ant fresh_install
Buildfile: /home/dspace/dspace-6.0-src-release/dspace/target/dspace-installer/build.xml

init_installation:

prepare_configs:
    [mkdir] Created dir: /home/dspace/dspace-6.0-src-release/dspace/target/dspace-installer/config-temp
     [copy] Copying 157 files to /home/dspace/dspace-6.0-src-release/dspace/target/dspace-installer/config-temp
     [copy] Copying 1 file to /home/dspace/dspace-6.0-src-release/dspace/target/dspace-installer/config-temp
     [copy] Copying 16 files to /home/dspace/dspace-6.0-src-release/dspace/target/dspace-installer/config-temp

init_configs:
     [copy] Copying 1 file to /home/dspace/config
   [delete] Deleting directory /home/dspace/dspace-6.0-src-release/dspace/target/dspace-installer/config-temp

test_database:
     [java] 2017-01-30 12:14:37,830 WARN  org.dspace.services.email.EmailServiceImpl @ Couldn't get an email session from environment:  Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial
     [java] 
     [java] Error running 'test': 2017-01-30 12:14:38,542 ERROR org.dspace.storage.rdbms.DatabaseUtils @ Unable to setup Flyway against DSpace database
     [java]  - java.sql.SQLException: Cannot create PoolableConnectionFactory (The connection attempt failed.)
     [java] 
     [java] 
     [java] Please see the DSpace documentation for assistance.
     [java] 
     [java] java.sql.SQLException: Cannot create PoolableConnectionFactory (The connection attempt failed.)java.sql.SQLException: Cannot create PoolableConnectionFactory (The connection attempt failed.)
     [java] 
     [java] at org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2294) at org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2294)
     [java] 
     [java] at org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2039) at org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2039)
     [java] 
     [java] at org.apache.commons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1533) at org.apache.commons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1533)
     [java] at org.dspace.storage.rdbms.DatabaseUtils.main(DatabaseUtils.java:105)
     [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     [java] 
     [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
     [java] at org.dspace.storage.rdbms.DatabaseUtils.setupFlyway(DatabaseUtils.java:473) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     [java] 
     [java] at java.lang.reflect.Method.invoke(Method.java:606)
     [java] at org.dspace.storage.rdbms.DatabaseUtils.main(DatabaseUtils.java:98)
     [java] at org.dspace.app.launcher.ScriptLauncher.runOneCommand(ScriptLauncher.java:229) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     [java] at org.dspace.app.launcher.ScriptLauncher.main(ScriptLauncher.java:81)
     [java] Caused by: org.postgresql.util.PSQLException: The connection attempt failed.
     [java] 
     [java] at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:275)
     [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:54)
     [java] 
     [java] at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:218) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     [java] 
     [java] at org.postgresql.Driver.makeConnection(Driver.java:407)
     [java] at org.postgresql.Driver.connect(Driver.java:275) at java.lang.reflect.Method.invoke(Method.java:606)
     [java] 
     [java] at org.apache.commons.dbcp2.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:39) at org.dspace.app.launcher.ScriptLauncher.runOneCommand(ScriptLauncher.java:229)
     [java] at org.apache.commons.dbcp2.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:256)
     [java] 
     [java] at org.apache.commons.dbcp2.BasicDataSource.validateConnectionFactory(BasicDataSource.java:2304) at org.dspace.app.launcher.ScriptLauncher.main(ScriptLauncher.java:81)
     [java] at org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2290)
     [java] 
     [java] ... 9 more
     [java] Caused by: java.net.UnknownHostException: "irtest.library.uaf.edu"Caused by: org.postgresql.util.PSQLException: The connection attempt failed.
     [java] at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:178)
     [java] at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
     [java] 
     [java] at java.net.Socket.connect(Socket.java:576) at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:275)
     [java] at org.postgresql.core.PGStream.<init>(PGStream.java:64)
     [java] 
     [java] at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:54)
     [java] at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:147) at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:218)
     [java] ... 17 more
     [java] 
     [java] at org.postgresql.Driver.makeConnection(Driver.java:407)
     [java] at org.postgresql.Driver.connect(Driver.java:275)
     [java] at org.apache.commons.dbcp2.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:39)
     [java] at org.apache.commons.dbcp2.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:256)
     [java] at org.apache.commons.dbcp2.BasicDataSource.validateConnectionFactory(BasicDataSource.java:2304)
     [java] at org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2290)
     [java] ... 10 more
     [java] Caused by: java.net.UnknownHostException: "irtest.library.uaf.edu"
     [java] at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:178)
     [java] at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
     [java] at java.net.Socket.connect(Socket.java:576)
     [java] at org.postgresql.core.PGStream.<init>(PGStream.java:64)
     [java] at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:147)
     [java] ... 18 more
     [java] 
     [java] Attempting to connect to database
     [java] 2017-01-30 12:14:38,608 WARN  org.dspace.services.sessions.SessionRequestServiceImpl @ Request interceptor (org.dspace.services.events.SystemEventService$EventRequestInterceptor@17fcf875) failed to execute on end (request-814-1485810878464): null

BUILD FAILED
/home/dspace/dspace-6.0-src-release/dspace/target/dspace-installer/build.xml:792: Java returned: 1

Total time: 10 seconds
[dspace@irtest dspace-installer]$

Luiz dos Santos

unread,
Jan 30, 2017, 6:00:31 PM1/30/17
to Walter Rutherford, DSpace Technical Support
Hi,

   I could not connect to the database: java.sql.SQLException: Cannot create PoolableConnectionFactory (The connection attempt failed.)java.sql.SQLException: Cannot create PoolableConnectionFactory (The connection attempt failed.)

    Are you able to connect in the data base by command line: (psql -U "user-name" ) and then the passowrd.

Best regards 

Luiz Claudio Santos
http://luizclaudiosantos.me/

Walter Rutherford

unread,
Jan 30, 2017, 7:02:07 PM1/30/17
to DSpace Technical Support

Yes and no.
If I'm logged into Linux as user 'dspace' (which is also the name of the postgres user and database) then
'psql -U dspace' drops me in without a password. If I force a password with 'psql -U dspace -W' I can get
in just fine even with an incorrect password! But if I try from another Linux login the connection fails with:
    psql: FATAL:  Peer authentication failed for user "dspace"

.The tail end of the pg_hba.conf file looks about like this:
# TYPE  DATABASE        USER            ADDRESS                 METHOD

# Tighten security per instructions in DSpace Manual
host    dspace         dspace     127.0.0.1  255.255.255.255    md5
#host    dspace         dspace     127.0.0.1  255.255.255.255    peer

# "local" is for Unix domain socket connections only
local   all             all                                     peer
#local   all             all                                     trust
# IPv4 local connections:
host    all             all             127.0.0.1/32            ident
# IPv6 local connections:

Walter Rutherford

unread,
Jan 30, 2017, 7:16:53 PM1/30/17
to DSpace Technical Support
I think that all makes sense. If I'm logging in from user 'dspace' to  'dspace' in posgres it uses
the peer rule and lets me in without a password. Any other user would have to be accessing
their own user/database.
So, how should the pg_hba.conf file be configured to allow any user to access the DSpace
database via a webpage and Tomcat?

Walter Rutherford

unread,
Jan 30, 2017, 8:53:57 PM1/30/17
to DSpace Technical Support
I tried some of the commented rules in pg_hba.conf. They either wouldn't allow the postgres server to
restart or there was no obvious change - I continued to get the java.net.UnknownHostException error
which implies to me that the authentication method isn't the immediate cause of the ant failure. It's a
problem identifying the DSpace server host.

I changed domain.hostname in my DSpace local.cfg to the IP address and to "localhost" and reran
"mvn clean package". Each time it created the ant installer targets and each time it failed with the
same error as before except the host it tried to reach changed to the IP address and "localhost". I
did an nslookup for both the IP address and the hostname and they both resolve to the other so it
doesn't appear DNS is the problem. It's also obvious the local.cfg file is being consulted.

Walter Rutherford

unread,
Jan 30, 2017, 8:56:51 PM1/30/17
to DSpace Technical Support

Sorry... Correction: "dspace.hostname" not "domain.hostname".

Luiz dos Santos

unread,
Jan 31, 2017, 5:09:21 AM1/31/17
to DSpace Technical Support, Walter Rutherford
Man, it is really weird, I've not ever faced an issue like that, it is hard to know what is going on. If I was your shoes I could keep try, but right now, I don't have any idea to offer to you, sorry!

On Mon, Jan 30, 2017 at 8:56 PM Walter Rutherford <wlruth...@gmail.com> wrote:

Sorry... Correction: "dspace.hostname" not "domain.hostname".

--
You received this message because you are subscribed to the Google Groups "DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dspace-tech...@googlegroups.com.

To post to this group, send email to dspac...@googlegroups.com.
Visit this group at https://groups.google.com/group/dspace-tech.
For more options, visit https://groups.google.com/d/optout.
--

Mark Wood

unread,
Jan 31, 2017, 10:03:37 AM1/31/17
to DSpace Technical Support

You need an entry that matches the db.* settings in dspace.cfg or local.cfg.  db.url specifies the DBMS hostname, db.username the database user, and db.password the database user's password.  If your db.url is 'jdbc:postgresql://localhost:5432/dspace', db.username is 'dspace', and db.password is 'secret', then your existing 'host dspace dspace...' rule should work.  The DBMS cluster would have to be on the local host and have to have a user 'dspace' with the password 'secret' for this to work.

The PostgreSQL JDBC driver always uses a TCP connection, not a local socket, so only 'host' or 'hostssl' rules will apply to DSpace.  The 'psql' tool will by default use the local socket, so only 'local' rules will apply to it unless you tell it otherwise using the --host option.

Luiz dos Santos

unread,
Jan 31, 2017, 10:18:43 AM1/31/17
to Mark Wood, DSpace Technical Support
Hi Mark,

    Maybe I lost that part, but he said that the database is local, right? if he is using the Dspace 6, he should use local.cfg, it is not an option, right? The wierd thing here is that he said, he can connect with the linux user "dspace", but not with others linux user, to me it seem like there is something wrong with the his database installation, right?  I would install the database as a service in linux.  

Best regards

Luiz Claudio Santos
http://luizclaudiosantos.me/

--
You received this message because you are subscribed to the Google Groups "DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dspace-tech+unsubscribe@googlegroups.com.

Walter Rutherford

unread,
Jan 31, 2017, 1:45:08 PM1/31/17
to DSpace Technical Support
Postgres is running as a Linux service if that's what you mean.

Luiz dos Santos

unread,
Jan 31, 2017, 1:54:31 PM1/31/17
to Walter Rutherford, DSpace Technical Support
Hi Walter,

    I was clarify some points of Mark's e-mail... About you issue, I guess it is something with config/installation of your database, but I don't have idea how to solve it, but review the connection info in the dspace.cfg/local.cfg as Mark said is always a good idea.

Best regards

Luiz Claudio Santos
http://luizclaudiosantos.me/

On Tue, Jan 31, 2017 at 1:45 PM, Walter Rutherford <wlruth...@gmail.com> wrote:
Postgres is running as a Linux service if that's what you mean.

Walter Rutherford

unread,
Jan 31, 2017, 3:14:48 PM1/31/17
to DSpace Technical Support

Thanks Mark and Luiz. Unless I'm misunderstanding how it reads variables I'm using almost the default
values in our local.cfg file::

dspace.hostname = "irtest.library.uaf.edu"
dspace.baseUrl = http://${dspace.hostname}:5432/
db.url = jdbc:postgresql://${dspace.hostname}:5432/dspace

With db.username and db.password defined exactly as in the database. It appears to be choking on the
dspace.hostname because I've tried both 'localhost' and the systems IP address. All that changed was
the hostname specified in the java.net.UnknownHostExcpetion error message.

But there are a LOT of parameters that can be tweaked so it's very possible I missed something.


Walter Rutherford

unread,
Jan 31, 2017, 3:23:12 PM1/31/17
to DSpace Technical Support
I remember having some difficulty during the database part of the installation. I'm tempted to rip out the
database down to reinstalling Postgres and starting over. But before I do, should the dspace user have
an special privileges? I didn't see where any should be set in the instructs so it looks pretty bare:
dspace=> \du
                                   List of roles
 Role name |                         Attributes                         | Member
 of 
-----------+------------------------------------------------------------+-------
----
 dspace    |                                                            | {}
 postgres  | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
 walter    |                                                            | {}

Luiz dos Santos

unread,
Jan 31, 2017, 3:23:25 PM1/31/17
to Walter Rutherford, DSpace Technical Support
Hi Walter,

    Are you sure the database is available outside of the server, did you try to use db.url = jdbc:postgresql://localhost:5432/dspace, and more the Dspace dspace it should be something like baseUrl = http://${dspace.hostname}:80/ or dspace.baseUrl = http://${dspace.hostname}:8080/, but have the tomcat in the same port of the database doesn't make sense.

Best regards

Luiz Claudio Santos
http://luizclaudiosantos.me/

Tom Desair

unread,
Jan 31, 2017, 4:03:25 PM1/31/17
to Walter Rutherford, DSpace Technical Support
Hi Walter,

You need to make sure of the following:
  1. Allow the "dspace" PostgreSQL user to connect using a password: This means having the following line to the pg_hba.conf file:
      • "host    dspace         dspace     127.0.0.1  255.255.255.255    md5" 
      • This tells the Postgres server to allow database connection for user DSpace using password authentication but only when the request comes from ip address 127.0.0.1 (which is localhost)
    1. Test database connection: On your DSpace server, verify that as a user which is not dspace that you can connect to the PostgreSQL database using: 
      • psql -h localhost -p 5432 -d dspace -U dspace
      • This should prompt you for a password
    2. local.cfg values: In your local.cfg file, you should have the following property:
        • db.url = jdbc:postgresql://localhost:5432/dspace
        • Note that using "localhost" here is important because in step 1 we told the Postgres database to only allow connection coming from localhost. If you put "irtest.library.uaf.edu" here, the request to the database will go through the full network stack and the Postgres database will see your external network IP address as the request IP address and not allow access.
      1. Make sure the "dspace" user has the correct roles: Connect to your PostgreSQL database and execute:
        • ALTER ROLE dspace NOSUPERUSER CREATEDB NOCREATEROLE NOCREATEUSER;
      Do these steps solve your problem?

       
      logoTom Desair
      250-B Suite 3A, Lucius Gordon Drive, West Henrietta, NY 14586
      Esperantolaan 4, Heverlee 3001, Belgium
      www.atmire.com


      Luiz dos Santos

      unread,
      Jan 31, 2017, 4:23:07 PM1/31/17
      to Tom Desair, Walter Rutherford, DSpace Technical Support
      Hi Tom,

          It was a very complete answer, you should put it in a wiki page as  a troubleshooting.

      Best
      Luiz Claudio Santos
      http://luizclaudiosantos.me/

      Walter Rutherford

      unread,
      Jan 31, 2017, 5:19:04 PM1/31/17
      to DSpace Technical Support

       Thank you Tom.

      1) I have the md5 line in the pg_hba.conf file
      3) Changed dspace.hostname to "localhost" then later to localhost (no quotes) since that's the default
      4) Postgres complained with I tried to reset dspace's attributes

           postgres=# alter role dspace NOSUPERUSER CREATEDB NOCREATEROLE NOCREATEUSER;
           ERROR:  conflicting or redundant options

      Not sure what it didn't like but, since it didn't have any superpowers before, I just added CREATEDB and that passed.

      2) Now I can access the database BUT only if I don't specify '-U dspace'.

      [root@irtest config]# su - walter
      [walter@irtest ~]$ psql -h localhost -p 5432 -d dspace -U dspace
      psql: FATAL:  Ident authentication failed for user "dspace"
      [walter@irtest ~]$ psql -d dspace
      psql (9.5.5)
      Type "help" for help.

      dspace=> \du
                                         List of roles
       Role name |                         Attributes                         | Member
       of 
      -----------+------------------------------------------------------------+-------
       dspace    | Create DB                                                  | {}
       postgres  | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
       walter    |                                                            | {}

      dspace=> \q
      [walter@irtest ~]$ psql -d dspace -U dspace
      psql: FATAL:  Peer authentication failed for user "dspace"

      [walter@irtest ~]$ [walter@irtest ~]$ psql -d dspace -p 5432
      psql (9.5.5)
      Type "help" for help.

      dspace=> \c
      You are now connected to database "dspace" as user "walter".
      dspace=> \q
      [walter@irtest ~]$ 


      The mvn command succeeded but, at first, the 'ant fresh_install' failed. :-(
      But I realized that was because somebody had stopped the database server.
      If failed a second time but AFTER it successfully connected to the database!
      That is SO much closer - Now it's only complaining about pgcrypto which I was
      sure I had added weeks ago. Now I wonder if I installed it on a different database.

      test_database:
           [java] 2017-01-31 13:06:47,925 WARN  org.dspace.services.email.EmailServiceImpl @ Couldn't get an email session from environment:  Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial
           [java] 
           [java] Attempting to connect to database
           [java] Connected successfully!
           [java] 
           [java] Database Type: postgres
           [java] Database URL: jdbc:postgresql://localhost:5432/dspace
           [java] Database Schema: public
           [java] Database Username: dspace
           [java] Database Software: PostgreSQL version 9.5.5
           [java] Database Driver: PostgreSQL Native Driver version PostgreSQL 9.4.1211.jre7
           [java] PostgreSQL 'pgcrypto' extension installed/up-to-date? false (not installed)
           [java] 
           [java] WARNING: Required PostgreSQL 'pgcrypto' extension is NOT INSTALLED on this database.
           [java] 
           [java] ** DSpace REQUIRES PostgreSQL >= 9.4 AND pgcrypto extension >= 1.1 **
           [java] 
           [java] To install it, please connect to your DSpace database as a 'superuser' and manually run the following command: 
           [java] 
           [java]   CREATE EXTENSION pgcrypto;
           [java] 

      I added the pgcrypto extension and reran the ant command. Holy Smokes! It worked!

           BUILD SUCCESSFUL
           Total time: 19 seconds

       
      I haven't gotten to the part where it coordinates with Tomcat but they shouldn't conflict because
      the database is using port 6543 and Tomcat uses 8080.

      Thanks again. I'll walk through the rest of the installation. Wish me luck!



      Walter Rutherford

      unread,
      Jan 31, 2017, 10:05:30 PM1/31/17
      to DSpace Technical Support
      I've previously only interacted with DSpace as a user so please pardon the
      'newb' questions. I'm trying to (re)create a repository that anyone can search
      via a website but only certain authorized local users can modify.

      Given these authentication rules:
      host     dspace         dspace     127.0.0.1  255.255.255.255    md5
      local    all             all                                     peer
      host     all             all             127.0.0.1/32            ident

      Aren't all the connections local, (explicitly or due to the 127 address)?

      When I have DSpace setup with Tomcat does the database see that as
      a local or host connection? Because if it's a host connection then
      the md5 host rule will kick in and the user will have to supply a password.
      And even then, given the ADDRESS it's still a local connection, right?
      So I assumed DSpace web connections would be translated into local
      (Tomcat => 'dspace') database queries/connections.

      If my 'dspace' database user had no authority to do anything dangerous
      and all access attempts are filtered through Tomcat as 'dspace' could I
      just 'trust' the connection since I (hopefully) can trust Tomcat? Then users
      wouldn't need a password to search our repository. Something like this:

      host     dspace         dspace    127.0.0.1  255.255.255.255    md5
      local    dspace         dspace                                  trust
      local    all            all                                     peer
      host     all            all             127.0.0.1/32            ident

      Or would that open my site up to all sorts of mischief?
      Note: I don't have the Tomcat interface up so I haven't yet tested any of this from a browser.

      Tom Desair

      unread,
      Feb 1, 2017, 6:11:27 AM2/1/17
      to Walter Rutherford, DSpace Technical Support
      Your PostgreSQL database is not aware of any users that are logged in into or connected to your DSpace web application. It is the Tomcat process itself (which serves the DSpace web app) that connects to your database and since both are on the same host, you should only have the rule "host     dspace         dspace    127.0.0.1  255.255.255.255    md5". You could see this as Tomcat executing queries on behalf of a user browsing your DSpace repository.

      The extra rule you added is a high security risk. I would strongly recommend you to remove it.

      Just to be sure, in your previous post you mentioned ports 5432 (the default) and 6543 but I'll assume this is a typo and that you have only one database server running.

      Best regards,
      Tom
       
      logoTom Desair
      250-B Suite 3A, Lucius Gordon Drive, West Henrietta, NY 14586
      Esperantolaan 4, Heverlee 3001, Belgium
      www.atmire.com

      Walter Rutherford

      unread,
      Feb 1, 2017, 11:54:10 AM2/1/17
      to DSpace Technical Support
      Thanks for clarifying. Tomcat is the dspace "user" accessing the database on behalf of a person
      searching our repository online, so everything is local as far as the database is concerned.

      To clarify my side, I didn't add that 'trust' authorization rule and 6543 was a typing-in-the-dark
      typo by a partial touch typist who never quite mastered the top row. :-)

      I still have a ways to go to get Tomcat to talk to the database, but getting past that ant install was
      I'm sure the biggest hurdle. Thanks again.

      Walter Rutherford

      unread,
      Feb 7, 2017, 1:55:41 PM2/7/17
      to DSpace Technical Support
      Sorry if this post is a bit chatty, but I wanted it to be helpful to anybody else who runs into the same problems.

      I had some initial success and was able to complete the 'ant fresh_install'. Tomcat didn't display the default page but
      I think that may be because I installed it with yum rather than from source code like the manual expected and it was
      installed in a different directory than DSpace expected. In the end I copied the directory ant built to where tomcat
      expects to find its pages (symlinks didn't work) and tomcat started with the default page.

      But it doesn't connect to the postgres database. That may be because it's running from a new location or there's still
      and issue with the pg_hba.conf file. I tried connecting again as a different user as Tom suggested above and got a
      new error:
        [walter@irtest ~]$ psql -h localhost -p 5432 -d dspace -U dspace
        psql: FATAL:  no pg_hba.conf entry for host "::1", user "dspace", database "dspace", SSL off

      It looks like it has skipped over the IPv4 host md5 rule and is trying to connect via IPv6. We aren't actively using IPv6 but
      just as a sanity check I added a new rule to the pg_hba.conf file:
        host     dspace          dspace          ::1/128                 md5

      Then logged in as a different user. It worked. So why is it ignoring the nearly identical IPv4 host rule???
      Reply all
      Reply to author
      Forward
      0 new messages