Tuesday, December 1, 2015

java.sql.SQLException: ResultSet.next was not called Oracle JDeveloper, B2B Callout

While running a Java code of B2B callout i was getting the below error. This was due to below Java code. The commented code was causing the problem then i defined it in if statement as shown below. I hope you understand the reason.


 PreparedStatement pstmt = conn.prepareStatement("My select query=?");
        pstmt.setInt(1, Integer.parseInt(SequenceNum));
     
   ResultSet rs = pstmt.executeQuery();
               //  TR=rs.getString(1);
              //  System.out.println("TR is " +TR);
      if (rs.next())
     {
                    TR=rs.getString(1);
                    System.out.println("TR is " +TR);
        
      }


java.sql.SQLException: ResultSet.next was not called
at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:234)
at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:223)
at weblogic.jdbc.rmi.internal.ResultSetImpl_weblogic_jdbc_wrapper_ResultSet_oracle_jdbc_driver_OracleResultSetImpl_1035_WLStub.getString(Unknown Source)
at weblogic.jdbc.rmi.internal.ResultSetStub_weblogic_jdbc_rmi_internal_ResultSetImpl_weblogic_jdbc_wrapper_ResultSet_oracle_jdbc_driver_OracleResultSetImpl_1035_WLStub.getString(Unknown Source)
at weblogic.jdbc.rmi.internal.ResultSetStraightReader.getString(ResultSetStraightReader.java:45)
at weblogic.jdbc.rmi.SerialResultSet.getString(SerialResultSet.java:150)
at DBInserterMT100.dbInserter(DBInserterMT100.java:105)
at DBInserterMT100.execute(DBInserterMT100.java:55)
at oracle.tip.b2b.callout.CalloutExecuteWorker.doWork(CalloutExecuteWorker.java:288)
at oracle.tip.b2b.callout.CalloutExecuteWorker.run(CalloutExecuteWorker.java:258)
at oracle.integration.platform.blocks.executor.WorkManagerExecutor$1.run(WorkManagerExecutor.java:120)
at weblogic.work.j2ee.J2EEWorkManager$WorkWithListener.run(J2EEWorkManager.java:183)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Caused by: java.sql.SQLException: ResultSet.next was not called
at oracle.jdbc.driver.OracleResultSetImpl.getString(OracleResultSetImpl.java:2870)
at weblogic.jdbc.wrapper.ResultSet_oracle_jdbc_driver_OracleResultSetImpl.getString(Unknown Source)
at weblogic.jdbc.rmi.internal.ResultSetImpl_weblogic_jdbc_wrapper_ResultSet_oracle_jdbc_driver_OracleResultSetImpl.getString(Unknown Source)
at weblogic.jdbc.rmi.internal.ResultSetImpl_weblogic_jdbc_wrapper_ResultSet_oracle_jdbc_driver_OracleResultSetImpl_WLSkel.internalInvoke1(Unknown Source)
at weblogic.jdbc.rmi.internal.ResultSetImpl_weblogic_jdbc_wrapper_ResultSet_oracle_jdbc_driver_OracleResultSetImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:667)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:522)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:518)
at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
... 2 more

