Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

connecting from client aplication server to ejb server aplication

  Asked By: Cory    Date: Sep 12    Category: Java    Views: 966
  

connecting from client aplication server to ejb server aplication

the ip of my pc where i put server aplication and client aplication is :
10.126.14.208 and i connect by http://10.126.14.208:8100/pos
the name of my jar componen server is pos.jar
the name of my database is POSJ

now i make my client aplication(servlet+JSP) on 10.126.14.206

what is the code in order to connectiong client aplication from
10.126.14.206 to server aplication on 10.126.14.208

here is one the code of my client aplication


import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import javax.naming.*;
import java.util.*;
import com.pos.*;
import com.pos.customer.*;

public class SchedulerForShoppingCart extends HttpServlet {

protected void doGet(HttpServletRequest request, HttpServletResponse
response)
throws ServletException, IOException {
try {
InitialContext ic = new InitialContext();
ShoppingListHome home = (ShoppingListHome)
ic.lookup("java:comp/env/ejb/ShoppingListSession");
ShoppingList remote = home.create();

// Hapus keranjang belanja yang tidak aktif selama dua jam.
// Metode berikut akan menghapus keranjang belanja.
remote.removeOldShoppingList();
}
catch (Exception e) {
log(e.getMessage());
}
}

}

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Raul Clark     Answered On: Sep 12

generally spoken to have two remote JAVA application communicating
together you have to use RMI/IIOP protocol (you might start with
tutorial at Sun site - http://java.sun.com/docs/books/tutorial/rmi/).
The RMI/IIOP communication happens as well in J2EE world, it is just
provided automatically by your application servers (if configured
properly).

So, I do believe that you either add an RMI code to your servlets and
you 'manually' connect to remote ejb  server, or you add your PC into
a cluster (using some administration tool of your application server)
with an EJB application server  and you modify the XML properties of
your client  and ejb applications, making the
application "distributed".

 
Answer #2    Answered By: Nixie Schmidt     Answered On: Sep 12

what is the meaning of distributed object?

 




Tagged: