5 Replies Latest reply on Mar 10, 2005 9:37 AM by schoetz

    BLOB - CLOB issue

    schoetz

      I try to use CLOB field, but it does not work so far. I always get an exeption:

      14:29:16,428 INFO [STDOUT] javax.transaction.TransactionRolledbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=AC49113699/23, BranchQual=, localId=23] status=STATUS_NO_TRANSACTION; - nested throwable: (java.lang.ClassCastException: java.lang.String)
      14:29:16,428 INFO [STDOUT] at org.jboss.aspects.tx.TxSupport.endTransaction(TxSupport.java:220)
      14:29:16,428 INFO [STDOUT] at org.jboss.aspects.tx.TxSupport.invokeInOurTx(TxSupport.java:153)
      14:29:16,428 INFO [STDOUT] at org.jboss.aspects.tx.TxSupport$Required.serverInvoke(TxSupport.java:438)
      14:29:16,428 INFO [STDOUT] at org.jboss.aspects.tx.TxInterceptor.internalInvoke(TxInterceptor.java:112)
      14:29:16,428 INFO [STDOUT] at org.jboss.aspects.tx.TxInterceptor.invoke(TxInterceptor.java:60)
      14:29:16,428 INFO [STDOUT] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:66)
      14:29:16,438 INFO [STDOUT] at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:72)
      14:29:16,438 INFO [STDOUT] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:66)
      14:29:16,438 INFO [STDOUT] at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:36)
      14:29:16,438 INFO [STDOUT] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:66)
      14:29:16,438 INFO [STDOUT] at org.jboss.aspects.security.RoleBasedAuthorizationInterceptor.invoke(RoleBasedAuthorizationInterceptor.java:152)
      14:29:16,438 INFO [STDOUT] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:66)
      14:29:16,498 INFO [STDOUT] at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:80)
      14:29:16,498 INFO [STDOUT] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:66)
      14:29:16,498 INFO [STDOUT] at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:90)
      14:29:16,498 INFO [STDOUT] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:66)
      14:29:16,498 INFO [STDOUT] at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:165)
      14:29:16,518 INFO [STDOUT] at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:102)
      14:29:16,518 INFO [STDOUT] at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:74)
      14:29:16,518 INFO [STDOUT] at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:295)
      14:29:16,518 INFO [STDOUT] at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:169)
      14:29:16,518 INFO [STDOUT] at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:259)
      14:29:16,548 INFO [STDOUT] at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:308)
      14:29:16,548 INFO [STDOUT] at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:141)


      the tables in the databases are created with the correct data type.

      I'm useing the preview 4 of EJB 3.0 and PostgresSQL 8.0

      schoetz

        • 1. Re: BLOB - CLOB issue
          bill.burke

          I don't understand, you ran the Blob tutorial? Or, you modified it to do:


          @Lob(LobType.CLOB)
          public String getString()
          {
          ...
          }

          I only support java.sql.Clob and Blob types right now. String, char[], byte[], etc.. not supported yet.

          • 2. Re: BLOB - CLOB issue
            schoetz

            That's the point. I already found out, that it works if I use java.sql.Clob as type. But acording to the current spec String, char[] and Character[] should be also supported.

            But anyway thx for the fast answer.

            • 3. Re: BLOB - CLOB issue
              schoetz

              So there is an other issue about the CLOB thing. Now I got it working and the values are stored in the DB correctly. But if I try to read it from a remote client I get this exception:

              [java] Caused by: java.rmi.ConnectException: Failed to communicate. Problem during marshalling/unmarshalling; nested exception is:
              [java] java.io.EOFException
              [java] at org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:237)
              [java] at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:96)
              [java] at org.jboss.remoting.Client.invoke(Client.java:197)
              [java] at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:39)
              [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:66)
              [java] at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:44)
              [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:66)
              [java] at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:38)
              [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:66)
              [java] at org.jboss.aspects.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:32)
              [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:66)
              [java] at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:82)
              [java] ... 19 more
              [java] Caused by: java.io.EOFException
              [java] at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2502)
              [java] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1267)
              [java] at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
              [java] at org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.read(SerializableUnMarshaller.java:34)
              [java] at org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:215)
              [java] ... 30 more



              On the server-side is no exception thrown, so I think the CLOB has been send over network correctly, but the client can't interprete the stream correctly, because it contains an EOF somewhere in the text stream.

              schoetz

              • 4. Re: BLOB - CLOB issue
                bill.burke

                clobs are not Serializable. Also, I'm pretty sure that they cannot be used outside the context of a transaction. So, you'll have to do some fooling around like extracting the String when the setter is called.

                Apologies for not implementing Clob mapping for String yet.

                Bill

                • 5. Re: BLOB - CLOB issue
                  schoetz

                  No problem, but I hope they will come soon.