javax.naming.CommunicationException [Root exception is java.net.ConnectException: t3: Destination unreachable

While compiling some code in JDeveloper I was getting the below error. It was coming due to proxy issue. So go to Jdeveloper then Tools---Preferences---Web Browser and Proxy then in exceptions field enter your server hostname. Test your code again and this time hopefully error will not come. It resolved my issue and i hope it will be helpful.


SEVERE: javax.naming.CommunicationException [Root exception is java.net.ConnectException: t3://hostname:port: Destination unreachable; nested exception is: 
java.net.ProtocolException: unrecognized response from proxy: 'HTTP/1.1 502 Proxy Error ( The specified Secure Sockets Layer (SSL) port is not allowed. Forefront TMG is not configured to allow SSL requests from this port. Most Web browsers use port 443 for SSL requests.  )'; No available router to destination]
oracle.bpel.services.workflow.client.WorkflowServiceClientException: javax.naming.CommunicationException [Root exception is java.net.ConnectException: t3://hostname:port: Destination unreachable; nested exception is: 
java.net.ProtocolException: unrecognized response from proxy: 'HTTP/1.1 502 Proxy Error ( The specified Secure Sockets Layer (SSL) port is not allowed. Forefront TMG is not configured to allow SSL requests from this port. Most Web browsers use port 443 for SSL requests.  )'; No available router to destination]
at oracle.bpel.services.workflow.client.WorkflowServiceClientContext.createInitialContext(WorkflowServiceClientContext.java:793)
at oracle.bpel.services.workflow.client.WorkflowServiceClientContext.getJNDIInitialContext(WorkflowServiceClientContext.java:423)
at oracle.bpel.services.workflow.query.client.TaskQueryServiceRemoteClient.getInitialContext(TaskQueryServiceRemoteClient.java:47)
at oracle.bpel.services.workflow.query.client.TaskQueryServiceRemoteClient.authenticate(TaskQueryServiceRemoteClient.java:90)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at oracle.bpel.services.workflow.client.WFClientRetryInvocationHandler.invokeTarget(WFClientRetryInvocationHandler.java:144)
at oracle.bpel.services.workflow.client.WFClientRetryInvocationHandler.invoke(WFClientRetryInvocationHandler.java:82)
at $Proxy14.authenticate(Unknown Source)
at nl.whitehorses.fcforms.tasks.utility.BPELWorkflowServices.authenticate(BPELWorkflowServices.java:191)
at nl.whitehorses.fcforms.tasks.services.HumanTaskClient.completeTask(HumanTaskClient.java:265)
at nl.whitehorses.fcforms.tasks.test.Complete.<init>(Complete.java:9)
at nl.whitehorses.fcforms.tasks.test.Complete.main(Complete.java:14)
Caused by: javax.naming.CommunicationException [Root exception is java.net.ConnectException: t3://hostname:port: Destination unreachable; nested exception is: 
java.net.ProtocolException: unrecognized response from proxy: 'HTTP/1.1 502 Proxy Error ( The specified Secure Sockets Layer (SSL) port is not allowed. Forefront TMG is not configured to allow SSL requests from this port. Most Web browsers use port 443 for SSL requests.  )'; No available router to destination]
at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:40)
at weblogic.jndi.WLInitialContextFactoryDelegate.toNamingException(WLInitialContextFactoryDelegate.java:788)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:368)
at weblogic.jndi.Environment.getContext(Environment.java:315)
at weblogic.jndi.Environment.getContext(Environment.java:285)
at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:117)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:197)
at oracle.bpel.services.workflow.client.WorkflowServiceClientContext.createInitialContext(WorkflowServiceClientContext.java:789)
... 14 more
Caused by: java.net.ConnectException: t3://hostname:port: Destination unreachable; nested exception is: 
java.net.ProtocolException: unrecognized response from proxy: 'HTTP/1.1 502 Proxy Error ( The specified Secure Sockets Layer (SSL) port is not allowed. Forefront TMG is not configured to allow SSL requests from this port. Most Web browsers use port 443 for SSL requests.  )'; No available router to destination
at weblogic.rjvm.RJVMFinder.findOrCreateInternal(RJVMFinder.java:216)
at weblogic.rjvm.RJVMFinder.findOrCreate(RJVMFinder.java:170)
at weblogic.rjvm.ServerURL.findOrCreateRJVM(ServerURL.java:153)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:353)
... 22 more
Caused by: java.rmi.ConnectException: Destination unreachable; nested exception is: 
java.net.ProtocolException: unrecognized response from proxy: 'HTTP/1.1 502 Proxy Error ( The specified Secure Sockets Layer (SSL) port is not allowed. Forefront TMG is not configured to allow SSL requests from this port. Most Web browsers use port 443 for SSL requests.  )'; No available router to destination
at weblogic.rjvm.ConnectionManager.bootstrap(ConnectionManager.java:470)
at weblogic.rjvm.ConnectionManager.bootstrap(ConnectionManager.java:321)
at weblogic.rjvm.RJVMManager.findOrCreateRemoteInternal(RJVMManager.java:254)
at weblogic.rjvm.RJVMManager.findOrCreate(RJVMManager.java:197)
at weblogic.rjvm.RJVMFinder.findOrCreateRemoteServer(RJVMFinder.java:238)
at weblogic.rjvm.RJVMFinder.findOrCreateInternal(RJVMFinder.java:200)
... 25 more
Exception in thread "main" java.lang.RuntimeException: javax.naming.CommunicationException [Root exception is java.net.ConnectException: t3://hostname:port: Destination unreachable; nested exception is: 
java.net.ProtocolException: unrecognized response from proxy: 'HTTP/1.1 502 Proxy Error ( The specified Secure Sockets Layer (SSL) port is not allowed. Forefront TMG is not configured to allow SSL requests from this port. Most Web browsers use port 443 for SSL requests.  )'; No available router to destination]
at nl.whitehorses.fcforms.tasks.services.HumanTaskClient.completeTask(HumanTaskClient.java:280)
at nl.whitehorses.fcforms.tasks.test.Complete.<init>(Complete.java:9)
at nl.whitehorses.fcforms.tasks.test.Complete.main(Complete.java:14)