OpenAS2 / OpenAs2App

OpenAS2 is a java-based implementation of the EDIINT AS2 standard. It is intended to be used as a server. It is extremely configurable and supports a wide variety of signing and encryption algorithms.
https://sourceforge.net/projects/openas2/
BSD 2-Clause "Simplified" License
177 stars 132 forks source link

Unable to connect to PostgreSQL #340

Closed tripleclones closed 1 month ago

tripleclones commented 9 months ago

Hi,

I'm having issues with configuring PostgreSQL, this is the config settings I'm using:

           msg_tracking.use_embedded_db="false"
           msg_tracking.force_load_jdbc_driver="false" (have tried true as well)
           msg_tracking.db_user="userid"
           msg_tracking.db_pwd="password"
           msg_tracking.db_name="openas2"
           msg_tracking.table_name="msg_metadata"
           msg_tracking.db_directory="%home%/DB"
           msg_tracking.jdbc_driver="org.postgresql.Driver"
           msg_tracking.jdbc_connect_string="jdbc:postgresql://localhost:5432/$component.db_name$"
           msg_tracking.sql_escape_character="'"
           msg_tracking.tcp_server_start="false"
           msg_tracking.tcp_server_port=""
           msg_tracking.tcp_server_password=""

I'm using postgresql-42.6.0.jar and have tried using pgbouncer although my default is direct to db and have of course tested connections via jdbc with the credentials via other methods.

I have seen two distinct errors (possibly based on force_load_jdbc_driver although I can't be sure)

2023-09-19 10:42:45.783 ERROR DbTrackingModule: Failed to persist a tracking event: Read timed out ::: Data map: {state_msg=Message sending started, is_resend=N, receiver_id=xxxx, file_name=xxxx, resend_count=0, sender_id=xxxx, content_transfer_encoding=null, content_type=application/EDI-X12, sent_file_name=xxxx, prior_msg_id=null, signature_algorithm=xxxxx, mdn_mode=SYNC, encryption_algorithm=xxxx, state=msg_send_start, msg_id=, compression=null, direction=SEND, status=sending_msg} [] org.postgresql.util.PSQLException: The connection attempt failed. at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:354) at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:54) at org.postgresql.jdbc.PgConnection.(PgConnection.java:263) at org.postgresql.Driver.makeConnection(Driver.java:443) at org.postgresql.Driver.connect(Driver.java:297) at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:681) at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:229) at org.openas2.processor.msgtracking.DbTrackingModule.persist(DbTrackingModule.java:102) at org.openas2.processor.msgtracking.BaseMsgTrackingModule.handle(BaseMsgTrackingModule.java:21) at org.openas2.processor.DefaultProcessor.handle(DefaultProcessor.java:55) at org.openas2.message.BaseMessage.trackMsgState(BaseMessage.java:456) at org.openas2.processor.sender.AS2SenderModule.handle(AS2SenderModule.java:133) at org.openas2.processor.DefaultProcessor.handle(DefaultProcessor.java:55) at org.openas2.processor.receiver.MessageBuilderModule.processDocument(MessageBuilderModule.java:232) at org.openas2.processor.receiver.MessageBuilderModule.processDocument(MessageBuilderModule.java:113) at org.openas2.processor.receiver.DirectoryPollingModule.processFile(DirectoryPollingModule.java:253) at org.openas2.processor.receiver.DirectoryPollingModule.processSingleFile(DirectoryPollingModule.java:193) at org.openas2.processor.receiver.DirectoryPollingModule$1.run(DirectoryPollingModule.java:236) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:833) Caused by: java.net.SocketTimeoutException: Read timed out at java.base/sun.nio.ch.NioSocketImpl.timedRead(NioSocketImpl.java:283) at java.base/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:309) at java.base/sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:350) at java.base/sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:803) at java.base/java.net.Socket$SocketInputStream.read(Socket.java:966) at org.postgresql.core.VisibleBufferedInputStream.readMore(VisibleBufferedInputStream.java:161) at org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedInputStream.java:128) at org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedInputStream.java:113) at org.postgresql.core.VisibleBufferedInputStream.read(VisibleBufferedInputStream.java:73) at org.postgresql.core.PGStream.receiveChar(PGStream.java:465) at org.postgresql.core.v3.ConnectionFactoryImpl.enableSSL(ConnectionFactoryImpl.java:589) at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:191) at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:258) ... 20 more

