您的位置:首页 > Web前端

No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/D:/package/java/hibernat

2009-10-28 19:12 661 查看
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,3,4错误是由于你的类路径里有ehcache-
0.9.jar这个文件(这个是hibernate用的二级cache的实现,hibernate支持多种二级cache的实现,包括ehcache
等),但是你又没有通过配置二级cache。应该把这个文件删除就可以了。

第一个错误可能是你的配置文件的问题,看看你的hibernate配置文件有没有session_factory_name这个变量,把这个变量去掉即可,如果你设置了这个变量,hibernate会试图把这个sessionfacotry注册到jndi中去。


--------------------------------------------------------------------------------------------------------------------------------------

document.body.oncopy = function() {
if (window.clipboardData) {
setTimeout(function() {
var text = clipboardData.getData("text");
if (text && text.length>300) {
text = text + "/r/n/n本文来自CSDN博客,转载请标明出处:" + location.href;
clipboardData.setData("text", text);
}
}, 100);
}
}

function StorePage(){d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(keyit=window.open('http://www.365key.com/storeit.aspx?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t),'keyit','scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes'));keyit.focus();}
如果在/sandh/web-inf/classes下面没有ehcache.xml这个文件,会报这个错误,No configuration found.

Configuring ehcache from ehcache-failsafe.xml found in the classpath:.....这个文件是hibernate缓存配置文



<ehcache>

<diskStore path="java.io.tmpdir"/>

<defaultCache

maxElementsInMemory="10000"

eternal="false"

timeToIdleSeconds="10000"

timeToLiveSeconds="10000"

overflowToDisk="true"

/>

<cache name="com.hour41.hibernate.vo.common.City"

maxElementsInMemory="10000"

eternal="false"

timeToIdleSeconds="10000"

timeToLiveSeconds="10000"

overflowToDisk="true"

/>

</ehcache>

上面配置了默认类缓存和城市类缓存策略:

<diskStore>表示当内存缓存中对象数量超过类设置内存缓存数量时,将缓存对象写到硬盘,path=”java.io.tmpdir

”表示把数据写到这个目录下。Java.io.tmpdir目录在运行时会根据相对路径生成。

<defaultCache>表示设定缓存的默认数据过期策略。

<cache>表示设定用具体的命名缓存的数据过期策略。

name表示具体的缓存命名。

maxElementsInMemory表示cache中最大允许保存的对象数据量。

eternal表示cache中数据是否为常量。

timeToIdleSeconds表示缓存数据钝化时间

timeToLiveSeconds表示缓存数据的生命时间。

overflowToDisk表示内存不足时,是否启用磁盘缓存。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