0 Replies Latest reply on Nov 30, 2003 5:32 PM by martin0

    JNDI lookup woes

    martin0

      Hi,

      I have an EJB with a local interface deployed in jar J.
      I have a servlet that I want to give access to that EJB. My servlet is deployed in war W.

      I am getting a NamingException when I do the lookup of my EJB from my servlet.

      in my war web.xml I include: (yes it's Petstore)
      <ejb-local-ref>
      <ejb-ref-name>ejb/local/PurchaseOrder</ejb-ref-name>
      <ejb-ref-type>Entity</ejb-ref-type>
      <local-home>com.sun.j2ee.blueprints.purchaseorder.ejb.PurchaseOrderLocalHome</local-home>
      com.sun.j2ee.blueprints.purchaseorder.ejb.PurchaseOrderLocal
      <ejb-link>po-ejb.jar#PurchaseOrderEJB</ejb-link>
      </ejb-local-ref>

      The jar file J's ejb-jar.xml includes this:

      PurchaseOrder CMP EJB
      <display-name>PurchaseOrderEB</display-name>
      <ejb-name>PurchaseOrderEJB</ejb-name>
      <local-home>com.sun.j2ee.blueprints.purchaseorder.ejb.PurchaseOrderLocalHome</local-home>
      com.sun.j2ee.blueprints.purchaseorder.ejb.PurchaseOrderLocal
      <ejb-class>com.sun.j2ee.blueprints.purchaseorder.ejb.PurchaseOrderEJB</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.String</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>PurchaseOrder</abstract-schema-name>
      <cmp-field>
      <field-name>poId</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>poUserId</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>poEmailId</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>poDate</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>poLocale</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>poValue</field-name>
      </cmp-field>
      <primkey-field>poId</primkey-field>
      <ejb-local-ref id="EJBLocalRef_1">
      <ejb-ref-name>ejb/local/ContactInfo</ejb-ref-name>
      <ejb-ref-type>Entity</ejb-ref-type>
      <!-- CALLISTA CHANGE. WebSphere Technology for Developers "server visibility" problem. -->
      <local-home>com.sun.j2ee.blueprints.contactinfo.ejb.OpcContactInfoLocalHome</local-home>
      com.sun.j2ee.blueprints.contactinfo.ejb.ContactInfoLocal
      <ejb-link>ContactInfoEJB</ejb-link>
      </ejb-local-ref>
      <ejb-local-ref id="EJBLocalRef_2">
      <ejb-ref-name>ejb/local/Address</ejb-ref-name>
      <ejb-ref-type>Entity</ejb-ref-type>
      <!-- CALLISTA CHANGE. WebSphere Technology for Developers "server visibility" problem. -->
      <local-home>com.sun.j2ee.blueprints.address.ejb.OpcAddressLocalHome</local-home>
      com.sun.j2ee.blueprints.address.ejb.AddressLocal
      <ejb-link>AddressEJB</ejb-link>
      </ejb-local-ref>
      <ejb-local-ref id="EJBLocalRef_3">
      <ejb-ref-name>ejb/local/CreditCard</ejb-ref-name>
      <ejb-ref-type>Entity</ejb-ref-type>
      <!-- CALLISTA CHANGE. WebSphere Technology for Developers "server visibility" problem. -->
      <local-home>com.sun.j2ee.blueprints.creditcard.ejb.OpcCreditCardLocalHome</local-home>
      com.sun.j2ee.blueprints.creditcard.ejb.CreditCardLocal
      <ejb-link>CreditCardEJB</ejb-link>
      </ejb-local-ref>
      <ejb-local-ref id="EJBLocalRef_4">
      <ejb-ref-name>ejb/local/LineItem</ejb-ref-name>
      <ejb-ref-type>Entity</ejb-ref-type>
      <!-- CALLISTA CHANGE. WebSphere Technology for Developers "server visibility" problem. -->
      <local-home>com.sun.j2ee.blueprints.lineitem.ejb.OpcLineItemLocalHome</local-home>
      com.sun.j2ee.blueprints.lineitem.ejb.LineItemLocal
      <ejb-link>LineItemEJB</ejb-link>
      </ejb-local-ref>
      <security-identity>

      <use-caller-identity id="UseCallerIdentity_1"></use-caller-identity>
      </security-identity>


      <query-method id="QueryMethod_1">
      <method-name>findPOBetweenDates</method-name>
      <method-params>
      <method-param>long</method-param>
      <method-param>long</method-param>
      </method-params>
      </query-method>
      <ejb-ql>SELECT OBJECT(a) From PurchaseOrder a WHERE a.poDate BETWEEN ?1 AND ?2</ejb-ql>





      but the jboss.xml for the jar J includes this:

      <ejb-name>PurchaseOrderEJB</ejb-name>
      <local-jndi-name>com.sun.j2ee.blueprints.purchaseorder.ejb.PurchaseOrderLocalHome</local-jndi-name>


      I don't have a jboss-web.xml entry for the war file at present because I want to use name in the web.xml. However I don't understand the consequences of the local-jndi-name in jboss.xml

      Can anyone help?
      Thanks
      Martin