IBM Support

Socket connection refused for Derby due to missing java permission

Troubleshooting


Problem

During normal operation TDI/SDI fails with Derby error: java.sql.SQLNonTransientConnectionException: java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused: connect. at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown Source) at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source) at org.apache.derby.jdbc.ClientDriver.connect(Unknown Source) even though System store is not in use.

Symptom

Derby log reveals details about access denied security issue:

java.security.AccessControlException: Access denied ("java.net.SocketPermission" "localhost:1527" "listen,resolve")
at java.security.AccessController.throwACE(AccessController.java:125)
at java.security.AccessController.checkPermission(AccessController.java:234)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:563)

Cause

It seems that Java security settings do not allow Derby to listen on specified target (host:port) after starting.

Environment

This issue can be seen in TDI 7.1, TDI 7.1.1 and SDI 7.2

Resolving The Problem

To resolve the problem add grant permission to the java policy file <TDI_HOME>/jvm/jre/lib/security/java.policy as in the following two examples:

1. using java policy tool <TDI_HOME>/jvm/jre/bin/policytool:

Permission: java.net.SocketPermission
Target Name: localhost:1527
Actions: listen, resolve

which should add the following lines into java.policy file:

grant {
permission java.net.SocketPermission "localhost:1527", "listen, resolve";
};

2. using any editor and inserting the following single line into the list of existing granted permissions:

permission java.net.SocketPermission "localhost:1527", "listen, resolve";

Note: permission, host, port and actions in above two examples are based on the exception from Symptom above.

[{"Product":{"code":"SSCQGF","label":"Tivoli Directory Integrator"},"Business Unit":{"code":"BU008","label":"Security"},"Component":"General","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"7.1;7.1.1;7.2","Edition":"","Line of Business":{"code":"LOB24","label":"Security Software"}}]

Document Information

Modified date:
16 June 2018

UID

swg21984849