Naming exception: javax.naming.NamingException: Unexpected exception resolving reference [Root exception is org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.] Porque ta dando esse erro? (A senha e o login estao certos)
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<Resource name="jdbc/serverdb"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
auth="Container"
type="javax.sql.DataSource"
username="ppto"
password="sdweas"
driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://localhost/serverdbtst"
minIdle="2"
maxIdle="2"
maxActive="32"
logAbandoned="true"
testWhileIdle="true"
/>
</Context>
public void init() throws ServletException {
try {
// lookup initial context.
Context initCtx = new InitialContext();
// Look up data source
this.ds = (DataSource) initCtx.lookup("java:comp/env/jdbc/serverdb");
} catch(NamingException e){
throw new ServletException("Naming exception: " + e.toString());
}
}
public void destroy() {
}
}