Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB 3 Newbie

 
Jeffry Kristianto Yanuar
Ranch Hand
Posts: 759
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
    author & internet detective
    Marshal
    Posts: 34371
    345
    Eclipse IDE Java VI Editor
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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.
     
    Reza Rahman
    author
    Ranch Hand
    Posts: 580
    5
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
     
    Jeffry Kristianto Yanuar
    Ranch Hand
    Posts: 759
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
    Posts: 580
    5
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
    Posts: 759
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
    Posts: 580
    5
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Jeffry,

    Great! Many thanks...

    Reza
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic