神山树9196 2017-05-11 03:16 采纳率: 0%
浏览 978

这个是什么问题??哪里配置出错了

信息: Starting service Catalina
2017-5-11 11:10:38 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.20
2017-5-11 11:10:38 org.apache.catalina.loader.WebappClassLoader validateJarFile
信息: validateJarFile(D:\tgame\workspace\tianshen_dev\webroot\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: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/D:/tgame/workspace/tianshen_dev/webroot/WEB-INF/lib/logback-classic-1.1.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/tgame/workspace/tianshen_dev/webroot/WEB-INF/lib/slf4j-log4j12-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
2017-5-11 11:10:39 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
11:10:39.840 [main] DEBUG n.s.e.config.ConfigurationFactory - Configuring ehcache from InputStream
11:10:39.852 [main] DEBUG net.sf.ehcache.config.BeanHandler - Ignoring ehcache attribute xmlns:xsi
11:10:39.854 [main] DEBUG net.sf.ehcache.config.BeanHandler - Ignoring ehcache attribute xsi:noNamespaceSchemaLocation
11:10:39.854 [main] DEBUG n.s.e.config.DiskStoreConfiguration - Disk Store Path: E:\apache-tomcat-6.0.20\apache-tomcat-6.0.20\temp
11:10:39.862 [main] DEBUG n.s.e.config.ConfigurationHelper - No CacheManagerEventListenerFactory class specified. Skipping...
11:10:39.884 [main] DEBUG n.s.e.config.ConfigurationHelper - No BootstrapCacheLoaderFactory class specified. Skipping...
11:10:39.884 [main] DEBUG n.s.e.config.ConfigurationHelper - No CacheExceptionHandlerFactory class specified. Skipping...
11:10:39.887 [main] DEBUG n.s.e.config.ConfigurationHelper - No BootstrapCacheLoaderFactory class specified. Skipping...
11:10:39.887 [main] DEBUG n.s.e.config.ConfigurationHelper - No CacheExceptionHandlerFactory class specified. Skipping...
11:10:39.888 [net.sf.ehcache.CacheManager@1721e22] DEBUG net.sf.ehcache.util.UpdateChecker - Checking for update...
11:10:39.904 [main] DEBUG net.sf.ehcache.store.DiskStore - Deleting data file testCache.data
11:10:39.909 [main] DEBUG net.sf.ehcache.store.MemoryStore - Initialized net.sf.ehcache.store.MemoryStore for testCache
11:10:39.910 [main] DEBUG net.sf.ehcache.Cache - Initialised cache: testCache
11:10:40.564 [net.sf.ehcache.CacheManager@1721e22] INFO net.sf.ehcache.util.UpdateChecker - New update(s) found: 2.4.7 [http://www.terracotta.org/confluence/display/release/Release+Notes+Ehcache+Core+2.4]

  • 写回答

1条回答 默认 最新

  • 你知我知皆知 2024-08-05 20:53
    关注

    以下回答参考 皆我百晓生券券喵儿 等免费微信小程序相关内容作答,并由本人整理回复。

    这个问题是由于Spring Boot环境下的Java应用使用了Ehcache缓存技术导致的。在Spring Boot中,如果开启了Ehcache缓存功能,并且没有正确配置Ehcache,则可能会出现找不到缓存实例的问题。

    以下是可能的原因和解决方法:

    原因:

    1. Ehcache缓存配置不正确:确保在启动Ehcache时设置了正确的Ehcache配置文件路径。
    2. 缓存实例未被正确初始化或加载:检查Ehcache实例是否已经被正确地创建并初始化。
    3. 没有正确配置Spring Boot中的Ehcache支持:确保在application.properties或application.yml文件中启用了Ehcache,并指定了对应的Ehcache实例名称和缓存大小等参数。

    解决方案:

    1. 首先确认Ehcache的配置文件(例如,ehcache.xml)是否正确放置在项目中,并且其路径指向正确的Ehcache目录。
    2. 确保Ehcache服务已经启动并且运行正常。
    3. 在Spring Boot项目中启用Ehcache支持。在pom.xml文件中添加以下依赖项:
    <dependency>
        <groupId>com.ehcache</groupId>
        <artifactId>ehcache-core</artifactId>
        <version>${ehcache.version}</version>
    </dependency>
    

    然后,在application.properties文件中设置Ehcache相关的属性,例如:

    spring.cache.ehcache.type=org.ehcache.hibernate
    spring.cache.ehcache.cache-manager-name=test-cache-manager
    spring.cache.ehcache.key-generator-class=org.ehcache.hibernate.KeyGenerator
    spring.cache.ehcache.default-store-type=memory
    spring.cache.ehcache.size=50
    

    注意:这些配置只是示例,具体配置应根据实际需求进行调整。

    通过以上步骤,应该可以解决Ehcache缓存配置错误导致的找不到缓存实例的问题。如果问题仍然存在,请提供更多关于项目的详细信息,以便进一步诊断和解决问题。

    评论

报告相同问题?