Skip to main content
Known Participant
February 11, 2009
Question

java.net.SocketPermission Error

  • February 11, 2009
  • 1 reply
  • 1861 views
A java class I'm trying to use needs to create a listening socket, but I receive an error when I try to use this class. The error is "Security: The requested template has been denied access to localhost:1024-". Further on down in the error it says "(java.net.SocketPermission localhost:1024- listen,resolve)".

I have ColdFusion 8 Standard on Windows 2003 server. I have the security sandbox enabled. I have no IP:PORT restrictions.

From what little I've found online so far this seems to be a problem only when the sandbox is enabled (which I must have so I can limit access to certain resources). Furthermore I believe it's being triggered because there's a java security policy somewhere that does not include a grant permission on listening sockets.

{CF_ROOT}\runtime\jre\lib\security\java.policy does contain, by default, a line granding listen permissions on localhost to any port above 1024.

{CF_ROOT}\runtime\lib\jrun.policy contains even more permissions as it pertains to sockets. I've tried copying the three lines regarding SocketPermission into java.policy and restarting the server, but that didn't do a damn thing.

I've seen documentation about the need to explicitly set the java policy in the JVM arguments when sandbox security is enabled, but everything I've read says this is ONLY when running CF on top of another JRE rather than the JRun install that it comes with.

So.

Any ideas?
    This topic has been closed for replies.

    1 reply

    June 13, 2014

    I had a similar issue with CFSEARCH on CF10 with sandbox security that I resolved by adding the following to the neo-security.xml file:

    <struct><var name='CLASS'><string>java.net.SocketPermission</string></var><var name='TARGET'><string>127.0.0.1:0</string></var><var name='ACTION'><string>listen,resolve</string></var></struct></array></var></struct></var> </struct>

    That gives permission to listen on dynamic ports (the colon-zero part).

    Inspiring
    February 2, 2017

    I have tried this (on CF 9) but it breaks CF totally. I inserted it inside existing sandbox definition in the same place any other rule would be place if created via cfadmin.

    Are you sure the syntax is correct, or does it go somewhere else ?