0 Replies Latest reply on Feb 10, 2017 5:06 PM by Sp999

    Not able to fetch data from Database using resultset.getString(1) in Java


      Issue Description: Java Program is working fine in Weblogic, Jrockit 1.6.0_37 and backend DB server is Oracle But same program is not working in weblogic , Java 1.7.0_79 and DB server There is no change in the linux shell script(which is using to run the job) except Java_home and Wl_home. Weblogic installation ojdbc drivers are using as part of classpath settings. Java program connects to Oracle DB server and pull the data and generates the feed file, as part of this process in Java 1.7, weblogic program fetch some of the records then program throws exception - "java.sql.SQLException: getString, Exception = Unexpected Exception" . number of records printing in the log is random, sometime it logs 50 records and sometimes it prints 100
      records and throws exception, sometime program got hanged and need to force shutdown.


      Kindly help out to resolve this issue..


      Code snippet as below.....




      PreparedStatement ps = null;

      ResultSet result = null;

      String query ="SELECT column1||'~'||column2|| from TB_temp";

      ArrayList totalRecords = new ArrayList();



      ps = connection.prepareStatement(query);

      result = ps.executeQuery();

      int count = 1;

      while ((result != null) && (result.next())) {




           } catch (Exception e) {

      logger.debug("Exception raised in getDownloadData due to ::" + e.getMessage());


      throw e;



      below exception is throwing at line --   totalRecords.add(result.getString(1));


      java.sql.SQLException: getString, Exception = Unexpected Exception

              at weblogic.jdbc.rmi.RMIWrapperImpl.invocationExceptionHandler(RMIWrapperImpl.java:102)

              at weblogic.jdbc.rmi.RMIStubWrapperImpl.invocationExceptionHandler(RMIStubWrapperImpl.java:34)

              at weblogic.jdbc.rmi.SerialResultSet.getString(SerialResultSet.java:153)




      Caused by: weblogic.rmi.extensions.RemoteRuntimeException: Unexpected Exception

              at weblogic.jdbc.rmi.internal.ResultSetImpl_weblogic_jdbc_wrapper_ResultSet_oracle_jdbc_driver_OracleResultSetImpl_1036_WLStub.getString(Unknown Source)

              at weblogic.jdbc.rmi.internal.ResultSetStub_weblogic_jdbc_rmi_internal_ResultSetImpl_weblogic_jdbc_wrapper_ResultSet_oracle_jdbc_driver_OracleResultSetImpl_1036_WLStub.getString(Unknown Source)

              at weblogic.jdbc.rmi.internal.ResultSetStraightReader.getString(ResultSetStraightReader.java:45)

              at weblogic.jdbc.rmi.SerialResultSet.getString(SerialResultSet.java:150)

              ... 10 more

      Caused by: java.rmi.UnmarshalException: failed to unmarshal class java.lang.String; nested exception is:

              java.io.StreamCorruptedException: invalid type code: 01

              at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:245)

              at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:223)

              ... 14 more

      Caused by: java.io.StreamCorruptedException: invalid type code: 01

              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1377)

              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)

              at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:208)