[jcifs] "java.net.SocketException: Permission denied: connect" after some time

Michael B Allen ioplex at gmail.com
Fri Sep 26 23:36:32 MDT 2014

On Tue, Aug 26, 2014 at 3:17 AM, luk <luk.vogel at gmx.de> wrote:
> Hello,
> I have implemented an server which reads and writes files all 30 minutes.
> This server is running about 4 weeks now. There were no problems all time.
> But now i get following exception: "java.net.SocketException: Permission
> denied: connect"
> All user data is right.
> I got the errors for 5 days.
> After this 5 days i restarted the server. -> No problems anymore. The server
> is running now for 1 day. I think after next 4 weeks i will get same problem
> again.
> Any ideas?

Hi Luk,

That error is not related to JCIFS or user credentials. It is a JVM
security manager issue. Specifically, it seems the Thread used by
JCIFS to call Socket.connect() does not have permission to create a

Note that JCIFS uses a separate Thread to create and read sockets. Not
sure if that is important in this case.

It's difficult to tell what the real cause could be. It could be a
ClassLoader issue. For example, if you restart the webapp, but not the
entire app server, JCIFS will be loaded into a new ClassLoader and
then maybe loose permissions somehow? But this is just a wild guess.
There are probably a number of environmental factors that could result
in a socket permission issue like this.

Just Google "java socket connect permission" and see if anything lines
up with your symptoms.


Michael B Allen
Java Active Directory Integration

More information about the jCIFS mailing list