当前位置:web 服务器 > Tomcat >>

用tomcat做web服务器,JSP开发一个网站,下载的源代码。总是出现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.wy.tool.JDBConnection.executeQuery(JDBConnection.java:52) com.wy.dao.ConsumerDao.getConsumerForm(ConsumerDao.java:98) com.wy.webiter.ConsumerServlet.checkConsumer(ConsumerServlet.java:169) com.wy.webiter.ConsumerServlet.doGet(ConsumerServlet.java:16) com.wy.webiter.ConsumerServlet.doPost(ConsumerServlet.java:186) javax.servlet.http.HttpServlet.service(HttpServlet.java:710) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) note The full stack trace of the root cause is available in the Apache Tomcat/6.0.14 logs.
追问:
        	
				
package com.wy.dao;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.*;

import com.wy.form.ConsumerForm;
import com.wy.tool.JDBConnection;

public class ConsumerDao {
	private JDBConnection connection = null;

	private ConsumerForm consumerForm = null;

	public ConsumerDao() {
		connection = new JDBConnection();
	}

	}
答案:数据库连接不对。你看看数据库名字和密码是否正确。还有看看数据库jar包,有没有。
其他:数据库没连接上吧 那不报JDBC的空指针吗 应该是你的JDBConnection这个类没有实例化

        Class.forName("com.mysql.jdbc.Driver");
        Connection conn = DriverManager.getConnection("jdbc:mysql://ip:port/sid", "username", "password");
        Statement st = conn.createStatement();
        ResultSet rs = st.executeQuery("select * from user");

看看你少哪句 把dao的代码粘出来看看 ConsumerDao这个类连数据库的时候有问题,你看看包和语句写错了 

上一个:jsp中怎样用正规式.test()验证一个String变量 请给出范例代码,感激不尽!
下一个:java相关的 省市级3级联动怎么实现啊 谢谢 帮助一下 要有源代码和JSP页面显示

Apache
IIS
Nginx
Tomcat
如果你遇到web 服务器难题:
请访问www.zzzyk.com 试试
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,