Missing mandatory jurisdiction policy files: unlimited - java

Something to do with eclipse as I can run the code successfully in cmd.
I am using standard oracle Java version 15 and eclipse version 2020-12(4.18.0) on windows 10
HttpURLConnection httpUrlConnection = (HttpURLConnection)url.openConnection();
At the line above I am getting error as pasted below.
Please note: System.out.println(System.getProperty("java.security.properties")); gives null
Exception in thread "main" java.lang.ExceptionInInitializerError
at java.base/javax.crypto.Cipher.getInstance(Unknown Source)
at java.base/sun.security.ssl.SSLCipher.isTransformationAvailable(Unknown Source)
at java.base/sun.security.ssl.SSLCipher.(Unknown Source)
at java.base/sun.security.ssl.SSLCipher.(Unknown Source)
at java.base/sun.security.ssl.CipherSuite.(Unknown Source)
at java.base/sun.security.ssl.SSLContextImpl.getApplicableSupportedCipherSuites(Unknown Source)
at java.base/sun.security.ssl.SSLContextImpl$AbstractTLSContext.(Unknown Source)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Unknown Source)
at java.base/java.security.Provider$Service.getImplClass(Unknown Source)
at java.base/java.security.Provider$Service.newInstance(Unknown Source)
at java.base/sun.security.jca.GetInstance.getInstance(Unknown Source)
at java.base/sun.security.jca.GetInstance.getInstance(Unknown Source)
at java.base/javax.net.ssl.SSLContext.getInstance(Unknown Source)
at java.base/javax.net.ssl.SSLContext.getDefault(Unknown Source)
at java.base/javax.net.ssl.SSLSocketFactory.getDefault(Unknown Source)
at java.base/javax.net.ssl.HttpsURLConnection.getDefaultSSLSocketFactory(Unknown Source)
at java.base/javax.net.ssl.HttpsURLConnection.(Unknown Source)
at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.(Unknown Source)
at java.base/sun.net.www.protocol.https.Handler.openConnection(Unknown Source)
at java.base/sun.net.www.protocol.https.Handler.openConnection(Unknown Source)
at java.base/java.net.URL.openConnection(Unknown Source)
at hackerearthpractice/hackerearthpractice.GoalGetter.main(GoalGetter.java:16)
Caused by: java.lang.SecurityException: Can not initialize cryptographic mechanism
at java.base/javax.crypto.JceSecurity.(Unknown Source)
... 23 more
Caused by: java.lang.SecurityException: Missing mandatory jurisdiction policy files: unlimited
at java.base/javax.crypto.JceSecurity.setupJurisdictionPolicies(Unknown Source)
at java.base/javax.crypto.JceSecurity$1.run(Unknown Source)
at java.base/javax.crypto.JceSecurity$1.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
... 24 more

It was using this weird runtime in eclipse, I changed it to the one I have installed and then it worked.

Related

java 9 module exception in running

