我在 ehcache 的多个版本中遇到问题。因此,当我运行测试用例时,我遇到以下错误。所以我用googled找到删除ehcache 1.2.3以解决问题。所以我运行依赖项以找到下面1.2.3的引用是依赖树.Pls建议从依赖树中删除ehcache:jar:1.2.3。我在下面尝试过,但没有在依赖树中删除。请建议解决这个问题。
Caused by: net.sf.ehcache.CacheException: Error configuring from input stream. Initial cause was null:17: Element <defaultCache> does not allow attribute "maxElementsOnDisk".
at net.sf.ehcache.config.ConfigurationFactory.parseConfiguration(ConfigurationFactory.java:147)
at org.springframework.cache.ehcache.EhCacheManagerFactoryBean.afterPropertiesSet(EhCacheManagerFactoryBean.java:140)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1612)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1549)
+ - com.shc.automation:cars-dao-framework:jar:1.0:test
[INFO] | + - antlr:antlr:jar:2.7.6:test
[INFO] | + - commons-collections:commons-collections:jar:3.2.1:test
[INFO] | + - db2jcc:db2jcc:jar:9.7.4:test
[INFO] | + - org.hibernate:ejb3-persistence:jar:1.0.2.GA:test
[INFO] | + - org.hibernate:hibernate:jar:3.2.7.ga:test
[INFO] | | - net.sf.ehcache:ehcache:jar:1.2.3:test
[INFO] | + - javax.transaction:jta:jar:1.1:test
[INFO] | + - log4j:log4j:jar:1.2.16:test
[INFO] | + - mysql:mysql-connector-java:jar:5.1.29:test
[INFO] | - cglib:cglib-nodep:jar:2.1_3:test
的pom.xml
<dependency>
<groupId>com.shc.automation</groupId>
<artifactId>cars-dao-framework</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>net.sf.ehcache</artifactId>
</exclusion>
</exclusions>
</dependency>
答案 0 :(得分:0)
在我的 pom 中,ehcache 是由 org.apache.camel 加载的
这对我有用:
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cache</artifactId>
<exclusions>
<exclusion>
<artifactId>ehcache</artifactId>
<groupId>net.sf.ehcache</groupId>
</exclusion>
</exclusions>
</dependency>