Eclipse 2022-06 java.security.AccessControlException state.dat/.markers write - java

I have a weird problem after updateing to Eclipse 2022-06. I'm running it on Windows 10 under java.version=17.0.3 java.vendor=Azul Systems, Inc.
When I exit my (newly created) workspace after changing some system properties or project content, I get an error message:
Problems occurred while trying to save the state of the workbench.
java.security.AccessControlException: access denied ("java.io.FilePermission" "D:\xxxxxx.metadata.plugins\org.eclipse.core.resources.projects\MyProject\org.eclipse.jdt.core\state.dat" "write")
or
java.security.AccessControlException: access denied ("java.io.FilePermission" ""D:\xxxxxx.metadata.plugins\org.eclipse.core.resources.projects\MyProject.markers" "write")
at java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:485)
at java.base/java.security.AccessController.checkPermission(AccessController.java:1068)
at java.base/java.lang.SecurityManager.checkPermission(SecurityManager.java:416)
at java.base/java.lang.SecurityManager.checkWrite(SecurityManager.java:847)
at ro.sync.security.manager.SandboxSecurityManager.checkWrite(SandboxSecurityManager.java:188)
at java.base/java.io.FileOutputStream.(FileOutputStream.java:223)
at java.base/java.io.FileOutputStream.(FileOutputStream.java:184)
at org.eclipse.jdt.internal.core.JavaModelManager.createOutputStream(JavaModelManager.java:4387)
at org.eclipse.jdt.internal.core.JavaModelManager.saveBuiltState(JavaModelManager.java:4341)
at org.eclipse.jdt.internal.core.JavaModelManager.saveState(JavaModelManager.java:4323)
at org.eclipse.jdt.internal.core.JavaModelManager.lambda$1(JavaModelManager.java:4699)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.Nodes$CollectorTask.doLeaf(Nodes.java:2183)
at java.base/java.util.stream.Nodes$CollectorTask$OfRef.doLeaf(Nodes.java:2193)
at java.base/java.util.stream.AbstractTask.compute(AbstractTask.java:327)
at java.base/java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:754)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
at java.base/java.util.concurrent.ForkJoinTask.invoke(ForkJoinTask.java:686)
at java.base/java.util.stream.Nodes.collect(Nodes.java:328)
at java.base/java.util.stream.ReferencePipeline.evaluateToNode(ReferencePipeline.java:111)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:570)
at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616)
at org.eclipse.jdt.internal.core.JavaModelManager.lambda$0(JavaModelManager.java:4704)
at java.base/java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1428)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
I even tried to add my project path to the java.policy file ->
permission java.io.FilePermission "D:\xxxxxx-", "write"
but that didn't help.
Is this a known issue? Any suggestions how I can resolve the problem?
Thanx
Thomas

