Discussions

EJB design: Local Beans + Invoking Error

  1. Local Beans + Invoking Error (5 messages)

    Hi,

    I have developed a simple HelloWorld EJB using JBuilder 9.0 and Weblogic 8.1.
    When I try to invoke it it gives me the error :-

    javax.naming.LinkException: . Root exception is javax.naming.NameNotFoundException: remaining name: /app/ejb/HelloWorld.jar#HelloWorldBean/local-home

    at weblogic.j2eeclient.SimpleContext.resolve(SimpleContext.java:35)

    ........


    Client code :-

    Context ctx = getInitialContext("t3://localhost:7001", "weblogic", "weblogic");
    ....
    static Context getInitialContext(String url, String user, String password) {
         try{
           Properties h = new Properties();
           h.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
           h.put(Context.PROVIDER_URL, url);
           h.put(Context.SECURITY_PRINCIPAL, user);
           h.put(Context.SECURITY_CREDENTIALS, password);
           return new InitialContext(h);
         }catch(Exception e) {System.out.println("Error in getInitialContext" + e); return null;}
      }

    Can u please help me to solve this problem. I tried with Remote it works.

    Thanks,

    Samsidd

    Threaded Messages (5)

  2. Remote Clients aren't local![ Go to top ]

    Local interfaces are for use by beans co-located in the same EJB container, and allows them to be used without the distributed object protocol overhead - You probably want to have a facade bean exposing a remote interface then the facade bean calls your other beans via their local interfaces.
  3. My Client is local[ Go to top ]

    hi,

    I wanted a local client or any application to test the local interface ie, local bean. How should i modify my client code to call the local interface.

    Thanks,

    Samsidd
  4. Test options[ Go to top ]

    Ah - now we're getting to the tricky stuff! :-)

    The two approaches that I know involves either
    [1] getting your test-cases on to the AppServer, e.g. JunitEE (http://www.junitee.org) or Cactus (http://jakarta.apache.org/cactus/), or
    [2] running them within an app-server simulator, e.g, Glider (http://www.ensemble-systems.com/glider/)

    The 1st two are open-source, while the 2nd is commercial, but definately worth a look.
  5. Add a jsp file invoking your current client code and package that as a War along with the EJB as a complete EAR and deploy. The local EJB home would be only accessible within the application context and not outisde of the application as in Remote EJBs.
  6. It worked[ Go to top ]

    Hi,

    I created a EAR file having my client file , WAR file and the JAR file of EJBS.
    Then my client code was able to access the Beans locally.
    Thanks for everything.

    samsidd