Internal Exception: org.postgresql.util.PSQLException: Connection to localhost:8461 refused - postgresql

While starting a Spring boot application I am getting the following error org.postgresql.util.PSQLException SQL Exception State : 08001. See the complete logs below
I have tried restarting the postgres server using systemctl restart postgresql-9.6 and the application worked fine then but I am not able to figure out why it occurred in first place.
2019-06-26 12:03:24 IST +0530 INFO com.entrust.cm.utils.ApplicationConfig:110 - sslfactory : org.postgresql.ssl.NonValidatingFactory
2019-06-26 12:03:24 IST +0530 ERROR com.entrust.cm.utils.ApplicationConfig:176 - Error while creating Database: Connection to localhost:8461 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
2019-06-26 12:03:24 IST +0530 ERROR com.entrust.cm.utils.ApplicationConfig:211 - Error while creating Schema : {}; Code : {} Connection to localhost:8461 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. : SQL Exception State : 08001
2019-06-26 12:03:24 IST +0530 WARN com.entrust.cm.utils.ApplicationConfig:79 - Search base already set
2019-06-26 12:03:25 IST +0530 INFO org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean:415 - Initialized JPA EntityManagerFactory for persistence unit 'entityManagerFactory'
2019-06-26 12:03:25 IST +0530 INFO org.hibernate.validator.internal.util.Version:21 - HV000001: Hibernate Validator 6.0.3.Final
2019-06-26 12:03:26 IST +0530 WARN org.springframework.web.context.support.XmlWebApplicationContext:554 - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'enrollmentFilerDaoImpl': Unsatisfied dependency expressed through field 'componentManagementDaoImpl'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'componentManagementDaoImpl' defined in com.entrust.cm.utils.ApplicationConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.entrust.cm.dao.ComponentManagementDaoImpl]: Factory method 'componentManagementDaoImpl' threw exception; nested exception is javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.0.v20170811-d680af5): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: org.postgresql.util.PSQLException: Connection to localhost:8461 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
Error Code: 0
2019-06-26 12:03:26 IST +0530 ERROR org.springframework.web.servlet.DispatcherServlet:533 - Context initialization failed
I am not able to get do the Root cause analysis of this error.

Related

kafkadrop: Timeout while connecting to confluent cloud

I launch kafkadrop to connect to a kafka cluster running in confluent cloud:
java -jar kafdrop-3.30.0.jar
---kafka.brokerConnect=.......confluent.cloud:9092
I see error:
Caused by: org.apache.kafka.common.errors.TimeoutException: Timed out waiting for a node assignment. Call: listNodes
, message=Request processing failed; nested exception is kafdrop.service.KafkaAdminClientException: java.util.concurrent.ExecutionException: org.apache.kafka.common.errors.TimeoutException: Timed out waiting for a node assignment. Call: listNodes, path=/}
2022-07-31 11:25:45.662 INFO 44652 [ionShutdownHook] i.u.Undertow : stopping server: Undertow - 2.2.16.Final
2022-07-31 11:25:45.672 INFO 44652 [ionShutdownHook] i.u.s.s.ServletContextImpl : Destroying Spring FrameworkServlet 'dispatcherServlet'
What do I miss here?

PostgreSQL errors on symfony server launch

