facebook

Trying to run simple ejb3 example on weblogic

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #285509 Reply

    abdul123
    Member

    Hi Guys, can anyone help me here on this simple proble… I created three jave files to understand stateless EJBs, the files are

    package com.myeclipse.ejb3;

    import javax.ejb.Remote;

    @Remote

    public interface HelloUser {
    public void sayHello(String name);
    }

    ==============================================================

    package com.myeclipse.ejb3;

    import javax.ejb.Stateless;
    @Stateless(mappedName=”HelloUser”)
    public class HelloUserBean implements HelloUser {
    public void sayHello(String name) {
    System.out.println(“Hello ” + name + ” welcome to EJB 3 In Action!”);
    }
    }

    ==============================================================
    // and the client class
    package com.myeclipse.ejb3;

    import javax.ejb.EJB;
    import javax.naming.*;

    public class HelloUserClient {

    private static HelloUser helloUser;

    public static void main(String[] args) {
    System.out.println(“Invoking EJB”);

    try
    {
    Context ctx = new InitialContext();
    helloUser = (HelloUser) ctx.lookup(“HelloUser#com.myeclipse.ejb3.HelloUser”);

    helloUser.sayHello(“Curious George”);
    System.out.println(“Invoked EJB successfully .. see server console for output”);
    }
    catch (Exception e)
    {
    e.printStackTrace();
    }
    }
    }
    ==================================
    when I created an EJB3 project in myeclipse, and run this client after deploying it to Weblogic 10, I am getting this o/p

    javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
    at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)

    Can you tell what’s going wrong here, I haven’t created any other file except these three …am I missing anything here…..

    #285542

    Loyal Water
    Member

    Were you able to get this project to work?
    http://www.myeclipseide.com/documentation/quickstarts/ejb3/

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Trying to run simple ejb3 example on weblogic

You must be logged in to post in the forum log in