But the ejb it is a field of servlet or the lokup it is only into metod
doGet ?
Il 31/mag/2014 19:49 "Romain Manni-Bucau [via OpenEJB]" <
[email protected]> ha scritto:

> Hi
>
> all works, basically depend how you configure security. Often you create
> the context in the init method and do the lookup and close the context in
> destroy one
>
>
>
> Romain Manni-Bucau
> Twitter: @rmannibucau
> Blog: http://rmannibucau.wordpress.com/
> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> Github: https://github.com/rmannibucau
>
>
> 2014-05-31 18:37 GMT+02:00 mauro2java2011 <[hidden email]
> <http://user/SendEmail.jtp?type=node&node=4669770&i=0>>:
>
> > 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.
> >
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://openejb.979440.n4.nabble.com/get-initialContext-ctx-into-a-servlet-tp4669769p4669770.html
>  To unsubscribe from get initialContext ctx into a servlet ., click here
> <http://openejb.979440.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4669769&code=bWF1cm8yamF2YTIwMTFAZ21haWwuY29tfDQ2Njk3Njl8LTExMTcxODc2MjU=>
> .
> NAML
> <http://openejb.979440.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: 
http://openejb.979440.n4.nabble.com/get-initialContext-ctx-into-a-servlet-tp4669769p4669775.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Reply via email to