Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP 404 error when runnig the Openforis Collect Docker container #162

Open
omarlabidi opened this issue Jun 13, 2023 · 2 comments
Open

Comments

@omarlabidi
Copy link

omarlabidi commented Jun 13, 2023

I runned the Postgresql Docker container and the Collect Docker container
and i had the "HTTP 404" error message when trying to load "http://localhost:8080/collect"

when running the Collect Docker container i had this error message "Connection to localhost:5432 refused" . more detail below

2023-06-13 11:09:00,452 WARN [main] support.AbstractApplicationContext (AbstractApplicationContext.java:591) - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [org/openforis/collect/application-context-core.xml]: Invocation of init method failed; nested exception is liquibase.exception.UnexpectedLiquibaseException: java.sql.SQLException: Cannot create PoolableConnectionFactory (Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.)

2023-06-13 11:09:00,456 ERROR [main] context.ContextLoader (ContextLoader.java:299) - Context initialization failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [org/openforis/collect/application-context-core.xml]: Invocation of init method failed; nested exception is liquibase.exception.UnexpectedLiquibaseException: java.sql.SQLException: Cannot create PoolableConnectionFactory (Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.)

any one had this issue?

this is my collect.env file
COLLECT_DB_DRIVER=org.postgresql.Driver
COLLECT_DB_URL=jdbc:postgresql://localhost:5432/arena
COLLECT_DB_USERNAME=arena
COLLECT_DB_PASSWORD=arena

this was the command to run Postgresql container
docker run -d --name collect-db -p 5432:5432 -e POSTGRES_DB=arena -e POSTGRES_PASSWORD=arena -e POSTGRES_USER=arena postgis/postgis:12-3.0

and this was the command to run the collect container
docker run -m 4GB -p 8080:8080 --env-file ./collect.env openforis/collect:latest

and i tried with diffrent database connexion parameter
database login passwd
collect collect collect123
arena arena arena

@Pump122
Copy link

Pump122 commented Jan 16, 2024

I had the same error I think. I was using the latest top image of postgresql from the top image download.

Here is the postgresql log
2024-01-17 08:14:37
2024-01-17 08:14:37 2024-01-16 19:14:37.700 UTC [48] LOG: received fast shutdown request
2024-01-17 08:14:37 waiting for server to shut down....2024-01-16 19:14:37.713 UTC [48] LOG: aborting any active transactions
2024-01-17 08:14:37 2024-01-16 19:14:37.715 UTC [48] LOG: background worker "logical replication launcher" (PID 55) exited with exit code 1
2024-01-17 08:14:37 2024-01-16 19:14:37.716 UTC [50] LOG: shutting down
2024-01-17 08:14:38 2024-01-16 19:14:38.675 UTC [48] LOG: database system is shut down
2024-01-17 08:14:38 done
2024-01-17 08:14:38 server stopped
2024-01-17 08:14:38
2024-01-17 08:14:38 PostgreSQL init process complete; ready for start up.
2024-01-17 08:14:38
2024-01-17 08:37:09
2024-01-17 08:37:09 PostgreSQL Database directory appears to contain a database; Skipping initialization
2024-01-17 08:37:09

and openforis log
2024-01-16 18:40:33,509 WARN [main] support.AbstractApplicationContext (AbstractApplicationContext.java:591) - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [org/openforis/collect/application-context-core.xml]: Invocation of init method failed; nested exception is liquibase.exception.UnexpectedLiquibaseException: java.sql.SQLException: Cannot create PoolableConnectionFactory (Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.)
2024-01-16 18:40:33,516 ERROR [main] context.ContextLoader (ContextLoader.java:299) - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [org/openforis/collect/application-context-core.xml]: Invocation of init method failed; nested exception is liquibase.exception.UnexpectedLiquibaseException: java.sql.SQLException: Cannot create PoolableConnectionFactory (Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804) ~[spring-beans-5.3.27.jar:5.3.27]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620) ~[spring-beans-5.3.27.jar:5.3.27]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.27.jar:5.3.27]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.27.jar:5.3.27]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.27.jar:5.3.27]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.27.jar:5.3.27]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.27.jar:5.3.27]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955) ~[spring-beans-5.3.27.jar:5.3.27]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:920) ~[spring-context-5.3.27.jar:5.3.27]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.27.jar:5.3.27]
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:399) ~[spring-web-5.3.27.jar:5.3.27]
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:278) [spring-web-5.3.27.jar:5.3.27]
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:103) [spring-web-5.3.27.jar:5.3.27]
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4768) [catalina.jar:9.0.65]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5230) [catalina.jar:9.0.65]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina.jar:9.0.65]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726) [catalina.jar:9.0.65]
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:698) [catalina.jar:9.0.65]
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:696) [catalina.jar:9.0.65]
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:690) [catalina.jar:9.0.65]
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1889) [catalina.jar:9.0.65]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) [tomcat-util.jar:9.0.65]
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:118) [?:?]
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:583) [catalina.jar:9.0.65]
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:473) [catalina.jar:9.0.65]
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1618) [catalina.jar:9.0.65]
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:319) [catalina.jar:9.0.65]
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123) [catalina.jar:9.0.65]
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423) [catalina.jar:9.0.65]
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:366) [catalina.jar:9.0.65]
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:946) [catalina.jar:9.0.65]
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:835) [catalina.jar:9.0.65]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina.jar:9.0.65]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396) [catalina.jar:9.0.65]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1386) [catalina.jar:9.0.65]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) [tomcat-util.jar:9.0.65]
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140) [?:?]
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:919) [catalina.jar:9.0.65]
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:265) [catalina.jar:9.0.65]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina.jar:9.0.65]
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:432) [catalina.jar:9.0.65]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina.jar:9.0.65]
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930) [catalina.jar:9.0.65]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina.jar:9.0.65]
at org.apache.catalina.startup.Catalina.start(Catalina.java:772) [catalina.jar:9.0.65]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:345) [bootstrap.jar:9.0.65]
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:476) [bootstrap.jar:9.0.65]
Caused by: liquibase.exception.UnexpectedLiquibaseException: java.sql.SQLException: Cannot create PoolableConnectionFactory (Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.)
at liquibase.database.jvm.JdbcConnection.getURL(JdbcConnection.java:149) ~[liquibase-core-4.17.1.jar:?]
at liquibase.database.core.CockroachDatabase.isCorrectDatabaseImplementation(CockroachDatabase.java:59) ~[liquibase-core-4.17.1.jar:?]
at liquibase.database.DatabaseFactory.findCorrectDatabaseImplementation(DatabaseFactory.java:102) ~[liquibase-core-4.17.1.jar:?]
at org.openforis.collect.persistence.liquibase.DatabaseAwareSpringLiquibase.getDatabase(DatabaseAwareSpringLiquibase.java:89) ~[collect-core-4.0.89.jar:?]
at org.openforis.collect.persistence.liquibase.DatabaseAwareSpringLiquibase.createDatabase(DatabaseAwareSpringLiquibase.java:33) ~[collect-core-4.0.89.jar:?]
at org.openforis.collect.persistence.liquibase.DatabaseAwareSpringLiquibase.createLiquibase(DatabaseAwareSpringLiquibase.java:46) ~[collect-core-4.0.89.jar:?]
at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:281) ~[liquibase-core-4.17.1.jar:?]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863) ~[spring-beans-5.3.27.jar:5.3.27]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ~[spring-beans-5.3.27.jar:5.3.27]
... 53 more

@SteRiccio
Copy link
Member

Dear users,
many sorry for the late reply.
Please try to follow the updated instructions in the README file or in DockerHub: https://hub.docker.com/r/openforis/collect
In practice what you need to do is to create a Docker network and run the Collect container and it's DB container using that network.
Many thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants