Unable to Startup Derby database – java.net.SocketPermission
Issue – Unable to startup the default derby database provided with the glassfish application server. The database was unable to open the default 1527 port for database.
Pre-requisities –
OS – Windows
JDK – 1.7 update 55
JRE – 1.7 update 55
Glassfish Server – 4.0 (Open source edition)
As per some search on google it was a bug in JDK 1.7 update 51.that has been resolved now. But i was facing similar kind of issue with JDK 1.7 update 55 version. It was throwing the below execption when ever i was trying to startup the database.
C:glassfish4glassfishbinasadmin start-domain domain1
C:glassfish4glassfishbinasadmin start-database
Exception – Tue Jun 24 01:21:22 EDT 2014 : access denied (“java.net.SocketPermission” “localhost:1527” “listen,resolve”)
The startup script for database is trying to use the basic security manager (i.e java.policy) setting to startup the database but it was missing the below grant permission in the update 51
permission java.net.SocketPermission “localhost:1024-“, “listen”;
Resolution – I added the below grant permission into the java.policy file available at the below location
and was able to startup the database appropriately.
%JAVA_HOME%jrelibsecurityjava.policy
grant {
permission java.net.SocketPermission “localhost:1525”, “listen”;
};
C:glassfish4glassfishbin>asadmin start-domain
Waiting for domain1 to start ……………………………………………
………………………………………………..
Successfully started the domain : domain1
domain Location: C:glassfish4glassfishdomainsdomain1
Log File: C:glassfish4glassfishdomainsdomain1logsserver.log
Admin Port: 4848
Command start-domain executed successfully.
C:glassfish4glassfishbin>asadmin start-domain
Waiting for domain1 to start ……………………………………………
………………………………………………..
Successfully started the domain : domain1
domain Location: C:glassfish4glassfishdomainsdomain1
Log File: C:glassfish4glassfishdomainsdomain1logsserver.log
Admin Port: 4848
Command start-domain executed successfully.
…
…
…
Starting database in the background.
Log redirected to C:glassfish4glassfishdatabasesderby.log.
Command start-database executed successfully.
=====================================================================
Hope you enjoyed reading this article. Thank you.
4 COMMENTS