2

We are getting below exception in the content service logs:

ERROR JPQLExecutor - Can not execute query: org.hibernate.exception.GenericJDBCException: Could not close connection at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54) ~[hibernate-core-4.3.9.Final.jar:4.3.9.Final] at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:126) ~[hibernate-core-4.3.9.Final.jar:4.3.9.Final] at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:112) ~[hibernate-core-4.3.9.Final.jar:4.3.9.Final]

Followed by below exception line:

Caused by: java.sql.SQLException: Already closed. at org.apache.commons.dbcp.PoolableConnection.close(PoolableConnection.java:114) ~[commons-dbcp-1.4.jar:1.4] at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.close(PoolingDataSource.java:191) ~[commons-dbcp-1.4.jar:1.4] at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.closeConnection(DatasourceConnectionProviderImpl.java:144) ~[hibernate-core-4.3.9.Final.jar:4.3.9.Final] at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.releaseConnection(AbstractSessionImpl.java:391) ~[hibernate-core-4.3.9.Final.jar:4.3.9.Final] at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.releaseConnection(LogicalConnectionImpl.java:255) ~[hibernate-core-4.3.9.Final.jar:4.3.9.Final]

I found this link on SO website, which suggests configuring few parameters in data source config https://stackoverflow.com/questions/16331959/java-sql-sqlexception-already-closed

However, I am unable to find any datasource config/XML file for Content Service.

My confusions/Queries:

  • Content service uses/is itself Apache Tomcat App?

  • Does this service has files like server.xml? Like we have in an apache tomcat app?

  • The Content Delivery microservices do run on Tomcat, yes. If you look in the file structure for it, you'll find some of the configuration files you expect to see on Tomcat (under [service_root]/services or bin, not sure anymore) – Nuno Linhares Sep 9 at 12:28
  • No idea. Try it out? – Nuno Linhares Sep 9 at 19:01
  • @NunoLinhares : Can I add parameters like: "validationQuery" and "testOnBorrow" to content service config file like we do for a normal Tomcat app : commons.apache.org/proper/commons-dbcp/configuration.html – Arvind thiag Sep 10 at 5:05
  • @NunoLinhares I wanted to see/try if it was possible to check if a connection is alive using the parameters like: "validationQuery" and "testOnBorrow" in config. It doesn't works so far. – Arvind thiag Sep 10 at 5:08
1

To answer your questions as per my knowledge:

Q: Content service uses/is itself an Apache Tomcat App?

A: Yes, The Content Delivery Microservices - developed as Spring Boot web applications include a pre-configured, embedded tomcat web server by default.

Q: Does this service has files like server.xml? Like we have in an apache tomcat app?

A: There is no server.xml in the part of microservices for us to configure, some cases for configuring the Tomcat embedded server through the application.properties file.

The following Common Embedded Tomcat Configurations can be done using application.properties

  • To enable SSL support
server.ssl.enabled=true 
server.ssl.protocol=TLS
server.ssl.key-store-password=my_password
server.ssl.key-store-type=keystore_type
server.ssl.key-store=keystore-path 
server.ssl.key-alias=tomcat
  • Tomcat Server Access Logs:
server.tomcat.accesslog.enabled=true
server.tomcat.accesslog.directory=logs
server.tomcat.accesslog.file-date-format=yyyy-MM-dd
server.tomcat.accesslog.prefix=access_log
server.tomcat.accesslog.suffix=.log
  • Service Port:

The service port information can be managed in the start.ps1 or InstallService.ps1 as startup parameters.

To view more possible configurations, please visit the official Spring Boot application properties docs page.

Q: Can I add parameters like: "validationQuery" and "testOnBorrow" to content service config file like we do for a normal Tomcat app?

A: Yes, It's possible to add those parameters in the cd_storage_config.xml in the Storage section.

eg:

<Pool Type="jdbc" Size="15" MonitorInterval="60" IdleTimeout="120" CheckoutTimeout="120" TestOnBorrow="true" ValidationQuery="SELECT 1"/>

I hope it helps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.