Error when starting Docker App-Only container

Hiroyuki Adachi shared this question 2 months ago
Answered

I am trying to install into a container using the App-Only image with the following reference, but I am getting an error and am unable to proceed.

https://wiki.yellowfinbi.com/display/yfcurrent/Install+in+a+Container

https://wiki.yellowfinbi.com/display/yfcurrent/Single+Instance+with+App-Only+Image

First I did a fresh install using the Yellowfin installer. I used postgres as the repository database.The attached image is a screenshot of the installation. postgres host is localhost and port number is 15432. (Sorry the image is in Japanese)

9b0464cd4829d3d7d8213da2a69b9abb


Next, I pulled the Yellowfin 9.7.1.1 App-Only image from Docker Hub.

docker pull yellowfinbi/yellowfin-app-only:9.7.1.1

I then created docker-compose.yaml with the following contents.

version: '3'
services:
  yellowfin-standalone-single-instance:
   ports:
      - "8081:8081"
   environment:
      - JDBC_CLASS_NAME=org.postgresql.Driver
      - JDBC_CONN_URL=jdbc:postgresql://localhost:15432/yellowfin
      - JDBC_CONN_USER=test
      - JDBC_CONN_PASS=password
      - JDBC_CONN_ENCRYPTED=false
   image: "yellowfinbi/yellowfin-app-only:9.7.1.1"
   container_name: yellowfin_9711

Next, I launched the Yellowfin container.

docker compose up -d

However, Yellowfin failed to start.While monitoring the logs during startup, the log output stopped for several minutes in the following areas.

=================== i4 JDBC Connection Pool ================================
|
| Description :  Connection Pool
| JDBC Driver :  org.postgresql.Driver
| Url :          jdbc:postgresql://localhost:15432/yellowfin
| User :         test
| Min Count :    2
| Max Count :    25
| Recycle :      null
| Timeout :      null
| PS Cache Size: null
| JDBC Fetch Size: null
| Isolation Level: null
| Heart Beat:      true
| No Verify:       false
| No Lock:         false
|
| JDBCFetchSize parameter could not be parsed

Later, when log output resumed, the following exception occurred.

java.lang.Exception: Failed to create DBConnectionPool
	at com.hof.pool.DBConnectionPool.createJDBCPool(DBConnectionPool.java:575)
	at com.hof.pool.DBConnectionManager.initialiseAppPool(DBConnectionManager.java:455)
	at com.hof.servlet.InitConnectionPool.init(InitConnectionPool.java:248)
	at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1164)
	at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1117)
	at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1010)
	at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4957)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5264)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:698)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:696)
	at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:690)
	at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1889)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
	at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:118)
	at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:583)
	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:473)
	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1618)
	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:319)
	at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
	at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423)
	at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:366)
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:946)
	at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:835)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1386)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
	at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:919)
	at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:263)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.core.StandardService.startInternal(StandardService.java:432)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:927)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:772)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:345)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:476)
Caused by: org.postgresql.util.PSQLException: Connection to localhost:15432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
	at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:285)
	at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
	at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:217)
	at org.postgresql.Driver.makeConnection(Driver.java:458)
	at org.postgresql.Driver.connect(Driver.java:260)
	at com.hof.pool.JDBCConnection.openConnection(JDBCConnection.java:181)
	at com.hof.pool.DBConnection.authenticateAndOpenConnection(DBConnection.java:127)
	at com.hof.pool.DBConnectionPool.A(DBConnectionPool.java:1284)
	at com.hof.pool.DBConnectionPool.createJDBCPool(DBConnectionPool.java:551)
	... 46 more
Caused by: java.net.ConnectException: Connection refused (Connection refused)
	at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
	at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
	at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
	at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
	at java.base/java.net.Socket.connect(Socket.java:609)
	at org.postgresql.core.PGStream.<init>(PGStream.java:81)
	at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:93)
	at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:197)
	... 54 more
| Performing JDBC connections...ERROR
|
| Exception details: java.lang.Exception: Failed to create DBConnectionPool
========================================================================

