techprocess
asked on
Null Pointer while using HttpURLConnection
we are facing NullPointerException while we are trying to communicate with some URL to send XML data. Following is the exception,
****** UPSInteractionServlet ********** packageweight received : null
Client established connection with https://wwwcie.ups.com/ups.app/xml/ShipConfirm
https Connection :- weblogic.net.http.HttpsURL Connection :https://wwwcie.ups.com/ups.app/xml/ShipConfirm
Manual xml : <?xml version='1.0' encoding='UTF-8' standalone='yes'?><AccessR equest><Ac cessLicens eNumber>1C 5A10478422 410C</Acce ssLicenseN umber><Pas sword>annt aylor</Pas sword><Use rId>manish _maini</Us erId></Acc essRequest ><?xml version='1.0' encoding='UTF-8' standalone='yes'?><Shipmen tConfirmRe quest><Lab elSpecific ation><HTT PUserAgent >Mozilla/4 .5</HTTPUs erAgent><L abelImageF ormat><Cod e>GIF</Cod e><Descrip tion>GIF</ Descriptio n></LabelI mageFormat ><LabelPri ntMethod>< Code>GIF</ Code><Desc ription>gi f file</Description></LabelP rintMethod ></LabelSp ecificatio n><Request ><RequestA ction>Ship Confirm</R equestActi on><Reques tOption>no nvalidate< /RequestOp tion><Tran sactionRef erence><Cu stomerCont ext>Custom er Comment</CustomerContext>< /Transacti onReferenc e></Reques t><Shipmen t><Descrip tion>2nd Day Air</Description><Package> <Additiona lHandling> 0</Additio nalHandlin g><Descrip tion>Packa ge Description</Description>< PackageWei ght><Weigh t>60.0</We ight></Pac kageWeight ><Packagin gType><Cod e>02</Code ><Descript ion>Custom er Supplied</Description></Pa ckagingTyp e></Packag e><Payment Informatio n><Prepaid ><BillShip per><Accou ntNumber>9 7XA44</Acc ountNumber ></BillShi pper></Pre paid></Pay mentInform ation><Ser vice><Code >08</Code> <Descripti on>2nd Day Air</Description></Service ><ShipFrom ><Address> <AddressLi ne1>480 Parkton Plaza</AddressLine1><City> Hoboken</C ity><Count ryCode>US< /CountryCo de><Postal Code>08805 </PostalCo de><StateP rovinceCod e>NJ</Stat eProvinceC ode></Addr ess><Atten tionName>M r.ABC</Att entionName ><CompanyN ame>ABC Associates</CompanyName><P honeNumber >123456789 0</PhoneNu mber><TaxI dentificat ionNumber> 1234567877 </TaxIdent ificationN umber></Sh ipFrom><Sh ipTo><Addr ess><Addre ssLine1>Yo rk Rd</AddressLine1><City>Ham burg</City ><CountryC ode>DE</Co untryCode> <PostalCod e>20354</P ostalCode> <StateProv inceCode>M D</StatePr ovinceCode ></Address ><Attentio nName>Mr.D EF</Attent ionName><C ompanyName >DEF Associates</CompanyName><P honeNumber >123456789 8</PhoneNu mber><TaxI dentificat ionNumber> 1234567877 </TaxIdent ificationN umber></Sh ipTo><Ship per><Addre ss><Addres sLine1>480 Parkton Plaza</AddressLine1><City> Hoboken</C ity><Count ryCode>US< /CountryCo de><Postal Code>08805 </PostalCo de><StateP rovinceCod e>NJ</Stat eProvinceC ode></Addr ess><Atten tionName>M r.DEF</Att entionName ><Name>ABC Associates</Name><PhoneNum ber>123456 7890</Phon eNumber><S hipperNumb er>97XA44< /ShipperNu mber></Shi pper></Shi pment></Sh ipmentConf irmRequest >
Error sending data to server
java.lang.NullPointerExcep tion
at javax.net.ssl.impl.SSLSock etImpl.clo se(Unknown Source)
at java.net.Socket.<init>(Soc ket.java:2 93)
at java.net.Socket.<init>(Soc ket.java:1 47)
at javax.net.ssl.SSLSocket.<i nit>(Dasho A6275)
at javax.net.ssl.impl.SSLSock etImpl.<in it>(Unknow n Source)
at javax.net.ssl.impl.SSLSock etFactoryI mpl.create Socket(Unk nown Source)
at weblogic.security.SSL.SSLS ocketFacto ry.createS ocket(SSLS ocketFacto ry.java:12 3)
at weblogic.net.http.HttpsCli ent.openSe rver(Https Client.jav a:145)
at weblogic.net.http.HttpsCli ent.openSe rver(Https Client.jav a:280)
at weblogic.net.http.HttpsCli ent.<init> (HttpsClie nt.java:10 6)
at weblogic.net.http.HttpsURL Connection .getHttpCl ient(Https URLConnect ion.java:2 46)
at weblogic.net.http.HttpsURL Connection .connect(H ttpsURLCon nection.ja va:216)
at weblogic.net.http.HttpURLC onnection. getOutputS tream(Http URLConnect ion.java:1 58)
at com.cedera.client.servlet. dispatcher .UPSIntera ctionServl et.service (UPSIntera ctionServl et.java:16 9)
at javax.servlet.http.HttpSer vlet.servi ce(HttpSer vlet.java: 853)
at weblogic.servlet.internal. ServletStu bImpl$Serv letInvocat ionAction. run(Servle tStubImpl. java:1058)
at weblogic.servlet.internal. ServletStu bImpl.invo keServlet( ServletStu bImpl.java :401)
at weblogic.servlet.internal. ServletStu bImpl.invo keServlet( ServletStu bImpl.java :306)
at weblogic.servlet.internal. WebAppServ letContext $ServletIn vocationAc tion.run(W ebAppServl etContext. java:5445)
at weblogic.security.service. SecuritySe rviceManag er.runAs(S ecuritySer viceManage r.java:780 )
at weblogic.servlet.internal. WebAppServ letContext .invokeSer vlet(WebAp pServletCo ntext.java :3105)
at weblogic.servlet.internal. ServletReq uestImpl.e xecute(Ser vletReques tImpl.java :2588)
at weblogic.kernel.ExecuteThr ead.execut e(ExecuteT hread.java :213)
at weblogic.kernel.ExecuteThr ead.run(Ex ecuteThrea d.java:189 )
Exception is : java.lang.NullPointerExcep tion
* the link we are communicating at,
https://wwwcie.ups.com/ups.app/xml/ShipConfirm
we researched around and thought of some common problems like,
1) we have used "java.net.HttpURLConnectio n" while developling the code, but as can be seen from exception weblogic internally using its own class "weblogic.net.http.HttpsUR LConnectio n"
and throws "NullPointerException" while we are trying to take OutputStream for the connection.
we think that there might be some class loading issue as WebLogic using its own HttpURLConnection class instead of class from jdk1.4.
2) there might be some internal casting WebLogic is performing while we are not able to understand, (as "weblogic.net.http.HttpsUR LConnectio n" is subclass of "java.net.HttpURLConnectio n".
request you to provide some insight on how to go about its resolution. Attached is the class generating the exception.
UPSInteractionServlet.java
****** UPSInteractionServlet ********** packageweight received : null
Client established connection with https://wwwcie.ups.com/ups.app/xml/ShipConfirm
https Connection :- weblogic.net.http.HttpsURL
Manual xml : <?xml version='1.0' encoding='UTF-8' standalone='yes'?><AccessR
Error sending data to server
java.lang.NullPointerExcep
at javax.net.ssl.impl.SSLSock
at java.net.Socket.<init>(Soc
at java.net.Socket.<init>(Soc
at javax.net.ssl.SSLSocket.<i
at javax.net.ssl.impl.SSLSock
at javax.net.ssl.impl.SSLSock
at weblogic.security.SSL.SSLS
at weblogic.net.http.HttpsCli
at weblogic.net.http.HttpsCli
at weblogic.net.http.HttpsCli
at weblogic.net.http.HttpsURL
at weblogic.net.http.HttpsURL
at weblogic.net.http.HttpURLC
at com.cedera.client.servlet.
at javax.servlet.http.HttpSer
at weblogic.servlet.internal.
at weblogic.servlet.internal.
at weblogic.servlet.internal.
at weblogic.servlet.internal.
at weblogic.security.service.
at weblogic.servlet.internal.
at weblogic.servlet.internal.
at weblogic.kernel.ExecuteThr
at weblogic.kernel.ExecuteThr
Exception is : java.lang.NullPointerExcep
* the link we are communicating at,
https://wwwcie.ups.com/ups.app/xml/ShipConfirm
we researched around and thought of some common problems like,
1) we have used "java.net.HttpURLConnectio
and throws "NullPointerException" while we are trying to take OutputStream for the connection.
we think that there might be some class loading issue as WebLogic using its own HttpURLConnection class instead of class from jdk1.4.
2) there might be some internal casting WebLogic is performing while we are not able to understand, (as "weblogic.net.http.HttpsUR
request you to provide some insight on how to go about its resolution. Attached is the class generating the exception.
UPSInteractionServlet.java
ASKER
Thanks for comment,
The URL we are using is - https://wwwcie.ups.com/ups.app/xml/ShipConfirm
Further during our research we also used security providers and SSLSocketFactory to perform connection. With this implementation we are atlest able to connect to URL and able to send data. But when we try to get response from URL (socket as used here in code attached) we are getting "Socket is closed" exception.
Also we checked socket status, we are getting ""socket.isConnected()" TRUE but on next line where we checked "socket.isClosed()" and are getting TRUE.
the code section of exceptin is
System.out.println("Socket status.. " + socket.isConnected());
BufferedReader in = null;
if(!socket.isClosed()) {
in = new BufferedReader(new InputStreamReader(socket.g etInputStr eam()));
} else {
System.out.println("Socket is closed..");
}
The URL we are using is - https://wwwcie.ups.com/ups.app/xml/ShipConfirm
Further during our research we also used security providers and SSLSocketFactory to perform connection. With this implementation we are atlest able to connect to URL and able to send data. But when we try to get response from URL (socket as used here in code attached) we are getting "Socket is closed" exception.
Also we checked socket status, we are getting ""socket.isConnected()" TRUE but on next line where we checked "socket.isClosed()" and are getting TRUE.
the code section of exceptin is
System.out.println("Socket
BufferedReader in = null;
if(!socket.isClosed()) {
in = new BufferedReader(new InputStreamReader(socket.g
} else {
System.out.println("Socket
}
System.out.println("Creating Connection..");
String urlString = "https://wwwcie.ups.com/ups.app/xml/ShipConfirm";
URL url = new URL(urlString);
System.out.println("Adding provider ..");
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
SSLSocketFactory factory = (SSLSocketFactory)SSLSocketFactory.getDefault();
SSLSocket socket = (SSLSocket)factory.createSocket(url.getHost(), 443);
//java.net.URL url = new java.net.URL("https://wwwcie.ups.com/ups.app/xml/ShipConfirm");
/*HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoOutput(true);
connection.setAllowUserInteraction(true);
System.out.println("Client established connection with " + url.toString());
//out.println("https Connection :- " + connection);
String accessxml = stringbuffer.toString();
out.println(accessxml);
OutputStreamWriter out1 = new OutputStreamWriter(connection.getOutputStream());
System.out.println(" OutputStreamWriter out1 : " + out1);
out1.write(accessxml);
out1.close();
System.out.println(" Data sent to the UPS. ");
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String responseString="";
String UPSResponse = "";
while ((responseString = in.readLine()) != null)
{
UPSResponse += responseString;
}
System.out.println("Response From UPS Server : " + UPSResponse);
System.out.println("");*/
System.out.println("Sending XML ..");
String accessxml = stringbuffer.toString();
PrintWriter out1 = new PrintWriter(new OutputStreamWriter(socket.getOutputStream()));
out1.println("GET " + urlString + " HTTP/1.1");
out1.println(accessxml);
out1.println();
out1.flush();
System.out.println("Reading response ..");
System.out.println("Reading response ..1");
System.out.println("Socket status.. " + socket.isConnected());
BufferedReader in = null;
if(!socket.isClosed()) {
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
} else {
System.out.println("Socket is closed..");
}
String line;
System.out.println("Reading data ..");
while ((line = in.readLine()) != null) {
System.out.println(line);
}
out1.close();
in.close();
}catch (Exception e) {
System.out.println("Error sending data to server");
e.printStackTrace();
System.out.println("Exception is : " + e);
}
Hmm..interestiing..when I used the same code you provided I am able to get back data from the SSL connection.
Can you just try this example class and let me know if it fails? If it does, it might be some network issue that you are encountering.
SSLSocketTest.java
Can you just try this example class and let me know if it fails? If it does, it might be some network issue that you are encountering.
SSLSocketTest.java
ASKER
Thanks anilallewar,
The basic task we are trying to achieve is,
We have one HTTPS URL to which we have to send a request XML string and get XML as response in turn. We are able to achieve this using standalone classes, but if we use same code under WebLogic then we are facing exceptions.
Currently, we are facing connection issue (while getting OutputStream) only when we deploy the code on WebLogic. In fact the code works perfect and gives proper result if executed stand alone or deployed on Pramati server. It seems to be WebLogic 7 configuration issue here.
We even tried different different approaches to get code working on WebLogic but no success. The latest option what we tried is,
1. we downloaded ssl certificate for the link,
2. configured it on the same JDK 1.4.0_03 on which WebLogic runs,
3. modified code to load certificate dynamically (we used "SSLContext sslContext = SSLContext.getInstance("SS L");" to load the context.
This context loading executed successfully if we run code as standalone class, using main method. But if we create JSP for this code and run under WebLogic7 then it generates below exception,
java.security.NoSuchAlgori thmExcepti on: Algorithm SSL not available
at javax.net.ssl.SunJSSE_b.a( DashoA6275 )
at javax.net.ssl.SSLContext.g etInstance (DashoA627 5)
at jsp_servlet.__httpstestnew ._jspServi ce(__https testnew.ja va:261)
at weblogic.servlet.jsp.JspBa se.service (JspBase.j ava:27)
at weblogic.servlet.internal. ServletStu bImpl$Serv letInvocat ionAction. run(Servle tStubImpl. java:1058)
at weblogic.servlet.internal. ServletStu bImpl.invo keServlet( ServletStu bImpl.java :401)
at weblogic.servlet.internal. ServletStu bImpl.invo keServlet( ServletStu bImpl.java :445)
at weblogic.servlet.internal. ServletStu bImpl.invo keServlet( ServletStu bImpl.java :306)
at weblogic.servlet.internal. WebAppServ letContext $ServletIn vocationAc tion.run(W ebAppServl etContext. java:5445)
at weblogic.security.service. SecuritySe rviceManag er.runAs(S ecuritySer viceManage r.java:780 )
at weblogic.servlet.internal. WebAppServ letContext .invokeSer vlet(WebAp pServletCo ntext.java :3105)
at weblogic.servlet.internal. ServletReq uestImpl.e xecute(Ser vletReques tImpl.java :2588)
at weblogic.kernel.ExecuteThr ead.execut e(ExecuteT hread.java :213)
at weblogic.kernel.ExecuteThr ead.run(Ex ecuteThrea d.java:189 )
We are really stucked at this level since 4 days and desperately looking for solution.
httpsTestNewJSP.txt
The basic task we are trying to achieve is,
We have one HTTPS URL to which we have to send a request XML string and get XML as response in turn. We are able to achieve this using standalone classes, but if we use same code under WebLogic then we are facing exceptions.
Currently, we are facing connection issue (while getting OutputStream) only when we deploy the code on WebLogic. In fact the code works perfect and gives proper result if executed stand alone or deployed on Pramati server. It seems to be WebLogic 7 configuration issue here.
We even tried different different approaches to get code working on WebLogic but no success. The latest option what we tried is,
1. we downloaded ssl certificate for the link,
2. configured it on the same JDK 1.4.0_03 on which WebLogic runs,
3. modified code to load certificate dynamically (we used "SSLContext sslContext = SSLContext.getInstance("SS
This context loading executed successfully if we run code as standalone class, using main method. But if we create JSP for this code and run under WebLogic7 then it generates below exception,
java.security.NoSuchAlgori
at javax.net.ssl.SunJSSE_b.a(
at javax.net.ssl.SSLContext.g
at jsp_servlet.__httpstestnew
at weblogic.servlet.jsp.JspBa
at weblogic.servlet.internal.
at weblogic.servlet.internal.
at weblogic.servlet.internal.
at weblogic.servlet.internal.
at weblogic.servlet.internal.
at weblogic.security.service.
at weblogic.servlet.internal.
at weblogic.servlet.internal.
at weblogic.kernel.ExecuteThr
at weblogic.kernel.ExecuteThr
We are really stucked at this level since 4 days and desperately looking for solution.
httpsTestNewJSP.txt
What JRE is your weblogic using; my assumption is Weblogic uses its own JRE that doesn't like the SSL stuff you are using.
To change defualt JDK for a WebLogic domain
Find and open the startWeblogic.sh (or startWeblogic.cmd in windows) file that is in the root of the
domain:
Change the value of the variable: JAVA_HOME to your JDK path.
To change defualt JDK for a WebLogic domain
Find and open the startWeblogic.sh (or startWeblogic.cmd in windows) file that is in the root of the
domain:
Change the value of the variable: JAVA_HOME to your JDK path.
ASKER
Generaly WebLogic 7 is shipped with jdk1.3, but in actyality, we are using JDK 1.4 with WebLogic7 as this is the configuration of our production.
We are able to resolve all the issue and receive desired reply but using JDK1.3 with WebLogic7, when we use JDK1.4 with WebLogic7 we are facing "java.io.IOException: Write Channel Closed, possible SSL handshaking or trust failure" exception.
To get is working we tried following steps bu still no success,
1. got the certificate for HTTPS URL we are trying to hit.
2. configured the the certificate to WebLogic "cacert" under path "bea\weblogic700\server\li b"
After implementing these steps, we are able to perform URL communication successfully using WebLogic with JDK1.3, but when we tried using WebLogic with JDK1.4 we faced following exception.
java.io.IOException: Write Channel Closed, possible SSL handshaking or trust fai
lure
at com.certicom.tls.record.Wr iteHandler .write(Unk nown Source)
at com.certicom.tls.interface impl.TLSCo nnectionIm pl.fireAle rtSent(Unk now
n Source)
at com.certicom.tls.record.ha ndshake.Ha ndshakeHan dler.fireA lert(Unkno wn
Source)
at com.certicom.tls.record.ha ndshake.Ha ndshakeHan dler.fireA lert(Unkno wn
Source)
at com.certicom.tls.record.ha ndshake.Ha ndshakeHan dler.handl eHandshake Mes
sage(Unknown Source)
at com.certicom.tls.record.ha ndshake.Ha ndshakeHan dler.handl eHandshake Mes
sages(Unknown Source)
at com.certicom.tls.record.Re adHandler. interpretC ontent(Unk nown Source)
at com.certicom.tls.record.Re adHandler. readRecord (Unknown Source)
at com.certicom.tls.record.Re adHandler. readUntilH andshakeCo mplete(Unk now
n Source)
at com.certicom.tls.interface impl.TLSCo nnectionIm pl.complet eHandshake (Un
known Source)
at com.certicom.tls.record.Wr iteHandler .write(Unk nown Source)
at java.io.BufferedOutputStre am.flushBu ffer(Buffe redOutputS tream.java :69
)
at java.io.BufferedOutputStre am.flush(B ufferedOut putStream. java:127)
at java.io.FilterOutputStream .flush(Fil terOutputS tream.java :123)
at weblogic.net.http.HttpURLC onnection. writeReque sts(HttpUR LConnectio n.j
ava:97)
at weblogic.net.http.HttpURLC onnection. getInputSt ream(HttpU RLConnecti on.
java:284)
at jsp_servlet.__httpstested. _jspServic e(__httpst ested.java :231)
at weblogic.servlet.jsp.JspBa se.service (JspBase.j ava:27)
at weblogic.servlet.internal. ServletStu bImpl$Serv letInvocat ionAction. run
(ServletStubImpl.java:1058 )
at weblogic.servlet.internal. ServletStu bImpl.invo keServlet( ServletStu bIm
pl.java:401)
at weblogic.servlet.internal. ServletStu bImpl.invo keServlet( ServletStu bIm
pl.java:445)
at weblogic.servlet.internal. ServletStu bImpl.invo keServlet( ServletStu bIm
pl.java:306)
at weblogic.servlet.internal. WebAppServ letContext $ServletIn vocationAc tio
n.run(WebAppServletContext .java:5445 )
at weblogic.security.service. SecuritySe rviceManag er.runAs(S ecuritySer vic
eManager.java:780)
at weblogic.servlet.internal. WebAppServ letContext .invokeSer vlet(WebAp pSe
rvletContext.java:3105)
at weblogic.servlet.internal. ServletReq uestImpl.e xecute(Ser vletReques tIm
pl.java:2588)
at weblogic.kernel.ExecuteThr ead.execut e(ExecuteT hread.java :213)
at weblogic.kernel.ExecuteThr ead.run(Ex ecuteThrea d.java:189 )
Exception is : java.io.IOException: Write Channel Closed, possible SSL handshaki
ng or trust failure
Error sending data to server
java.io.IOException: Write Channel Closed, possible SSL handshaking or trust fai
lure
at com.certicom.tls.record.Wr iteHandler .write(Unk nown Source)
at com.certicom.tls.interface impl.TLSCo nnectionIm pl.fireAle rtSent(Unk now
n Source)
at com.certicom.tls.record.ha ndshake.Ha ndshakeHan dler.fireA lert(Unkno wn
Source)
at com.certicom.tls.record.ha ndshake.Ha ndshakeHan dler.fireA lert(Unkno wn
Source)
at com.certicom.tls.record.ha ndshake.Ha ndshakeHan dler.handl eHandshake Mes
sage(Unknown Source)
at com.certicom.tls.record.ha ndshake.Ha ndshakeHan dler.handl eHandshake Mes
sages(Unknown Source)
at com.certicom.tls.record.Re adHandler. interpretC ontent(Unk nown Source)
at com.certicom.tls.record.Re adHandler. readRecord (Unknown Source)
at com.certicom.tls.record.Re adHandler. readUntilH andshakeCo mplete(Unk now
n Source)
at com.certicom.tls.interface impl.TLSCo nnectionIm pl.complet eHandshake (Un
known Source)
at com.certicom.tls.record.Wr iteHandler .write(Unk nown Source)
at java.io.BufferedOutputStre am.flushBu ffer(Buffe redOutputS tream.java :69
)
at java.io.BufferedOutputStre am.flush(B ufferedOut putStream. java:127)
at java.io.FilterOutputStream .flush(Fil terOutputS tream.java :123)
at weblogic.net.http.HttpURLC onnection. writeReque sts(HttpUR LConnectio n.j
ava:97)
at weblogic.net.http.HttpURLC onnection. getInputSt ream(HttpU RLConnecti on.
java:284)
at jsp_servlet.__httpstested. _jspServic e(__httpst ested.java :231)
at weblogic.servlet.jsp.JspBa se.service (JspBase.j ava:27)
at weblogic.servlet.internal. ServletStu bImpl$Serv letInvocat ionAction. run
(ServletStubImpl.java:1058 )
at weblogic.servlet.internal. ServletStu bImpl.invo keServlet( ServletStu bIm
pl.java:401)
at weblogic.servlet.internal. ServletStu bImpl.invo keServlet( ServletStu bIm
pl.java:306)
at weblogic.servlet.internal. WebAppServ letContext $ServletIn vocationAc tio
n.run(WebAppServletContext .java:5445 )
at weblogic.security.service. SecuritySe rviceManag er.runAs(S ecuritySer vic
eManager.java:780)
at weblogic.servlet.internal. WebAppServ letContext .invokeSer vlet(WebAp pSe
rvletContext.java:3105)
at weblogic.servlet.internal. ServletReq uestImpl.e xecute(Ser vletReques tIm
pl.java:2588)
at weblogic.kernel.ExecuteThr ead.execut e(ExecuteT hread.java :213)
at weblogic.kernel.ExecuteThr ead.run(Ex ecuteThrea d.java:189 )
Exception is : java.io.IOException: Write Channel Closed, possible SSL handshaki
ng or trust failure
We are able to resolve all the issue and receive desired reply but using JDK1.3 with WebLogic7, when we use JDK1.4 with WebLogic7 we are facing "java.io.IOException: Write Channel Closed, possible SSL handshaking or trust failure" exception.
To get is working we tried following steps bu still no success,
1. got the certificate for HTTPS URL we are trying to hit.
2. configured the the certificate to WebLogic "cacert" under path "bea\weblogic700\server\li
After implementing these steps, we are able to perform URL communication successfully using WebLogic with JDK1.3, but when we tried using WebLogic with JDK1.4 we faced following exception.
java.io.IOException: Write Channel Closed, possible SSL handshaking or trust fai
lure
at com.certicom.tls.record.Wr
at com.certicom.tls.interface
n Source)
at com.certicom.tls.record.ha
Source)
at com.certicom.tls.record.ha
Source)
at com.certicom.tls.record.ha
sage(Unknown Source)
at com.certicom.tls.record.ha
sages(Unknown Source)
at com.certicom.tls.record.Re
at com.certicom.tls.record.Re
at com.certicom.tls.record.Re
n Source)
at com.certicom.tls.interface
known Source)
at com.certicom.tls.record.Wr
at java.io.BufferedOutputStre
)
at java.io.BufferedOutputStre
at java.io.FilterOutputStream
at weblogic.net.http.HttpURLC
ava:97)
at weblogic.net.http.HttpURLC
java:284)
at jsp_servlet.__httpstested.
at weblogic.servlet.jsp.JspBa
at weblogic.servlet.internal.
(ServletStubImpl.java:1058
at weblogic.servlet.internal.
pl.java:401)
at weblogic.servlet.internal.
pl.java:445)
at weblogic.servlet.internal.
pl.java:306)
at weblogic.servlet.internal.
n.run(WebAppServletContext
at weblogic.security.service.
eManager.java:780)
at weblogic.servlet.internal.
rvletContext.java:3105)
at weblogic.servlet.internal.
pl.java:2588)
at weblogic.kernel.ExecuteThr
at weblogic.kernel.ExecuteThr
Exception is : java.io.IOException: Write Channel Closed, possible SSL handshaki
ng or trust failure
Error sending data to server
java.io.IOException: Write Channel Closed, possible SSL handshaking or trust fai
lure
at com.certicom.tls.record.Wr
at com.certicom.tls.interface
n Source)
at com.certicom.tls.record.ha
Source)
at com.certicom.tls.record.ha
Source)
at com.certicom.tls.record.ha
sage(Unknown Source)
at com.certicom.tls.record.ha
sages(Unknown Source)
at com.certicom.tls.record.Re
at com.certicom.tls.record.Re
at com.certicom.tls.record.Re
n Source)
at com.certicom.tls.interface
known Source)
at com.certicom.tls.record.Wr
at java.io.BufferedOutputStre
)
at java.io.BufferedOutputStre
at java.io.FilterOutputStream
at weblogic.net.http.HttpURLC
ava:97)
at weblogic.net.http.HttpURLC
java:284)
at jsp_servlet.__httpstested.
at weblogic.servlet.jsp.JspBa
at weblogic.servlet.internal.
(ServletStubImpl.java:1058
at weblogic.servlet.internal.
pl.java:401)
at weblogic.servlet.internal.
pl.java:306)
at weblogic.servlet.internal.
n.run(WebAppServletContext
at weblogic.security.service.
eManager.java:780)
at weblogic.servlet.internal.
rvletContext.java:3105)
at weblogic.servlet.internal.
pl.java:2588)
at weblogic.kernel.ExecuteThr
at weblogic.kernel.ExecuteThr
Exception is : java.io.IOException: Write Channel Closed, possible SSL handshaki
ng or trust failure
The SSL library that weblogic uses(com.certicom.) will NOT be compatible with 1.4 and that is what is causing the issue. This is not a problem with the cert.
Weren't you previously using JDK 1.4 classes to make SSL connection? If you were getting the same exception then probably there is NO way to tell weblogic to use the standard library; you would have to either go with JDK 1.3 or use a newer version of weblogic.
Weren't you previously using JDK 1.4 classes to make SSL connection? If you were getting the same exception then probably there is NO way to tell weblogic to use the standard library; you would have to either go with JDK 1.3 or use a newer version of weblogic.
ASKER
No, we havent used JDK1.4 with WebLogic7 earlier for SSL connection. We have migrated WebLogic7 from JDK1.3 environment to JDK1.4 as a part of earlier requirement of security API integration.
And now we have another requirement where we have to use same combination of WebLogic7 and JDK1.4 to only (as they are on production also), we cannot escape this combination now. Also coming back to JDK1.3 is not possivle, and upgradation of WebLogic is also not feasible as it will require upgradation of whole UAT, Staging and Production environments.
Aren't there any feasible way out to workaround this, like to use Sun JSSE or any other configurations at JDK1.4 or WebLogic7 level?
And now we have another requirement where we have to use same combination of WebLogic7 and JDK1.4 to only (as they are on production also), we cannot escape this combination now. Also coming back to JDK1.3 is not possivle, and upgradation of WebLogic is also not feasible as it will require upgradation of whole UAT, Staging and Production environments.
Aren't there any feasible way out to workaround this, like to use Sun JSSE or any other configurations at JDK1.4 or WebLogic7 level?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Like I told you earlier(Comment #28679675), the standard Sun JSSE and Weblogic implementation were getting mixed up leading to all the weird errors. Since you removed the Sun JSSE libraries, only weblogic libraries were used and you were able to connect correctly.
You could have done the same by removing Weblogic libraries but we are wary of the side-effects.
I generally have this grudge against most App server vendors as to why they provide their own implementation of some Java specification when a standard version is availble :(
You could have done the same by removing Weblogic libraries but we are wary of the side-effects.
I generally have this grudge against most App server vendors as to why they provide their own implementation of some Java specification when a standard version is availble :(
Can you try with the HTTP non-SSL URL (http://wwwcie.ups.com/ups.app/xml/ShipConfirm) instead of SSL site in your program and then check?