I am learning Symfony,
I create my project with : symfony new myproject --full
directly after this I run symfony serve
in the console I am getting thoses errors :
Tailing Web Server log file (/Users/ben/.symfony/log/cd52af540b09d661e4ffb4f5029da4bbaf3586a9.log)
Tailing PHP-FPM log file (/Users/ben/.symfony/log/cd52af540b09d661e4ffb4f5029da4bbaf3586a9/53fb8ec204547646acb3461995e4da5a54cc7575.log)
[OK] Web server listening
The Web server is using PHP FPM 7.3.11
https://127.0.0.1:8000
[Web Server ] Jun 3 23:38:48 |DEBUG | PHP Reloading PHP versions
[Web Server ] Jun 3 23:38:48 |DEBUG | PHP Using PHP version 7.3.11 (from default version in $PATH)
[Application] Jun 3 21:29:59 |CRITICA| REQUES Uncaught PHP Exception Doctrine\DBAL\Exception\ConnectionException: "An exception occurred in driver: SQLSTATE[08006] [7] could not connect to server: Connection refused Is the server running on host "127.0.0.1" and accepting TCP/IP connections on port 5432?" at /Users/ben/Desktop/symfonytuto/demo/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php line 96
[Application] Jun 3 21:29:59 |CRITICA| REQUES Exception thrown when handling an exception (Doctrine\DBAL\Exception\ConnectionException: An exception occurred in driver: SQLSTATE[08006] [7] could not connect to server: Connection refused Is the server running on host "127.0.0.1" and accepting TCP/IP connections on port 5432? at /Users/ben/Desktop/symfonytuto/demo/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php line 96)
[Application] Jun 3 21:29:59 |CRITICA| PHP Uncaught Exception: An exception occurred in driver: SQLSTATE[08006] [7] could not connect to server: Connection refused Is the server running on host "127.0.0.1" and accepting TCP/IP connections on port 5432?
[Application] Jun 3 21:37:59 |ERROR | REQUES Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No route found for "GET https://127.0.0.1:8000/"" at /Users/ben/Desktop/symfonytuto/demo/vendor/symfony/http-kernel/EventListener/RouterListener.php line 136
[Application] Jun 3 21:38:00 |ERROR | REQUES Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No route found for "GET https://127.0.0.1:8000/favicon.ico" (from "https://127.0.0.1:8000/")" at /Users/ben/Desktop/symfonytuto/demo/vendor/symfony/http-kernel/EventListener/RouterListener.php line 136
[Application] Jun 3 21:38:00 |CRITICA| REQUES Exception thrown when handling an exception (Doctrine\DBAL\Exception\ConnectionException: An exception occurred in driver: SQLSTATE[08006] [7] could not connect to server: Connection refused Is the server running on host "127.0.0.1" and accepting TCP/IP connections on port 5432? at /Users/ben/Desktop/symfonytuto/demo/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php line 96)
[Application] Jun 3 21:38:00 |CRITICA| PHP Uncaught Exception: An exception occurred in driver: SQLSTATE[08006] [7] could not connect to server: Connection refused Is the server running on host "127.0.0.1" and accepting TCP/IP connections on port 5432?
[Application] Jun 3 21:38:00 |CRITICA| REQUES Uncaught PHP Exception Doctrine\DBAL\Exception\ConnectionException: "An exception occurred in driver: SQLSTATE[08006] [7] could not connect to server: Connection refused Is the server running on host "127.0.0.1" and accepting TCP/IP connections on port 5432?" at /Users/ben/Desktop/symfonytuto/demo/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php line 96
[Application] Jun 3 21:38:00 |CRITICA| REQUES Exception thrown when handling an exception (Doctrine\DBAL\Exception\ConnectionException: An exception occurred in driver: SQLSTATE[08006] [7] could not connect to server: Connection refused Is the server running on host "127.0.0.1" and accepting TCP/IP connections on port 5432? at /Users/ben/Desktop/symfonytuto/demo/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php line 96)
[Application] Jun 3 21:38:00 |CRITICA| PHP Uncaught Exception: An exception occurred in driver: SQLSTATE[08006] [7] could not connect to server: Connection refused Is the server running on host "127.0.0.1" and accepting TCP/IP connections on port 5432?
[Web Server ] Jun 3 23:38:48 |INFO | PHP listening path="/usr/sbin/php-fpm" php="7.3.11" port=50170
[PHP-FPM ] Jun 3 23:38:48 |NOTICE | FPM fpm is running, pid 1240
[PHP-FPM ] Jun 3 23:38:48 |NOTICE | FPM ready to handle connections
After this the Symfony's default page is loading correctly but when I add a route to the url for example : https://127.0.0.1:8000/testtt
I'm getting this error :
An exception occurred in driver: SQLSTATE[08006] [7] could not connect to server: Connection refused
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 5432?
(it should be something like 'this route doesnt exist' no ?)
Please tell me how I can give you more info about my problem !
Thanks a lot !
This question pops up often enough that I think an answer is appropriate until the issue is resolved.
Assume you just created a new Symfony website-skeleton app, added a new controller and started the development server. You navigate to your new route and exceptions are tossed. Either get a 'driver not found' or a 'could connect to server'. Which of course is a bit unexpected since you have not yet done anything with the database.
The problem is that the Doctrine migrations bundle provides a data collector for Symfony's profiler bar that shows up at the bottom of the browser page when running in development mode. The data collector needs to connect to the database in order to collect migrations data. It does not care about the fact that there is no database. It just tries to connect and ends up tossing an exception.
I opened an issue on this. I am still not entirely sure if this is a feature or bug. Feel free to comment on the issue if you like.
This is a fairly recent problem though I have not tracked exactly when it first popped up. Hence many existing tutorials and step by step guides do not mention it. Consider it to be part of your development experience. Learning how to read exceptions is quite important.
There are several solutions. If you plan on using a database then go ahead and create yourself a database and adjust the DATABASE_URL to point to it. The database can be empty. The migration data collector just needs to be able to connect to it. On my local development machine I actually created a database called db_name just to avoid this error message.
A second solution is to just remove the migrations bundle with
composer remove doctrine/doctrine-migrations-bundle
And the problem goes away. If later on you need migrations then just use composer require to re-install it.
I have another solution that solves the problem without having to remove the package with composer remove ....
comment out Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true], in /config/bundles.php
Then move /config/packages/doctrine_migrations.yaml up one directory so it's not longer trying to be included.
This may be a little less intimidating for new developers.
If the issue appears when you want to access the localhost.../lucky/number, go to .env file under the your "folder name" and uncomment this line:
DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
And the rest of them with mySQl and Postgres, comment them.
Hope it works for you. :)

