On 26/11/2020 19:57, Hrafn Malmquist wrote:

<snip/>

> I am running:
> 
> CentOS Linux release 7.8.2003
> Tomcat 9.0.12
> PostgreSQL 9.5.23
> openjdk version "1.8.0_262"
> OpenJDK Runtime Environment (build 1.8.0_262-b10)

There are good reasons to update to a more recent Tomcat 9 release but
I'm not aware of any fixes that would impact the specific issue you are
currently seeing.

>    1.  I downloaded postgresql-42.2.18.jar from
>    https://jdbc.postgresql.org/download/postgresql-42.2.18.jar and placed
>    it in /home/lib/dspace/apache-tomcat-9.0.12/lib

OK. That looks good.

>    2. In /home/lib/dspace/apache-tomcat-9.0.12/conf/server.xml I added the
>    following Resource
> 
>    <Resource name="jdbc/dspaceWeb"
>                  factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
>                  type="javax.sql.DataSource"
>                  auth="Container"
>                  username="*****"
>                  password="******"
>                  driverClassName="org.postgresql.Driver"
>                  url="jdbc:postgresql://localhost:5432/dspace"
>                  initialSize="5"
>                  maxTotal="50"
>                  maxIdle="15"
>                  minIdle="5" />

Exactly where in server.xml did you put this? What element was it nested
under?

>    There are a couple of issues that confuse me:
>    a) the official documentation about JNDI datasource examples [0] says 
> "*This
>    author has not had success here, although others have reported so.
>    Clarification would be appreciated here."  *in the section about
>    Postgres. In other words, we can't be sure this works?

That text needs to be removed. The author clearly made an error in their
config. This definitely works.

>    b) in the official documtation about JDBC connection pool it says that
>    if you want to define a JDBC connection pool in the Apache Container (which
>    I understand to be trying to do) you have to specify the factory attribute
>    and set the value to org.apache.tomcat.jdbc.pool.DataSourceFactory [1]

Do you want to use Tomcat's jdbc-pool? If so leave the factory attribute
as is. If you want to use Tomcat's built in copy for Apache Commons
DBCP2, remove the factory attribute.

Personally, I'd go with DBCP2 but either should work.

>    3. Created a context.xml in /dspace/webapps/xmlui/META-INF/

I think this is the problem. That location looks to be outside of the
default appBase. If I'm right, there is already a Context element
defined for this web application somewhere else. You need to find that
Context definition and add the ResourceLink to it.

> 
>    <Context docBase="/dspace/webapps/xmlui">>        <ResourceLink 
> name="jdbc/dspace"
>                      global="jdbc/dspaceWeb"
>                      type="javax.sql.DataSource"
>        />
>    </Context>

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to