also

2023-09-07 00:00:32.546 ERROR DbTrackingModule: Failed to persist a tracking event: Connection refused: no further information ::: Data map: {state_msg=Message sending started, is_resend=N, receiver_id=xxxx, file_name=xxxx, resend_count=0, sender_id=xxxx, content_transfer_encoding=null, content_type=application/EDI-X12, sent_file_name=xxxx, prior_msg_id=null, signature_algorithm=xxxx, mdn_mode=SYNC, encryption_algorithm=xxxx, state=msg_send_start, msg_id=, compression=null, direction=SEND, status=sending_msg} [] 2023-09-07 00:00:32.546 ERROR DbTrackingModule: Failed to persist a tracking event: Connection refused: no further information ::: Data map: {state_msg=Message sent. Message MDN success response received., is_resend=N, receiver_id=xxxx, file_name=xxxx, resend_count=0, mdn_response=This is not a guarantee that the message has been completely processed or understood by the receiving translator , sender_id=xxxx, content_transfer_encoding=null, content_type=application/EDI-X12, sent_file_name=xxxx, mdn_id=, prior_msg_id=null, signature_algorithm=xxxx, mdn_mode=SYNC, encryption_algorithm=xxxx, state=msg_sent_mdn_received_ok, msg_id=, compression=null, direction=SEND, status=verifying_mdn} [] 2023-09-07 00:00:32.546 ERROR DbTrackingModule: Failed to persist a tracking event: Connection refused: no further information ::: Data map: {state_msg=Message sending started, is_resend=N, receiver_id=xxxx, file_name=xxxx, resend_count=0, sender_id=xxxx, content_transfer_encoding=null, content_type=application/EDI-X12, sent_file_name=xxxx, prior_msg_id=null, signature_algorithm=xxxx, mdn_mode=SYNC, encryption_algorithm=xxxx, state=msg_send_start, msg_id=, compression=null, direction=SEND, status=sending_msg} [] org.postgresql.util.PSQLException: Connection to localhost:5432 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:342) at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:54) at org.postgresql.jdbc.PgConnection.(PgConnection.java:263) at org.postgresql.Driver.makeConnection(Driver.java:443) at org.postgresql.Driver.connect(Driver.java:297) at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:681) at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:229) at org.openas2.processor.msgtracking.DbTrackingModule.persist(DbTrackingModule.java:102) at org.openas2.processor.msgtracking.BaseMsgTrackingModule.handle(BaseMsgTrackingModule.java:21) at org.openas2.processor.DefaultProcessor.handle(DefaultProcessor.java:55) at org.openas2.message.BaseMessage.trackMsgState(BaseMessage.java:456) at org.openas2.util.AS2Util.processMDN(AS2Util.java:524) at org.openas2.processor.sender.AS2SenderModule.processResponse(AS2SenderModule.java:232) at org.openas2.processor.sender.AS2SenderModule.sendMessage(AS2SenderModule.java:205) at org.openas2.processor.sender.AS2SenderModule.handle(AS2SenderModule.java:135) at org.openas2.processor.DefaultProcessor.handle(DefaultProcessor.java:55) at org.openas2.processor.receiver.MessageBuilderModule.processDocument(MessageBuilderModule.java:232) at org.openas2.processor.receiver.MessageBuilderModule.processDocument(MessageBuilderModule.java:113) at org.openas2.processor.receiver.DirectoryPollingModule.processFile(DirectoryPollingModule.java:253) at org.openas2.processor.receiver.DirectoryPollingModule.processSingleFile(DirectoryPollingModule.java:193) at org.openas2.processor.receiver.DirectoryPollingModule$1.run(DirectoryPollingModule.java:236) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:833) Caused by: java.net.ConnectException: Connection refused: no further information at java.base/sun.nio.ch.Net.pollConnect(Native Method) at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:672) at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:549) at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:597) at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327) at java.base/java.net.Socket.connect(Socket.java:633) at org.postgresql.core.PGStream.createSocket(PGStream.java:243) at org.postgresql.core.PGStream.(PGStream.java:98) at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:132) at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:258) ... 23 more org.postgresql.util.PSQLException: Connection to localhost:5432 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:342) at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:54) at org.postgresql.jdbc.PgConnection.(PgConnection.java:263) at org.postgresql.Driver.makeConnection(Driver.java:443) at org.postgresql.Driver.connect(Driver.java:297) at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:681) at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:229) at org.openas2.processor.msgtracking.DbTrackingModule.persist(DbTrackingModule.java:102) at org.openas2.processor.msgtracking.BaseMsgTrackingModule.handle(BaseMsgTrackingModule.java:21) at org.openas2.processor.DefaultProcessor.handle(DefaultProcessor.java:55) at org.openas2.message.BaseMessage.trackMsgState(BaseMessage.java:456) at org.openas2.processor.sender.AS2SenderModule.handle(AS2SenderModule.java:133) at org.openas2.processor.DefaultProcessor.handle(DefaultProcessor.java:55) at org.openas2.processor.receiver.MessageBuilderModule.processDocument(MessageBuilderModule.java:232) at org.openas2.processor.receiver.MessageBuilderModule.processDocument(MessageBuilderModule.java:113) at org.openas2.processor.receiver.DirectoryPollingModule.processFile(DirectoryPollingModule.java:253) at org.openas2.processor.receiver.DirectoryPollingModule.processSingleFile(DirectoryPollingModule.java:193) at org.openas2.processor.receiver.DirectoryPollingModule$1.run(DirectoryPollingModule.java:236) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:833) Caused by: java.net.ConnectException: Connection refused: no further information at java.base/sun.nio.ch.Net.pollConnect(Native Method) at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:672) at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:549) at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:597) at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327) at java.base/java.net.Socket.connect(Socket.java:633) at org.postgresql.core.PGStream.createSocket(PGStream.java:243) at org.postgresql.core.PGStream.(PGStream.java:98) at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:132) at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:258) ... 20 more org.postgresql.util.PSQLException: Connection to localhost:5432 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:342) at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:54) at org.postgresql.jdbc.PgConnection.(PgConnection.java:263) at org.postgresql.Driver.makeConnection(Driver.java:443) at org.postgresql.Driver.connect(Driver.java:297) at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:681) at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:229) at org.openas2.processor.msgtracking.DbTrackingModule.persist(DbTrackingModule.java:102) at org.openas2.processor.msgtracking.BaseMsgTrackingModule.handle(BaseMsgTrackingModule.java:21) at org.openas2.processor.DefaultProcessor.handle(DefaultProcessor.java:55) at org.openas2.message.BaseMessage.trackMsgState(BaseMessage.java:456) at org.openas2.processor.sender.AS2SenderModule.handle(AS2SenderModule.java:133) at org.openas2.processor.DefaultProcessor.handle(DefaultProcessor.java:55) at org.openas2.processor.receiver.MessageBuilderModule.processDocument(MessageBuilderModule.java:232) at org.openas2.processor.receiver.MessageBuilderModule.processDocument(MessageBuilderModule.java:113) at org.openas2.processor.receiver.DirectoryPollingModule.processFile(DirectoryPollingModule.java:253) at org.openas2.processor.receiver.DirectoryPollingModule.processSingleFile(DirectoryPollingModule.java:193) at org.openas2.processor.receiver.DirectoryPollingModule$1.run(DirectoryPollingModule.java:236) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:833) Caused by: java.net.ConnectException: Connection refused: no further information at java.base/sun.nio.ch.Net.pollConnect(Native Method) at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:672) at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:549) at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:597) at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327) at java.base/java.net.Socket.connect(Socket.java:633) at org.postgresql.core.PGStream.createSocket(PGStream.java:243) at org.postgresql.core.PGStream.(PGStream.java:98) at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:132) at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:258) ... 20 more

