I have a question .
Suppose that from a tomee servlet inside a web application i would call a
ejb on another tomee instance .
I know that the code for call a remote EJB it is the following......
Properties p = new Properties();
p.put("java.naming.factory.initial",
"org.apache.openejb.client.RemoteInitialContextFactory");
p.put("java.naming.provider.url", "http://mytomeewebsite:8080/tomee/ejb");
// user and pass optional
p.put("java.naming.security.principal", "myuser");
p.put("java.naming.security.credentials", "mypass");
InitialContext ctx = new InitialContext(p);
MyBean myBean = (MyBean) ctx.lookup("MyBeanRemote");
*i know that for get the ctx is it is a expensive operation *.
SO i you ask :
1) the InitialContext i have to make it a field of Servlet ???????
2) the EJB remote i have to get it inside the method doFGet inside servlet
or it is a filed of servlet?
3) i know that the servlet it is multithreaded and for safety of
concurrence i have not create field into servlet -
4) the ctx i have to close it for each l operations or not?
pratically the process to get the InitialCOntext for get the ejb remote it
is a process at @PostCreate at servlet or it is a process that it is inside
a method called into the method
public void doGet (Request req, Response resp){
}
--
View this message in context:
http://openejb.979440.n4.nabble.com/get-initialContext-ctx-into-a-servlet-tp4669769.html
Sent from the OpenEJB User mailing list archive at Nabble.com.