----- Original Message ----- From: Mircea Moisei To: A mailing list about Java Server Pages specification and reference Sent: Thursday, November 30, 2000 1:32 PM Subject: How to call a remote EJBean from a Servlet/JSP using j2ee server Hi all, I'm back. I think something is wrong somewhere. Let me explain what I'm trying to achieve. Reading thru Writing Enterprise Application with J2EE(Monica Pawlan, Sept 27th 2000 ) I build the very first example with CalcBean. After I run in locally(localhost) using j2ee server from Sun I tried to deploy the bean to a different machine. I renamed the JNDI name for the one was locally deployed. I've redeployed the application made from a web tier( on single Servlet and one single html file) and the unused session stateless bean on my machine. I've created a second application made only from the bean described above and I deployed on the second machine. The JNDI name for second one is "calcs". When I'm trying to run it the lookup fails - the name "calcs" given to the second bean is not visible. (javax.naming.NameNotFoundException: calcs not found) Here is the init method where it fails. public void init(ServletConfig config) throws ServletException{ //Look up home interface try { //InitialContext ctx = new InitialContext(); //new code Properties p = new Properties(); p.put(Context.PROVIDER_URL, "iiop://ddd.ddd.ddd.ddd:1050"); InitialContext ctx = new InitialContext(p); Object objref = ctx.lookup("calcs"); homecalc = (CalcHome)PortableRemoteObject.narrow(objref, CalcHome.class); } catch (Exception NamingException) { NamingException.printStackTrace(); throw new ServletException( NamingException ); } } An additional test I've replace ddd.ddd.ddd.ddd with my IP address and rename calcs with the name of the "local" EJB and it worked just fine. I have now some doubts about some security issues(policies) that I have to take care of. If anyone had ever a similar problem, please give me a hint to move on. Thanks. Regards, Mircea From: "Mark Wutka" <[EMAIL PROTECTED]> To: "Mircea Moisei" <[EMAIL PROTECTED]> Sent: Wednesday, November 29, 2000 5:02 PM Subject: Re: How to call EJBean from JSP? > > You need to set up the provider URL for your naming service. You can set > it two ways. First, you can set a system property called > java.naming.provider.url. The URLs vary for different servers. If you're > using Sun's reference implementation I *think* the parameter is: > -Djava.naming.provider.url=iiop://yourejbhostname:1049 > > You can also set the parameter when you create the InitialContext, and for > a JSP that's probably your best bet since it's not always easy to set > system properties for the JSP server. Do something like this: > > Properties p = new Properties(); > p.put(Context.PROVIDER_URL, "iiop://yourejbhostname:1049"); > > Context ctx = new InitialContext(p); > > If you're using weblogic, the URL is t3://yourejbhostname:7001 > Mark > > On Wed, 29 Nov 2000, Mircea Moisei wrote: > > > This is working when both are on the same machine what about when the jsp is > > running on a web tier and the ejb itself is deployed on different machine. > > How do I connect my jsp with the ejb. > > I've try using j2ee server but is not working. > > Regards, > > Mircea > > > > -- > =Servlets =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.html http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets