3 Replies Latest reply on Jul 11, 2006 5:50 AM by manik

    complex object problem

    bingbingbing

      i use the jalapeno and want to test the example code(Person and Address).I configured Person and Address in jboss-aop.xml and use the example replSync-service.xml as configuration file.
      then in my testcase the code is something like:
      System.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.jboss.cache.transaction.DummyContextFactory");
      DummyTransactionManager.getInstance();

      Properties prop = new Properties();
      prop.put(Context.INITIAL_CONTEXT_FACTORY,"org.jboss.cache.transaction.DummyContextFactory");
      UserTransaction tx = (UserTransaction) new InitialContext(prop).lookup("UserTransaction");

      PojoCache tree = new PojoCache();
      PropertyConfigurator config = new PropertyConfigurator();
      config.configure(tree,".\\jboss-cache\\etc\\META-INF\\replSync-service.xml");

      Person joe = new Person();
      joe.setName("Joe Black");
      joe.setAge(31);

      Address addr = new Address();
      addr.setCity("Sunnyvale");
      addr.setStreet("123 Albert Ave");
      addr.setZip(94086);

      joe.setAddress(addr);



      tree.startService();
      tree.putObject("/aop/joe", joe);

      And i run my junit-testcase and get following exceptions:
      2006-07-06 17:11:03,660 [main] INFO org.jboss.cache.TreeCache - parseConfig(): PojoCacheConfig is empty
      2006-07-06 17:11:03,801 [main] ERROR org.jboss.cache.transaction.DummyTransaction - beforeCompletion() failed for tx=org.jboss.cache.transaction.DummyTransaction@baa466, handlers=[TxInterceptor.LocalSynchronizationHandler(gtx=GlobalTransaction:<10.1.18.140:3348>:1, tx=org.jboss.cache.transaction.DummyTransaction@baa466)]
      java.lang.RuntimeException:
      at org.jboss.cache.interceptors.TxInterceptor$LocalSynchronizationHandler.beforeCompletion(TxInterceptor.java:1083)
      at org.jboss.cache.interceptors.OrderedSynchronizationHandler.beforeCompletion(OrderedSynchronizationHandler.java:75)
      at org.jboss.cache.transaction.DummyTransaction.notifyBeforeCompletion(DummyTransaction.java:247)
      at org.jboss.cache.transaction.DummyTransaction.commit(DummyTransaction.java:54)
      at org.jboss.cache.transaction.DummyBaseTransactionManager.commit(DummyBaseTransactionManager.java:61)
      at org.jboss.cache.aop.PojoCache.endTransaction(PojoCache.java:693)
      at org.jboss.cache.aop.PojoCache.putObject(PojoCache.java:483)
      at org.jboss.cache.aop.PojoCache.putObject(PojoCache.java:422)
      at com.cycos.jcl.message.TestCache.testPlainCache(TestCache.java:160)
      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:324)
      at junit.framework.TestCase.runTest(TestCase.java:154)
      at junit.framework.TestCase.runBare(TestCase.java:127)
      at junit.framework.TestResult$1.protect(TestResult.java:106)
      at junit.framework.TestResult.runProtected(TestResult.java:124)
      at junit.framework.TestResult.run(TestResult.java:109)
      at junit.framework.TestCase.run(TestCase.java:118)
      at junit.framework.TestSuite.runTest(TestSuite.java:208)
      at junit.framework.TestSuite.run(TestSuite.java:203)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
      Caused by: java.io.StreamCorruptedException: invalid stream header
      at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:737)
      at java.io.ObjectInputStream.(ObjectInputStream.java:253)
      at org.jboss.invocation.MarshalledValueInputStream.(MarshalledValueInputStream.java:60)
      at org.jboss.cache.marshall.VersionAwareMarshaller.objectFromByteBuffer(VersionAwareMarshaller.java:176)
      at org.jgroups.blocks.RpcDispatcher.handle(RpcDispatcher.java:232)
      at org.jgroups.blocks.RequestCorrelator.handleRequest(RequestCorrelator.java:604)
      at org.jgroups.blocks.RequestCorrelator.receiveMessage(RequestCorrelator.java:504)
      at org.jgroups.blocks.RequestCorrelator.receive(RequestCorrelator.java:327)
      at org.jgroups.blocks.MessageDispatcher$ProtocolAdapter.up(MessageDispatcher.java:701)
      at org.jgroups.JChannel.up(JChannel.java:1049)
      at org.jgroups.stack.ProtocolStack.up(ProtocolStack.java:376)
      at org.jgroups.stack.ProtocolStack.receiveUpEvent(ProtocolStack.java:392)
      at org.jgroups.stack.Protocol.passUp(Protocol.java:538)
      at org.jgroups.protocols.pbcast.STATE_TRANSFER.up(STATE_TRANSFER.java:137)
      at org.jgroups.stack.UpHandler.run(Protocol.java:59)
      2006-07-06 17:11:03,801 [main] ERROR org.jboss.cache.transaction.DummyTransaction - afterCompletion() failed for org.jboss.cache.aop.PojoTxSynchronizationHandler@1343ed0
      java.lang.NullPointerException
      at org.jboss.cache.aop.PojoTxSynchronizationHandler.runRollbackPhase(PojoTxSynchronizationHandler.java:66)
      at org.jboss.cache.aop.PojoTxSynchronizationHandler.afterCompletion(PojoTxSynchronizationHandler.java:50)
      at org.jboss.cache.transaction.DummyTransaction.notifyAfterCompletion(DummyTransaction.java:270)
      at org.jboss.cache.transaction.DummyTransaction.commit(DummyTransaction.java:64)
      at org.jboss.cache.transaction.DummyBaseTransactionManager.commit(DummyBaseTransactionManager.java:61)
      at org.jboss.cache.aop.PojoCache.endTransaction(PojoCache.java:693)
      at org.jboss.cache.aop.PojoCache.putObject(PojoCache.java:483)
      at org.jboss.cache.aop.PojoCache.putObject(PojoCache.java:422)
      at com.cycos.jcl.message.TestCache.testPlainCache(TestCache.java:160)
      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:324)
      at junit.framework.TestCase.runTest(TestCase.java:154)
      at junit.framework.TestCase.runBare(TestCase.java:127)
      at junit.framework.TestResult$1.protect(TestResult.java:106)
      at junit.framework.TestResult.runProtected(TestResult.java:124)
      at junit.framework.TestResult.run(TestResult.java:109)
      at junit.framework.TestCase.run(TestCase.java:118)
      at junit.framework.TestSuite.runTest(TestSuite.java:208)
      at junit.framework.TestSuite.run(TestSuite.java:203)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
      2006-07-06 17:11:03,816 [main] WARN org.jboss.cache.TreeCache - PojoCache.endTransaction(): rolling back transaction with exception: javax.transaction.RollbackException: outcome is false status: 1

      So i can not put one complex object in the cache.Please help me!

      Thanks!

        • 1. Re: complex object problem
          bingbingbing

          And when i use sourceRelative("aop.bsh"); in the BeanShell,it works fine only can not properly work under my junit-testcase in eclipse.

          best regards

          • 2. Re: complex object problem

             

            "bingbingbing" wrote:
            Caused by: java.io.StreamCorruptedException: invalid stream header
            at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:737)
            at java.io.ObjectInputStream.<init>(ObjectInputStream.java:253)
            at org.jboss.invocation.MarshalledValueInputStream.<init>(MarshalledValueInputStream.java:60)
            at org.jboss.cache.marshall.VersionAwareMarshaller.objectFromByteBuffer(VersionAwareMarshaller.java:176)
            at org.jgroups.blocks.RpcDispatcher.handle(RpcDispatcher.java:232)


            I think this is the culprit when you run the test case under Eclipse (and if you run it from command line, I think it will work actually). Can you try to add this sysmtem property?

            -Dserialization.jboss=false

            This will disable the jboss serialization to see that is the root cause?



            • 3. Re: complex object problem
              manik

              which version of Jalapeno were you using? Beta1, Beta2, CR1 or CR2?