static静态代码块加载配置文件时总是说错误。static {
ResourceBundle bundler = ResourceBundle.getBundle("db");// 加载配置文件(读取配置文件)
dbDriver = bundler.getString("db_driver");
dbUrl = bundler.getString("db_url");
dbUser = bundler.getString("db_user");
dbPswd = bundler.getString("db_pswd");
}
db_driver=com.mysql.jdbc.Driver
db_url=jdbc:mysql://localhost/test?useUnicode=true&characterEncoding=utf-8
db_user=root
db_pswd=rootException in thread "main" java.lang.ExceptionInInitializerError
at com.uu.jdbc.dao.StudentDAO.<init>(StudentDAO.java:25)
at com.uu.jdbc.service.StudentService.<init>(StudentService.java:21)
at com.uu.jdbc.controller.StudentController.<init>(StudentController.java:21)
at com.uu.jdbc.controller.StudentController.main(StudentController.java:65)
Caused by: java.util.MissingResourceException: Can't find bundle for base name db, locale zh_CN
at java.util.ResourceBundle.throwMissingResourceException(Unknown Source)
at java.util.ResourceBundle.getBundleImpl(Unknown Source)
at java.util.ResourceBundle.getBundle(Unknown Source)
at com.uu.jdbc.db.MySqlManager.<clinit>(MySqlManager.java:52)
... 4 more在网上找了,但是没看懂,求解
添加回答
举报
0/150
提交
取消