igwtech commented 9 months ago

Both seem like TCP/IP connectivity issues. Have you verified connectivity between the Java Application Host and the PostgreSQL Host? If you are running in containers, kubernetes or virtualized environments you probably will need some extra configuration.

Also, If you are running in a Linux Server Distro, I would suggest to verify your connections are not being blocked by SELinux or AppArmor. In such case you will have to allow the corresponding exceptions for your environment.

Regards, J

On Wed, Sep 20, 2023 at 6:50 AM Peter Collins @.***> wrote:

Hi,

I'm having issues with configuring PostgreSQL, this is the config settings I'm using:

       msg_tracking.use_embedded_db="false"
       msg_tracking.force_load_jdbc_driver="false" (have tried true as well)
       msg_tracking.db_user="userid"
       msg_tracking.db_pwd="password"
       msg_tracking.db_name="openas2"
       msg_tracking.table_name="msg_metadata"
       msg_tracking.db_directory="%home%/DB"
       msg_tracking.jdbc_driver="org.postgresql.Driver"
       msg_tracking.jdbc_connect_string="jdbc:postgresql://localhost:5432/$component.db_name$"
       msg_tracking.sql_escape_character="'"
       msg_tracking.tcp_server_start="false"
       msg_tracking.tcp_server_port=""
       msg_tracking.tcp_server_password=""