I found the solution. I had oXygen 23.1 (to be clear - it's an older version not recomended for eclipse 2022-06) installed that seems to cause the problem. After uninstalling this version everything works fine.

Related

Getting security issue while upgrading apache santuario library from 1.5.6 to 3.0.1

while updating apache santuario library we are facing below error.
java.security.AccessControlException: access denied ("java.security.SecurityPermission" "org.apache.xml.security.register")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
at java.security.AccessController.checkPermission(AccessController.java:886)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at org.apache.xml.security.utils.JavaUtils.checkRegisterPermission(JavaUtils.java:219)
at org.apache.xml.security.utils.XMLUtils.setDsPrefix(XMLUtils.java:96)
at org.apache.xml.security.utils.ElementProxy.setNamespacePrefix(ElementProxy.java:487)
at org.apache.xml.security.utils.ElementProxy.registerDefaultPrefixes(ElementProxy.java:500)
at org.apache.xml.security.Init.dynamicInit(Init.java:121)
at org.apache.xml.security.Init.init(Init.java:92)
at org.apache.ws.security.WSSConfig.setXmlSecIgnoreLineBreak(WSSConfig.java:400)
at org.apache.ws.security.WSSConfig.init(WSSConfig.java:420)
at org.apache.ws.security.WSSConfig.getNewInstance(WSSConfig.java:455)
at org.apache.ws.security.WSSecurityEngine.getWssConfig(WSSecurityEngine.java:142)
at
we have added permission in catalina.policy as java.security.SecurityPermission "org.apache.xml.security.register" it works for us but I want to provide specific jar level permission to library.
Thanks in advance!

Internal error (java.nio.file.AccessDeniedException): C:\Users\Р’С–Рє

While tryin` to build any project (even empty) in Intellij Idea, I get this error:
Internal error (java.nio.file.AccessDeniedException): C:\Users\Р’С–Рє
java.nio.file.AccessDeniedException: C:\Users\Р’С–Рє
at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:89)
at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
at java.base/sun.nio.fs.WindowsFileSystemProvider.createDirectory(WindowsFileSystemProvider.java:509)
at java.base/java.nio.file.Files.createDirectory(Files.java:690)
at java.base/java.nio.file.Files.createAndCheckIsDirectory(Files.java:797)
at java.base/java.nio.file.Files.createDirectories(Files.java:783)
at com.intellij.util.io.ResizeableMappedFile.ensureParentDirectoryExists(ResizeableMappedFile.java:181)
at com.intellij.util.io.ResizeableMappedFile.<init>(ResizeableMappedFile.java:67)
at com.intellij.util.io.PersistentBTreeEnumerator.<init>(PersistentBTreeEnumerator.java:93)
at com.intellij.util.io.PersistentEnumerator.createDefaultEnumerator(PersistentEnumerator.java:66)
at com.intellij.util.io.PersistentMapImpl.<init>(PersistentMapImpl.java:136)
at com.intellij.util.io.PersistentMapBuilder.buildImplementation(PersistentMapBuilder.java:62)
at com.intellij.util.io.PersistentMapBuilder.build(PersistentMapBuilder.java:44)
at com.intellij.util.io.PersistentHashMap.<init>(PersistentHashMap.java:39)
at com.intellij.util.io.PersistentHashMap.<init>(PersistentHashMap.java:54)
at org.jetbrains.jps.incremental.storage.AbstractStateStorage.createMap(AbstractStateStorage.java:116)
at org.jetbrains.jps.incremental.storage.AbstractStateStorage.<init>(AbstractStateStorage.java:29)
at org.jetbrains.jps.incremental.storage.FileTimestampStorage.<init>(FileTimestampStorage.java:27)
at org.jetbrains.jps.incremental.storage.ProjectStamps.<init>(ProjectStamps.java:41)
at org.jetbrains.jps.cmdline.BuildRunner.load(BuildRunner.java:97)
at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:311)
at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:162)
at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:218)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Please perform full project rebuild (Build | Rebuild Project)
It must be C:\Users\Вік instead of C:\Users\Р’С–Рє, but i don`t know how to make Intellij read it correctly
The access to write or read from this directory has been denied by your computer while mishandling a program or another app.
Close all opened projects from Intellij and close all running applications on your computer.
Make sure all of them are well closed then restart your PC. This should solve the problem.
It said that you dont have permission to execute action on that path. Try to set your permission, example in linux:
chmod -R 777 YOUR_APTH
In window, you can try this:
https://v2cloud.com/tutorials/how-to-change-folder-permissions-on-windows

Access Denied when using openJDK

I get an error
IOException:access denied ("java.io.FilePermission"
"D:\certainfilelocation" "read")
When accessing a file while using OpenJDK10 instead of JRE.
I also added in the java.policy this line
jdk-10.0.2\conf\security
permission java.io.FilePermission "<< ALL FILES >>","read";
But I still get the same error.
Is there any way? Thanks

Tomcat AccessControlException despite using AllPermission

I'm attempting to deploy a WAR to Tomcat and running into problems with the Java Security Manager. This is Tomcat 7.0.55 running Java 1.8.0, and Tomcat is started with parameters like this:
-Dcatalina.base="/path/to/apache-tomcat-7.0.55"
-Dcatalina.home="/path/to/apache-tomcat-7.0.55"
-Djava.endorsed.dirs="/path/to/apache-tomcat-7.0.55\endorsed"
-Djava.security.manager
-Djava.security.policy="/path/to/config/custom_catalina.policy"
The important thing here is that it's enabling the Java Security Manager and then pointing it at a custom security policy, which looks like this:
grant {
permission java.security.AllPermission;
};
It seems like this should result in the rather pointless configuration of activating the security manager and then telling it to just allow everything (I don't run the server so don't blame me!). However, when I deploy my WAR it fails with several stack traces containing things like:
Caused by: java.security.AccessControlException: access denied ("java.util.PropertyPermission" "java.version" "read")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:457) ~[?:1.8.0_51]
at java.security.AccessController.checkPermission(AccessController.java:884) ~[?:1.8.0_51]
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) ~[?:1.8.0_51]
at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:1294) ~[?:1.8.0_51]
at java.lang.System.getProperty(System.java:753) ~[?:1.8.0_51]
at org.apache.commons.lang3.JavaVersion.maxVersion(JavaVersion.java:196) ~[commons-lang3-3.4.jar:3.4]
I've tried explicitly granting AllPermission to my own application with something like:
grant codeBase "file:${catalina.home}/webapps/myApp/-" {
permission java.security.AllPermission;
};
and even explicitly granting the PropertyPermission to read java.version. None of it makes any difference. The same AccessControlExceptions still get thrown and prevent deployment.
What is going on here? How can I troubleshoot this?
Ours was not coming during deployment, rather while heavy load testing.
We changed the Connector in server.xml from Nio2 to Nio and it solved problem for us
org.apache.coyote.http11.Http11NioProtocol (The first version of NIO, instead of NIO2).
We didn't disable tomcat security manager, that is against our firm's policy.

How to resolve java.io.FilePermission error?

I am developing a java game for my school project from a tutorial which uses eclipse as its IDE. I am supposed to make this game in Netbeans but the problem is that after porting it gives an error like this.
java.security.AccessControlException: access denied ("java.io.FilePermission" "E:\java game\TheBigGame\Unit 3 Day 7\build\data\character.png" "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.awt.image.URLImageSource.<init>(URLImageSource.java:55)
at sun.applet.AppletImageRef.reconstitute(AppletImageRef.java:51)
at sun.misc.Ref.get(Ref.java:64)
at sun.applet.AppletViewer.getCachedImage(AppletViewer.java:395)
at sun.applet.AppletViewer.getImage(AppletViewer.java:390)
at java.applet.Applet.getImage(Applet.java:274)
at java.applet.Applet.getImage(Applet.java:296)
at kiloboltgame.StartingClass$1.run(StartingClass.java:66)
at java.security.AccessController.doPrivileged(Native Method)
at kiloboltgame.StartingClass.init(StartingClass.java:64)
at sun.applet.AppletPanel.run(AppletPanel.java:434)
at java.lang.Thread.run(Thread.java:722)
The game works well in Eclipse but is having troubles in Netbeans.
I saw a similar question and tried using policy tool, editing java.properties and java.policy in lib\security but still no progress. By the way I use Windows 8.1 (if that helps).
The game is made on an applet.
I think your file is open. When under Windows, if a file is being used, sometimes you cannot open it from somewhere else..
Or it could be that you really don't have permissions :) right click on the file and check permissions (need to have all of them, read, write)

Categories