I have download jdk 9 from https://jdk9.java.net/download/ and Quick-start guide from http://openjdk.java.net/projects/jigsaw/quick-start#linkerJigsaw and wrote the first example "Greetings" according to this guide. The project compiled successfully but when i trying to run i got exception
E:\>java --module-path mods -m com.greetings/com.greetings.Main
Error occurred during initialization of VM
java.lang.module.ResolutionException: Error reading module: mods\com.greetings
at java.lang.module.Resolver.findWithBeforeFinder(java.base#9-ea/Unknown Source)
at java.lang.module.Resolver.resolveRequires(java.base#9-ea/Unknown Source)
at java.lang.module.Configuration.resolveRequiresAndUses(java.base#9-ea/Unknown Source)
at java.lang.module.ModuleDescriptor$1.resolveRequiresAndUses(java.base#9-ea/Unknown Source)
at jdk.internal.module.ModuleBootstrap.boot(java.base#9-ea/Unknown Source)
at java.lang.System.initPhase2(java.base#9-ea/Unknown Source)
Caused by: java.lang.module.InvalidModuleDescriptorException: Main.class found in in top-level directory (unnamed package not allowed in module)
at java.lang.module.ModuleInfo.invalidModuleDescriptor(java.base#9-ea/Unknown Source)
at java.lang.module.ModuleInfo.read(java.base#9-ea/Unknown Source)
at java.lang.module.ModuleDescriptor.read(java.base#9-ea/Unknown Source)
at java.lang.module.ModulePath.readExplodedModule(java.base#9-ea/Unknown Source)
at java.lang.module.ModulePath.readModule(java.base#9-ea/Unknown Source)
at java.lang.module.ModulePath.scanDirectory(java.base#9-ea/Unknown Source)
at java.lang.module.ModulePath.scan(java.base#9-ea/Unknown Source)
at java.lang.module.ModulePath.scanNextEntry(java.base#9-ea/Unknown Source)
at java.lang.module.ModulePath.find(java.base#9-ea/Unknown Source)
at java.lang.module.ModuleFinder$2.lambda$find$0(java.base#9-ea/Unknown Source)
at java.util.stream.ReferencePipeline$3$1.accept(java.base#9-ea/Unknown Source)
at java.util.AbstractList$RandomAccessSpliterator.tryAdvance(java.base#9-ea/Unknown Source)
at java.util.stream.ReferencePipeline.forEachWithCancel(java.base#9-ea/Unknown Source)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(java.base#9-ea/Unknown Source)
at java.util.stream.AbstractPipeline.copyInto(java.base#9-ea/Unknown Source)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(java.base#9-ea/Unknown Source)
at java.util.stream.FindOps$FindOp.evaluateSequential(java.base#9-ea/Unknown Source)
at java.util.stream.AbstractPipeline.evaluate(java.base#9-ea/Unknown Source)
at java.util.stream.ReferencePipeline.findFirst(java.base#9-ea/Unknown Source)
at java.lang.module.ModuleFinder$2.find(java.base#9-ea/Unknown Source)
at java.lang.module.Resolver.findWithBeforeFinder(java.base#9-ea/Unknown Source)
at java.lang.module.Resolver.resolveRequires(java.base#9-ea/Unknown Source)
at java.lang.module.Configuration.resolveRequiresAndUses(java.base#9-ea/Unknown Source)
at java.lang.module.ModuleDescriptor$1.resolveRequiresAndUses(java.base#9-ea/Unknown Source)
at jdk.internal.module.ModuleBootstrap.boot(java.base#9-ea/Unknown Source)
at java.lang.System.initPhase2(java.base#9-ea/Unknown Source)
I could not find reason of this exception

Getting Rita.WordNet to work

According to Rita Homepage you just have to download Rita.jar and
WordNet-3.1 and add both to thebuild path of your java project.
I did it like that and everytime i try to use it:
RiWordNet wordNet = new RiWordNet(Test.class.getResource("/WordNet-3.1").getPath());
I get:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at rita.wordnet.jwnl.util.factory.Element.install(Unknown Source)
at rita.wordnet.jwnl.JWNL.initialize(Unknown Source)
at rita.RiWordNet.initWordNet(Unknown Source)
at rita.RiWordNet.<init>(Unknown Source)
at rita.RiWordNet.<init>(Unknown Source)
at de.hof.iisys.relationExtraction.analyzer.utils.Rita.main(Rita.java:13)
Caused by: rita.wordnet.jwnl.JWNLException: The properties file must specify a dictionary path
at rita.wordnet.jwnl.util.factory.AbstractValueParam.create(Unknown Source)
at rita.wordnet.jwnl.dictionary.FileBackedDictionary.installStatic(Unknown Source)
... 10 more
Caused by: rita.wordnet.RiWordNetError:
[ERROR] Couldn't find file: .\WordNet-3.1\dict\index.verb
at rita.wordnet.WordnetDictionaryFile.openFile(Unknown Source)
at rita.wordnet.jwnl.dictionary.file.AbstractDictionaryFile.open(Unknown Source)
at rita.wordnet.jwnl.dictionary.file.DictionaryCatalog.open(Unknown Source)
at rita.wordnet.jwnl.dictionary.file.DictionaryCatalogSet.open(Unknown Source)
at rita.wordnet.jwnl.dictionary.file_manager.FileManagerImpl.<init>(Unknown Source)
at rita.wordnet.jwnl.dictionary.file_manager.FileManagerImpl.create(Unknown Source)
at rita.wordnet.jwnl.util.factory.AbstractValueParam.create(Unknown Source)
... 11 more
The data files are no longer supplied as part of the installation. You need to download the WordNet version for your platform and then pass it to the constructor, as documented here.

javaw.exe process hangs on applet start

Periodically we have this problem that prevents an applet to go running, the process javaw.exe seems locked, killing them several times unlock the applet. In the trace file I find this (we have jdk 1.6_35, the applet is used by a j2ee web application):
**server running at port: 50091
basic: unique id: JavaControlPanel
basic: server port at: 49187
basic: getSingleInstanceFilename: C:\Users\amoriconi\AppData\LocalLow\Sun\Java\Deployment\tmp\si\JavaControlPanel-x86_49187
basic: file should be removed: C:\Users\amoriconi\AppData\LocalLow\Sun\Java\Deployment\tmp\si\JavaControlPanel-x86_50091
basic: waiting connection
Exception in thread "main" java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.security.jca.ProviderConfig$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.security.jca.ProviderConfig.doLoadProvider(Unknown Source)
at sun.security.jca.ProviderConfig.getProvider(Unknown Source)
at sun.security.jca.ProviderList.getProvider(Unknown Source)
at sun.security.jca.ProviderList$ServiceList.tryGet(Unknown Source)
at sun.security.jca.ProviderList$ServiceList.access$200(Unknown Source)
at sun.security.jca.ProviderList$ServiceList$1.hasNext(Unknown Source)
at sun.security.jca.GetInstance.getInstance(Unknown Source)
at java.security.SecureRandom.getInstance(Unknown Source)
at java.security.SecureRandom.getDefaultPRNG(Unknown Source)
at java.security.SecureRandom.<init>(Unknown Source)
at com.sun.deploy.services.WPlatformService.getSecureRandom(Unknown Source)
at com.sun.deploy.si.SingleInstanceImpl.getSecureRandom(Unknown Source)
at com.sun.deploy.si.SingleInstanceImpl.access$100(Unknown Source)
at com.sun.deploy.si.SingleInstanceImpl$SingleInstanceServer$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.deploy.si.SingleInstanceImpl$SingleInstanceServer.createSingleInstanceFile(Unknown Source)
at com.sun.deploy.si.SingleInstanceImpl$SingleInstanceServer.<init>(Unknown Source)
at com.sun.deploy.si.SingleInstanceImpl.addSingleInstanceListener(Unknown Source)
at com.sun.deploy.panel.ControlPanel.<init>(Unknown Source)
at com.sun.deploy.panel.ControlPanel.main(Unknown Source)
Caused by: java.lang.RuntimeException: java.security.NoSuchAlgorithmException: class configured for SecureRandom(provider: SUN)cannot be found.
at java.security.SecureRandom.getDefaultPRNG(Unknown Source)
at java.security.SecureRandom.<init>(Unknown Source)
at com.sun.crypto.provider.SunJCE.<clinit>(DashoA13*..)
... 28 more
Caused by: java.security.NoSuchAlgorithmException: class configured for SecureRandom(provider: SUN)cannot be found.
at java.security.Provider$Service.getImplClass(Unknown Source)
at java.security.Provider$Service.newInstance(Unknown Source)
at sun.security.jca.GetInstance.getInstance(Unknown Source)
at sun.security.jca.GetInstance.getInstance(Unknown Source)
at java.security.SecureRandom.getInstance(Unknown Source)
... 31 more
Caused by: java.lang.ClassNotFoundException: com/sun/deploy/security/WSecureRandom
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
... 36 more**
For some reason this problem is originated from an hidden update of java, installing jdk 7u45 and then removing solve for some time the problem.....
I'm going crazy....
This is happening because there are more security checks that have been imposed on applets in the new release of the JRE (7u45-b18).
http://www.oracle.com/technetwork/java/javase/7u45-relnotes-2016950.html#newft
Its good to be on old JRE or implement security related changes.

NPE with logging while launching webstart on jre7 update 40

My application was running fine until I upgraded my jre to 7u40. When my application is initializing, it's doing Logger.getLogger("ClassName"), and I'm getting the following exception.
java.lang.ExceptionInInitializerError
at java.util.logging.Logger.demandLogger(Unknown Source)
at java.util.logging.Logger.getLogger(Unknown Source)
at com.company.Application.Applet.<clinit>(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.javaws.Launcher.executeApplication(Unknown Source)
at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at java.util.logging.Logger.setParent(Unknown Source)
at java.util.logging.LogManager$6.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.doSetParent(Unknown Source)
at java.util.logging.LogManager.access$1100(Unknown Source)
at java.util.logging.LogManager$LogNode.walkAndSetParent(Unknown Source)
at java.util.logging.LogManager$LoggerContext.addLocalLogger(Unknown Source)
at java.util.logging.LogManager$LoggerContext.addLocalLogger(Unknown Source)
at java.util.logging.LogManager.addLogger(Unknown Source)
at java.util.logging.LogManager$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.<clinit>(Unknown Source)
The exception is coming from this line:
private static Logger logger = Logger.getLogger(Applet.class.getName());
Could it be because of any sideeffects with fix http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8017174 ?
A workaround is to open the java control center and enable logging. This is a concern since by default "Enable Logging" is unchecked. If I select "Enable Logging", the application starts fine.
This problem seems to be fixed in java7 update 45.
Try to package java.util.logging.* with your app in a JAR, and make sure it's on the classpath. That way it is always available. Also, what does your logging.properties look like?

Applet throwing exception when running it through web browser

I have written an applet program. It has some references to classes from java tools.jar in it (eg:- import com.sun.jdi.connect.IllegalConnectorArgumentsException)
When I run this applet through appletviewer utility it works fine. But when I embed this applet in HTML file and try to run it through web browser, I am getting exception about some classes not found at runtime:-
Java Plug-in 1.6.0_18
Using JRE version 1.6.0_18-b07 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\Pras
java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/sun/jdi/connect/IllegalConnectorArgumentsException
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: com/sun/jdi/connect/IllegalConnectorArgumentsException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.sun.jdi.connect.IllegalConnectorArgumentsException
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 14 more
Caused by: java.io.FileNotFoundException: C:\pal\WTP_Workspace\JavaSocketBridge\bin\com\sun\jdi\connect\IllegalConnectorArgumentsException.class (The system cannot find the path specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(Unknown Source)
at java.io.FileInputStream.(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 17 more
Exception: java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/sun/jdi/connect/IllegalConnectorArgumentsException
However the IllegalConnectorArgumentsException class is part of java runtime located inside tools.jar.
How I can get run it inside browser as well?
many thanks in advance.
Regards,
Pras
You are running your applet from the JRE. The class IllegalConnectorArgumentsException can only be access from the JDK since it's related to debugging.
Refer to this question.

Categories

Resources