aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes EJB 3 Newbie Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB 3 Newbie" Watch "EJB 3 Newbie" New topic
Author

EJB 3 Newbie

Jeffry Kristianto Yanuar
Ranch Hand

Joined: Oct 01, 2007
Posts: 759
Hi friends, my name is Jeffry. I'm a newbie in EJB 3 technology.

I have few questions regarding invoking EJB session bean:

  • Can I invoke session bean through an independent Java swing application without running it inside the application client container ? If I can, how can I do that ?


  • Can I invoke session bean across the Internet ?


  • Your help will become a great contribution in my learning experience.

    Thanks before


    Jeffry Kristianto Yanuar (Java Instructor)
    SCJP 5.0 SCJA SCJD
    Jeanne Boyarsky
    internet detective
    Marshal

    Joined: May 26, 2003
    Posts: 30294
        
    150

    Jeffry,
    You can definitely call it from the Swing client. I'm not sure about over the internet. I know you can call it from a different machine. I don't know if it has to be on the same network. I think you can do it, but I'm not positive.

    The code varies a bit based on your server, but it basically looks like this example.


    [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
    Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
    Reza Rahman
    author
    Ranch Hand

    Joined: Feb 01, 2005
    Posts: 580
        
        5
    Jeffry,

    Take a look here: https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html. You may use either DI or look-ups in a Swing based standalone Java SE client.

    Remote EJB calls via RMI/JRMP (the default for most application servers and the most performance friendly choice) can be made across the Internet in theory. In practice, you will need to configure RMI HTTP/S tunneling since most routers block RMI ports: http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3954059#3954059. Note, I've never seen anyone trying to invoke EJB across a firewall via HTTP/RMI, so am not sure how it will work in practice. Remoting inside a firewall works very well.

    Hope it helps,
    Reza


    Independent Consultant — Author, EJB 3 in Action — Expert Group Member, Java EE 6 and EJB 3.1
    Jeffry Kristianto Yanuar
    Ranch Hand

    Joined: Oct 01, 2007
    Posts: 759
    Thanks Reza, actually I am learning EJB using your book titled "EJB 3 in Action". The book is very good. I think you should provide the sample code in Netbenas project. Using Netbeans to build a project is easier than invoking Ant method.



    Jeffry Kristianto Yanuar (Java Instructor) SCJP 5.0 SCJA SCJD
    Reza Rahman
    author
    Ranch Hand

    Joined: Feb 01, 2005
    Posts: 580
        
        5
    Jeffry,

    Thanks for the kind words. If you get a chance, please do consider posting a review on Amazon.com or elsewhere. It really helps us out.

    I am going to write on setting up EJB 3/Java EE 5 projects using Eclipse, NetBeans or Maven very soon. I am just very busy, so it is difficult to make time. I wish someone else would do some of it (hint, hint ;-)).

    Cheers,
    Reza
    Jeffry Kristianto Yanuar
    Ranch Hand

    Joined: Oct 01, 2007
    Posts: 759
    I'll post a review on Amazon when I have a time, I also very busy cause I need to teach EJB 3 soon. I am a Java Instructor in Java SE, ME, and EE (currently teaching Servlet and JSP).

    Thanks for replying and providing very good links. The "EJB 3 in Action" book become a primary contribution in my learning experience


    Thanks

    Jeffry Kristianto Yanuar (Java Instructor) SCJP 5.0 SCJA SCJD
    Reza Rahman
    author
    Ranch Hand

    Joined: Feb 01, 2005
    Posts: 580
        
        5
    Jeffry,

    Great! Many thanks...

    Reza
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: EJB 3 Newbie