I am trying to execute this program, http://java.sun.com/developer/technicalArticles/ThirdParty/WebCrawler/WebCrawler.java The program compiles without any error after i referred this page, http://www.velocityreviews.com/forums/t146972-web-crawler.html
But while executing using the command "appletviewer WebCrawler.html" i get this exception..
Exception in thread "Thread-4"
java.security.AccessControlException:access denied(java.net.SocketPermission java.sun.com:80 connect,resolve)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
at java.security.AccessController.checkPermission(AccessController.java:546)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at java.lang.SecurityManager.checkConnect(SecurityManager.java:1034)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:233)
at sun.net.www.http.HttpClient.New(HttpClient.java:306)
at sun.net.www.http.HttpClient.New(HttpClient.java:323)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:860)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:801)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:726)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1049)
at java.net.URL.openStream(URL.java:1010)
at WebCrawler.robotSafe(WebCrawler.java:139)
at WebCrawler.run(WebCrawler.java:235)
at java.lang.Thread.run(Thread.java:619)
How do i make it work.?
By default, an applet may only connect to the same server + port from which it is located. You could do one of the following:
Also you could have a look at configuring the crossdomain for the applet, see:
http://weblogs.java.net/blog/2008/05/28/java-doodle-crossdomainxml-support
It's pretty straight forward to self-sign an applet (which you can do for free). If you don't sign the applet you'll only get bare minimum security access and won't give access to the sockets.
Simple 3 step guide is here:
http://www.narendranaidu.com/2007/11/3-easy-steps-to-self-sign-applet-jar.html
or a more in-depth explination: http://java.sun.com/developer/onlineTraining/Programming/JDCBook/signed.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.