当前位置: 代码迷 >> Java Web开发 >> 不知道错在哪里?
  详细解决方案

不知道错在哪里?

热度:215   发布时间:2008-01-04 15:10:58.0
不知道错在哪里?
package service;


import User.User;

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import com.ibatis.dao.client.DaoException;
import java.sql.SQLException;
import javax.xml.rpc.ServiceException;
/**
*
* @author Administrator
*/
public class  UserService {
    private static User user = new User();
   
    public static User login(String UserCode, String UserPwd) throws DaoException, SQLException, ServiceException{
        return checkSystemUser(UserCode,UserPwd);
    }
   
    private static  User checkSystemUser(String UserCode,String UserPwd) throws DaoException, SQLException, ServiceException
    {
        User loginUser = UserService.getUserByCode(UserCode);
        if(loginUser==null)
            throw new ServiceException("用户不存在");
        String pwd=loginUser.getUserPwd();
        if(UserPwd.compareTo(pwd)!=0)
            throw new ServiceException("密码不正确");
        return loginUser;         
    }
   
    private static User getUserByID(int id) throws DaoException, SQLException, ServiceException
    {
        User loginUser=user.findById(id);        
        if(loginUser==null)
            throw new ServiceException("用户没有找到");
        return loginUser;
        
    }
   
    private static User getUserByCode(String UserCode) throws DaoException, SQLException, ServiceException
    {
         User loginUser=user.findById(UserCode);         
         if(loginUser==null)
             throw new ServiceException("用户不存在");
         return loginUser;
    }
}


这是我项目里面的一个文件,搞不懂为什么红色部分总提示出错?
----------------解决方案--------------------------------------------------------
java.lang.ExceptionInInitializerError
提示这个错
----------------解决方案--------------------------------------------------------
private change into public

or  evict   the keyword static
----------------解决方案--------------------------------------------------------
private 不能和 static同时放在一起吧
----------------解决方案--------------------------------------------------------
谢谢
----------------解决方案--------------------------------------------------------
问题
不能这样新建对象吧!!
----------------解决方案--------------------------------------------------------
这个类不能用静态实例化吧。。。。。
----------------解决方案--------------------------------------------------------
去掉static
----------------解决方案--------------------------------------------------------
  相关解决方案