Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

JSP to EJB Communication

12 views
Skip to first unread message

Kishori Sharan

unread,
Oct 16, 2009, 5:44:41 PM10/16/09
to
Setup:
1. I have two EAServers running on two different machines.
2. One EAServer has many EJBs and PB components deployed.
3. Another EAServer has a web application
4. Using EAServer 4.2 and EJB 2.0 session beans

I want to access EJB and PB components on one server from another server
which runs web application. I am able to access PB components from a JSP.
However, I am not able to access EJB, which is on different server, from
JSP, which is not on teh same server as EJB.

Here is the code that I have tried in my JSP..
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
java.util.Properties p = new java.util.Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sybase.ejb.InitialContextFactory");
p.put(Context.PROVIDER_URL, server);
p.put(Context.SECURITY_PRINCIPAL, userId);
p.put(Context.SECURITY_CREDENTIALS, password);

// Now create an InitialContext that uses the properties
Context ctx = new InitialContext(p);
String compName = "SupportServices/XMLService";
java.lang.Object obj = ctx.lookup(compName);
XMLServiceHome home = (XMLServiceHome)PortableRemoteObject.narrow(obj,
XMLServiceHome.class);
XMLService xml = home.create();
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////

I am able to access EBJs, which run on the same server as JSP. I get the
following exception. I have also tried configuring EJB Ref for web
applicatio and using "java:comp/env/SupportServices/XMLService" format of
component name. It does not work either.


javax.naming.NamingException:
NotFound:java:comp/env/SupportServices/XMLService. Root exception is
javax.naming.NamingException: NotFound:SupportServices/XMLService. Root
exception is org.omg.CORBA.OBJECT_NOT_EXIST: minor code: 0 completed: No
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at java.lang.Class.newInstance0(Class.java:308)
at java.lang.Class.newInstance(Class.java:261)
at
com.sybase.CORBA.iiop.Connection.createSystemException(Connection.java:5238)
at com.sybase.CORBA.iiop.Connection.invoke(Connection.java:3602)
at com.sybase.CORBA.ObjectRef._is_a(ObjectRef.java:411)
at
com.sybase.ejb.CosNaming.NamingContextHelper.narrow(NamingContextHelper.java:33)
at com.sybase.ejb.NamingContext.lookup(NamingContext.java:734)
at com.sybase.ejb.NamingContext.parseServletData(NamingContext.java:877)
at com.sybase.ejb.NamingContext.lookupServletData(NamingContext.java:856)
at com.sybase.ejb.NamingContext.lookup(NamingContext.java:703)
at javax.naming.InitialContext.lookup(InitialContext.java:354)
at
com.sybase.jsp.webtestharness_0005fverify_0005feaserver_0005flogin$jsp._jspService(webtestharness_0005fverify_0005feaserver_0005flogin$jsp.java:106)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:268)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:461)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:553)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sybase.jaguar.servlet.JagServlet.service(JagServlet.java:657)
at
com.sybase.jaguar.servlet.JagRequestDispatcher.service(JagRequestDispatcher.java:922)
at com.sybase.jaguar.servlet.JagWebResource.service(JagWebResource.java:90)
at
com.sybase.jaguar.servlet.JagFilterChain.doFilter(JagFilterChain.java:131)
at com.sybase.jaguar.servlet.ServletEngine._service(ServletEngine.java:815)
at com.sybase.jaguar.servlet.ServletEngine.service(ServletEngine.java:357)
at
com.sybase.jaguar.servlet.ServletServiceImpl.doService(ServletServiceImpl.java:52)
at
com.sybase.jaguar.servlet._sk_JaguarServlet_ServletService.invoke(_sk_JaguarServlet_ServletService.java:151)

0 new messages