Discussions

EJB design: problem looking up an ejb local interface

  1. problem looking up an ejb local interface (1 messages)

    Hi,

    I am newbie in ejb. I'm calling an ejb local interface and getting an exception (BEA WLS 8.1):
    ** Unable to connect to the server at:
    javax.naming.LinkException: [Root exception is ...

    How can I fix this problem?
    Thanks for the help.
    Wolfgang

    The client code:
    Properties p = new Properties(); p.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
    Context ctx = new InitialContext(p);
    StudentLocalHome localHome = (StudentLocalHome) ctx.lookup("StudentLocalEJB");

    The ejb-jar.xml:
    <ejb-jar>
      <enterprise-beans>
        <entity>
          <ejb-name>StudentEJB</ejb-name>
          <local-home>com.pro.StudentLocalHome</local-home>
          <local>com.pro.StudentLocal</local>
          <ejb-class>com.pro.StudentBean</ejb-class>
    ...
    </ejb-jar>

    The weblogic-ejb-jar.xml:
    <weblogic-ejb-jar>
      <weblogic-enterprise-bean>
        <ejb-name>StudentEJB</ejb-name>
    ...
        <local-jndi-name>StudentLocalEJB</local-jndi-name>
      </weblogic-enterprise-bean>
    </weblogic-ejb-jar>
  2. The fact that there is no address for the server after the colon in your exception trace leads me to believe that you need to put in the property value for Context.PROVIDER_URL in your Porperties object to initialize the InitialContext. Try this - it may well solve your problem.