hibernate动态链接数据库配置文件问题
//protected Configuration conf=new Configuration().configure(); protected Configuration conf=new Configuration().addFile("hibernate.cfg.xml");这是某个action的部分代码,上面注释掉的是正确代码,在这条代码下,应用是正常的,但是对于下面的代码,控制台产生如下信息:
七月 23, 2013 11:24:07 上午 org.hibernate.cfg.Configuration addFile INFO: HHH000220: Reading mappings from file: hibernate.cfg.xml
之后即不再产生任何信息……
我自己的分析是,上面的代码说明配置文件是没有错的,应该是addFile中的路径有问题,于是路径修改成了
/hibernate.cfg.xml但是问题仍然如故……只是控制台信息改成了
七月 23, 2013 11:24:07 上午 org.hibernate.cfg.Configuration addFile INFO: HHH000220: Reading mappings from file: /hibernate.cfg.xml
请大家解答。
另,附控制台信息:
七月 23, 2013 2:13:08 下午 org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:tomcatTest' did not find a matching property.
七月 23, 2013 2:13:08 下午 org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:webStruts' did not find a matching property.
七月 23, 2013 2:13:08 下午 org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:strutsTest' did not find a matching property.
七月 23, 2013 2:13:08 下午 org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:PaaSofLogistics' did not find a matching property.
七月 23, 2013 2:13:08 下午 org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:scoreMS' did not find a matching property.
七月 23, 2013 2:13:08 下午 org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:target' did not find a matching property.
七月 23, 2013 2:13:08 下午 org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
七月 23, 2013 2:13:08 下午 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1332 ms
七月 23, 2013 2:13:08 下午 org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
七月 23, 2013 2:13:08 下午 org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.26
七月 23, 2013 2:13:09 下午 org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/home/ufo/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/scoreMS/WEB-INF/lib/el-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/el/Expression.class
七月 23, 2013 2:13:09 下午 org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/home/ufo/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/scoreMS/WEB-INF/lib/servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
七月 23, 2013 2:13:12 下午 org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/home/ufo/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/PaaSofLogistics/WEB-INF/lib/el-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/el/Expression.class
七月 23, 2013 2:13:12 下午 org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/home/ufo/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/PaaSofLogistics/WEB-INF/lib/servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
七月 23, 2013 2:13:13 下午 org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/home/ufo/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/target/WEB-INF/lib/el-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/el/Expression.class
七月 23, 2013 2:13:13 下午 org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/home/ufo/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/target/WEB-INF/lib/servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
七月 23, 2013 2:13:14 下午 org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
七月 23, 2013 2:13:14 下午 org.apache.catalina.startup.Catalina start
INFO: Server startup in 5851 ms
七月 23, 2013 2:15:08 下午 org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
七月 23, 2013 2:15:08 下午 org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.1.9.Final}
七月 23, 2013 2:15:08 下午 org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
七月 23, 2013 2:15:08 下午 org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
七月 23, 2013 2:15:08 下午 org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: hibernate.cfg.xml
七月 23, 2013 2:15:08 下午 org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator initiateService
WARN: HHH000181: No appropriate connection provider encountered, assuming application will be supplying connections
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
开debug日志。
用排除法,去掉hibernate.cfg.xml里面的mapping标签,如果去掉哪个mapping的文件不出错了,那么就是哪个配置文件里面配置的问题
用排除法,去掉hibernate.cfg.xml里面的mapping标签,如果去掉哪个mapping的文件不出错了,那么就是哪个配置文件里面配置的问题