From b6f2841ca7f41a84bdc664f8d0bb312335593184 Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Tue, 19 Dec 2017 18:33:19 +0200 Subject: [PATCH] Update notes for 2017-12-19 --- content/post/2017-12.md | 90 +++++++++++++++++++++++++++++++++ public/2017-12/index.html | 104 ++++++++++++++++++++++++++++++++++++-- public/robots.txt | 2 +- public/sitemap.xml | 20 ++++---- 4 files changed, 202 insertions(+), 14 deletions(-) diff --git a/content/post/2017-12.md b/content/post/2017-12.md index 56d9ce5d1..870242ee1 100644 --- a/content/post/2017-12.md +++ b/content/post/2017-12.md @@ -529,4 +529,94 @@ $ cp ~/dspace/lib/postgresql-9.1-901-1.jdbc4.jar /usr/local/opt/tomcat@7/libexec - a `` 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 diff --git a/public/2017-12/index.html b/public/2017-12/index.html index aac70bf7e..2108d4027 100644 --- a/public/2017-12/index.html +++ b/public/2017-12/index.html @@ -23,7 +23,7 @@ The list of connections to XMLUI and REST API for today: - + @@ -56,9 +56,9 @@ The list of connections to XMLUI and REST API for today: "@type": "BlogPosting", "headline": "December, 2017", "url": "https://alanorth.github.io/cgspace-notes/2017-12/", - "wordCount": "2915", + "wordCount": "3342", "datePublished": "2017-12-01T13:53:54+03:00", - "dateModified": "2017-12-19T10:38:57+02:00", + "dateModified": "2017-12-19T14:10:16+02:00", "author": { "@type": "Person", "name": "Alan Orth" @@ -708,6 +708,104 @@ javax.naming.NameNotFoundException: Name [jdbc/dspace] is not bound in this Cont
  • 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
    +
    + + + +
    # ln -sv /usr/share/java/postgresql.jar /usr/share/tomcat7/lib
    +
    + + + +
    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
    +
    + + + +
    # 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/
    +
    + + + +
    # 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 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
    +
    + + + +
    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
    +
    + + diff --git a/public/robots.txt b/public/robots.txt index 7c86be3fe..d2ae9994d 100644 --- a/public/robots.txt +++ b/public/robots.txt @@ -30,7 +30,7 @@ Disallow: /cgspace-notes/2015-12/ Disallow: /cgspace-notes/2015-11/ Disallow: /cgspace-notes/ Disallow: /cgspace-notes/categories/ -Disallow: /cgspace-notes/categories/notes/ Disallow: /cgspace-notes/tags/notes/ +Disallow: /cgspace-notes/categories/notes/ Disallow: /cgspace-notes/post/ Disallow: /cgspace-notes/tags/ diff --git a/public/sitemap.xml b/public/sitemap.xml index 163c01278..1f7bc756a 100644 --- a/public/sitemap.xml +++ b/public/sitemap.xml @@ -4,7 +4,7 @@ https://alanorth.github.io/cgspace-notes/2017-12/ - 2017-12-19T10:38:57+02:00 + 2017-12-19T14:10:16+02:00 @@ -139,7 +139,7 @@ https://alanorth.github.io/cgspace-notes/ - 2017-12-19T10:38:57+02:00 + 2017-12-19T14:10:16+02:00 0 @@ -148,27 +148,27 @@ 0 + + https://alanorth.github.io/cgspace-notes/tags/notes/ + 2017-12-19T14:10:16+02:00 + 0 + + https://alanorth.github.io/cgspace-notes/categories/notes/ 2017-09-28T12:00:49+03:00 0 - - https://alanorth.github.io/cgspace-notes/tags/notes/ - 2017-12-19T10:38:57+02:00 - 0 - - https://alanorth.github.io/cgspace-notes/post/ - 2017-12-19T10:38:57+02:00 + 2017-12-19T14:10:16+02:00 0 https://alanorth.github.io/cgspace-notes/tags/ - 2017-12-19T10:38:57+02:00 + 2017-12-19T14:10:16+02:00 0