9 Replies Latest reply on Apr 24, 2002 3:13 PM by FSYU

    problems when reference external jar deployed on same app se

    CLaus Guttesen Newbie

      Hi.

      Have previously posted same question in forum 'persistence'. Sorry for cross-posting, but this is driving me nuts.

      I've deployed the cabin-example from Enterprise JavaBeans by Mr. Monson-Haefel. Creating the cabin-clients works great. Added the test-data without problems.

      When I execute the travelagent-client I'm able to get the jndi-ref. to the travelagent-bean. But the travelagent-bean can't get a reference to the cabin-bean.

      It gets the initial context,. I accessed the cabin-bean directly by a test-client, and got the desired result.

      Here is the output from jboss:

      [INFO,Default] Got context
      [ERROR,TravelAgentEJB] TRANSACTION ROLLBACK EXCEPTION:
      javax.transaction.TransactionRolledbackException: null; nested exception is:
      javax.ejb.EJBException
      ...

      part of TravelAgentBean.java:

      public String [] listCabins(int shipId, int bedCount) {
      try {
      // Get a naming context
      InitialContext jndiContext = new InitialContext();
      System.out.println("Got context");

      // Get a reference to the CabinBean bean
      Object obj = jndiContext.lookup("java:comp/env/ejb/CabinEJB");
      System.out.println("Got reference");

      CabinHomeRemote home = (CabinHomeRemote)
      PortableRemoteObject.narrow(obj, CabinHomeRemote.class);

      Part of ejb-jar.xml:


      <ejb-name>TravelAgentEJB</ejb-name>
      no.gnomeit.travelagent.TravelAgentHomeRemote
      no.gnomeit.travelagent.TravelAgentRemote
      <ejb-class>no.gnomeit.travelagent.TravelAgentBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
      <ejb-ref>
      <ejb-ref-name>CabinEJB</ejb-ref-name>
      <ejb-ref-type>Entity</ejb-ref-type>
      no.gnomeit.cabin.CabinHomeRemote
      no.gnomeit.cabin.CabinRemote
      </ejb-ref>

      par of jboss.xml:

      <ejb-name>TravelAgentEJB</ejb-name>
      <ejb-ref-name>CabinJEB</ejb-ref-name>
      <jndi-name>CabinEJB</jndi-name>

      When the jndiContext.lookup is empty (jndiContext.lookup("") the bean is able to continue, but does obviously not get any data back, since it doesn't know where to get it.

      I'm completely out of ideas on how to proceed, have even considered trying a commercial app server, just to see whether it's me or not.

      regards
      Claus