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!

javax.net.ssl.SSLException: Invalid Padding length

3021942Aug 28 2015 — edited Aug 31 2015

I am getting this exception when trying to execute a webservice over https. This exception occures the movement I try to get the service instance. I followed the below steps for generating the webservice client using wsImport.exe tool.

  1. I manualy downloaded the wsdl from the site
  2. Used wsImport tool to generate the client java files
  3. Added the java files to my project in eclipse
  4. Wrote a test client as below to test the service instance

public static void main(String[] args) { 

    String certificatesTrustStorePath = "c:/Apps/Java/jdk1.8.0_25/jre/lib/security/cacerts";

// if I don't set the keystore path, I get error

    //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 

System.setProperty("javax.net.ssl.trustStore", certificatesTrustStorePath);

URL wsdlLocation = null; String https_url ="https://localhost/services/WebService/wsdl/WebService.wsdl";

try {

  wsdlLocation = new URL(https_url);

  } catch (MalformedURLException e) {

// TODO Auto-generated catch block e.printStackTrace(); } 

//This is the line where I get the below execption

WebServiceService webServiceService = new WebServiceService(wsdlLocation, new QName("http://webservice.com", "WebServiceService")); 

}

With the above code I below execption

   Exception in thread "main" com.sun.xml.internal.ws.wsdl.parser.InaccessibleWSDLException: 2 counts of InaccessibleWSDLException. 


javax.net.ssl.SSLException: Invalid Padding length: 76

javax.net.ssl.SSLException: Invalid Padding length: 50 


at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.tryWithMex(Unknown Source)

at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(Unknown Source)

at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(Unknown Source)

at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(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 com.webservice.WebServiceService.<init>(WebServiceService.java:42)

at com.client.Client.main(Client.java:46)

Everytime I execute, the numbers in the front ot "Invalid Pad length" is different. this time it is 76 and 50. other time it was 67, 106. etc

Please help, I am using latest version of Java i.e. 1.8.0_51.

Regards,

This post has been answered by 3021942 on Aug 31 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 28 2015
Added on Aug 28 2015
1 comment
3,504 views