SuReN
SuReN

Reputation: 341

NullPointerException exception at Websphere?

I have servlet call to another servlet Using PrintWriter .Unable to redirect particular target URL.My code is

PrintWriter pw= null;
pw= response.getWriter();
pw.print("URL TO Redirect");
pw.close();

Websphere SystemErrorLog:

java.lang.NullPointerException
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:485)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:301)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:275)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:557)
        at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:607)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:984)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1069)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1563)

Upvotes: 0

Views: 1233

Answers (1)

Konstantin Yovkov
Konstantin Yovkov

Reputation: 62884

pw.close; should be pw.close();.

Otherwise you're trying to access a non-private field, named close. And if such exists, it's possible it's null.

Apart from that, your code looks fine and the NPE reason is somewhere else.

Upvotes: 2

Related Questions