首页 新闻 搜索 专区 学院

用Eclipse开发java项目,出现以下错误应该怎么调试呢

0
[待解决问题]

最近在学习Java开发,使用的是Eclipse工具,但是遇到以下问题,解决不了,请前辈指点迷津!!!!谢谢啊

log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError
 at org.hibernate.cfg.Configuration.reset(Configuration.java:174)
 at org.hibernate.cfg.Configuration.<init>(Configuration.java:193)
 at org.hibernate.cfg.Configuration.<init>(Configuration.java:197)
 at com.mwq.hibernate.HibernateSessionFactory.<clinit>(HibernateSessionFactory.java:16)
 at com.mwq.hibernate.BaseDao.queryList(BaseDao.java:29)
 at com.mwq.hibernate.Dao.queryManagerOfNatural(Dao.java:141)
 at com.mwq.frame.LandFrame.<init>(LandFrame.java:100)
 at com.mwq.PersonnelManage.land(PersonnelManage.java:30)
 at com.mwq.PersonnelManage$1.run(PersonnelManage.java:24)
 at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
 at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
 at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
 at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
 at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
 at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
 at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
 at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: java.lang.NullPointerException
 at org.hibernate.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:144)
 at org.hibernate.cfg.Environment.<clinit>(Environment.java:529)
 ... 17 more

tttiger的主页 tttiger | 初学一级 | 园豆:200
提问于:2010-12-23 15:18
< >
分享
所有回答(2)
0

 at com.mwq.hibernate.BaseDao.queryList(BaseDao.java:29)

你这个方法错了,具体怎么错你的日志log4j:WARN Please initialize the log4j system properly.

先配下日志

akunamotata | 园豆:235 (菜鸟二级) | 2011-03-02 17:42
0

在项目的classpath路径下(src目录下)添加一个log4j.properties文件

log4j.rootLogger=INFO,CONSOLE,FILE
log4j.addivity.org.apache=true 
# 应用于控制台 
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender 
log4j.appender.Threshold=INFO 
log4j.appender.CONSOLE.Target=System.out 
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout 
log4j.appender.CONSOLE.layout.ConversionPattern=[framework] %d - %c -%-4r [%t] %-5p %c %x - %m%n 
#log4j.appender.CONSOLE.layout.ConversionPattern=[start]%d{DATE}[DATE]%n%p[PRIORITY]%n%x[NDC]%n%t[THREAD] n%c[CATEGORY]%n%m[MESSAGE]%n%n 
#应用于文件 
log4j.appender.FILE=org.apache.log4j.DailyRollingFileAppender
log4j.appender.FILE.File=webAPP.log 
log4j.appender.FILE.Append=false 
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout 
log4j.appender.FILE.layout.ConversionPattern=[framework] %d - %c -%-4r [%t] %-5p %c %x - %m%n 

   还有空指针异常:BaseDao.java:29行,调用了一个未初始化对象的方法。

CN.programmer.Luxh | 园豆:362 (菜鸟二级) | 2012-07-08 00:09
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册