当我将terracotta配置添加到ehcache.xml中时,我遇到了以下错误。我认为图书馆存在冲突,但我没有找到哪一个? 当我删除terrracotta配置时,项目有效。
Caused By: org.apache.shiro.cache.CacheException: net.sf.ehcache.CacheException: Error configuring from input stream. Initial cause was null:34: Element <cache> does not allow nested <terracotta> elements.
at org.apache.shiro.cache.ehcache.EhCacheManager.ensureCacheManager(EhCacheManager.java:224)
at org.apache.shiro.cache.ehcache.EhCacheManager.getCache(EhCacheManager.java:156)
at org.apache.shiro.realm.AuthorizingRealm.getAuthorizationCacheLazy(AuthorizingRealm.java:245)
at org.apache.shiro.realm.AuthorizingRealm.getAvailableAuthorizationCache(AuthorizingRealm.java:260)
at org.apache.shiro.realm.AuthorizingRealm.afterCacheManagerSet(AuthorizingRealm.java:226)
Truncated. see log file for complete stacktrace
我该如何解决这个问题?
我在&lt;之间添加了行。 ! - 和 - &gt;进入赤土陶器的ehcache.xml:
<cache name="shiro-activeSessionCache"
maxElementsInMemory="10000"
eternal="true"
timeToLiveSeconds="0"
timeToIdleSeconds="0"
diskPersistent="false"
overflowToDisk="false"
diskExpiryThreadIntervalSeconds="600">
<!-- <terracotta/> -->
</cache>
<!-- <terracottaConfig url="x.x.x.x:9510"/> -->
的pom.xml
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.7.0</version>
</dependency>
<dependency>
<groupId>commons-digester</groupId>
<artifactId>commons-digester</artifactId>
<version>1.8</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-vfs2</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>el-impl</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>1.0.b2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.3.9</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>5.2</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>2.1_3</version>
</dependency>
<dependency>
<groupId>asm</groupId>
<artifactId>asm-all</artifactId>
<version>2.2.3</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-tools</artifactId>
<version>4.0.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.0.2.GA</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-envers</artifactId>
<version>4.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<version>1.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.18.1-GA</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
<version>3.3.1.GA</version>
<exclusions>
<exclusion>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-web</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast</artifactId>
<version>3.5.3</version>
</dependency>
<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast-client</artifactId>
<version>3.5.3</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-ehcache</artifactId>
<version>1.2.3</version>
</dependency>
答案 0 :(得分:0)
要最好地回答这类问题,请使用带有tree目标的maven依赖插件。
给定依赖项列表的输出是:
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ test ---
[INFO] test:test:pom:1.0.0-SNAPSHOT
[INFO] +- commons-beanutils:commons-beanutils:jar:1.7.0:compile
[INFO] +- commons-digester:commons-digester:jar:1.8:compile
[INFO] +- commons-logging:commons-logging:jar:1.1:compile
[INFO] | +- logkit:logkit:jar:1.0.1:compile
[INFO] | \- avalon-framework:avalon-framework:jar:4.1.3:compile
[INFO] +- log4j:log4j:jar:1.2.17:compile
[INFO] +- org.apache.commons:commons-vfs2:jar:2.0:compile
[INFO] | +- org.apache.maven.scm:maven-scm-api:jar:1.4:compile
[INFO] | | \- org.codehaus.plexus:plexus-utils:jar:1.5.6:compile
[INFO] | \- org.apache.maven.scm:maven-scm-provider-svnexe:jar:1.4:compile
[INFO] | +- org.apache.maven.scm:maven-scm-provider-svn-commons:jar:1.4:compile
[INFO] | \- regexp:regexp:jar:1.3:compile
[INFO] +- javax.el:el-api:jar:2.2:compile
[INFO] +- org.glassfish.web:el-impl:jar:2.2:compile
[INFO] +- xml-apis:xml-apis:jar:1.0.b2:provided
[INFO] +- javax.servlet:servlet-api:jar:2.5:provided
[INFO] +- javax.servlet.jsp:jsp-api:jar:2.1:provided
[INFO] +- javax:javaee-api:jar:6.0:provided
[INFO] +- javax.servlet:javax.servlet-api:jar:3.0.1:compile
[INFO] +- org.codehaus.groovy:groovy-all:jar:2.3.9:compile
[INFO] +- commons-collections:commons-collections:jar:3.2.1:compile
[INFO] +- commons-io:commons-io:jar:2.4:compile
[INFO] +- org.apache.commons:commons-lang3:jar:3.3.2:compile
[INFO] +- commons-codec:commons-codec:jar:1.9:compile
[INFO] +- javax.transaction:jta:jar:1.1:compile
[INFO] +- javax:javaee-web-api:jar:6.0:provided
[INFO] +- org.primefaces:primefaces:jar:5.2:compile
[INFO] +- cglib:cglib-nodep:jar:2.1_3:compile
[INFO] +- asm:asm-all:jar:2.2.3:compile
[INFO] +- org.hibernate:hibernate-core:jar:4.0.1.Final:compile
[INFO] | +- antlr:antlr:jar:2.7.7:compile
[INFO] | +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:jar:1.0.0.Final:compile
[INFO] | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | +- org.jboss.logging:jboss-logging:jar:3.1.0.CR2:compile
[INFO] | \- org.hibernate.common:hibernate-commons-annotations:jar:4.0.1.Final:compile
[INFO] +- org.hibernate:hibernate-tools:jar:4.0.0.Final:compile
[INFO] | +- org.hibernate:hibernate-commons-annotations:jar:3.2.0.Final:compile
[INFO] | +- org.hibernate:hibernate-entitymanager:jar:4.0.1.Final:compile
[INFO] | +- ant:ant:jar:1.6.5:compile
[INFO] | +- freemarker:freemarker:jar:2.3.8:compile
[INFO] | +- org.hibernate:jtidy:jar:r8-20060801:compile
[INFO] | +- org.eclipse.tycho:org.eclipse.jdt.core:jar:3.9.1.v20130905-0837:compile
[INFO] | +- org.eclipse:text:jar:3.2.0-v20060605-1400:compile
[INFO] | | +- org.eclipse.core:commands:jar:3.3.0-I20070605-0010:compile (version selected from constraint [3.2.0,4.0.0))
[INFO] | | \- org.eclipse.equinox:common:jar:3.6.200-v20130402-1505:compile (version selected from constraint [3.2.0,4.0.0))
[INFO] | \- org.eclipse.core:runtime:jar:3.10.0-v20140318-2214:runtime
[INFO] | +- org.eclipse:osgi:jar:3.10.0-v20140606-1445:runtime (version selected from constraint [3.7.0,4.0.0))
[INFO] | +- org.eclipse.core:jobs:jar:3.6.0-v20140424-0053:runtime (version selected from constraint [3.2.0,4.0.0))
[INFO] | +- org.eclipse.equinox:registry:jar:3.5.400-v20140428-1507:runtime (version selected from constraint [3.4.0,4.0.0))
[INFO] | +- org.eclipse.equinox:preferences:jar:3.5.200-v20140224-1527:runtime (version selected from constraint [3.4.0,4.0.0))
[INFO] | +- org.eclipse.core:contenttype:jar:3.4.200-v20140207-1251:runtime (version selected from constraint [3.3.0,4.0.0))
[INFO] | \- org.eclipse.equinox:app:jar:1.3.200-v20130910-1609:runtime (version selected from constraint [1.0.0,))
[INFO] +- org.hibernate:hibernate-validator:jar:4.0.2.GA:compile
[INFO] | +- javax.validation:validation-api:jar:1.0.0.GA:compile
[INFO] | +- javax.xml.bind:jaxb-api:jar:2.1:compile
[INFO] | | +- javax.xml.stream:stax-api:jar:1.0-2:compile
[INFO] | | \- javax.activation:activation:jar:1.1:compile
[INFO] | \- com.sun.xml.bind:jaxb-impl:jar:2.1.3:compile
[INFO] +- org.hibernate:hibernate-envers:jar:4.0.1.Final:compile
[INFO] +- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.1.Final:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.6.1:compile
[INFO] +- org.slf4j:slf4j-simple:jar:1.6.1:compile
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.6.1:compile
[INFO] +- org.javassist:javassist:jar:3.18.1-GA:compile
[INFO] +- org.hibernate:hibernate-ehcache:jar:3.3.1.GA:compile
[INFO] | \- net.sf.ehcache:ehcache:jar:1.2.3:compile
[INFO] +- javax.faces:jsf-api:jar:2.1:compile
[INFO] +- org.apache.shiro:shiro-core:jar:1.2.3:compile
[INFO] +- org.apache.shiro:shiro-web:jar:1.2.3:compile
[INFO] +- com.hazelcast:hazelcast:jar:3.5.3:compile
[INFO] +- com.hazelcast:hazelcast-client:jar:3.5.3:compile
[INFO] \- org.apache.shiro:shiro-ehcache:jar:1.2.3:compile
[INFO] \- net.sf.ehcache:ehcache-core:jar:2.5.0:compile
问题来自以下两行:
[INFO] +- org.hibernate:hibernate-ehcache:jar:3.3.1.GA:compile
[INFO] | \- net.sf.ehcache:ehcache:jar:1.2.3:compile
回到您的依赖项声明,似乎您从hibernate-ehcache
中排除了错误的工件ID。排除应该是ehcache
而不是ehcache-core
。
当版本hibernate-core
{{3}时,您使用4.0.1.Final
版本hibernate-ehcache
版本3.3.1.GA
和4.0.1.Final
版本{{1}}似乎很奇怪}。