1 Reply Latest reply on May 24, 2002 5:54 PM by Leila Tite

    CMP2-example UserTest fails

    Leila Tite Newbie

      Hi,
      I'm trying to get a working CMP2 example for JBoss 3.0RC2. I've been following the documentation, fixing things like old DTD references, renamed data fields in the ejb-jar.xml queries (orderStatus and ordernumber). I'm down to only one remaining failed JUnit test.
      Is there something else I need to set up from the default configuration in order for this test to work?
      Any help would be greatly appreciated.
      Thanks!
      leila@ieee.org

      The error is:

      test:
      [junit] java.lang.NullPointerException
      [junit] at org.jboss.proxy.ejb.EntityInterceptor.invoke(EntityInterceptor.java:104)
      [junit] at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
      [junit] at $Proxy3.isIdentical(Unknown Source)
      [junit] at org.jboss.docs.cmp2.commerce.UserTest.testAddCd(UserTest.java:76)
      [junit] at java.lang.reflect.Method.invoke(Native Method)
      [junit] at junit.framework.TestCase.runTest(TestCase.java:166)
      [junit] at junit.framework.TestCase.runBare(TestCase.java:140)
      [junit] at junit.framework.TestResult$1.protect(TestResult.java:106)
      [junit] at junit.framework.TestResult.runProtected(TestResult.java:124)
      [junit] at junit.framework.TestResult.run(TestResult.java:109)
      [junit] at junit.framework.TestCase.run(TestCase.java:131)
      [junit] at junit.framework.TestSuite.runTest(TestSuite.java:173)
      [junit] at junit.framework.TestSuite.run(TestSuite.java:168)
      [junit] at junit.framework.TestSuite.runTest(TestSuite.java:173)
      [junit] at junit.framework.TestSuite.run(TestSuite.java:168)
      [junit] at junit.textui.TestRunner.doRun(TestRunner.java:74)
      [junit] at junit.textui.TestRunner.start(TestRunner.java:234)
      [junit] at junit.textui.TestRunner.main(TestRunner.java:112)
      [junit] ......F.........
      [junit] Time: 12.147
      [junit] There was 1 failure:
      [junit] 1) testAddCd(org.jboss.docs.cmp2.commerce.UserTest)junit.framework.AssertionFailedError: Error in big old me
      thod:
      [junit] at org.jboss.docs.cmp2.commerce.UserTest.testAddCd(UserTest.java:106)
      [junit]
      [junit] FAILURES!!!
      [junit] Tests run: 15, Failures: 1, Errors: 0
      [junit]

        • 1. Re: CMP2-example UserTest fails
          Leila Tite Newbie

          The problem seems to be in the customer -> user relationship. After the line:
          customer.setUser(user);

          I added a line that does:
          assertNotNull("Customer-User ref should NOT be null", customer.getUser());

          which explains why the
          assertTrue(user.isIdentical(customer.getUser()));
          gets a null pointer reference.

          I haven't changed any of the ejb-jar.xml for user or customer, and it's still using the default Hypersonic Db. Why wouldn't it be setting up this relationship correctly?

          Thanks,
          Leila