#MongoSocketException #JaversBuildException [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
Getting the below error while building the project on Jenkins,
Same is getting build on local environment.
MongoSocketException
JaversFromStarter Bean not getting created
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 41.849 s <<< FAILURE! - in in.evergreenrevolution.egr.EgrApplicationTests
[ERROR] contextLoads(in.evergreenrevolution.egr.EgrApplicationTests) Time elapsed: 0.001 s <<< ERROR!
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'JaversFromStarter' defined in class path resource [org/javers/spring/boot/mongo/JaversMongoAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.javers.core.Javers]: Factory method 'javers' threw exception; nested exception is com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting to connect. Client view of cluster state is {type=UNKNOWN, servers=[{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused (Connection refused)}}]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.javers.core.Javers]: Factory method 'javers' threw exception; nested exception is com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting to connect. Client view of cluster state is {type=UNKNOWN, servers=[{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused (Connection refused)}}]
Caused by: com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting to connect. Client view of cluster state is {type=UNKNOWN, servers=[{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused (Connection refused)}}]
Install Mongo DB Server on your local machine or VM
MongoDB Installation
Your build environment is point to localhost, most likely you do not (and do not want to have) MongoDB installed on the build server. Just change you config and point to your mongod.

Socket and postgreSQL connection problem while connecting spring boot application to postgreSQL in eclipse

I am running a maven spring boot application which fetches data from postgreSQL. But I am getting such type of error when I run the project using the command
mvn spring-boot:run
->
2019-05-29 14:37:03.750 WARN 18368 --- [ main] unknown.jul.logger : IOException occurred while connecting to mc:19745
java.net.SocketTimeoutException: connect timed out
2019-05-29 14:36:52.241 ERROR 18368 --- [ main] org.postgresql.Driver : Connection error:
org.postgresql.util.PSQLException: The connection attempt failed.
Caused by: java.net.SocketTimeoutException: connect timed out
2019-05-29 14:36:53.245 ERROR 18368 --- [ main]
com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Exception during pool initialization.
org.postgresql.util.PSQLException: The connection attempt failed.
I have mentioned only the main errors.
The application.properties file is:
spring.main.banner.mode=/offlinekyc
# Oracle settings
spring.datasource.url=jdbc:postgresql://mc:19745/post
spring.datasource.username=postgre
spring.datasource.password=123
spring.jpa.properties.hibernate.default_schema=oms_owner
spring.thymeleaf.cache=false
spring.jpa.properties.hibernate.dialect= org.hibernate.dialect.PostgreSQLDialect
http.mappers.json-pretty-print=true
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
hibernate.discriminator.ignore_explicit_for_joined=false
# create and drop tables and sequences, loads import.sql
spring.jpa.hibernate.ddl-auto= update
spring.datasource.driverClassName=org.postgresql.Driver
# HikariCP settings
# spring.datasource.hikari.*
spring.datasource.hikari.connection-timeout=60000
spring.datasource.hikari.maximum-pool-size=5
#hibernate.dialect=org.hibernate.dialect.PostgreSQL9Dialect
#hibernate.default_schema=oms_owner
#hibernate.show_sql=true
#hibernate.format_sql=true
#hibernate.jdbc.lob.non_contextual_creation=true
spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults=false
# Because detection is disabled you have to set correct dialect by hand.
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQL9Dialect
Hibernate.properties file also have the same matter.
Here my post database is in mc:19745 server. I am little confused regarding localhost and server address.
Can anyone help in this matter?

Payara Glassfish 4.1.1 will not start in Netbeans 8.2 MacOSX

Glassfish freezes at:
Information: JMXStartupService has started JMXConnector on JMXService URL service:jmx:rmi://192.168.0.119:8686/jndi/rmi://192.168.0.119:8686/jmxrmi
I have tried to reinstall netbeans, reinstall glashfish, others projects also not working.
I get sometimes an error message:
Please check server admin user name and password properties.
Also please check the server log file for other possible causes.
And i think there is no new server.log file created but the file contains:
Caused by: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: 192.168.0.117; nested exception is:
Caused by: java.rmi.ConnectException: Connection refused to host: 192.168.0.117; nested exception is:
Caused by: java.net.ConnectException: Operation timed out (Connection timed out)
Caused by: javax.naming.ConfigurationException [Root exception is java.rmi.UnknownHostException: Unknown host: eleonores-air; nested exception is:
Caused by: java.rmi.UnknownHostException: Unknown host: eleonores-air; nested exception is:
Caused by: java.net.UnknownHostException: eleonores-air
Please help me to find a solution.