rd.forward(request,response) que me trae loco

ruben
20 de Julio del 2005
protected void processRequest(HttpServletRequest request,

HttpServletResponse response)
throws ServletException, IOException {

Context contexto = null;
Context contexto2 = null;
iTicketHome miHome = null;
proAlmacenHome miHome2 = null;
String nid =request.getParameter("nid");
String cantidad=request.getParameter("cantidad");
try
{
contexto = new InitialContext();
Object objetoGenerico = contexto.lookup("ticketejb");
miHome = (iTicketHome)

PortableRemoteObject.narrow(objetoGenerico,iTicketHome.class);
iTicket ejbGestorTicket = miHome.create();
Integer nidi=Integer.valueOf(nid);
ticketcmp

ticket=ejbGestorTicket.recuperaticketPorId2(nidi);
String nref=ticket.getNref();

if (ticket==null){

}else{
ticket.remove();

RequestDispatcher rd =

getServletContext().getNamedDispatcher("servletcantidad");
if (rd == null){

}
String vector= request.getParameter("nid");
request.setAttribute("nref",nref);

request.setAttribute("cantidad",cantidad);


************************************************************

rd.forward(request,response);



************************************************************

getServletConfig().getServletContext().getRequestDispatcher("/cajanorma

l2.jsp").forward(request, response);

}

}
catch(Exception e) {


e.printStackTrace();
}


}

hola tengo ese servletk elimina un ticket y quiero que una vez

eliminado m vaya al servletcantidad para operar con la cantidad sumar o

restar segun el caso pero cuadno llego al rd.froward(request,reponse)

error como sigue:

java.rmi.RemoteException: nested exception is:

java.lang.NullPointerException; nested exception is:
java.lang.NullPointerException
at

com.sun.enterprise.iiop.POAProtocolMgr.mapException(POAProtocolMgr.java

:389)
at

com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:431)
at

ejbalmacen.AlmacenbeanBean_PM_RemoteHomeImpl.findByPrimaryKey(Almacenbe

anBean_PM_RemoteHomeImpl.java:61)
at ejbalmacen._AlmacenbeanHome_Stub.findByPrimaryKey(Unknown

Source)
at servletcantidad.processRequest(servletcantidad.java:67)
at servletcantidad.doGet(servletcantidad.java:109)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at

org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispat

cher.java:683)
at

org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDis

patcher.java:403)
at

org.apache.catalina.core.ApplicationDispatcher.access$0(ApplicationDisp

atcher.java:359)
at

org.apache.catalina.core.ApplicationDispatcher$PrivilegedForward.run(Ap

plicationDispatcher.java:130)
at java.security.AccessController.doPrivileged(Native Method)
at

org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispa

tcher.java:347)
at servletTicketE.processRequest(servletTicketE.java:90)
at servletTicketE.doGet(servletTicketE.java:118)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at

org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet

.java:446)
at

org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:1

80)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at

org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applic

ationFilterChain.java:247)
at

org.apache.catalina.core.ApplicationFilterChain.access$0(ApplicationFil

terChain.java:197)
at

org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilter

Chain.java:176)
at java.security.AccessController.doPrivileged(Native Method)
at

org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFil

terChain.java:172)
at

org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVal

ve.java:243)
at

org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.j

ava:566)
at

org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:

472)
at

org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at

org.apache.catalina.core.StandardContextValve.invoke(StandardContextVal

ve.java:201)
at

org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.j

ava:566)
at

org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.j

ava:246)
at

org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.j

ava:564)
at

org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:

472)
at

org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at

org.apache.catalina.core.StandardContext.invoke(StandardContext.java:23

43)
at

org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.jav

a:164)
at

org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.j

ava:566)
at

org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherV

alve.java:170)
at

org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.j

ava:564)
at

org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.jav

a:170)
at

org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.j

ava:564)
at

org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java

:368)
at

org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.j

ava:564)
at

org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:

472)
at

org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at

org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve

.java:174)
at

org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.j

ava:566)
at

org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:

472)
at

org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at

org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.

java:1012)
at

org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java

:1107)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.lang.NullPointerException
at

com.sun.ejb.persistence.PartitionImpl$PersistentKey.hashCode(PartitionI

mpl.java:501)
at java.util.HashMap.hash(HashMap.java:261)
at java.util.HashMap.get(HashMap.java:317)
at

com.sun.ejb.persistence.PartitionImpl.ejbFindByPrimaryKey(PartitionImpl

.java:710)
at

ejbalmacen.AlmacenbeanBean_PM.ejbFindByPrimaryKey(AlmacenbeanBean_PM.ja

va:203)
at

ejbalmacen.AlmacenbeanBean_PM_RemoteHomeImpl.findByPrimaryKey(Almacenbe

anBean_PM_RemoteHomeImpl.java:56)
... 52 more

tengo que decir que si quito el forward el ticket se elimina y m

redirije de nuevo a donde quiero eso si sin ir al servlet pero si lo

pongo error a ver si alguien sabe decirme que puede ser muchas gracias