On 08/04/2010, Thomas VEQUAUD <[email protected]> wrote: > Hi Sebb, > > Thank you for your answer, I browsed your link quickly, it's seem really > interesting, I'll go deeper after work. Tell me if I'm wrong but the policy > file is stored on computers so I cannot access or edit this file for every > users who try to use my applet?
True, but perhaps worth trying on your system to see if it helps. > Maybe I used a too basic crypting method ? Maybe a stronger one could grant > highest permissions such as socket permissions ? > I'm sorry, but I don't really know how else to solve the issue. Maybe you also need to sign the Commons Net jar? I've done some Googling and found this: http://faq.javaranch.com/java/HowCanAnAppletReadFilesOnTheLocalFileSystem Also, consider catching the Exception and providing a nicer message to the user of the applet. This is getting off-topic for the Commons User list. > > On Thu, Apr 8, 2010 at 2:50 PM, sebb <[email protected]> wrote: > > > On 08/04/2010, Thomas VEQUAUD <[email protected]> wrote: > > > Hi everybody, > > > > > > This is the first time I have to use Java and build an applet for a > > specific > > > need : browse images files on a computer and send them on a server in > > HTP or > > > FTP. Everything works perfectly fine within NetBeans or AppletViewer but > > > once embedded in an HTML file... Outch ! I had a first read/write > > exception > > > with JFileChooser... I googled it and found an answer: jsigner. So I > > signed > > > my .jar and problem solved. But now, I have a new Exception and no > > answer > > > about how to fix it so I hope you can get me out of this ! > > > > > > Exception in thread "AWT-EventQueue-2" > > java.security.AccessControlException: > > > access denied (java.net.SocketPermission ftpperso.free.fr resolve) > > > > Look like the applet does not have "resolve" permission for socket > > operations. > > > > Googling suggests adding something like: > > > > permission java.net.SocketPermission "*", "connect, resolve"; > > > > to the policy file (you'll need connect after the resolve succeeds). > > > > Replace "*" with "ftpperso.free.fr" if you want to restrict the applet > > to just that host. > > > > See: > > > > http://java.sun.com/docs/books/tutorial/security/TOC.html > > > > for some useful info on permissions etc. > > > > I'm surprised that the appletviewer does not show the same problem, > > but perhaps that has been configured with different permissions from > > the webserver. > > > > > at java.security.AccessControlContext.checkPermission(Unknown Source) > > > at java.security.AccessController.checkPermission(Unknown Source) > > > at java.lang.SecurityManager.checkPermission(Unknown Source) > > > at java.lang.SecurityManager.checkConnect(Unknown Source) > > > at sun.plugin2.applet.Applet2SecurityManager.checkConnect(Unknown > > Source) > > > at java.net.InetAddress.getAllByName0(Unknown Source) > > > at java.net.InetAddress.getAllByName(Unknown Source) > > > at java.net.InetAddress.getAllByName(Unknown Source) > > > at java.net.InetAddress.getByName(Unknown Source) > > > at java.net.InetSocketAddress.<init>(Unknown Source) > > > at org.apache.commons.net.SocketClient.connect(SocketClient.java:176) > > > at > > > > > > fr.fastimage.uploader.Uploader.uploadButtonActionPerformed(Uploader.java:176) > > > at fr.fastimage.uploader.Uploader.actionPerformed(Uploader.java:123) > > > at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) > > > > > > Thanks a lot ! > > > > In future, please specify the NET version and JVM in case they are > > relevant. > > > > > -- > > > Thomas VEQUAUD http://thomas.vequaud.free.fr/ > > > Expert EPITECH en Ingénierie Informatique > > > Tél : +33(0)6.50.39.28.10 Fax: +33(0)9.58.46.10.07 > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [email protected] > > For additional commands, e-mail: [email protected] > > > > > > > > -- > > Thomas VEQUAUD http://thomas.vequaud.free.fr/ > Expert EPITECH en Ingénierie Informatique > Tél : +33(0)6.50.39.28.10 Fax: +33(0)9.58.46.10.07 > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
