Java applet: connect to "maps.googleapis.com" - access denied ("java.net.SocketPermission") - java

I'm running a java applet embedded into a Grails application on my local. The applet should connect to the Google Maps API, but it gives me access denied.
Exception in thread "AWT-EventQueue-11" java.security.AccessControlException: access denied ("java.net.SocketPermission" "maps.googleapis.com:80" "connect,resolve")
When running the .java file in the applet viewer, the connection is fine, however when the applet is running on the tomcat server, I get access denied.
I've tried every solution I could find - granting permissions, signing the .jar file, creating and crossdomain.xml file and so on. Nothing works.
I'm running java version "1.8.0_40" on ubuntu.

You have to put the your applet inside of a jar and sign it using jarsigner

Related

AzureFiles access denied Linux

I'm stuck with a problem of file access in my virtual machine.
I actually have two app services (linux) with a mounting point to the AzureFiles. This actually works but I'm trying to put one of the app on a virtual machine (ubuntu 20).
I can connect the AzureFiles using the provided script by Azure with the protocol SMB. But I have got some errors using my apps (Java):
AccessDeniedException
NoSuchFileException
Files.move()
// for f in directory Files.delete(f)
Files are mount with 777 with nogroup nobody on the app service app, and 777 root root on the azure vm
Files are correctly detected by the for loop, but nosuchfile is thrown by delete.
Here are the mounting points :
App service :
//mystorage.file.core.windows.net/mypath /mypath cifs rw,relatime,vers=3.1.1,cache=strict,username=myusername,uid=0,noforceuid,gid=0,noforcegid,addr=x.x.x.x,file_mode=0777,dir_mode=0777,soft,persistenthandles,nounix,serverino,mapposix,mfsymlinks,noperm,rsize=1048576,wsize=1048576,bsize=1048576,echo_interval=60,actimeo=1 0 0
VM:
//mystorage.file.core.windows.net/mypath /mypath cifs nofail,credentials=/etc/smbcredentials/mystorage.cred,dir_mode=0777,file_mode=0777,serverino,nosharesock,actimeo=30
EDIT : It seems to be stuck only with files created by the application on the VM. If I upload a file with Azure Strorage explorer, the delete function works.
Any idea why it doesn't work ?
Thanks

Security Exception while connecting to Oracle Database using ojdbc6.jar

I have replaced classes12.jar to ojdbc6.jar to connect oracle 12c database. Here I am connecting to Service name not to SID.
This works fine if I run my applet application through eclipse as java application.
But if I export the same application to a WAR file and deployed in weblogic it doesn't work.
I am encountering getting below exception.
java.security.AccessControlException: access denied
("java.util.PropertyPermission" "oracle.jdbc.RetainV9LongBindBehavior" "read")
How to solve this exception?

Console don't let my applet run because of a file

I am working in an applet. It works perfect with Eclipse but when I try to run from Console it gives me this stack trace:
C:\Course Technology\src>appletviewer TestJAlienHunt.html
Path for file entered D:\Course Technology\AssignmentFinal\scoreFile.txt java.security.AccessControlException: access denied ("java.io.FilePermission" "D:\Course Technology\AssignmentFinal\scoreFile.txt" "read")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:366)
at java.security.AccessController.checkPermission(AccessController.java:555)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at java.lang.SecurityManager.checkRead(SecurityManager.java:888)
at sun.nio.fs.WindowsPath.checkRead(WindowsPath.java:792)
at sun.nio.fs.WindowsFileSystemProvider.checkAccess(WindowsFileSystemProvider.java:360)
at java.nio.file.Files.exists(Files.java:2311)
at ReadFile.fileExists(ReadFile.java:47)
at JAlienHunt.readScore(JAlienHunt.java:187)
at JAlienHunt.init(JAlienHunt.java:73)
at sun.applet.AppletPanel.run(AppletPanel.java:434)
at java.lang.Thread.run(Thread.java:722)
The file has permission to read and write, why I am getting this?
An applet needs to be digitally signed by you and trusted by the end user before it can access the local file system on the user's computer.
I highlight user's computer because that is where any File will equate to. There is no option for getting a File pointing to the server. If this is read only and the server hosts the resource, access it by URL.

How to solve java.security.AccessControlException?

I am trying to access client's temp directory through my applet on my web project.
When I run the applet by itself, it gets the tempdir with no problem.
When I try to get it on my project using javascript and calling the applet method, I am having accessControlException on my javascript console. Also I am getting the same exception when I try to read a file under the temp directory.
This is what I see exactly:
java.security.accesscontrolexception access denied (java.util.propertypermission java.io.tmpdir read)
java.security.accesscontrolexception access denied (java.io.filepermission read)
How to solve java.security.AccessControlException?
Simplest solution is just to sign the applet.

Java - Applet Exception

I have a Java project that contains 1 JApplet.
I'm able to run the Applet in desk-top mode (adding the applet to a frame in main[] method).
It doesn't work in a browser though. Getting this error:
I already signed all the jars.
I believe its related to mysql connector jar.
Any ideas?
Exception occurred: java.lang.ExceptionInInitializerError (uncaught)"thread=AWT-
EventQueue-1", java.awt.EventDispatchThread.run(), line=156 bci=152
It runs fine if I add grant all to java.policy
You should ensure:
That your applet is signed to allow for database connections.
That your mysql connector jar is available on your 'download' path just like your applet jar file.
Running the application from a webserver solved the issue.

Categories