tags:

views:

154

answers:

1

hey, I am having somewhat related issue only. Recently the external SOAP interface which were generating client for changed to https one. and I had an old code base at hand which was generating the java files through cxf and unsecured, http:// based wsdl. I chnaged the uri and on maven side everything works fine even the test pass. but when i use this jar in the main project of mine I get this:

Caused by: java.lang.NoSuchMethodError: javax.net.ssl.HttpsURLConnection.getSSLSocketFactory()Ljavax/net/ssl/SSLSocketFactory;
        at sun.net.www.protocol.https.DelegateHttpsURLConnection.getSSLSocketFactory(DelegateHttpsURLConnection.java:50)
        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:172)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:801)
        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:158)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1049)
        at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:234)
        at java.net.URL.openStream(URL.java:1010)
        at org.apache.cxf.resource.URIResolver.tryFileSystem(URIResolver.java:169)
        at org.apache.cxf.resource.URIResolver.resolve(URIResolver.java:119)
        at org.apache.cxf.resource.ExtendedURIResolver.resolve(ExtendedURIResolver.java:41)
        at org.apache.cxf.transport.TransportURIResolver.resolve(TransportURIResolver.java:134)
        at org.apache.cxf.catalog.CatalogWSDLLocator.getBaseInputSource(CatalogWSDLLocator.java:72)
        at org.apache.cxf.wsdl11.AbstractWrapperWSDLLocator.getBaseInputSource(AbstractWrapperWSDLLocator.java:57)
        at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:214)
        at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:179)
        at org.apache.cxf.wsdl11.WSDLServiceFactory.(WSDLServiceFactory.java:91)
        at org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:207)
        at org.apache.cxf.jaxws.ServiceImpl.(ServiceImpl.java:150)
        at org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:63)
        at javax.xml.ws.Service.(Service.java:56)
        at generated.webservices.com.gbm.sso.ssoclient.AuthenticationServiceInternal.(AuthenticationServiceInternal.java:49)
        at com.gbm.caprice.sso.client.CachingSSOClient.init(CachingSSOClient.java:42)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1536)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1409)
        ... 45 more

Can you please help?

A: 

Since you're getting a NoSuchMethodError (which is caught/thrown by the compiler), My suggestion is that you are using a version of Java class (in this case, javax.net.ssl.HttpsURLConnection) which doesn't have the following method signature:

javax.net.ssl.HttpsURLConnection.getSSLSocketFactory()

This class can be found in the JRE/lib jsse.jar (as from time of writing, JDK 1.6.0_21). Make sure that your java libraries and your Apache CXF libaries are declared in the java CLASSPATH.

That's what I can help you based on your caused exception.

The Elite Gentleman
Very rightlty said. thats what I was hoping. but the thing is Apache CXF is in classpath amd jssee.jar too. But still, it gives this error. So, my guess is it has something to with the Apache CXf overriding (means providing a different implementation of HttpsURLConnection) and the more worrying part is if it goes to HttpsURLConnection in jsse.jar (with jdk 1.6.0_16) it has that method. Strange!
Does it mean static btw?
No, the method isn't static and Apache CXF never implemented their own HttpsURLConnection. If both JAVA libraries and CXF are in the classpath, I don't know why they don't see each other.
The Elite Gentleman
@The Elite Gentleman - yeah that's starnge. Can't say fully confidently that it's definitely due to CXF. But there might be some correlation, 1% may be. Ok, approaching the problem differmntly, what can do to get rid of the same? jsse substitute? Also please note that issue comes with only when I use secured SOAP service as oppose to the non-secured one. So, that should throw some hint.