1.如果出现这样的提示,意思是说your slf4j包的版本不兼容,
slf4j包的版本冲突,你有至少两个版本的SLF4J,有一个1.6版本的,有一个1.6一下的,删除一个即可
SLF4J: The requested version 1.6 by your slf4j binding is not compatible with [1.5.5, 1.5.6, 1.5.7, 1.5.8]
SLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further details.
15 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.3.2.GA
31 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found
31 [main] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist
2.如果报出如下异常:
1109 [main] WARN org.hibernate.impl.SessionFactoryObjectFactory - Could not bind factory to JNDI
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.getNameParser(Unknown Source)
at org.hibernate.util.NamingHelper.bind(NamingHelper.java:75)
at org.hibernate.impl.SessionFactoryObjectFactory.addInstance(SessionFactoryObjectFactory.java:113)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:348)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1341)
at com.asm.hibernate.test.UserTest.main(UserTest.java:16)
------解决方法--------------------------------------------------------
应该是jndi没有配置好
------解决方法--------------------------------------------------------
配置文件名是不是hibernate.cfg.xml?
代码new Configuration().configure().buildSessionFactory();是指读入默认名为hibernate.cfg.xml的配置文件。
------解决方法--------------------------------------------------------
把
<session-factory name="eheshnew">
改成
<session-factory >
name="xxxx" 是为了把SessionFactory的唯一实例bind到jndi上的,这样可以通过new InitialContext().lookup("xxxx")来得到SessionFactory,不过实际上没什么用处。
非j2ee容器下直接执行或容器不支持jndi动态bind(如tomcat)都会出现这个问题。
分享到:
相关推荐
Tomcat启动时报错Artifact staff_management_dev:war exploded: Error during artifact dep
之前tomcat启动老是报错,虽然不影响项目的启动运行,但是有强迫症的程序员会心里不爽: 如下: 问题分析 由于本机安装的jdk版本与tomcat中使用的jdk版本不一致导致的。 解决方法 后面我把原先tomcat启动环境用的...
Name salesDataSource is not bound in this Context,连接池的问题
自己在学习Mybatis时,集成spring,经常在tomcat启动时报错缺少某个类,所以在做完项目后将依赖的jar共享出来,以后各位在学习Mybatis时可以节省点事件。后续将持续更新
启动Tomcat时报错:Caused by: java.lang.LinkageError: loader constraints violated when linking javax/el/ExpressionFactory class 说明:原因是juel.jar, juel-engine.jar, juel-impl.jar包和Tomcat6.0中的el-...
修改Tomcat的配置,用于对Tomcat中启动时报内存溢出的情况解决。修改java虚拟机的内存占用大小
在IntelliJ IDEA 2019.3.3 x64中启动tomcat时报错java.lang.UnsatisfiedLinkError: D:\Tomcat v7.0.4.7\bin\tcnative-1.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform at java.lang.ClassLoader$...
主要介绍了Web项目打成war包部署到tomcat时报MySQL Access denied for user 'root'@'localhost' (using password: YES)错误解决方案(推),需要的朋友可以参考下
tcnative-1.dll的多个版本集合打包,32位、64位。 解决Tomcat启动时报tcnative-1.dll版本错误,替换相应的dll即可(Tomcat的安装路径下的\bin中)
启动时报如下异常: org.slf4j.spi.LocationAwareLogger.log(Lorg.slf4j.Marker;Ljava.lang.String;Ljava.lang.String.Ljava.lang.Object;Ljava.lang.Throwable) 原因是旧版本的slf4j-api不包含以上方法,附件解压...
Jdk升级到1.8版本后,如果项目采用的是SSH框架,原来1.7版本及以下的jar包会启动时报错,整理了Jdk1.8版本所需的SSH框架jar包,这个是老版本的框架 但是运行在jdk1.8版本下的 项目实战 大家可以看看
配置springboot环境时报错: An incompatible version [1.1.33] of the APR based Apache Tomcat Native library is installed, while Tomcat requires version [1.2.14] 将文件放在:C:\Windows\System32 ...
在websphere通过getClassLoader().getResource("").getPath()取配置文件的路径跟在tomcat环境下是不一样的,如果配置文件是放在classes目录下,会报找不到配置文件。 发布应用时,报web.xml文件有错 发布应用成功,...
十二、问题描述 通过Controler调用远程代理时报错,Error: CCI security error:You are running under secure mode and the function system is not allowed in this mode. 解决方法:在代理开启的时候,去掉勾选...