Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Oracle 9iAS, OC4J question regarding shared servlets/EJB's

Oracle 9iAS, OC4J question regarding shared servlets/EJB's

From: kshave <kshave_at_gov.mb.ca>
Date: 13 Sep 2001 12:13:48 -0700
Message-ID: <8cb78087.0109131113.baf2d49@posting.google.com>


We are deploying to the OC4J container. Below applications, we have two different contexts (LTC and REG).

Applications
+
--------LTC
+
--------REG We have a servlet that is in the LTC context which we would like to make a call to a servlet running in the REG context. When we make that call we receive the message java.lang.NullPointerException. As far as we know from talking to other people, it should be possible to do this, however, we are not having any luck in making it work. Perhaps something needs to be modified in one of the xml files, but the question is (What!).

An example of this would be nice, but we have not found anything that does this. All the examples out there seem to be calling their EJB Beans and Servlets all from within the same context. We want to get system specific in our breakdowns. Even a nice Hello World example in two different contexts would be nice.

A snapshot of the code that we are using:

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import java.lang.*;
import ClientRegistrySystemInfo;

public class LTC_ControllingServlet2 extends HttpServlet {

        
	public void init(ServletConfig config) throws ServletException

{
super.init(config); } public String getServletInfo()
{
return "LTC2"; } public void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
{
HttpSession session = req.getSession(true); String sStep = req.getParameter("STEP"); PrintWriter out = resp.getWriter(); resp.setContentType("text/html"); RequestDispatcher page = null; ServletContext context = getServletContext(); Enumeration en = context.getInitParameterNames(); while (en.hasMoreElements()) { String name = (String) en.nextElement(); Object value = context.getAttribute(name); } String sPhin = req.getParameter("sPhin"); req.setAttribute("sCarrier","1"); req.setAttribute("sGsas","PC"); req.setAttribute("sPhin",sPhin); RequestDispatcher dispatcher = null; // Call the REG Servlet in the REG context. try { this.getServletConfig().getServletContext().getContext("/REG").getRequestDispatcher("/REG_ControllingServlet?STEP=0").include(req,resp); } catch (Exception e) { out.println(e.getClass().getName() + " " + e.getMessage ()); e.printStackTrace(); } page = this.getServletContext().getRequestDispatcher("/JSP/LTC_ClientDisplayPage.jsp"); page.forward(req, resp);

    }
} Received on Thu Sep 13 2001 - 14:13:48 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US