求救。。我servlet有错误求各位大佬帮忙

gatx177 2011-06-15 10:15:23
HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

java.lang.NullPointerException
com.movie.action.newMovie.doGet(newMovie.java:30)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


配置路径无错。。一写到自己的方法就错

...全文
86 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
gatx177 2011-06-15
  • 打赏
  • 举报
回复
谢谢各位大叔大姐关心^^
飞跃颠峰 2011-06-15
  • 打赏
  • 举报
回复
其他朋友都很详细地解释了,我只给楼主提个建议:
以后遇到这样的问题,先自己分析下报错的地方,Exception通常把程序名和行号都报告出来了。

此外为了能更快让大家帮到你,尽量贴出关键代码,而且最好是带行号的,免得让大家还要数行数
Spring89 2011-06-15
  • 打赏
  • 举报
回复
我看了一下你的代码,产生java.lang.NullPointerException的代码99%出现在这里:
int product =Integer.getInteger(request.getParameter("product"));
看看这个product是不是写错了,页面上有没有这个!
还有1%可能产生java.lang.NullPointerException的代码是这里:
out.println(biz.CreateInitXml(imei, phonenum, product, platform, terminalinfo, did, action, key));
gatx177 2011-06-15
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 gatx177 的回复:]
代码
package com.movie.action;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.H……
[/Quote]
Source not found for ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 306 大佬太强了
meishichuichuifeng 2011-06-15
  • 打赏
  • 举报
回复
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

doPost(request, response);
}

这里要用this.doPost(request,response);
用this掉用dopost方法
Spring89 2011-06-15
  • 打赏
  • 举报
回复
newMovie第30行出现著名的java.lang.NullPointerException
你看下代码,你对一个null对象进行了操作,调用了它的方法,
故出现这个异常!debug或者把代码贴出来,这样问题就很好解决了!
gatx177 2011-06-15
  • 打赏
  • 举报
回复
代码
package com.movie.action;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.movie.biz.Initbiz;

public class Init extends HttpServlet {



/**
* Destruction of the servlet. <br>
*/


/**
* The doGet method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to get.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

doPost(request, response);
}

/**
* The doPost method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to post.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

String imei = request.getParameter("imei");
String phonenum = request.getParameter("phonenum");
int product =Integer.getInteger(request.getParameter("product"));
String platform = request.getParameter("platform");
String terminalinfo = request.getParameter("terminalinfo");
String version = request.getParameter("version");
String did = request.getParameter("did");
String action = request.getParameter("action");
String key = request.getParameter("key");
Initbiz biz = new Initbiz();
response.setContentType("text/xml");
PrintWriter out = response.getWriter();
out .println("<?xml version='1.0' encoding='UTF-8'?>");
out.println(biz.CreateInitXml(imei, phonenum, product, platform, terminalinfo, did, action, key));
out.flush();
out.close();
}

/**
* Initialization of the servlet. <br>
*
* @throws ServletException if an error occurs
*/


}
飞跃颠峰 2011-06-15
  • 打赏
  • 举报
回复
把newMovie.java第30行贴出来啊
火光闪耀 2011-06-15
  • 打赏
  • 举报
回复
java.lang.NullPointerException


你debug下,看看哪里是空的。也不知道你的代码,就只有这么给你说了。
gatx177 2011-06-15
  • 打赏
  • 举报
回复
求教啊!
gatx177 2011-06-15
  • 打赏
  • 举报
回复
求大侠帮忙谢谢

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