3 Replies Latest reply on Oct 28, 2003 2:51 PM by kuato

    No Nested InitalContext in jboss???

    kuato

      Hi.

      I'm just screwing around with Jboss and ran into a bit of a problem, well, not really a problem, just trying to see if this is a 'feature' a 'bug' or determine if my code is whacked.

      I deployed an EntityBean and then created a test program to test the entitybean. No worries, it looks up the bean name ok in the naming service, connects to the database, does some stuff....whatever.

      Now, when I go into the ejbCreate() method and add another

      InitialContext context = new InitialContext(props)

      I get a

      javax.ejb.CreateException: Could not obtain an InitialContext.

      Can you not nest these types of calls? Ie can you not call a bean that gets a context, that calls a bean that gets a context, that calls a bean that gets a context etc?

      The props in the testclient and the bean are identical as it was just a cut and paste job, so why is it failing to get the Context?


        • 1. Re: No Nested InitalContext in jboss???
          darranl

          Don't pass in the props when creating the InitialContext inside the bean.

          Only the client needs the properties.

          • 2. Re: No Nested InitalContext in jboss???
            kuato

            No love. Props or no props, the InitialContext is failing to be obtainted.

            Got to be something I'm missing. My bean is trying to call a sequenceBean who's responsibility is to check the database for the next available primary key.

            My test client obtains the Initialcontext alright, but when myBean tries to lookup my sequenceBean, it can't get the InitialContext.

            sigh








            • 3. Re: No Nested InitalContext in jboss???
              kuato

              found the problem, mySequenceBean ALSO called an InitialContext which I forgot to provide with props so I had actually 3 levels of nesting there. Case closed.