Topic: 终于第一次成功的运行了Hibernate,但是还是有些小问题 |
Print this page |
1.终于第一次成功的运行了Hibernate,但是还是有些小问题 | Copy to clipboard |
Posted by: KevinTian Posted on: 2004-12-03 10:53 经过几个小时的折磨,在几近崩溃的边缘,终于成功的运行了Hibernate 把数据写到Database中去了. 但是运行中有四个Warning,其中一个Warning还引起了一个Exception 1.WARN SessionFactoryObjectFactory:98 - Could not bind factory to JNDI 2.WARN Configurator:125 - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/D:/package/java/hibernate2/lib/ehcache-0.9.jar!/ehcache-failsafe.xml 3.WARN EhCache:94 - Could not find configuration for net.sf.hibernate.cache.UpdateTimestampsCache. Configuring using the defaultCache settings. 4.WARN EhCache:94 - Could not find configuration for net.sf.hibernate.cache.StandardQueryCache. Configuring using the defaultCache settings. 其中第一个Warning引起了一个Exception 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 net.sf.hibernate.util.NamingHelper.bind(NamingHelper.java:52) at net.sf.hibernate.impl.SessionFactoryObjectFactory.addInstance(SessionFactoryObjectFactory.java:90) at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:172) at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:796) at TestMain.main(TestMain.java:22) 希望各位大虾帮我分析一下原因,以及该怎么解决 小弟不胜感激 (缩略图,点击图片链接看原图) |
2.Re:终于第一次成功的运行了Hibernate,但是还是有些小问题 [Re: KevinTian] | Copy to clipboard |
Posted by: KevinTian Posted on: 2004-12-04 16:44 怎么没人啊????? 大虾们都去哪里了???? |
3.Re:终于第一次成功的运行了Hibernate,但是还是有些小问题 [Re: KevinTian] | Copy to clipboard |
Posted by: huangfei Posted on: 2004-12-06 17:06 2,3,4错误是由于你的类路径里有ehcache-0.9.jar这个文件(这个是hibernate用的二级cache的实现,hibernate支持多种二级cache的实现,包括ehcache等),但是你又没有通过配置二级cache。应该把这个文件删除就可以了。 第一个错误可能是你的配置文件的问题,看看你的hibernate配置文件有没有session_factory_name这个变量,把这个变量去掉即可,如果你设置了这个变量,hibernate会试图把这个sessionfacotry注册到jndi中去。 |
4.Re:终于第一次成功的运行了Hibernate,但是还是有些小问题 [Re: KevinTian] | Copy to clipboard |
Posted by: KevinTian Posted on: 2004-12-07 13:47 多谢, 根据你的解释,问题解决了 |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |