mirror of
https://github.com/alanorth/cgspace-notes.git
synced 2025-01-27 05:49:12 +01:00
Update notes for 2017-12-19
This commit is contained in:
@ -529,4 +529,94 @@ $ cp ~/dspace/lib/postgresql-9.1-901-1.jdbc4.jar /usr/local/opt/tomcat@7/libexec
|
||||
- a `<ResourceLink>` defined in each web application's context XML
|
||||
- unset the `db.url`, `db.username`, and `db.password` parameters in dspace.cfg
|
||||
- set the `db.jndi` in dspace.cfg to the name specified in the web application context
|
||||
- After adding the `Resource` to _server.xml_ on Ubuntu I get this in Catalina's logs:
|
||||
|
||||
```
|
||||
SEVERE: Unable to create initial connections of pool.
|
||||
java.sql.SQLException: org.postgresql.Driver
|
||||
...
|
||||
Caused by: java.lang.ClassNotFoundException: org.postgresql.Driver
|
||||
```
|
||||
|
||||
- The username and password are correct, but maybe I need to copy the fucking lib there too?
|
||||
- I tried installing Ubuntu's `libpostgresql-jdbc-java` package but Tomcat still can't find the class
|
||||
- Let me try to symlink the lib into Tomcat's libs:
|
||||
|
||||
```
|
||||
# ln -sv /usr/share/java/postgresql.jar /usr/share/tomcat7/lib
|
||||
```
|
||||
|
||||
- Now Tomcat starts but the localhost container has errors:
|
||||
|
||||
```
|
||||
SEVERE: Exception sending context initialized event to listener instance of class org.dspace.app.util.DSpaceContextListener
|
||||
java.lang.AbstractMethodError: Method org/postgresql/jdbc3/Jdbc3ResultSet.isClosed()Z is abstract
|
||||
```
|
||||
|
||||
- Could be a version issue or something since the Ubuntu package provides 9.2 and DSpace's are 9.1...
|
||||
- Let me try to remove it and copy in DSpace's:
|
||||
|
||||
```
|
||||
# rm /usr/share/tomcat7/lib/postgresql.jar
|
||||
# cp [dspace]/webapps/xmlui/WEB-INF/lib/postgresql-9.1-901-1.jdbc4.jar /usr/share/tomcat7/lib/
|
||||
```
|
||||
|
||||
- Wow, I think that actually works...
|
||||
- I wonder if I could get the JDBC driver from postgresql.org instead of relying on the one from the DSpace build: https://jdbc.postgresql.org/
|
||||
- I notice our version is 9.1-901, which isn't even available anymore! The latest in the archived versions is 9.1-903
|
||||
- Also, since I commented out all the db parameters in DSpace.cfg, how does the command line `dspace` tool work?
|
||||
- Let's try the upstream JDBC driver first:
|
||||
|
||||
```
|
||||
# rm /usr/share/tomcat7/lib/postgresql-9.1-901-1.jdbc4.jar
|
||||
# wget https://jdbc.postgresql.org/download/postgresql-42.1.4.jar -O /usr/share/tomcat7/lib/postgresql-42.1.4.jar
|
||||
```
|
||||
|
||||
- DSpace command line fails unless db settings are present in dspace.cfg:
|
||||
|
||||
```
|
||||
$ dspace database info
|
||||
Caught exception:
|
||||
java.sql.SQLException: java.lang.ClassNotFoundException:
|
||||
at org.dspace.storage.rdbms.DataSourceInit.getDatasource(DataSourceInit.java:171)
|
||||
at org.dspace.storage.rdbms.DatabaseManager.initDataSource(DatabaseManager.java:1438)
|
||||
at org.dspace.storage.rdbms.DatabaseUtils.main(DatabaseUtils.java:81)
|
||||
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
||||
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
|
||||
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
||||
at java.lang.reflect.Method.invoke(Method.java:498)
|
||||
at org.dspace.app.launcher.ScriptLauncher.runOneCommand(ScriptLauncher.java:226)
|
||||
at org.dspace.app.launcher.ScriptLauncher.main(ScriptLauncher.java:78)
|
||||
Caused by: java.lang.ClassNotFoundException:
|
||||
at java.lang.Class.forName0(Native Method)
|
||||
at java.lang.Class.forName(Class.java:264)
|
||||
at org.dspace.storage.rdbms.DataSourceInit.getDatasource(DataSourceInit.java:41)
|
||||
... 8 more
|
||||
```
|
||||
|
||||
- And in the logs:
|
||||
|
||||
```
|
||||
2017-12-19 18:26:56,971 ERROR org.dspace.storage.rdbms.DatabaseManager @ Error retrieving JNDI context: jdbc/dspace
|
||||
javax.naming.NoInitialContextException: 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
|
||||
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)
|
||||
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313)
|
||||
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:350)
|
||||
at javax.naming.InitialContext.lookup(InitialContext.java:417)
|
||||
at org.dspace.storage.rdbms.DatabaseManager.initDataSource(DatabaseManager.java:1413)
|
||||
at org.dspace.storage.rdbms.DatabaseUtils.main(DatabaseUtils.java:81)
|
||||
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
||||
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
|
||||
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
||||
at java.lang.reflect.Method.invoke(Method.java:498)
|
||||
at org.dspace.app.launcher.ScriptLauncher.runOneCommand(ScriptLauncher.java:226)
|
||||
at org.dspace.app.launcher.ScriptLauncher.main(ScriptLauncher.java:78)
|
||||
2017-12-19 18:26:56,983 INFO org.dspace.storage.rdbms.DatabaseManager @ Unable to locate JNDI dataSource: jdbc/dspace
|
||||
2017-12-19 18:26:56,983 INFO org.dspace.storage.rdbms.DatabaseManager @ Falling back to creating own Database pool
|
||||
2017-12-19 18:26:56,992 WARN org.dspace.core.ConfigurationManager @ Warning: Number format error in property: db.maxconnections
|
||||
2017-12-19 18:26:56,992 WARN org.dspace.core.ConfigurationManager @ Warning: Number format error in property: db.maxwait
|
||||
2017-12-19 18:26:56,993 WARN org.dspace.core.ConfigurationManager @ Warning: Number format error in property: db.maxidle
|
||||
```
|
||||
|
||||
- If I add the db values back to dspace.cfg the `dspace database info` command succeeds but the log still shows errors retrieving the JNDI connection
|
||||
- Perhaps something to report to the dspace-tech mailing list when I finally send my comments
|
||||
|
Reference in New Issue
Block a user