I'm using postgresql-42.6.0.jar and have tried using pgbouncer although my default is direct to db and have of course tested connections via jdbc with the credentials via other methods.

I have seen two distinct errors (possibly based on force_load_jdbc_driver although I can't be sure)

2023-09-19 10:42:45.783 ERROR DbTrackingModule: Failed to persist a tracking event: Read timed out ::: Data map: {state_msg=Message sending started, is_resend=N, receiver_id=xxxx, file_name=xxxx, resend_count=0, sender_id=xxxx, content_transfer_encoding=null, content_type=application/EDI-X12, sent_file_name=xxxx, prior_msg_id=null, signature_algorithm=xxxxx, mdn_mode=SYNC, encryption_algorithm=xxxx, state=msg_send_start, msg_id=, compression=null, direction=SEND, status=sending_msg} [] org.postgresql.util.PSQLException: The connection attempt failed. at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:354) at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:54) at org.postgresql.jdbc.PgConnection.(PgConnection.java:263) at org.postgresql.Driver.makeConnection(Driver.java:443) at org.postgresql.Driver.connect(Driver.java:297) at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:681) at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:229) at org.openas2.processor.msgtracking.DbTrackingModule.persist(DbTrackingModule.java:102) at org.openas2.processor.msgtracking.BaseMsgTrackingModule.handle(BaseMsgTrackingModule.java:21) at org.openas2.processor.DefaultProcessor.handle(DefaultProcessor.java:55) at org.openas2.message.BaseMessage.trackMsgState(BaseMessage.java:456) at org.openas2.processor.sender.AS2SenderModule.handle(AS2SenderModule.java:133) at org.openas2.processor.DefaultProcessor.handle(DefaultProcessor.java:55) at org.openas2.processor.receiver.MessageBuilderModule.processDocument(MessageBuilderModule.java:232) at org.openas2.processor.receiver.MessageBuilderModule.processDocument(MessageBuilderModule.java:113) at org.openas2.processor.receiver.DirectoryPollingModule.processFile(DirectoryPollingModule.java:253) at org.openas2.processor.receiver.DirectoryPollingModule.processSingleFile(DirectoryPollingModule.java:193) at org.openas2.processor.receiver.DirectoryPollingModule$1.run(DirectoryPollingModule.java:236) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:833) Caused by: java.net.SocketTimeoutException: Read timed out at java.base/sun.nio.ch.NioSocketImpl.timedRead(NioSocketImpl.java:283) at java.base/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:309) at java.base/sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:350) at java.base/sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:803) at java.base/java.net.Socket$SocketInputStream.read(Socket.java:966) at org.postgresql.core.VisibleBufferedInputStream.readMore(VisibleBufferedInputStream.java:161) at org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedInputStream.java:128) at org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedInputStream.java:113) at org.postgresql.core.VisibleBufferedInputStream.read(VisibleBufferedInputStream.java:73) at org.postgresql.core.PGStream.receiveChar(PGStream.java:465) at org.postgresql.core.v3.ConnectionFactoryImpl.enableSSL(ConnectionFactoryImpl.java:589) at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:191) at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:258) ... 20 more

