Where is an applet trying to load a class from? - java

I'm trying to debug an applet that occasionally fails with the stack trace below (on the Java Console).
It looks like it's trying to load binaries and it's getting an HTTP REDIRECT which isn't legal (perhaps because of the applet sandbox?).
Is there any way to turn on verbose class loading output (or other debugging that might be useful) on the Java Console? If this were a standard Java application (as opposed to an applet), I would put "-verbose:class" on the command line and see what I get - but I don't know how to do that with an applet.
I don't have access to the source for the applet - so I can't add any kind of instrumentation to the code itself.
java.lang.SecurityException: illegal URL redirect
at com.sun.deploy.net.HttpUtils.followRedirects(Unknown Source)
at com.sun.deploy.net.BasicHttpRequest.doRequest(Unknown Source)
at com.sun.deploy.net.BasicHttpRequest.doGetRequestEX(Unknown Source)
at com.sun.deploy.net.DownloadEngine.isUpdateAvailable(Unknown Source)
at com.sun.deploy.cache.DeployCacheHandler.get(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown
Source)
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown
Source)
at sun.plugin.PluginURLJarFileCallBack.downloadJAR(Unknown Source)
at sun.plugin.PluginURLJarFileCallBack.access$000(Unknown Source)
at sun.plugin.PluginURLJarFileCallBack$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin.PluginURLJarFileCallBack.retrieve(Unknown Source)
at sun.net.www.protocol.jar.URLJarFile.retrieve(Unknown Source)
at sun.net.www.protocol.jar.URLJarFile.getJarFile(Unknown Source)
at sun.net.www.protocol.jar.JarFileFactory.get(Unknown Source)
at sun.net.www.protocol.jar.JarURLConnection.connect(Unknown Source)
at sun.plugin.net.protocol.jar.CachedJarURLConnection.connect(Unknown
Source)
at sun.plugin.net.protocol.jar.CachedJarURLConnection.getJarFileInternal(Unknown
Source)
at sun.plugin.net.protocol.jar.CachedJarURLConnection.getJarFile(Unknown
Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.getJarFile(Unknown
Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.access$800(Unknown
Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader$1.run(Unknown
Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.ensureOpen(Unknown
Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.(Unknown
Source)
at com.sun.deploy.security.DeployURLClassPath$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.deploy.security.DeployURLClassPath.getLoader(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath.getLoader(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath.getResource(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown
Source)
at java.lang.Thread.run(Unknown Source) Exception: java.lang.SecurityException: illegal URL redirect

You can add the -verbose:class to the command line of java by going to Control Panel, Java, Java, View, then editing the 'runtime parameters'.

To make your applet get sources NOT FROM its native host you have to sign it;
Here are some helpful tutorials
Report that helps

Related

Getting java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessClassInPackage.sun.swing") with JDK8?

I am trying to run my applet with JDK8 but i'm getting below exception on java console at this line of my code
SplitPaneH = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
Traces
Exception in thread "AWT-EventQueue-2" java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessClassInPackage.sun.swing")
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.checkPackageAccess(Unknown Source)
at sun.plugin2.applet.SecurityManagerHelper.checkPackageAccessHelper(Unknown Source)
at sun.plugin2.applet.AWTAppletSecurityManager.checkPackageAccess(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.jb2011.lnf.beautyeye.ch17_split.BESplitPaneDivider.<init>(BESplitPaneDivider.java:77)
at org.jb2011.lnf.beautyeye.ch17_split.BESplitPaneUI.createDefaultDivider(BESplitPaneUI.java:54)
at javax.swing.plaf.basic.BasicSplitPaneUI.installDefaults(Unknown Source)
at javax.swing.plaf.basic.BasicSplitPaneUI.installUI(Unknown Source)
at javax.swing.JComponent.setUI(Unknown Source)
at javax.swing.JSplitPane.setUI(Unknown Source)
at javax.swing.JSplitPane.updateUI(Unknown Source)
at javax.swing.JSplitPane.<init>(Unknown Source)
at javax.swing.JSplitPane.<init>(Unknown Source)
at javax.swing.JSplitPane.<init>(Unknown Source)
at TeleProvisionManager.InventoryPage.<init>(InventoryPage.java:382)
at TeleProvisionManager.MainFrame.createMainTab(MainFrame.java:2147)
at TeleProvisionManager.MainFrame.<init>(MainFrame.java:1253)
at TeleProvisionManager.LoginChangeGroupDlg.handleContinueButton(LoginChangeGroupDlg.java:791)
at TeleProvisionManager.LoginChangeGroupDlg.jbtnContinueActionPerformed(LoginChangeGroupDlg.java:489)
at TeleProvisionManager.LoginChangeGroupDlg.access$100(LoginChangeGroupDlg.java:56)
at TeleProvisionManager.LoginChangeGroupDlg$4.actionPerformed(LoginChangeGroupDlg.java:355)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicRootPaneUI$Actions.actionPerformed(Unknown Source)
at javax.swing.SwingUtilities.notifyAction(Unknown Source)
at javax.swing.JComponent.processKeyBinding(Unknown Source)
at javax.swing.KeyboardManager.fireBinding(Unknown Source)
at javax.swing.KeyboardManager.fireKeyboardAction(Unknown Source)
at javax.swing.JComponent.processKeyBindingsForAllComponents(Unknown Source)
at javax.swing.SwingUtilities.processKeyBindings(Unknown Source)
at javax.swing.UIManager$2.postProcessKeyEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(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)
But it was worked well with JDK7. I am not getting what is the problem and how to solve it. And i tried downloading 'jsdg-stubs-jre1.5.jar' which contains sun.swing classes and copying that jar to WEB-INF/lib folder but no use. How to solve it please help me. TIA!
"accessClassInPackage.sun.swing" which signifies that in Webstart it is not allowed to use the package sun.swing.
You need to sign your applet, and with latest jdk 8 security, will block any applet signed with an untrusted certificate authority.So if you self sign this applet put low the security settings.untill it executes.
As an example here.
The thing with java 8 is that we have the security level ranging from high to very high ,while on java 7 it ranged from medium and above.The setting was only intended to block malicious or unsigned apps in java 8.However sometimes it may cause trouble with active X controls.If your app is running using low setting ,good otherwise i suggest java7, unless you dont use enhanced features like lambda expressions and other stuff
Between java7 and java8 there were a bunch of security restrictions added to the way applets are constrained in sandbox mode - especially in communicating over the network.
Check if anything here applies to your case - it may not be applicable, but these need to be checked anyway.

Applet throws java.io.FileNotFoundException: http :// localhost:7001/test/lib/log4j.jar

I have an applet embedded in JSF page that runs and functions just fine, which also makes a call to SOAP web service. However, it is spitting out a lots of errors on upload that don't really make any difference on how applet works, but delays upload of it. I tried specifying codebase, packaging those jars in various locations of war, and many other options, but nothing really stops these messages. Jars can be found easily under http://localhost:7001/test, but not where for some reason it is looking under http://localhost:7001/test/lib folder.
Here is what applet looks like in the page:
<applet id="applet"
name="applet"
width="496"
height="122">
<param name="code" value="applet.Applet"/>
<param name="archive" value="Applet.jar,Core.jar,log4j.jar,j2ee.jar,jdom-1.1.3.jar"/>
</applet>
Lines of the code that throws that error is when Web Service is called:
Error at ws.FileImporter.<init>(FileImporter.java:42) - automatically generated code from WSDL:
public FileImporter() {
super(__getWsdlLocation(), FILEIMPORTER_QNAME);
}
Error at applet.util.WSUtil.<init>(WSUtil.java:20):
private ws.FileImporter service = new ws.FileImporter()
Error at applet.Applet.<init>(Applet.java:76):
private WSUtil wsUtil = new WSUtil();
Here is the error trace:
network: Cache entry not found [url: http://localhost:7001/test/lib/log4j.jar, version: null]
network: Connecting http://localhost:7001/test/lib/log4j.jar with proxy=DIRECT
java.io.FileNotFoundException: http :// localhost:7001/test/lib/log4j.jar
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.access$200(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection$9.run(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection$9.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessController.doPrivileged(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at sun.plugin.PluginURLJarFileCallBack.downloadJAR(Unknown Source)
at sun.plugin.PluginURLJarFileCallBack.access$000(Unknown Source)
at sun.plugin.PluginURLJarFileCallBack$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin.PluginURLJarFileCallBack.retrieve(Unknown Source)
at sun.net.www.protocol.jar.URLJarFile.retrieve(Unknown Source)
at sun.net.www.protocol.jar.URLJarFile.getJarFile(Unknown Source)
at sun.net.www.protocol.jar.JarFileFactory.get(Unknown Source)
at sun.net.www.protocol.jar.JarURLConnection.connect(Unknown Source)
at sun.plugin.net.protocol.jar.CachedJarURLConnection.connect(Unknown Source)
at sun.plugin.net.protocol.jar.CachedJarURLConnection.getJarFileInternal(Unknown Source)
at sun.plugin.net.protocol.jar.CachedJarURLConnection.getJarFile(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.getJarFile(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.access$800(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.ensureOpen(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.<init>(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.getResource(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.getResource(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.findResource(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$1.next(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$1.hasMoreElements(Unknown Source)
at java.net.URLClassLoader$3$1.run(Unknown Source)
at java.net.URLClassLoader$3$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader$3.next(Unknown Source)
at java.net.URLClassLoader$3.hasMoreElements(Unknown Source)
at sun.misc.CompoundEnumeration.next(Unknown Source)
at sun.misc.CompoundEnumeration.hasMoreElements(Unknown Source)
at com.sun.xml.internal.ws.util.xml.XmlUtil.createDefaultCatalogResolver(Unknown Source)
at com.sun.xml.internal.ws.client.WSServiceDelegate.createCatalogResolver(Unknown Source)
at com.sun.xml.internal.ws.client.WSServiceDelegate.parseWSDL(Unknown Source)
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(Unknown Source)
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(Unknown Source)
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(Unknown Source)
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(Unknown Source)
at com.sun.xml.internal.ws.spi.ProviderImpl.createServiceDelegate(Unknown Source)
at javax.xml.ws.Service.<init>(Unknown Source)
at ws.FileImporter.<init>(FileImporter.java:42)
at applet.util.WSUtil.<init>(WSUtil.java:20)
at applet.Applet.<init>(Applet.java:76)
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.newInstance(Unknown Source)
at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter$1.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(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)
network: Cache entry not found [url: http://localhost:7001/test/lib/log4j.jar, version: null]
network: Connecting http://localhost:7001/test/lib/log4j.jar with proxy=DIRECT

Java Failed To Validate Certificate Java 8 Update 25

I am trying to access different sites that use Java and every time I get the failed to validate certificate error. I have looked at the security setting for this version and there are only 2 options, high and very high. How do I get around this error? I shouldn't have to add every site I want to use to the exception list. Here is the error
java.io.EOFException
at java.io.DataInputStream.readInt(Unknown Source)
at sun.security.provider.JavaKeyStore.engineLoad(Unknown Source)
at sun.security.provider.JavaKeyStore$JKS.engineLoad(Unknown Source)
at java.security.KeyStore.load(Unknown Source)
at com.sun.deploy.security.DeploySigningCertStore$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.deploy.security.DeploySigningCertStore.loadCertStore(Unknown Source)
at com.sun.deploy.security.DeploySigningCertStore.load(Unknown Source)
at com.sun.deploy.security.DeploySigningCertStore.load(Unknown Source)
at com.sun.deploy.security.ImmutableCertStore.load(Unknown Source)
at com.sun.deploy.security.TrustDecider.ensureBasicStoresLoaded(Unknown Source)
at com.sun.deploy.security.TrustDecider.isAllPermissionGranted(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.isTrustedByTrustDecider(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.getTrustedCodeSources(Unknown Source)
at com.sun.deploy.security.CPCallbackHandler$ParentCallback.strategy(Unknown Source)
at com.sun.deploy.security.CPCallbackHandler$ParentCallback.openClassPathElement(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.getJarFile(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.access$800(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.ensureOpen(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.<init>(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.deploy.security.DeployURLClassPath.getLoader(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath.getLoader(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath.getResource(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader$2.run(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.initAppletAdapter(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

JRE 7 update 51 and the extension mechanism

I've developed an applet that uses Java extension mechanism to install an extension package.
Both JARs are signed, and I have put this in the manifest:
Permissions: all-permissions
Codebase: *
Application-Library-Allowable-Codebase: *
Caller-Allowable-Codebase: *
It works fine with the JRE 1.7 update 45, but with the last version of the JRE (1.7 update 51), I get the following error:
java.lang.NullPointerException
at com.sun.deploy.security.DeployManifestChecker.verifyCodebase(Unknown Source)
at com.sun.deploy.security.DeployManifestChecker.verifyApplicationLibraryAllowableCodebase(Unknown Source)
at com.sun.deploy.security.DeployManifestChecker.verify(Unknown Source)
at com.sun.deploy.security.DeployManifestChecker.verify(Unknown Source)
at com.sun.deploy.security.TrustDecider.isAllPermissionGranted(Unknown Source)
at sun.plugin.extension.ExtensionInstallationImpl.verifyJar(Unknown Source)
at sun.plugin.extension.ExtensionInstallationImpl.access$100(Unknown Source)
at sun.plugin.extension.ExtensionInstallationImpl$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin.extension.ExtensionInstallationImpl.installExtension(Unknown Source)
at sun.misc.ExtensionDependency.installExtension(Unknown Source)
at sun.misc.ExtensionDependency.checkExtension(Unknown Source)
at sun.misc.ExtensionDependency.checkExtensions(Unknown Source)
at sun.misc.ExtensionDependency.checkExtensionsDependencies(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.parseExtensionsDependencies(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.getClassPath(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath.getLoader(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath.getResource(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.initAppletAdapter(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
If I copy the package extension in the lib/ext directory of the JRE, then the applet works.
I've read the changes in the new JRE, but how would I get this to work?

My java applet gets access denied to images that it embeds

I am coding a Java chess gui. It runs fine as an applet from Eclipse but I am struggling to get it to work on my local machine from an HTML page. I am using images which I include in the JAR. Images are accessed properly with an Eclipse Debug. What am I missing :( ?
The HTML looks like :
<html>
<applet code="Ginsie"
height="300px" width="300px" archive="chess.jar">
</applet>
</html>
The output of the Java Console (open from the browser) :
java.lang.RuntimeException: java.lang.ExceptionInInitializerError
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.ExceptionInInitializerError
at BoardPanel.loadSquares(BoardPanel.java:105)
at BoardPanel.<init>(BoardPanel.java:34)
at Ginsie.<init>(Ginsie.java:60)
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.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(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.security.AccessControlException: access denied (java.io.FilePermission ..\img\squares\Wood\BSQUARE.jpg read)
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.checkRead(Unknown Source)
at java.io.File.canRead(Unknown Source)
at javax.imageio.ImageIO.read(Unknown Source)
at Square.<clinit>(Square.java:47)
... 24 more
Exception : java.lang.RuntimeException: java.lang.ExceptionInInitializerError
Judging from the stack trace, it looks as if you are calling javax.imageio.ImageIO.read(File). In Eclipse, it likely works because it is accessing the local filesystem to read the image. Try using Class.getResourceAsStream() to read the file off the classpath (i.e. from the jar) and then pass the InputStream to javax.imageio.ImageIO.read(InputStream).

Categories

Resources