Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Socket.shutdownOutput() closes socket inside Oracle JVM

Re: Socket.shutdownOutput() closes socket inside Oracle JVM

From: mRangel <marcus.rangel_at_gmail.com>
Date: 23 Mar 2007 07:38:50 -0700
Message-ID: <1174660730.918734.275050@o5g2000hsb.googlegroups.com>


My printStackTrace shows the following:

java.net.SocketException: Socket is closed
	at java.net.SocketInputStream.socketRead0(Native Method)
	at java.net.SocketInputStream.read(SocketInputStream.java:129)
	at java.net.SocketInputStream.read(SocketInputStream.java:90)
	at kiman.socktest.test(socktest:76)

What does the "Native Method" on second line mean ? I think my problem is related to that somehow.

On Mar 20, 11:03 am, "mRangel" <marcus.ran..._at_gmail.com> wrote:
> Dear friends,
>
> We have a java class which uses the Socket class. Our class does a
> Socket.shutdownOutput() to indicate that the sending of data is over
> and the reply may start. It works just fine outside Oracle, but when
> the class is loaded in the database the shutdownOutput() method
> apparently causes the socket to be closed. Below is a sample of the
> code and its output. The user has JAVAUSERPRIV and JAVASYSPRIV
> granted, and I even tried JAVA_ADMIN without success. The Oracle
> versions tested were 10.2.0.1 (Windows) and 10.2.0.2 (AIX). Does
> anybody know what can be happening ? Thanks in advance.
>
> Code:
>
> /****************************************************/
> Socket sockICM = new Socket("192.168.1.133", 5010);
> byte byxml[] = hmapICM.toXMLString().getBytes();
> System.out.println("1");
> InputStream isXmlOut = sockICM.getInputStream();
> sockICM.getOutputStream().write(byxml);
> System.out.println("1.5");
> sockICM.shutdownOutput();
> System.out.println("socket.isOutputShutdown(): " +
> sockICM.isOutputShutdown());
> System.out.println("socket.isClosed(): " + sockICM.isClosed());
> System.out.println("2");
> byte b[] = new byte[1000];
> InputStream isXmlOut = sockICM.getInputStream();
> System.out.println("3");
> ByteArrayOutputStream bos = new ByteArrayOutputStream();
> System.out.println("4");
> try
> {
> int q;
> while((q = isXmlOut.read(b)) != -1)
> {
> bos.write(b, 0, q);
> System.out.println("leu: " + bos.toString());}
> }
>
> catch(Exception io){
> System.out.println("err=" + io.toString());}
>
> /****************************************************/
>
> Output:
>
> /****************************************************/
> 1
> 1.5
> socket.isOutputShutdown(): true
> socket.isClosed(): false
> 2
> 3
> 4
> err=java.net.SocketException: Socket is closed
> /****************************************************/
Received on Fri Mar 23 2007 - 09:38:50 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US