also

2023-09-07 00:00:32.546 ERROR DbTrackingModule: Failed to persist a tracking event: Connection refused: no further information ::: Data map: {state_msg=Message sending started, is_resend=N, receiver_id=xxxx, file_name=xxxx, resend_count=0, sender_id=xxxx, content_transfer_encoding=null, content_type=application/EDI-X12, sent_file_name=xxxx, prior_msg_id=null, signature_algorithm=xxxx, mdn_mode=SYNC, encryption_algorithm=xxxx, state=msg_send_start, msg_id=, compression=null, direction=SEND, status=sending_msg} [] 2023-09-07 00:00:32.546 ERROR DbTrackingModule: Failed to persist a tracking event: Connection refused: no further information ::: Data map: {state_msg=Message sent. Message MDN success response received., is_resend=N, receiver_id=xxxx, file_name=xxxx, resend_count=0, mdn_response=This is not a guarantee that the message has been completely processed or understood by the receiving translator , sender_id=xxxx, content_transfer_encoding=null, content_type=application/EDI-X12, sent_file_name=xxxx, mdn_id=, prior_msg_id=null, signature_algorithm=xxxx, mdn_mode=SYNC, encryption_algorithm=xxxx, state=msg_sent_mdn_received_ok, msg_id=, compression=null, direction=SEND, status=verifying_mdn} [] 2023-09-07 00:00:32.546 ERROR DbTrackingModule: Failed to persist a tracking event: Connection refused: no further information ::: Data map: {state_msg=Message sending started, is_resend=N, receiver_id=xxxx, file_name=xxxx, resend_count=0, sender_id=xxxx, content_transfer_encoding=null, content_type=application/EDI-X12, sent_file_name=xxxx, prior_msg_id=null, signature_algorithm=xxxx, mdn_mode=SYNC, encryption_algorithm=xxxx, state=msg_send_start, msg_id=, compression=null, direction=SEND, status=sending_msg} [] org.postgresql.util.PSQLException: Connection to localhost:5432 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:342) at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:54) at org.postgresql.jdbc.PgConnection.(PgConnection.java:263) at org.postgresql.Driver.makeConnection(Driver.java:443) at org.postgresql.Driver.connect(Driver.java:297) at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:681) at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:229) at org.openas2.processor.msgtracking.DbTrackingModule.persist(DbTrackingModule.java:102) at org.openas2.processor.msgtracking.BaseMsgTrackingModule.handle(BaseMsgTrackingModule.java:21) at org.openas2.processor.DefaultProcessor.handle(DefaultProcessor.java:55) at org.openas2.message.BaseMessage.trackMsgState(BaseMessage.java:456) at org.openas2.util.AS2Util.processMDN(AS2Util.java:524) at org.openas2.processor.sender.AS2SenderModule.processResponse(AS2SenderModule.java:232) at org.openas2.processor.sender.AS2SenderModule.sendMessage(AS2SenderModule.java:205) at org.openas2.processor.sender.AS2SenderModule.handle(AS2SenderModule.java:135) at org.openas2.processor.DefaultProcessor.handle(DefaultProcessor.java:55) at org.openas2.processor.receiver.MessageBuilderModule.processDocument(MessageBuilderModule.java:232) at org.openas2.processor.receiver.MessageBuilderModule.processDocument(MessageBuilderModule.java:113) at org.openas2.processor.receiver.DirectoryPollingModule.processFile(DirectoryPollingModule.java:253) at org.openas2.processor.receiver.DirectoryPollingModule.processSingleFile(DirectoryPollingModule.java:193) at org.openas2.processor.receiver.DirectoryPollingModule$1.run(DirectoryPollingModule.java:236) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:833) Caused by: java.net.ConnectException: Connection refused: no further information at java.base/sun.nio.ch.Net.pollConnect(Native Method) at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:672) at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:549) at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:597) at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327) at java.base/java.net.Socket.connect(Socket.java:633) at org.postgresql.core.PGStream.createSocket(PGStream.java:243) at org.postgresql.core.PGStream.(PGStream.java:98) at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:132) at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:258) ... 23 more org.postgresql.util.PSQLException: Connection to localhost:5432 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:342) at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:54) at org.postgresql.jdbc.PgConnection.(PgConnection.java:263) at org.postgresql.Driver.makeConnection(Driver.java:443) at org.postgresql.Driver.connect(Driver.java:297) at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:681) at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:229) at org.openas2.processor.msgtracking.DbTrackingModule.persist(DbTrackingModule.java:102) at org.openas2.processor.msgtracking.BaseMsgTrackingModule.handle(BaseMsgTrackingModule.java:21) at org.openas2.processor.DefaultProcessor.handle(DefaultProcessor.java:55) at org.openas2.message.BaseMessage.trackMsgState(BaseMessage.java:456) at org.openas2.processor.sender.AS2SenderModule.handle(AS2SenderModule.java:133) at org.openas2.processor.DefaultProcessor.handle(DefaultProcessor.java:55) at org.openas2.processor.receiver.MessageBuilderModule.processDocument(MessageBuilderModule.java:232) at org.openas2.processor.receiver.MessageBuilderModule.processDocument(MessageBuilderModule.java:113) at org.openas2.processor.receiver.DirectoryPollingModule.processFile(DirectoryPollingModule.java:253) at org.openas2.processor.receiver.DirectoryPollingModule.processSingleFile(DirectoryPollingModule.java:193) at org.openas2.processor.receiver.DirectoryPollingModule$1.run(DirectoryPollingModule.java:236) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:833) Caused by: java.net.ConnectException: Connection refused: no further information at java.base/sun.nio.ch.Net.pollConnect(Native Method) at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:672) at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:549) at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:597) at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327) at java.base/java.net.Socket.connect(Socket.java:633) at org.postgresql.core.PGStream.createSocket(PGStream.java:243) at org.postgresql.core.PGStream.(PGStream.java:98) at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:132) at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:258) ... 20 more org.postgresql.util.PSQLException: Connection to localhost:5432 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:342) at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:54) at org.postgresql.jdbc.PgConnection.(PgConnection.java:263) at org.postgresql.Driver.makeConnection(Driver.java:443) at org.postgresql.Driver.connect(Driver.java:297) at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:681) at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:229) at org.openas2.processor.msgtracking.DbTrackingModule.persist(DbTrackingModule.java:102) at org.openas2.processor.msgtracking.BaseMsgTrackingModule.handle(BaseMsgTrackingModule.java:21) at org.openas2.processor.DefaultProcessor.handle(DefaultProcessor.java:55) at org.openas2.message.BaseMessage.trackMsgState(BaseMessage.java:456) at org.openas2.processor.sender.AS2SenderModule.handle(AS2SenderModule.java:133) at org.openas2.processor.DefaultProcessor.handle(DefaultProcessor.java:55) at org.openas2.processor.receiver.MessageBuilderModule.processDocument(MessageBuilderModule.java:232) at org.openas2.processor.receiver.MessageBuilderModule.processDocument(MessageBuilderModule.java:113) at org.openas2.processor.receiver.DirectoryPollingModule.processFile(DirectoryPollingModule.java:253) at org.openas2.processor.receiver.DirectoryPollingModule.processSingleFile(DirectoryPollingModule.java:193) at org.openas2.processor.receiver.DirectoryPollingModule$1.run(DirectoryPollingModule.java:236) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:833) Caused by: java.net.ConnectException: Connection refused: no further information at java.base/sun.nio.ch.Net.pollConnect(Native Method) at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:672) at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:549) at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:597) at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327) at java.base/java.net.Socket.connect(Socket.java:633) at org.postgresql.core.PGStream.createSocket(PGStream.java:243) at org.postgresql.core.PGStream.(PGStream.java:98) at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:132) at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:258) ... 20 more

