4 Replies Latest reply on Sep 25, 2003 7:44 AM by Christian Neuroth

    Sql Exception when sending messages

    Christian Neuroth Newbie

      Hi!

      I receive the following exceptions when sending messages to a queue. Any ideas how to fix this?

      Thanks

      Christian


      15:57:03,437 ERROR [STDERR] java.sql.SQLException: JZ0C0: Verbindung wurde bereits geschlossen.
      15:57:03,437 ERROR [STDERR] at com.sybase.jdbc2.jdbc.ErrorMessage.raiseError(ErrorMessage.java:549)
      15:57:03,437 ERROR [STDERR] at com.sybase.jdbc2.jdbc.SybConnection.checkConnection(SybConnection.java:2101)
      15:57:03,437 ERROR [STDERR] at com.sybase.jdbc2.jdbc.SybConnection.rollback(SybConnection.java:1054)
      15:57:03,437 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.local.LocalManagedConnection.rollback(LocalManagedConnection.java:116)
      15:57:03,437 ERROR [STDERR] at org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource.rollback(TxConnectionManager.jav
      a:859)
      15:57:03,437 ERROR [STDERR] at org.jboss.tm.TransactionImpl.rollbackResources(TransactionImpl.java:1647)
      15:57:03,437 ERROR [STDERR] at org.jboss.tm.TransactionImpl.rollback(TransactionImpl.java:449)
      15:57:03,437 ERROR [STDERR] at org.jboss.tm.TxManager.rollback(TxManager.java:263)
      15:57:03,437 ERROR [STDERR] at org.jboss.mq.pm.jdbc2.PersistenceManager$TransactionManagerStrategy.endTX(PersistenceManager.java:174)
      15:57:03,437 ERROR [STDERR] at org.jboss.mq.pm.jdbc2.PersistenceManager.add(PersistenceManager.java:715)
      15:57:03,437 ERROR [STDERR] at org.jboss.mq.server.PersistentQueue.addMessage(PersistentQueue.java:39)
      15:57:03,437 ERROR [STDERR] at org.jboss.mq.server.JMSQueue.addMessage(JMSQueue.java:133)
      15:57:03,437 ERROR [STDERR] at org.jboss.mq.server.JMSDestinationManager.addMessage(JMSDestinationManager.java:409)
      15:57:03,437 ERROR [STDERR] at org.jboss.mq.server.JMSDestinationManager.addMessage(JMSDestinationManager.java:385)
      15:57:03,437 ERROR [STDERR] at org.jboss.mq.server.JMSServerInterceptorSupport.addMessage(JMSServerInterceptorSupport.java:135)
      15:57:03,437 ERROR [STDERR] at org.jboss.mq.security.ServerSecurityInterceptor.addMessage(ServerSecurityInterceptor.java:162)
      15:57:03,437 ERROR [STDERR] at org.jboss.mq.server.TracingInterceptor.addMessage(TracingInterceptor.java:234)
      15:57:03,437 ERROR [STDERR] at org.jboss.mq.server.JMSServerInvoker.addMessage(JMSServerInvoker.java:137)
      15:57:03,437 ERROR [STDERR] at org.jboss.mq.il.oil.OILServerILService$Client.run(OILServerILService.java:253)
      15:57:03,437 ERROR [STDERR] at java.lang.Thread.run(Thread.java:534)
      15:57:03,437 WARN [JBossManagedConnectionPool] ResourceException cleaning up ManagedConnection:org.jboss.resource.JBossResourceException: C
      ould not cleanup: ; - nested throwable: (java.sql.SQLException: JZ0C0: Verbindung wurde bereits geschlossen.)
      15:57:03,437 INFO [JBossManagedConnectionPool] Exception destroying ManagedConnection
      org.jboss.resource.JBossResourceException: Could not cleanup: ; - nested throwable: (java.sql.SQLException: JZ0C0: Verbindung wurde bereits
      geschlossen.)
      at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.cleanup(BaseWrapperManagedConnection.java:195)
      at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.destroy(BaseWrapperManagedConnection.java:225)
      at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.doDestroy(InternalManagedConnectionPool.java:394)
      at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.returnConnection(InternalManagedConnectionPool.java:270)
      at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool.returnConnection(JBossManagedConnectionPool.java:701)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2.returnManagedConnection(BaseConnectionManager2.java:464)
      at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener$TxRemover.afterCompletion(TxConnectionManager.
      java:669)
      at org.jboss.tm.TransactionImpl.doAfterCompletion(TransactionImpl.java:1325)
      at org.jboss.tm.TransactionImpl.rollback(TransactionImpl.java:451)
      at org.jboss.tm.TxManager.rollback(TxManager.java:263)
      at org.jboss.mq.pm.jdbc2.PersistenceManager$TransactionManagerStrategy.endTX(PersistenceManager.java:174)
      at org.jboss.mq.pm.jdbc2.PersistenceManager.add(PersistenceManager.java:715)
      at org.jboss.mq.server.PersistentQueue.addMessage(PersistentQueue.java:39)
      at org.jboss.mq.server.JMSQueue.addMessage(JMSQueue.java:133)
      at org.jboss.mq.server.JMSDestinationManager.addMessage(JMSDestinationManager.java:409)
      at org.jboss.mq.server.JMSDestinationManager.addMessage(JMSDestinationManager.java:385)
      at org.jboss.mq.server.JMSServerInterceptorSupport.addMessage(JMSServerInterceptorSupport.java:135)
      at org.jboss.mq.security.ServerSecurityInterceptor.addMessage(ServerSecurityInterceptor.java:162)
      at org.jboss.mq.server.TracingInterceptor.addMessage(TracingInterceptor.java:234)
      at org.jboss.mq.server.JMSServerInvoker.addMessage(JMSServerInvoker.java:137)
      at org.jboss.mq.il.oil.OILServerILService$Client.run(OILServerILService.java:253)
      at java.lang.Thread.run(Thread.java:534)
      Caused by: java.sql.SQLException: JZ0C0: Verbindung wurde bereits geschlossen.
      at com.sybase.jdbc2.jdbc.ErrorMessage.raiseError(ErrorMessage.java:549)
      at com.sybase.jdbc2.jdbc.SybConnection.checkConnection(SybConnection.java:2101)
      at com.sybase.jdbc2.jdbc.SybConnection.getTransactionIsolation(SybConnection.java:1356)
      at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.cleanup(BaseWrapperManagedConnection.java:188)
      ... 21 more
      15:57:03,453 WARN [OILServerILService] Client request resulted in a server exception:
      org.jboss.mq.SpyJMSException: Could not store message: 0 msg=0 hard NOT_STORED PERSISTENT queue=QUEUE.A priority=4 hashCode=26461030; - nest
      ed throwable: (java.sql.SQLException: JZ006: IOException: com.sybase.jdbc2.jdbc.SybConnectionDeadException: JZ0C0: Verbindung wurde bereits
      geschlossen. wurde abgefangen)
      at org.jboss.mq.pm.jdbc2.PersistenceManager.add(PersistenceManager.java:704)
      at org.jboss.mq.server.PersistentQueue.addMessage(PersistentQueue.java:39)
      at org.jboss.mq.server.JMSQueue.addMessage(JMSQueue.java:133)
      at org.jboss.mq.server.JMSDestinationManager.addMessage(JMSDestinationManager.java:409)
      at org.jboss.mq.server.JMSDestinationManager.addMessage(JMSDestinationManager.java:385)
      at org.jboss.mq.server.JMSServerInterceptorSupport.addMessage(JMSServerInterceptorSupport.java:135)
      at org.jboss.mq.security.ServerSecurityInterceptor.addMessage(ServerSecurityInterceptor.java:162)
      at org.jboss.mq.server.TracingInterceptor.addMessage(TracingInterceptor.java:234)
      at org.jboss.mq.server.JMSServerInvoker.addMessage(JMSServerInvoker.java:137)
      at org.jboss.mq.il.oil.OILServerILService$Client.run(OILServerILService.java:253)
      at java.lang.Thread.run(Thread.java:534)
      Caused by: java.sql.SQLException: JZ006: IOException: com.sybase.jdbc2.jdbc.SybConnectionDeadException: JZ0C0: Verbindung wurde bereits gesc
      hlossen. wurde abgefangen
      at com.sybase.jdbc2.jdbc.ErrorMessage.createIOEKilledConnEx(ErrorMessage.java:775)
      at com.sybase.jdbc2.jdbc.ErrorMessage.raiseErrorCheckDead(ErrorMessage.java:816)
      at com.sybase.jdbc2.tds.Tds.handleIOE(Tds.java:3479)
      at com.sybase.jdbc2.tds.Tds.cancel(Tds.java:1528)
      at com.sybase.jdbc2.tds.Tds.cancel(Tds.java:1457)
      at com.sybase.jdbc2.jdbc.SybStatement.doCancel(SybStatement.java:595)
      at com.sybase.jdbc2.jdbc.SybStatement.updateLoop(SybStatement.java:1739)
      at com.sybase.jdbc2.jdbc.SybStatement.executeUpdate(SybStatement.java:1685)
      at com.sybase.jdbc2.jdbc.SybPreparedStatement.executeUpdate(SybPreparedStatement.java:104)
      at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:308)
      at org.jboss.mq.pm.jdbc2.PersistenceManager.add(PersistenceManager.java:742)
      at org.jboss.mq.pm.jdbc2.PersistenceManager.add(PersistenceManager.java:689)

        • 1. Re: Sql Exception when sending messages
          Adrian Brock Master

          Please most in English not German.
          The SQL exception says the connection is already closed,
          probably because of an error.

          Have you changed the BLOB definitions in
          jbossmq-service.xml to match Sybase?

          When you have a working configuration, please post it.

          Regards,
          Adrian

          • 2. Re: Sql Exception when sending messages
            Christian Neuroth Newbie

            Thanks, Adrian!

            Yes! That's it...

            You simply could take the Oracle configuration file from the example directory.

            That leads to the BLOB_TYPE=BINARYSTREAM_BLOB. Sending now works.

            However, I am now facing a database issue when receiving messages (see the attached log snippet).

            I am not sure whether the OILServerILService or the database is the problem...

            Any ideas?

            Thanks

            Christian

            10:24:58,328 WARN [OILServerILService] Connection failure (1).
            java.net.SocketException: Connection reset
            at java.net.SocketInputStream.read(SocketInputStream.java:168)
            at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
            at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
            at java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStream.java:2133)
            at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(ObjectInputStream.java:2313)
            at java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStream.java:2380)
            at java.io.ObjectInputStream$BlockDataInputStream.read(ObjectInputStream.java:2452)
            at java.io.ObjectInputStream$BlockDataInputStream.readByte(ObjectInputStream.java:2601)
            at java.io.ObjectInputStream.readByte(ObjectInputStream.java:845)
            at org.jboss.mq.il.oil.OILServerILService$Client.run(OILServerILService.java:210)
            at java.lang.Thread.run(Thread.java:534)
            10:25:28,765 WARN [OILServerILService] Connection failure (1).
            java.net.SocketException: Connection reset
            at java.net.SocketInputStream.read(SocketInputStream.java:168)
            at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
            at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
            at java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStream.java:2133)
            at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(ObjectInputStream.java:2313)
            at java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStream.java:2380)
            at java.io.ObjectInputStream$BlockDataInputStream.read(ObjectInputStream.java:2452)
            at java.io.ObjectInputStream$BlockDataInputStream.readByte(ObjectInputStream.java:2601)
            at java.io.ObjectInputStream.readByte(ObjectInputStream.java:845)
            at org.jboss.mq.il.oil.OILServerILService$Client.run(OILServerILService.java:210)
            at java.lang.Thread.run(Thread.java:534)
            10:25:28,875 ERROR [BasicQueue] Caught unusual exception in restoreMessageTask.
            org.jboss.mq.SpyJMSException: Could not update the message in the database: update affected 0 rows
            at org.jboss.mq.pm.jdbc2.PersistenceManager.update(PersistenceManager.java:863)
            at org.jboss.mq.server.BasicQueue$RestoreMessageTask.run(BasicQueue.java:902)
            at org.jboss.mq.pm.TxManager.addPostCommitTask(TxManager.java:121)
            at org.jboss.mq.server.BasicQueue.acknowledge(BasicQueue.java:453)
            at org.jboss.mq.server.BasicQueue.nackMessages(BasicQueue.java:499)
            at org.jboss.mq.server.JMSQueue.nackMessages(JMSQueue.java:73)
            at org.jboss.mq.server.ClientConsumer.close(ClientConsumer.java:200)
            at org.jboss.mq.server.JMSDestinationManager.connectionClosing(JMSDestinationManager.java:550)
            at org.jboss.mq.server.JMSServerInterceptorSupport.connectionClosing(JMSServerInterceptorSupport.java:112)
            at org.jboss.mq.security.ServerSecurityInterceptor.connectionClosing(ServerSecurityInterceptor.java:61)
            at org.jboss.mq.server.TracingInterceptor.connectionClosing(TracingInterceptor.java:158)
            at org.jboss.mq.server.JMSServerInvoker.connectionClosing(JMSServerInvoker.java:114)
            at org.jboss.mq.il.oil.OILServerILService$Client.run(OILServerILService.java:402)
            at java.lang.Thread.run(Thread.java:534)

            • 3. Re: Sql Exception when sending messages
              Adrian Brock Master

              The update happens to set the redelivered flag
              on the message when it is nacked.
              Is there any more information on why it can't run
              this sql?

              Regards,
              Adrian

              • 4. Re: Sql Exception when sending messages
                Christian Neuroth Newbie

                Hi!

                At the moment, I have no idea. I checked the sources (JBoss3.2.2RC3) and took the sql command which leads to the exception. When invoked from a small db client, it works and returns 1 for rc....

                The same statement is executed inside of the JBoss....

                Thanks

                Christian

                System.out.println ("Test 1: *********");
                Statement stmt = con.createStatement();
                int rc = stmt.executeUpdate("UPDATE worker_test..JMS_MESSAGES SET MESSAGEBLOB='murx' WHERE MESSAGEID=101 AND DESTINATION='Q'");
                System.out.println ("rc= "+rc);

                System.out.println ("");
                System.out.println ("Test 2: *********");
                PreparedStatement pStmt = con.prepareStatement("UPDATE worker_test..JMS_MESSAGES SET MESSAGEBLOB=? WHERE MESSAGEID=? AND DESTINATION=?");


                byte[] messageAsBytes = new byte[10];
                for (int i=0; i<9; i++)
                messageAsBytes = new Integer(i * 2).byteValue();
                ByteArrayInputStream bais = new ByteArrayInputStream(messageAsBytes);
                pStmt.setBinaryStream(1, bais, messageAsBytes.length);
                //pStmt.setBinaryStream(1, null, 0);
                pStmt.setLong(2, 101);
                pStmt.setString(3, "Q");
                int rc2 = pStmt.executeUpdate();
                System.out.println ("rc2= "+rc2);