YF:2022-04-28 08:41:51.145: INFO (DBConnectionManager) - [1] [Background] [STARTUP] DBConnectionManager shutting down
YF:2022-04-28 08:41:51.145: INFO (DBConnectionManager) - [1] [Background] [STARTUP] DBConnectionManager completed shutdown

From the logs, it appears that I am being asked to specify a JDBC Fetch Size, but the wiki above does not list that option.

How can I start a container for my app-only image?

Comments (1)

photo
1

Hi Hiroyuki,

Is this your first time setting up the app-only Docker image? One thing that I've noticed is missing from our guides is that when using postgres, you need to allow 'external' connections in Postgres' configuration file pg_hba.conf

The file should be located in your PostgreSQL install folder, e.g. C:\Databases\pg_hba.conf

Make a backup of the file and then change it to

/4e56eef22eaf79a7860ea570ce67ca6f

Hopefully that resolves the issue.

Kind regards,

Chris

photo
1

Hi Chris,

Yes, this is my first setup with an app-only Docker image.

However, I have installed Yellowfin many times in the past using the native installer and have used PostgreSQL in the repository.

The pg_hba.conf configuration for my environment is as follows

65cde21660afb7d9777c26ca64deb7bc


I have also changed the address to listen in postgresql.conf.

eca006fecbd51f68ff092e0b1c3e7ff0


I also disabled the OS firewall and could not proceed with the same error.

If you have successfully activated the app-only image at your end, could you give me a specific configuration example?


Regards,

Hiroyuki

photo
1

Hi Hiroyuki,

Apologies I have not responded sooner. It seems the ticket status did not change from 'Awaiting Reply' when you last posted.

Is this still proving to be a problem for you?

One thing I noticed is that you're specifying port 15432 for PostgreSQL. Have you set up your Postgres server to use that port? The default is 5432.

Kind regards,

Chris

photo
1

Hi Chris,

Thanks for the reply.


Yes, I have intentionally specified the PostgreSQL port as 15432.

And when I run the native installer to create the initial repository DB tables, I specify that 15432 port and am able to connect without any problems.

(That's the first Japanese screenshot)


The problem is still unresolved and I am still wondering if this app-only image really works.


Is there any other possible cause?

Regards,Hiroyuki

photo
1

Hi Hiroyuki,

I spent some time messing around with this today and also ran into the same issue you were seeing. After a bit of Googling I finally fixed it!

Here's what I had to do:

Your docker-compose .yml file needs to specifiy the IP address of the machine hosting the database. If that's localhost, it needs to be the network accessible IP. In my case, the .yml file looks like:

version: '3'

services:

yellowfin-standalone-single-instance:

ports:

- "9711:8080"

environment:

- JDBC_CLASS_NAME=org.postgresql.Driver

- JDBC_CONN_URL=jdbc:postgresql://192.168.1.130:5432/yf_9711_20220406

- JDBC_CONN_USER=postgres

- JDBC_CONN_PASS=yellowfin

- JDBC_CONN_ENCRYPTED=false

- APP_MEMORY=4096

image: "yellowfinbi/yellowfin-app-only:9.7.1.1"

---

The pg_hba.conf file needs to have the IP address range added as well:

Just under the IPv4 line, add in an additional line:

/3020aee2c80e926d14f369b778ede9bb

The /16 is effectively a subnet mask like 255.255.0.0 so all local IPs can connect. Probably not needed but useful if you want to host the docker server elsewhere on your network.

You also need to modify postgresql.conf found in the same folder to specify the IP as a listen address. Here I have simply just added the wildcard for all addresses to make it easier:

/6df7d15c7202fee193134d8456cadeae

I hope that helps!

Kind regards,

Chris

photo
1

Hi Chris,

Thanks for taking the time to check it out!As you pointed out, I was able to get it to work by specifying the IP address in the JDBC_CON_URL.

Kind regards,

Hiroyuki

photo
1

Hi Hiroyuki,

Great to hear! Enjoy the rest of your week.

Kind regards,

Chris

photo