Hi Rupesh,

I'm trying to do same thing and gettign same problem.
Could you help me where i'm making mistake?

Here is more info:

IN EJB-JAR.XML
    <session>
      <ejb-name>UserFacadeLocalEJB</ejb-name>

<local-home>com.cgmp.esm.useradmin.ejb.UserFacadeLocalHome</local-home>
      <local>com.cgmp.esm.useradmin.ejb.UserFacadeLocal</local>
      <ejb-class>com.cgmp.esm.useradmin.ejb.UserFacadeLocalEJB</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
    </session>

IN WEBLOGIC-EJB-JAR.XML

  <weblogic-enterprise-bean>
    <ejb-name>UserFacadeLocalEJB</ejb-name>
    <local-jndi-name>esm/UserFacadeLocalEJB</local-jndi-name>
  </weblogic-enterprise-bean>

IN WEB.XML

  <ejb-local-ref>
    <ejb-ref-name>ejb/local/UserFacadeLocalEJB</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <local-home>com.cgmp.esm.useradmin.ejb.UserFacadeLocalHome</local-home>
    <local>com.cgmp.esm.useradmin.ejb.UserFacadeLocal</local>
    <ejb-link>UserFacadeLocalEJB</ejb-link>
  </ejb-local-ref>


IN WEBLOGIC.XML

  <reference-descriptor>
    <ejb-reference-description>
      <ejb-ref-name>ejb/local/UserFacadeLocalEJB</ejb-ref-name>
      <jndi-name>esm/UserFacadeLocalEJB</jndi-name>
    </ejb-reference-description>
  </reference-descriptor>


IN SERVLET

        ejbHome =
EJBLocalHome)context.lookup("java:comp/env/ejb/local/UserFacadeLocalEJB");
                // EXCEPTION : NamingException

        ejbHome = EJBLocalHome)context.lookup("/ejb/local/UserFacadeLocalEJB");
                // EXCEPTION : NamingException

        ejbHome = EJBLocalHome)context.lookup("/esm/UserFacadeLocalEJB");
                // SUCCESSFUL
regards
Deepak

-----Original Message-----
From: A mailing list for Enterprise JavaBeans development
[mailto:[EMAIL PROTECTED]]On Behalf Of Rupesh
Sent: Wednesday, April 17, 2002 12:40 PM
To: [EMAIL PROTECTED]
Subject: Re: ENC lookup problems


If you need to do a lookup with "java:comp/env/ejb/MyAdminHome", then you
need to define an ejb-ref for the desired bean.

Where are you doing the lookup? If the lookup code is in another bean say
MyBean then in ejb-jar.xml, for MyBean you will need to add ejb-ref for
MyAdminHome.

Descriptor for this will bean will look like
    <session>
      <ejb-name>MyBean</ejb-name>
      <home>abc.cde.MybeanHome</home>
      <remote>abc.cde.MyBeanRemote</remote>
      <ejb-class>abc.cde.MyBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
      <ejb-ref>
         <description>No Description</description>
         <ejb-ref-name>ejb/MyAdminHome</ejb-ref-name>
        <ejb-ref-type>Entity</ejb-ref-type>
         <home>com.abc.xyz.ejb.MyAdminHome</local-home>
         <remote>com.abc.xyz.ejb.MyAdmin</local>
     </ejb-ref>
    </session>

If the home being looked up is local, then you will need to add
ejb-local-ref.

Then in weblogic-ejb-jar.xml, under "reference-descriptor", you will have to
specify which ref maps to which jndi name.

If the lookup code is in any web component, (jsp/Servlet) then you will need
to put the refs in web.xml similarly and another entry in weblogic.xml.

In java client, you can not lookup with "java:comp/env... " unless the
server has Application client container. Wl6.1 does not have this. So, You
will need to do a direct JNDI lookup for this purpose.

Regards,
Rupesh.

> Hi All ,
>
> I have a stateless session ejb which is NOT referencing any other ejbs. I
> just wish to perform a JNDI lookup via ENC and this is how I am doing it.
I
> have successfully deployed it on Weblogic 6.1 server.
>
> Context ctx = new InitialContext();
> Object obj = ctx.lookup("java:comp/env/ejb/MyAdminHome");//throws an
> Exception
>
> BUT
>
> Object obj = ctx.lookup("MyAdminHome");//works fine
> ....
> ....
>
>
> But it gives me an Exception saying
>
> Unable to resolve comp/env/ejb/SMProCardSpendAdminHome Resolved:
'comp/env'
> Unresolved:'ejb'
>
> The ejb-jar.xml looks like this
> <ejb-jar>
>     <enterprise-beans>
>         <session>
>         <ejb-name>MyAdminBean</ejb-name>
>         <home>com.abc.xyz.ejb.MyAdminHome</home>
>         <remote>com.abc.xyz.ejb.MyAdmin</remote>
>         <ejb-class>com.abc.xyz.ejb.MyAdminBean</ejb-class>
>         <session-type>Stateless</session-type>
>         <transaction-type>Container</transaction-type>
>      </session>
>     </enterprise-beans>
>  </ejb-jar>
>
> and the weblogic-ejb-jar.xml looks like this
>
> <weblogic-enterprise-bean>
>         <ejb-name>MyAdminBean</ejb-name>
>         <stateless-session-descriptor>
>                 <pool>
>
<max-beans-in-free-pool>100</max-beans-in-free-pool>
>
> <initial-beans-in-free-pool>5</initial-beans-in-free-pool>
>                 </pool>
>         </stateless-session-descriptor>
>     <jndi-name>MyAdminHome</jndi-name>
> </weblogic-enterprise-bean>
>
> Where am I faltering? Can anybody please point out? I saw the petstore
> weblogic deployment descriptor for the Customer session bean but couldnt
> understand how the ENC lookup was working there.
>
> - Rahul
>
>
===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff EJB-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to