我在hibernate中设置了
@Before
public void setUp() throws Exception {
Configuration configuration = new Configuration()
.setProperty(Environment.DRIVER, "org.postgresql.Driver")
.setProperty(Environment.URL,
"jdbc:postgresql://localhost/nmsc")
.setProperty(Environment.USER, "postgres")
.setProperty(Environment.PASS, "postgres")
.setProperty(Environment.DIALECT,"org.hibernate.dialect.PostgreSQLDialect")
.setProperty(Environment.SHOW_SQL, "true")
// .setProperty(Environment.HBM2DDL_AUTO, "create-drop")
.addClass(com.nmsc.api.sso.SSOUser.class);
SessionFactory sessionFactory = configuration.buildSessionFactory();
HibernateTemplate hibernateTemplate = new HibernateTemplate(
sessionFactory);
userDAO.setHibernateTemplate(hibernateTemplate);
}
并使用maven构建,我收到此错误。
<error message="org.grlea.log.adapters.slf4j.Slf4jAdapter.trace(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V" type="java.lang.AbstractMethodError">java.lang.AbstractMethodError: org.grlea.log.adapters.slf4j.Slf4jAdapter.trace(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V
at org.hibernate.cfg.EJB3DTDEntityResolver.resolveEntity(EJB3DTDEntityResolver.java:56)
at com.sun.org.apache.xerces.internal.util.EntityResolverWrapper.resolveEntity(EntityResolverWrapper.java:107)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.resolveEntityAsPerStax(XMLEntityManager.java:1018)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1192)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XMLDocumentScannerImpl.java:1090)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1003)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
at org.dom4j.io.SAXReader.read(SAXReader.java:465)
at org.hibernate.util.xml.MappingReader.readMappingDocument(MappingReader.java:75)
at org.hibernate.cfg.Configuration.add(Configuration.java:513)
at org.hibernate.cfg.Configuration.add(Configuration.java:509)
at org.hibernate.cfg.Configuration.add(Configuration.java:716)
at org.hibernate.cfg.Configuration.addResource(Configuration.java:775)
at org.hibernate.cfg.Configuration.addClass(Configuration.java:818)
at com.nmsc.hibernateDAO.SSOUserDAO_Test.setUp(SSOUserDAO_Test.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.apache.maven.surefire.junitcore.ConfigurableParallelComputer$AsynchronousRunner$1.call(ConfigurableParallelComputer.java:186)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
</error>
我不能为我的生活弄清楚究竟是什么想告诉我的。 hbm文件在classpath中,它发现因为如果我改变它,错误来找不到hbm文件,我很难过。任何想法?