java - Axis exception: o.a.axis2.transport.http.HTTPSender.sendViaPost(196) - Unable to sendViaPost - Connection refused -


i have server executing webservice call external server. call has occur on ssl , using proxy:

my truststore configured:

truststore is: /opt/configuration/keystore/truststore.jks truststore type : jks truststore provider :  init truststore adding trusted cert: 

also handshake done correctly:

https-jsse-nio-8443-exec-6, read: tlsv1.2 handshake, length = 40 padded plaintext after decryption:  len = 16 0000: 14 00 00 0c 78 49 e5 e1   29 04 a5 1d fc 4f e6 e2  ....xi..)....o.. *** finished verify_data:  { 120, 73, 229, 225, 41, 4, 165, 29, 252, 79, 230, 226 } *** [read] md5 , sha1 hashes:  len = 16 0000: 14 00 00 0c 78 49 e5 e1   29 04 a5 1d fc 4f e6 e2  ....xi..)....o.. https-jsse-nio-8443-exec-6, write: tlsv1.2 change cipher spec, length = 1 [raw write]: length = 6 0000: 14 03 03 00 01 01                                  ...... *** finished 

i have proxyselector selects proxy use:

@override public list<proxy> select(uri uri) {      if (logger.isdebugenabled()) {         logger.debug("select url : " + uri);     }      if (uri == null) {         throw new illegalargumentexception("uri cannot null.");     }      // protocol , management configuration http or https.     string protocol = uri.getscheme();     if (stringutils.equalsignorecase("http", protocol)             || stringutils.equalsignorecase("https", protocol)             || stringutils.equalsignorecase("socket", protocol)) {         logger.debug("retrieving proxy list...");         list<proxy> proxylist = new arraylist<>();         (innerproxy p : proxies.values()) {              proxylist.add(p.toproxy());         }         logger.debug(proxylist.size() + " configured proxies");         // return configured proxy         return proxylist;     }      /*      * others protocols (could socks or ftp etc.) return default      * selector.      */     if (defaultselector != null) {         return defaultselector.select(uri);     } else {         list<proxy> proxylist = new arraylist<>();         proxylist.add(proxy.no_proxy);         return proxylist;     } } 

but when calling method on webmethod generated jax-ws ri:

/**  *   * @param base64objecttovalidate  * @param xmlmetadata  * @param xmlreferencedstandard  * @return  *     returns java.lang.string  * @throws soapexception_exception  */ @webmethod @webresult(name = "validationresult", targetnamespace = "") @requestwrapper(localname = "validateobject", targetnamespace = "http://ws.validator.sch.gazelle.ihe.net/", classname = "net.ihe.gazelle.schematron.validateobject") @responsewrapper(localname = "validateobjectresponse", targetnamespace = "http://ws.validator.sch.gazelle.ihe.net/", classname = "net.ihe.gazelle.schematron.validateobjectresponse") public string validateobject(     @webparam(name = "base64objecttovalidate", targetnamespace = "")     string base64objecttovalidate,     @webparam(name = "xmlreferencedstandard", targetnamespace = "")     string xmlreferencedstandard,     @webparam(name = "xmlmetadata", targetnamespace = "")     string xmlmetadata)     throws soapexception_exception ; 

i 8 query select requests (where expect 1):

15:55:30.228+02:00 [https-jsse-nio-8443-exec-6] debug e.epsos.util.net.customproxyselector.select(43) - select url : https://gazelle.ehdsi.ihe-europe.net/schematronvalidator-ejb/gazelleobjectvalidatorservice/gazelleobjectvalidator?wsdl 15:55:30.495+02:00 [https-jsse-nio-8443-exec-6] debug e.epsos.util.net.customproxyselector.select(43) - select url : https://gazelle.ehdsi.ihe-europe.net/schematronvalidator-ejb/gazelleobjectvalidatorservice/gazelleobjectvalidator?wsdl 15:55:30.637+02:00 [https-jsse-nio-8443-exec-6] debug e.epsos.util.net.customproxyselector.select(43) - select url : https://gazelle.ehdsi.ihe-europe.net/schematronvalidator-ejb/gazelleobjectvalidatorservice/gazelleobjectvalidator?wsdl 15:55:30.667+02:00 [https-jsse-nio-8443-exec-6] debug e.epsos.util.net.customproxyselector.select(43) - select url : https://gazelle.ehdsi.ihe-europe.net/schematronvalidator-ejb/gazelleobjectvalidatorservice/gazelleobjectvalidator?wsdl 15:55:31.130+02:00 [https-jsse-nio-8443-exec-6] debug e.epsos.util.net.customproxyselector.select(43) - select url : socket://gazelle.ehdsi.ihe-europe.net:443 15:55:31.134+02:00 [https-jsse-nio-8443-exec-6] debug e.epsos.util.net.customproxyselector.select(43) - select url : socket://gazelle.ehdsi.ihe-europe.net:443 15:55:31.137+02:00 [https-jsse-nio-8443-exec-6] debug e.epsos.util.net.customproxyselector.select(43) - select url : socket://gazelle.ehdsi.ihe-europe.net:443 15:55:31.140+02:00 [https-jsse-nio-8443-exec-6] debug e.epsos.util.net.customproxyselector.select(43) - select url : socket://gazelle.ehdsi.ihe-europe.net:443    

the custom proxy selector called 4 times real url , 4 times socket.

and in logs got following exception caused http request initiated axis (i'm using axis version 1.6.2):

15:55:31.137+02:00 [https-jsse-nio-8443-exec-6] debug e.epsos.util.net.customproxyselector.select(43) - select url : socket://gazelle.ehdsi.ihe-europe.net:443 15:55:31.139+02:00 [https-jsse-nio-8443-exec-6] debug o.a.c.httpclient.httpmethoddirector.executewithretry(404) - closing connection. 15:55:31.139+02:00 [https-jsse-nio-8443-exec-6] info  o.a.c.httpclient.httpmethoddirector.executewithretry(439) - i/o exception (java.net.connectexception) caught when processing request: connection refused (connection refused) 15:55:31.139+02:00 [https-jsse-nio-8443-exec-6] debug o.a.c.httpclient.httpmethoddirector.executewithretry(443) - connection refused (connection refused)     java.net.connectexception: connection refused (connection refused)         @ java.net.plainsocketimpl.socketconnect(native method)         @ java.net.abstractplainsocketimpl.doconnect(abstractplainsocketimpl.java:350)         @ java.net.abstractplainsocketimpl.connecttoaddress(abstractplainsocketimpl.java:206)         @ java.net.abstractplainsocketimpl.connect(abstractplainsocketimpl.java:188)         @ java.net.sockssocketimpl.connect(sockssocketimpl.java:392)         @ java.net.socket.connect(socket.java:589)         @ sun.security.ssl.sslsocketimpl.connect(sslsocketimpl.java:668)         @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)         @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62)         @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43)         @ java.lang.reflect.method.invoke(method.java:498)         @ org.apache.commons.httpclient.protocol.reflectionsocketfactory.createsocket(reflectionsocketfactory.java:140)         @ org.apache.commons.httpclient.protocol.sslprotocolsocketfactory.createsocket(sslprotocolsocketfactory.java:130)         @ org.apache.commons.httpclient.httpconnection.open(httpconnection.java:707)         @ org.apache.commons.httpclient.multithreadedhttpconnectionmanager$httpconnectionadapter.open(multithreadedhttpconnectionmanager.java:1361)         @ org.apache.commons.httpclient.httpmethoddirector.executewithretry(httpmethoddirector.java:387)         @ org.apache.commons.httpclient.httpmethoddirector.executemethod(httpmethoddirector.java:171)         @ org.apache.commons.httpclient.httpclient.executemethod(httpclient.java:397)         @ org.apache.axis2.transport.http.abstracthttpsender.executemethod(abstracthttpsender.java:621)         @ org.apache.axis2.transport.http.httpsender.sendviapost(httpsender.java:193)         @ org.apache.axis2.transport.http.httpsender.send(httpsender.java:75)         @ org.apache.axis2.transport.http.commonshttptransportsender.writemessagewithcommons(commonshttptransportsender.java:404)         @ org.apache.axis2.transport.http.commonshttptransportsender.invoke(commonshttptransportsender.java:231)         @ org.apache.axis2.engine.axisengine.send(axisengine.java:443)         @ org.apache.axis2.description.outinaxisoperationclient.send(outinaxisoperation.java:406)         @ org.apache.axis2.description.outinaxisoperationclient.executeimpl(outinaxisoperation.java:229)         @ org.apache.axis2.client.operationclient.execute(operationclient.java:165)         @ org.apache.axis2.jaxws.core.controller.impl.axisinvocationcontroller.execute(axisinvocationcontroller.java:578)         @ org.apache.axis2.jaxws.core.controller.impl.axisinvocationcontroller.doinvoke(axisinvocationcontroller.java:127)         @ org.apache.axis2.jaxws.core.controller.impl.invocationcontrollerimpl.invoke(invocationcontrollerimpl.java:93)         @ org.apache.axis2.jaxws.client.proxy.jaxwsproxyhandler.invokeseimethod(jaxwsproxyhandler.java:373)         @ org.apache.axis2.jaxws.client.proxy.jaxwsproxyhandler.invoke(jaxwsproxyhandler.java:171)         @ com.sun.proxy.$proxy137.validateobject(unknown source) 

i have no idea why axis executes these calls , why have java.net.connectexception: connection refused (connection refused) exception...

looks doesn't use configured proxy...

hope me out...

i found following lines in logging:

16:35:35.676+02:00 [https-jsse-nio-8443-exec-5] debug o.a.c.httpclient.httpconnection.open(692) - open connection gazelle.ehdsi.ihe-europe.net:443 16:35:35.677+02:00 [https-jsse-nio-8443-exec-5] debug e.epsos.util.net.customproxyselector.select(43) - select url : socket://gazelle.ehdsi.ihe-europe.net:443 16:35:35.677+02:00 [https-jsse-nio-8443-exec-5] debug e.epsos.util.net.customproxyselector.select(52) - protocol : socket 16:35:35.677+02:00 [https-jsse-nio-8443-exec-5] debug e.epsos.util.net.customproxyselector.select(56) - retrieving proxy list... 16:35:35.677+02:00 [https-jsse-nio-8443-exec-5] debug e.epsos.util.net.customproxyselector.select(62) - 1 configured proxies 16:35:35.680+02:00 [https-jsse-nio-8443-exec-5] debug o.a.c.httpclient.httpmethoddirector.executewithretry(404) - closing connection. 16:35:35.680+02:00 [https-jsse-nio-8443-exec-5] debug o.a.c.httpclient.httpmethoddirector.executewithretry(434) - method retry handler returned false. automatic recovery not attempted 16:35:35.680+02:00 [https-jsse-nio-8443-exec-5] debug o.a.c.httpclient.httpconnection.releaseconnection(1178) - releasing connection connection manager. 16:35:35.680+02:00 [https-jsse-nio-8443-exec-5] debug o.a.c.h.multithreadedhttpconnectionmanager.freeconnection(979) - freeing connection, hostconfig=hostconfiguration[host=https://gazelle.ehdsi.ihe-europe.net] 16:35:35.680+02:00 [https-jsse-nio-8443-exec-5] debug o.a.c.h.util.idleconnectionhandler.add(76) - adding connection at: 1503930935680 16:35:35.681+02:00 [https-jsse-nio-8443-exec-5] debug o.a.c.h.multithreadedhttpconnectionmanager.notifywaitingthread(961) - notifying no-one, there no waiting threads 16:35:35.681+02:00 [https-jsse-nio-8443-exec-5] info  o.a.axis2.transport.http.httpsender.sendviapost(196) - unable sendviapost url[https://gazelle.ehdsi.ihe-europe.net/schematronvalidator-ejb/gazelleobjectvalidatorservice/gazelleobjectvalidator] java.net.connectexception: connection refused (connection refused)     @ java.net.plainsocketimpl.socketconnect(native method)     @  java.net.abstractplainsocketimpl.doconnect(abstractplainsocketimpl.java:350)     @  java.net.abstractplainsocketimpl.connecttoaddress(abstractplainsocketimpl.java:206)     @  java.net.abstractplainsocketimpl.connect(abstractplainsocketimpl.java:188)     @ java.net.sockssocketimpl.connect(sockssocketimpl.java:392)     @ java.net.socket.connect(socket.java:589)     @ sun.security.ssl.sslsocketimpl.connect(sslsocketimpl.java:668)     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) 

i think reason why doesn't work explained in bugreport. it's 11 years old , still marked unresolved. comment says there no plans implement there might workaround:

however, axis1.x , 2.x can both switch use jakarta-commons httpclient library. should using if can, because understads http properly. if proxy support in there, either axis build pick up.

as far remember, commons http client supports proxyselector.


Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -