0
Could someone help a server problem REST?
I’m developing an app android and I’m working with a server restful, database Postgres and Tomcat.
And I’m making that mistake almost every time I make several requests:
GRAVE: Servlet.service() for servlet [Jersey REST Service] in context with path [/Servidor] threw exception [javax.persistence.PersistenceException: org.hibernate.exception.JDBCConnectionException: Um erro de E/S ocorreu ao enviar para o processo do servidor.] with root cause java.net.SocketTimeoutException: Read timed out at java.net.SocketInputStream.socketRead0(Native Method)
And this mistake too:
[javax.persistence.PersistenceException: org.hibernate.exception.JDBCConnectionException: Um erro de E/S ocorreu ao enviar para o processo do servidor.] with root cause java.net.SocketTimeoutException: Read timed out at java.net.SocketInputStream.socketRead0(Native Method)
Your server cannot connect to the database. What is the database URL? Are you sure the database is running correctly? If you ping from your server to the IP of your database works? Are you sure some firewall isn’t blocking connections by entering the Postgresql port of the database or blocking connections by exiting the server?
– Victor Stafusa
So, the connection is correct, the firewall is not blocking the connections in the Postgresql port. These exceptions of java.net.Socketexception and java.net.Sockettimeoutexception, happen when sending requests from the app to the server, just in this scenario. @Victorstafusa
– Paulo Vitor
Well, the message makes it clear that a
JDBCConnectionException
occurs in theServlet.service()
. That is, the server trying to talk to the database. This gives to understand strongly that the problem is in the server, and not in the app.– Victor Stafusa
Yes, that’s very clear. Would you have any hints? Because I’m starting in java and this is the first time I’ve made this mistake. @Victorstafusa
– Paulo Vitor
You can edit your question to add more details about your code and about the error obtained?
– Victor Stafusa