我正在开发一个访问数据库的项目,但是我遇到了一些问题。我尝试使用hibernate3.2和4.52,但是它不起作用。
log4j:WARN No appenders could be found for logger (org.jboss.logging). log4j:WARN Please initialize the log4j system properly. Exception in thread "main" java.lang.NoSuchFieldError: TRACE at org.jboss.logging.Log4jLogger.translate(Log4jLogger.java:60) at org.jboss.logging.Log4jLogger.isEnabled(Log4jLogger.java:35) at org.jboss.logging.Logger.logv(Logger.java:1953) at org.jboss.logging.DelegatingBasicLogger.tracev(DelegatingBasicLogger.java:89) at org.hibernate.cfg.EJB3DTDEntityResolver.resolveEntity(EJB3DTDEntityResolver.java:59) at com.sun.org.apache.xerces.internal.util.EntityResolverWrapper.resolveEntity(EntityResolverWrapper.java:110) at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.resolveEntityAsPerStax(XMLEntityManager.java:994) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1154) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XMLDocumentScannerImpl.java:1050) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:964) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:117) com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:649) at org.dom4j.io.SAXReader.read(SAXReader.java:465) at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2157) at org.hibernate.cfg.Configuration.configure(Configuration.java:2077) at org.hibernate.cfg.Configuration.configure(Configuration.java:2056) at aucas.Aucas.<init>(Aucas.java:38) at aucas.Aucas.main(Aucas.java:45)
例外是在这行代码中
public Aucas() { SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory(); Session session = sessionFactory.openSession(); LoginDialog d = new LoginDialog(null,false,this); }
您需要在类路径中检查类org.apache.log4j.Level的冲突版本并进行解决。版本1.2.12或更高版本的log4j jar中提供了TRACE级别。