— Reply to this email directly, view it on GitHub https://github.com/OpenAS2/OpenAs2App/issues/340, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA2QND25ZD3FVZ6MR7UUVELX3LC7TANCNFSM6AAAAAA47WVXDQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Javier Munoz

CEO

Greicodex Software

+58 2127629120 <+58+2127629120> @.*** www.greicodex.com Av Francisco Solano, Centro Solano Plaza, Oficina PHA, Caracas, Venezuela

tripleclones commented 9 months ago

Both seem like TCP/IP connectivity issues.

I would initial agree although believe I have addressed this in my original post, but to clarify:

I'm using postgresql-42.6.0.jar. I have tried using pgbouncer with no difference. My config shows the connection is via localhost, so nothing network related (firewalls etc) is getting in the way. I have tested connections via jdbc using the same config via other Jars. I'm running on Windows Server. No containers or virtualization. OpenAS2 is running as service. The same service account can connect using other Jars.

igwtech commented 9 months ago

I'm no expert in Postgresql, however from experience with MySQL, MSSQL and Oracle on Windows, sometimes the connectivity seems to work with other tools but they are, in fact, established via Named Pipes or other IPC means. This is because most of these tools have automatic fallbacks when you specify the "localhost" as the target. I would suggest you try re-testing the connection with pg tools but specifying the host's network routable IP (i.e 192.168.0.10).

