How to beat JSoup access denied java.net.SocketPermission in tomcat 6?
I got exception java.security.AccessControlException: access denied (java.net.SocketPermission www.somepage.net:80 conne开发者_如何学Goct,resolve)
when I try
doc = Jsoup.connect("http://www.somepage.net/").get();
in web app in Tomcat 6. However if I do this in mvn test
outside of tomcat 6 or in another web app in tc server all is going great.
You need to edit the /conf/catalina.policy
file to grant java.net.SocketPermission
on the code in question.
See also Tomcat 6.0 Security Manager HOW-TO.
精彩评论