Saturday, November 2, 2013

java.lang.ClassNotFoundException: com.apple.laf.AquaLookAndFeel

 Following exception occurred on Jboss while using JFreeChart on mac, The code works fine on Linux and windows.

Stacktrace:

14:22:57,220 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/testweb].[default]] (http-localhost-127.0.0.1-8080-1) Servlet.service() for servlet default threw exception: java.lang.ClassNotFoundException: com.apple.laf.AquaLookAndFeel from [Module "deployment.testweb.war:main" from Service Module Loader]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
    at java.lang.Class.forName0(Native Method) [classes.jar:1.6.0_65]
    at java.lang.Class.forName(Class.java:249) [classes.jar:1.6.0_65]

Solution :
We need to add com.apple.laf dependencies to Jboss to add the required jars in classpath.Add the following -D option in Jboss Startup variables and restart.

-Dswing.defaultlaf=javax.swing.plaf.metal.MetalLookAndFeel
 
 

Thursday, October 31, 2013

javax.net.ssl.SSLKeyException: FATAL Alert:BAD_CERTIFICATE - A corrupt or unuseable certificate was received.

Getting following exception when we deploy application in weblogic.
javax.net.ssl.SSLKeyException: FATAL Alert:BAD_CERTIFICATE - A corrupt or unuseable certificate was received.
 The same application works fine on Tomcat. It appears that Weblogic SSL validation fails the certificate when the certificate encryption is of a weaker strength than what is expected by newer versions of Java, whereas Tomcat allows the same certs.

Solution :
Adding the following -D options in weblogic should resolve the issue:


weblogic.security.SSL.allowSmallRSAExponent=true
weblogic.security.SSL.ignoreHostnameVerification=true

 Full Stack trace for reference:

]] Root cause of ServletException.
javax.xml.ws.WebServiceException: javax.net.ssl.SSLKeyException: FATAL Alert:BAD
_CERTIFICATE - A corrupt or unuseable certificate was received.
        at com.sun.xml.ws.transport.http.client.HttpClientTransport.readResponse
CodeAndMessage(HttpClientTransport.java:221)
        at com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTr
ansportPipe.java:204)
        at com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest
(HttpTransportPipe.java:124)
        at com.sun.xml.ws.transport.DeferredTransportPipe.processRequest(Deferre
dTransportPipe.java:118)
        at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:866)
        Truncated. see log file for complete stacktrace
Caused By: javax.net.ssl.SSLKeyException: FATAL Alert:BAD_CERTIFICATE - A corrup
t or unuseable certificate was received.
        at com.certicom.tls.interfaceimpl.TLSConnectionImpl.fireException(Unknow
n Source)
        at com.certicom.tls.interfaceimpl.TLSConnectionImpl.fireAlertSent(Unknow
n Source)
        at com.certicom.tls.record.handshake.HandshakeHandler.fireAlert(Unknown
Source)
        at com.certicom.tls.record.handshake.HandshakeHandler.fireAlert(Unknown
Source)
        at com.certicom.tls.record.handshake.ClientStateReceivedServerHello.hand
le(Unknown Source)
        Truncated. see log file for complete stacktrace
>
<Oct 31, 2013 2:30:27 PM CDT> <Warning> <Socket> <BEA-000449> <Closing socket as
no data read from it on 0:0:0:0:0:0:0:1:64,772 during the configured idle timeo
ut of 5 secs>

Added weblogic.security.SSL.allowSmallRSAExponent=true
Then I started getting hostname verification error as below

]] Root cause of ServletException.
javax.xml.ws.WebServiceException: javax.net.ssl.SSLKeyException: [Security:09050
4]Certificate chain received from ertservicescert.trivin.net - 76.193.245.70 fai
led hostname verification check. Certificate contained *.trivin.net but check ex
pected ertservicescert.trivin.net
        at com.sun.xml.ws.transport.http.client.HttpClientTransport.readResponse
CodeAndMessage(HttpClientTransport.java:221)
        at com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTr
ansportPipe.java:204)
        at com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest
(HttpTransportPipe.java:124)
        at com.sun.xml.ws.transport.DeferredTransportPipe.processRequest(Deferre
dTransportPipe.java:118)
        at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:866)
        Truncated. see log file for complete stacktrace
Caused By: javax.net.ssl.SSLKeyException: [Security:090504]Certificate chain rec
eived from ertservicescert.trivin.net - 76.193.245.70 failed hostname verificati
on check. Certificate contained *.trivin.net but check expected ertservicescert.
trivin.net
        at com.certicom.tls.interfaceimpl.TLSConnectionImpl.fireException(Unknow
n Source)
        at com.certicom.tls.interfaceimpl.TLSConnectionImpl.fireAlertSent(Unknow
n Source)
        at com.certicom.tls.record.handshake.HandshakeHandler.fireAlert(Unknown
Source)
        at com.certicom.tls.record.handshake.HandshakeHandler.fireAlert(Unknown
Source)
        at com.certicom.tls.record.handshake.ClientStateReceivedServerHello.hand
le(Unknown Source)
        Truncated. see log file for complete stacktrace
>
<Oct 31, 2013 2:27:37 PM CDT> <Warning> <Socket> <BEA-000449> <Closing socket as
no data read from it on 0:0:0:0:0:0:0:1:64,743 during the configured idle timeo
ut of 5 secs>