Regards, J

On Wed, Sep 20, 2023 at 8:20 AM Peter Collins @.***> wrote:

Both seem like TCP/IP connectivity issues.

I would initial agree although believe I have addressed this in my original post, but to clarify:

I'm using postgresql-42.6.0.jar. I have tried using pgbouncer with no difference. My config shows the connection is via localhost, so nothing network related (firewalls etc) is getting in the way. I have tested connections via jdbc using the same config via other Jars. I'm running on Windows Server. No containers or virtualization. OpenAS2 is running as service. The same service account can connection using other Jars.

— Reply to this email directly, view it on GitHub https://github.com/OpenAS2/OpenAs2App/issues/340#issuecomment-1727612798, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA2QND4AAZX6RMGSM3VW4I3X3LNQFANCNFSM6AAAAAA47WVXDQ . You are receiving this because you commented.Message ID: @.***>

-- Javier Munoz

CEO

Greicodex Software

+58 2127629120 <+58+2127629120> @.*** www.greicodex.com Av Francisco Solano, Centro Solano Plaza, Oficina PHA, Caracas, Venezuela

tripleclones commented 9 months ago

This is because most of these tools have automatic fallbacks when you specify the "localhost" as the target. I would suggest you try re-testing the connection with pg tools but specifying the host's network routable IP (i.e 192.168.0.10).

Thanks but I'm not convienced although I'll run up a test environment and do some more controlled testing.

I'm hoping someone with a working PostgreSQL connection could confirm they are able to use 3.7.0 and if so the version of the jdbc jar and config settings.

uhurusurfa commented 9 months ago

I will see if I can get it running later in the weekend but in the mean time, ave you tried using 127.0.0.1 instead of looking localhost?

uhurusurfa commented 9 months ago

It works fine on Postgres for me. Make sure you follow these steps setting up postrges:

  1. Create a user with password matching the msg_tracking.db_user and msg_tracking.db_pwd properties (default deployment sets them as "sa" and "OpenAS2" respectively) -- you can use the createdb command that comes with Postgresql: createuser --interactive
  2. Create the database with name matching the msg_tracking.db_name property (default deployment uses "openas2") --- you can use the createdb command that comes with Postgresql: createdb --owner=sa openas2
  3. Import the schema to Postgres (eassiest to use SymmetricDS - https://www.symmetricds.org ) - see below for using it
  4. Check you have connectivity using psql command line tool: psql -U sa

For using SymmetricDS:

  1. Download the latest version of Symmetric from https://www.symmetricds.org
  2. Add the bin folder to the executable path for your OS (unix: export PATH=$PATH:[SymmetricDS Base Dir]/bin )
  3. Create a properties file with the appropriate settings (see the attached example) in the [SymmetricDS Base Dir]/engines directory
  4. Run this command to creater the DB schema from the [OpenAS2 Install Dir]/resources/db directory: dbimport --engine openas2 --format XML --alter openas2-schema.xml
uhurusurfa commented 9 months ago

Example file for Symmetric attached symmetric.txt Save it as something like openas2.properties in the engines directory.

tripleclones commented 9 months ago

Thanks, I'll have a play although it was working fine and my table has rows in from prior to the 3.7.0 update