注册 登录
编程论坛 J2EE论坛

不知道错在哪里?

海蓝啸 发布于 2008-01-04 15:10, 1285 次点击
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((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;
    }
}


这是我项目里面的一个文件,搞不懂为什么红色部分总提示出错?
7 回复
#2
海蓝啸2008-01-04 15:12
java.lang.ExceptionInInitializerError
提示这个错
#3
黄袖标2008-01-04 16:37
private change into public

or  evict   the keyword static
#4
sea72008-01-04 21:07
private 不能和 static同时放在一起吧
#5
海蓝啸2008-01-07 08:51
谢谢
#6
wcbts5202008-01-29 17:46
问题
不能这样新建对象吧!!
#7
macrossyun2008-01-29 17:51
这个类不能用静态实例化吧。。。。。
#8
marer2008-01-31 11:27
去掉static
1