Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to solve weblogic.socket.MaxMessageSizeExceededException?

Status
Not open for further replies.

balubalu

Programmer
Jan 23, 2002
1
PH
How to solve this Exception. When is sent more than 8000 bytes of data in the request weblogic 5.1 in solaris server gives me this error. But the same server and same configuration in Window NT with same SSLClient program does not give any expection even if i send 60000 bytes in the request.

SSLClient program given below. Any configuration is required.

Exception got in the weblogic server 5.1 in solaris server
----------------------------------------------------------
weblogic.socket.MaxMessageSizeExceededException[Incoming HTTP request headers of size 8320 bytes exceeds the configured maximum of 8192 bytes]
at weblogic.socket.MuxableSocketHTTP.incrementBufferOffset(MuxableSocketHTTP.java:111)
at weblogic.socket.SSLFilter.isMessageComplete(SSLFilter.java:195)
at weblogic.socket.PosixSocketMuxer.processSockets(PosixSocketMuxer.java:361)
at weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:23)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:129)
* * *
SSLClient Program used: JSSE 1.0.2 package is used for SSL
-----------------------------------------------------------
import java.io.*;
import javax.net.ssl.*;
import java.net.*;
import com.sun.net.ssl.*;
import java.security.KeyStore;

public class SSLClient {

public SSLClientCheck()
{
System.out.println(" SSLClient is instantiated ...");
}

public String getSSLConnection(String host,String port,String keystorepwd,String truststorepwd,
String keystorepath,String truststorepath,String filepath,String parName,String message)throws Exception
{
String output = "";
int iport = Integer.parseInt(port);

SSLSocketFactory factory = null;
SSLContext ctx;
KeyManagerFactory kmf;
KeyStore ks;
KeyStore ks2;
TrustManagerFactory tmf;
char[] storepass = keystorepwd.toCharArray();
char[] truststorepass = truststorepwd.toCharArray();

ctx = SSLContext.getInstance("SSLv3");
kmf = KeyManagerFactory.getInstance("SunX509");
ks = KeyStore.getInstance("JKS");
ks.load(new FileInputStream(keystorepath), storepass);
kmf.init(ks, storepass);

tmf = TrustManagerFactory.getInstance("SunX509");
ks2 = KeyStore.getInstance("JKS");
ks2.load(new FileInputStream(truststorepath), truststorepass);
tmf.init(ks2);
ctx.init(kmf.getKeyManagers(),tmf.getTrustManagers(), null);
factory = ctx.getSocketFactory();

SSLSocket socket = (SSLSocket)factory.createSocket(host,iport);

socket.startHandshake();
PrintWriter out = new PrintWriter(
new BufferedWriter(
new OutputStreamWriter(
socket.getOutputStream())));
out.println("GET " + filepath+"?"+parName+"="+URLEncoder.encode(message) + " HTTP/1.0");
out.println();
out.flush();

if (out.checkError())
System.out.println("SSLSocketClient: java.io.PrintWriter error");

/* read response */
BufferedReader in = new BufferedReader(
new InputStreamReader(
socket.getInputStream()));
String inputLine ;
while ((inputLine = in.readLine()) != null){
output = output+inputLine;
//System.out.println(inputLine);
}

in.close();
out.close();
socket.close();

return output;
}


public static void main(String args[])
{
String host = "host name";
String port="7001";
String keystorepwd="cqrcqr";
String keystorepwd="changeit";
String keystorepath ="d:/weblogic/myserver/certificate/cqrstore";
String truststorepath="d:/jdk1.3/jre/security/cacerts";
String filepath="/servlets/SSLDemo";
String parName="xml_message";
String message="xml message";// of size more than 9000 bytes
try{
SSLClient ssl = new SSLClient();
String output = ssl.getSSLConnection(host,port,keystorepwd,keystorepwd,keystorepath,truststorepath,filepath,parName,message);
System.out.println(output);
}
catch(Exception e)
{
e.printStackTrace();
}

}

}

K.R.Balasubramaniam
krbalasubramaniam@dsqsoft.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top