Revocation Status Unknown error when generating X.509 certificate in BouncyCastle - java

New to encryption and security and trying to generate a x509 Certificate.
Tried the following code which is using BouncyCastle API:
X509V3CertificateGenerator certGenerator = new X509V3CertificateGenerator();
System.out.println("- ---Inside createCertificate Method----- certificate generated");
certGenerator.setSerialNumber(BigInteger.valueOf(Math.abs(new Random().nextLong())));
certGenerator.setIssuerDN(new X509Name(dn));
certGenerator.setSubjectDN(new X509Name(dn));
certGenerator.setIssuerDN(new X509Name(issuer)); // Set issuer!
Calendar instance = Calendar.getInstance();
X509Certificate certificate = (X509Certificate) certGenerator.generate(
privateKey, "BC");
And run into the exception.
security: The OCSP support is enabled
security: The CRL support is enabled
security: Failing over to CRLs: Certificate does not specify OCSP responder
security: Revocation Status Unknown
com.sun.deploy.security.RevocationChecker$StatusUnknownException: Certificate does not specify OCSP responder
at com.sun.deploy.security.RevocationChecker.checkOCSP(Unknown Source)
at com.sun.deploy.security.RevocationChecker.check(Unknown Source)
at com.sun.deploy.security.TrustDecider.checkRevocationStatus(Unknown Source)
at com.sun.deploy.security.TrustDecider.getValidationState(Unknown Source)
at com.sun.deploy.security.TrustDecider.validateChain(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$1000(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$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 java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(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$200(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)
Suppressed: com.sun.deploy.security.RevocationChecker$StatusUnknownException
at com.sun.deploy.security.RevocationChecker.checkCRLs(Unknown Source)
... 54 more
network: Created version ID: 1.7.0.51
network: Created version ID: 1.7.0.51
Tried to google, no clues on this. Thanks for any help.

Your problem is not related to BouncyCastle and the certificate generation. You are using a Java applet and the java plugin is trying to validate the JAR files signatures. However it seems that the signature certificate (or one of the certificate in the certificate chain) does not have the suitable extensions containing the CRL server or OCSP responder URL. Therefore the signature validation fails and the JAR cannot be used.
One solution could be deactivate the certificate validation in the Java Control Center (in the Advanced tab, "Perform certificate revocation checks on" option, select no validation). Note that this is NOT RECOMMENDED for a day-to-day usage but acceptable for testing purpose (for instance during development when the applet is signed with a development/self-signed certificate).

Related

Java 8 Swing application: javax.net.ssl.SSLKeyException: RSA premaster secret error

I have a Swing based Java application that uses Java 8 u161.
The jre that the application uses is stored in one of its directories (it doesn't use an installed jre).
One of the screens in the application approaches a Webshere that is installed on a distant server via HTTPS. The public key is installed on cacert in the client's jre\lib\security folder.
When the application runs as a standalone application, all is well: the handshake is completed successfully, the message is sent to the server and the returned code is 200 (OK).
But when the application runs in collaboration with another application (a dotnet application that injects code to the Java application. I'm not even sure what exactly), a "javax.net.ssl.SSLKeyException: RSA premaster secret error" is thrown
Most similar problems on the internet were solved by uninstalling and reinstalling all the Java versions. But my Java is not installed, so I can't do that.
I tripled checked that my Java application uses the correct jre- it does.
I can't understand what causes this exception and I don't know what else to check.
Here is how I open the connection:
URL servletUrl = new URL(urlStr); //throws java.net.MalformedURLException
HttpsURLConnection.setDefaultHostnameVerifier(new ChequesServletHostnameVerifier());
servletConnection = (HttpsURLConnection) servletUrl.openConnection(); //throws java.io.IOException
servletConnection.setDoOutput(true);
servletConnection.setUseCaches(false);
OutputStream os = servletConnection.getOutputStream(); //throws java.io.IOException
And here is the complete stacktrace:
javax.net.ssl.SSLKeyException: RSA premaster secret error
at sun.security.ssl.RSAClientKeyExchange.<init>(Unknown Source)
at sun.security.ssl.ClientHandshaker.serverHelloDone(Unknown Source)
at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source)
at sun.security.ssl.Handshaker.processLoop(Unknown Source)
at sun.security.ssl.Handshaker.process_record(Unknown Source)
at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(Unknown Source)
at qs.localtransactions.servlet.SrvltTxn.connect2Servlet(SrvltTxn.java:114)
at qs.localtransactions.AmgImgBase.retrieveImagesFromServlet(AmgImgBase.java:562)
at qs.localtransactions.AMGIMG91.sendAndReceive(AMGIMG91.java:27)
at qs.localtransactions.AMGIMG.sendAndReceive(AMGIMG.java:32)
at idb.messenger.sender.LocalBackendDispatcher.send(LocalBackendDispatcher.java:26)
at qc.distribution.protocol.idb.QtMessengerIDB.sendAndReceive(QtMessengerIDB.java:127)
at qc.distribution.QtTransaction.sendRemote(QtTransaction.java:3338)
at qc.distribution.QtTransaction.send(QtTransaction.java:2528)
at qc.distribution.QtTransaction.send(QtTransaction.java:1930)
at qt.presentacion.QtLogic.send(QtLogic.java:800)
at qt.presentacion.QtLogic.performObserverCommand(QtLogic.java:584)
at qt.presentacion.logic.QtAction.evaluateSensitive(QtAction.java:536)
at qt.presentacion.logic.QtAction.evaluate(QtAction.java:258)
at qt.presentacion.logic.QtLogicEvaluator.evaluateActions(QtLogicEvaluator.java:472)
at qt.presentacion.logic.QtLogicEvaluator.evaluate(QtLogicEvaluator.java:397)
at qt.presentacion.logic.QtLogicRoutines.evaluateNotificationStack(QtLogicRoutines.java:582)
at qt.presentacion.logic.QtLogicRoutines.evaluate(QtLogicRoutines.java:555)
at qt.presentacion.logic.QtLogicEvaluator.update(QtLogicEvaluator.java:1431)
at qt.presentacion.logic.QtLogicStackController.processNotification(QtLogicStackController.java:108)
at qc.controls.observer.QtNotificator.notify(QtNotificator.java:65)
at qt.presentacion.QtRadioButtonModel.setValid(QtRadioButtonModel.java:110)
at qt.presentacion.QtRadioButton.radiobutton_ItemStateChanged(QtRadioButton.java:1111)
at qt.presentacion.QtRadioButton.connEtoC2(QtRadioButton.java:150)
at qt.presentacion.QtRadioButton.itemStateChanged(QtRadioButton.java:882)
at javax.swing.AbstractButton.fireItemStateChanged(Unknown Source)
at javax.swing.AbstractButton$Handler.itemStateChanged(Unknown Source)
at javax.swing.DefaultButtonModel.fireItemStateChanged(Unknown Source)
at qt.presentacion.QtRadioButtonModel.setSelected(QtRadioButtonModel.java:95)
at javax.swing.ButtonGroup.setSelected(Unknown Source)
at qt.presentacion.QtRadioButtonModel.setSelected(QtRadioButtonModel.java:89)
at javax.swing.AbstractButton.setSelected(Unknown Source)
at qt.presentacion.QtRadioButton.select(QtRadioButton.java:1181)
at qt.presentacion.QtRadioButton.performObserverCommand(QtRadioButton.java:1045)
at qt.presentacion.logic.QtAction.evaluateSensitive(QtAction.java:536)
at qt.presentacion.logic.QtAction.evaluate(QtAction.java:258)
at qt.presentacion.logic.QtLogicEvaluator.evaluateActions(QtLogicEvaluator.java:472)
at qt.presentacion.logic.QtLogicEvaluator.evaluate(QtLogicEvaluator.java:397)
at qt.presentacion.logic.QtLogicEvaluator.register(QtLogicEvaluator.java:1312)
at qt.presentacion.QtLogic.registerEvaluators(QtLogic.java:741)
at qt.presentacion.QtLogic.initState(QtLogic.java:510)
at qt.presentacion.QtLogic.paint(QtLogic.java:529)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at qt.presentacion.QtPanel.paint(QtPanel.java:1995)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JLayeredPane.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JLayeredPane.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JLayeredPane.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JLayeredPane.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintToOffscreen(Unknown Source)
at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source)
at javax.swing.RepaintManager$PaintManager.paint(Unknown Source)
at javax.swing.RepaintManager.paint(Unknown Source)
at javax.swing.JComponent._paintImmediately(Unknown Source)
at javax.swing.JComponent.paintImmediately(Unknown Source)
at javax.swing.RepaintManager$4.run(Unknown Source)
at javax.swing.RepaintManager$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.prePaintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.access$1200(Unknown Source)
at javax.swing.RepaintManager$ProcessingRunnable.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$JavaSecurityAccessImpl.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.NoSuchAlgorithmException: SunTlsRsaPremasterSecret KeyGenerator not available
at javax.crypto.KeyGenerator.<init>(KeyGenerator.java:169)
at javax.crypto.KeyGenerator.getInstance(KeyGenerator.java:223)
at sun.security.ssl.JsseJce.getKeyGenerator(Unknown Source)
... 105 more
Any information with be appreciated.
Like many people mentioned in older posts regarding exception
javax.net.ssl.SSLKeyException: RSA premaster secret error
it means that two different java versions are mixed. Therefore, reinstalling Java helps.
In my case, apparently, the dotnet application set the java extension folder to an older java version. When the extension configuration was set to the correct Java version, the problem was solved.

Connect to Web Service in Java Project using a certificate .cer

Good Morning:
I have several problems to connect a server I am deploying.
First, I have a web service wsdl in a server I control.
And second, I am programming a java client to connect via https with 8443 port to tomcat webservice to return the data.
I firstly installed the pfx certificate on the server, and it works.
Second, I downloaded the client .cer certificate file from the browser and I have to use it to call the webservice https with 8443 and I am having the same error always.
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: javax.ws.rs.ProcessingException: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}hostname:vm6145260
javax.ws.rs.ProcessingException: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(Unknown Source)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at com.b7f2.ws.service.ImplLoginSoapBindingStub.validaLogin(ImplLoginSoapBindingStub.java:157)
at com.b7f2.ws.service.ImplLoginProxy.validaLogin(ImplLoginProxy.java:51)
at com.b7f2.ws.client.WindowPrincipal.enviarMatricula(WindowPrincipal.java:105)
at com.b7f2.ws.client.WindowPrincipal.access$1(WindowPrincipal.java:97)
at com.b7f2.ws.client.WindowPrincipal$2.actionPerformed(WindowPrincipal.java:216)
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.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(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.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.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$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.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$JavaSecurityAccessImpl.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)
I used thie same webservice first with 8080 port and it worked perfectly, but now with the certificate it doesn't work.
Can anybody explain to me, which have I to do with the .cer file in the client java project?
Thanks.
On the client side, you probably have to set these properties :
-Djavax.net.ssl.keyStore=path_to_keystore
-Djavax.net.ssl.keyStorePassword=keystore_password
Of course, the keystore contains your certificate (.cer)
Can you post your client code ?

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

JRE 1.7.0_51-b13 and signed applet

I've bought a Trusted Certificate to sign my applets, in order to prevent warnings and issues introduced by last release of Oracle JRE (1.7.0.51).
Everything fine, except with an applet that use also external jars (in particular, axis2-1.5.4.jar)
I've signed also this jar with my new certificate, but i always obtain:
java.lang.RuntimeException: java.lang.NoClassDefFoundError: org/apache/axis2/databinding/ADBBean
at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter.instantiateApplet(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)
Caused by: java.lang.NoClassDefFoundError: org/apache/axis2/databinding/ADBBean
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(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 sun.plugin2.applet.Plugin2ClassLoader.defineClassHelper(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.access$100(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.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
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.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$200(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)
Caused by: java.lang.ClassNotFoundException: org.apache.axis2.databinding.ADBBean
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.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 42 more
during applet load. What's wrong?
UPDATE: this is my applet code.
<object width="200" height="200" code="AeDPeA2WS.class" CODEBASE="/<path>/AeDPeA2WS/$FILE" name="AeDPeA2WS">
<param name="CODEBASE" value="/<path>/AeDPeA2WS/$FILE">
<param name="code" value="AeDPeA2WS.class">
<param name="name" value="AeDPeA2WS">
<PARAM NAME="MAYSCRIPT" VALUE="true">
<param name="archive" value="AeDPeA2WS.jar,axis2-kernel-1.4.1.jar,axis2-1.5.4.jar,activation-1.1.jar,axiom-api-1.2.10.jar,axis-wsdl4j-1.2.jar,backport-util-concurrent-3.1.jar,axiom-dom-1.2.10.jar,axiom-impl-1.2.10.jar,commons-codec-1.4.jar,commons-httpclient-3.1.jar,commons-logging-1.1.1.jar,mail-1.4.jar,neethi-2.0.4.jar,woden-api-1.0M8.jar,XmlSchema-1.4.3.jar">
UPDATE 2
I tried to isolate every single part of code, adding it step-by-step. I found that the problem is when i declare this method:
private Base64Binary setMTOMEncoding (DataHandler dh) {
Base64Binary bb = new Base64Binary();
bb.setBase64Binary( dh );
ContentType_type0 ct = new ContentType_type0();
ct.setContentType_type0( dh.getContentType() );
bb.setContentType( ct );
return bb;
}
that's defined in this way:
public static class Base64Binary implements org.apache.axis2.databinding.ADBBean{
......
this give me the exception: any idea?
Found solution. I've missed to add in external jars manifest this:
Trusted-Library: true

Categories

Resources