Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Urgent : SSLException: Unrecognized SSL message, plaintext connection

843811Oct 23 2006 — edited Aug 29 2007
I try to ask a webservice to an url in https with certificate.

This is my code (confidential informations was replaced by "####" :

package essai;

import java.net.Authenticator;
import java.util.List;

import javax.activation.DataHandler;
import javax.activation.FileDataSource;
import javax.xml.namespace.QName;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;



public class Essai {

public static void main(String[] args) {

try {
System.out.println("Debut");
Service monservice = new Service();


System.getProperties().put("http.proxySet" , "true");
System.getProperties().put("http.proxyHost","proxy");
System.getProperties().put("http.proxyPort", "8080"); //443
System.getProperties().put("proxyUser ", "####");
System.getProperties().put("proxyPassword", "####");


System.setProperty("javax.net.ssl.trustStore", "monalias");
System.setProperty("javax.net.ssl.trustStorePassword", "");
System.setProperty("javax.net.ssl.keyStore", "C:\\APPFT\\j2sdk1.4.2_08\\jre\\lib\\security\\cacerts");
System.setProperty("javax.net.ssl.keyStorePassword", "changeit");
System.setProperty("javax.net.ssl.keyStoreType", "jks");
System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");

Call call;

call = (Call) monservice.createCall();
DataHandler dhSource = new DataHandler(new FileDataSource("C:\\kruidvatleuven.xml"));

call.setTargetEndpointAddress(new java.net.URL("https://www.######/####"));

call.setOperationName(new QName("CheckAdress"));
call.setReturnType(org.apache.axis.Constants.XSD_STRING);
//call.setUsername("####");
//call.setPassword("####");
call.addParameter("testParam",org.apache.axis.Constants.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
call.invoke(new Object[] { dhSource });

List rtnValues = call.getOutputValues();

System.out.println("WS return : " + rtnValues.get(0).toString());
System.out.println("Fin");
} catch (Exception e) {
e.printStackTrace();
}
}

}

I have execute this command line to load certificate :

keytool -import -alias monalias -file C:\\xxxx.cer -trustcacerts -storetype JKS -keystore C:/APPFT/j2sdk1.4.2_08/jre/lib/security/cacerts -storepass changeit


I have these logs :

Debut
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
at com.sun.net.ssl.internal.ssl.InputRecord.b(DashoA12275)
at com.sun.net.ssl.internal.ssl.InputRecord.read(DashoA12275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.j(DashoA12275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(DashoA12275)
at org.apache.axis.components.net.JSSESocketFactory.create(JSSESocketFactory.java:186)
at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:131)
at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:370)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:88)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:147)
at org.apache.axis.client.Call.invokeEngine(Call.java:2719)
at org.apache.axis.client.Call.invoke(Call.java:2702)
at org.apache.axis.client.Call.invoke(Call.java:2378)
at org.apache.axis.client.Call.invoke(Call.java:2301)
at org.apache.axis.client.Call.invoke(Call.java:1758)
at essai.Essai.main(Essai.java:64)

{http://xml.apache.org/axis/}hostname:FT-8E6B46FD4908

javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:97)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:147)
at org.apache.axis.client.Call.invokeEngine(Call.java:2719)
at org.apache.axis.client.Call.invoke(Call.java:2702)
at org.apache.axis.client.Call.invoke(Call.java:2378)
at org.apache.axis.client.Call.invoke(Call.java:2301)
at org.apache.axis.client.Call.invoke(Call.java:1758)
at essai.Essai.main(Essai.java:64)
Caused by: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
at com.sun.net.ssl.internal.ssl.InputRecord.b(DashoA12275)
at com.sun.net.ssl.internal.ssl.InputRecord.read(DashoA12275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.j(DashoA12275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(DashoA12275)
at org.apache.axis.components.net.JSSESocketFactory.create(JSSESocketFactory.java:186)
at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:131)
at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:370)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:88)
... 10 more


Can you help me. Can I pass proxy ? Is my keystore config for certificate ok ?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 26 2007
Added on Oct 23 2006
8 comments
71,896 views