4Science / DSpace

This repository contains the 4Science optimized DSpace & DSpace-CRIS distribution.
https://wiki.lyrasis.org/display/DSPACECRIS/
BSD 3-Clause "New" or "Revised" License
43 stars 62 forks source link

dspace-cris script throw an error #326

Open smahi opened 1 year ago

smahi commented 1 year ago

I am using OS: Ubuntu 22.04 DB: Postgresql V14 DSPACE-CRIS: V7.5

Describe the bug launching the command ./dspace dsrun org.dspace.app.util.InitializeEntityTypesOnly -d throw an error

To Reproduce After successfully migrated the DB

./dspace database migrate

Database URL: jdbc:postgresql://localhost:5432/dspace
Migrating database to latest version... (Check dspace logs for details)
Done.

Steps to reproduce the behavior: launching this command ./dspace dsrun org.dspace.app.util.InitializeEntityTypesOnly -d from terminal

then this error appear

Exception: Cannot invoke "org.dspace.core.DBConnection.getSession()" because the return value of "org.dspace.core.Context.getDBConnection()" is null
java.lang.NullPointerException: Cannot invoke "org.dspace.core.DBConnection.getSession()" because the return value of "org.dspace.core.Context.getDBConnection()" is null
        at org.dspace.core.AbstractHibernateDAO.getHibernateSession(AbstractHibernateDAO.java:59)
        at org.dspace.core.AbstractHibernateDAO.getCriteriaBuilder(AbstractHibernateDAO.java:394)
        at org.dspace.content.dao.impl.EntityTypeDAOImpl.findByEntityType(EntityTypeDAOImpl.java:37)
        at org.dspace.content.EntityTypeServiceImpl.findByEntityType(EntityTypeServiceImpl.java:57)
        at org.dspace.app.util.InitializeEntityTypesOnly.assureExists(InitializeEntityTypesOnly.java:91)
        at org.dspace.app.util.InitializeEntityTypesOnly.main(InitializeEntityTypesOnly.java:64)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.dspace.app.launcher.ScriptLauncher.runOneCommand(ScriptLauncher.java:297)
        at org.dspace.app.launcher.ScriptLauncher.handleScript(ScriptLauncher.java:152)
        at org.dspace.app.launcher.ScriptLauncher.handleScript(ScriptLauncher.java:124)
        at org.dspace.app.launcher.ScriptLauncher.main(ScriptLauncher.java:99)

Expected behavior To run successfully and define Entities for dspace-cris

corrad82-4s commented 1 year ago

Hello, I think this could be related to version of PostgreSQL, could you check if it happens the same with a V12 or V13 Postgres database?