spring+hibernate 连接mysql的问题

05-09-28 zhch501
我做的一个项目在公司用的好好的,但放到一个无Internet连接的电脑上时就出现如下错误:

Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is org.hibernate.MappingException: org.dom4j.DocumentException: hibernate.sourceforge.net Nested exception: hibernate.sourceforge.net

org.hibernate.MappingException: org.dom4j.DocumentException: hibernate.sourceforge.net Nested exception: hibernate.sourceforge.net

at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:405)

at org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:608)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:962)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:354)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:223)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)

at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:271)

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:312)

at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:134)

at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:230)

at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:156)

at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:48)

at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3680)

at org.apache.catalina.core.StandardContext.start(StandardContext.java:4154)

at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:866)

at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:850)

at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)

at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:315)

at org.apache.catalina.core.StandardHost.install(StandardHost.java:859)

at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:723)

at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:473)

at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1002)

at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:393)

at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:166)

at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1133)

at org.apache.catalina.core.StandardHost.start(StandardHost.java:816)

at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1125)

at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:518)

at org.apache.catalina.core.StandardService.start(StandardService.java:519)

at org.apache.catalina.core.StandardServer.start(StandardServer.java:2343)

at org.apache.catalina.startup.Catalina.start(Catalina.java:580)

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:324)

at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:297)

at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:397)

Caused by: org.dom4j.DocumentException: hibernate.sourceforge.net Nested exception: hibernate.sourceforge.net

at org.dom4j.io.SAXReader.read(SAXReader.java:353)

at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:395)

... 36 more

请各位高手指教!

banq
2005-09-28 21:32
是XML解析时可能要访问hibernate.sourceforge.net 的DTD,你升级一下Spring或Hibernate再试验看看

jackytang520
2006-02-27 17:42
你用的是H2.x吧,把hibernate映射文件的上面换成3.0就可以了,我也碰到过,改成3就没事了,呵呵

猜你喜欢