重新部署时出现com.google.common.util.concurrent.ExecutionError

时间:2016-09-14 18:39:47

标签: maven wildfly resteasy jena apache-jena

在WildFly 10中部署我的REST服务时遇到以下异常。

当使用eclipse在wildfly上进行部署时,一切似乎都很好。但是当我使用maven时,部署是可以的,但是在启动时使用它时我会收到此错误。

知道问题是什么?

感谢。

编辑1:搜索一下后,似乎必须在重新部署war文件时不更新或清除缓存。但不确定。

例外:

2016-09-14 20:24:00,527 ERROR [io.undertow.request] (default task-3) UT005023: Exception handling request to /myservice/resources: com.google.common.util.concurrent.ExecutionError: java.lang.NoSuchMethodError: org.apache.jena.system.JenaSystem.logLifecycle(Ljava/lang/String;[Ljava/lang/Object;)V
        at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2201)
        at com.google.common.cache.LocalCache.get(LocalCache.java:3937)
        at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941)
        at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824)
        at org.jboss.weld.util.cache.LoadingCacheUtils.getCacheValue(LoadingCacheUtils.java:49)
        at org.jboss.weld.util.cache.LoadingCacheUtils.getCastCacheValue(LoadingCacheUtils.java:74)
        at org.jboss.weld.bean.proxy.ClientProxyProvider.getClientProxy(ClientProxyProvider.java:229)
        at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:736)
        at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:765)
        at org.jboss.weld.util.ForwardingBeanManager.getReference(ForwardingBeanManager.java:61)
        at org.jboss.weld.bean.builtin.BeanManagerProxy.getReference(BeanManagerProxy.java:85)
        at org.jboss.resteasy.cdi.CdiConstructorInjector.construct(CdiConstructorInjector.java:65)
        at org.jboss.resteasy.cdi.CdiConstructorInjector.construct(CdiConstructorInjector.java:70)
        at org.jboss.resteasy.plugins.server.resourcefactory.POJOResourceFactory.createResource(POJOResourceFactory.java:53)
        at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:235)
        at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)
        at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)
        at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
        at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
        at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
        at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
        at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
        at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
        at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
        at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
              at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
        at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
        at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
        at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
        at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
        at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
        at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
        at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
        at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:284)
        at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:263)
        at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
        at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:174)
        at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)
        at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:793)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoSuchMethodError: org.apache.jena.system.JenaSystem.logLifecycle(Ljava/lang/String;[Ljava/lang/Object;)V
        at org.apache.jena.riot.RIOT.init(RIOT.java:68)
        at org.apache.jena.riot.system.InitRIOT.start(InitRIOT.java:29)
        at org.apache.jena.system.JenaSystem.lambda$init$40(JenaSystem.java:114)
        at java.util.ArrayList.forEach(ArrayList.java:1249)
        at org.apache.jena.system.JenaSystem.forEach(JenaSystem.java:179)
        at org.apache.jena.system.JenaSystem.forEach(JenaSystem.java:156)
        at org.apache.jena.system.JenaSystem.init(JenaSystem.java:111)
        at org.apache.jena.tdb.sys.SystemTDB.<clinit>(SystemTDB.java:44)
        at org.apache.jena.tdb.TDB.<clinit>(TDB.java:99)
        at es.myservice.storage.semantic.TripleStore.<clinit>(TripleStore.java:71)
        at es.myservice.rest.ResourceRestService.<init>(ResourceRestService.java:26)
        at es.myservice.rest.ResourceRestService$Proxy$_$$_WeldClientProxy.<init>(Unknown Source)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at java.lang.Class.newInstance(Class.java:442)
        at org.jboss.weld.bean.proxy.DefaultProxyInstantiator.newInstance(DefaultProxyInstantiator.java:43)
        at org.jboss.weld.bean.proxy.ProxyFactory.run(ProxyFactory.java:327)
        at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:793)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoSuchMethodError: org.apache.jena.system.JenaSystem.logLifecycle(Ljava/lang/String;[Ljava/lang/Object;)V
        at org.apache.jena.riot.RIOT.init(RIOT.java:68)
        at org.apache.jena.riot.system.InitRIOT.start(InitRIOT.java:29)
        at org.apache.jena.system.JenaSystem.lambda$init$40(JenaSystem.java:114)
        at java.util.ArrayList.forEach(ArrayList.java:1249)
        at org.apache.jena.system.JenaSystem.forEach(JenaSystem.java:179)
        at org.apache.jena.system.JenaSystem.forEach(JenaSystem.java:156)
        at org.apache.jena.system.JenaSystem.init(JenaSystem.java:111)
        at org.apache.jena.tdb.sys.SystemTDB.<clinit>(SystemTDB.java:44)
        at org.apache.jena.tdb.TDB.<clinit>(TDB.java:99)
        at es.myservice.storage.semantic.TripleStore.<clinit>(TripleStore.java:71)
        at es.myservice.rest.ResourceRestService.<init>(ResourceRestService.java:26)
        at es.myservice.rest.ResourceRestService$Proxy$_$$_WeldClientProxy.<init>(Unknown Source)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at java.lang.Class.newInstance(Class.java:442)
        at org.jboss.weld.bean.proxy.DefaultProxyInstantiator.newInstance(DefaultProxyInstantiator.java:43)
        at org.jboss.weld.bean.proxy.ProxyFactory.run(ProxyFactory.java:327)
        at org.jboss.weld.bean.proxy.ProxyFactory.create(ProxyFactory.java:319)
        at org.jboss.weld.bean.proxy.ClientProxyFactory.create(ClientProxyFactory.java:83)
        at org.jboss.weld.bean.proxy.ClientProxyProvider.createClientProxy(ClientProxyProvider.java:198)
        at org.jboss.weld.bean.proxy.ClientProxyProvider.access$500(ClientProxyProvider.java:46)
        at org.jboss.weld.bean.proxy.ClientProxyProvider$CreateClientProxyForType.load(ClientProxyProvider.java:76)
        at org.jboss.weld.bean.proxy.ClientProxyProvider$CreateClientProxyForType.load(ClientProxyProvider.java:64)
        at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527)
        at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319)
        at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282)
        at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197)
        ... 47 more

的pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>es.myservice</groupId>
        <artifactId>myservice</artifactId>
        <packaging>war</packaging>
        <version>0.0.1-SNAPSHOT</version>
        <name>myservice Maven Webapp</name>
        <url>http://maven.apache.org</url>

        <properties>
                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
                <junit.version>3.8.1</junit.version>
                <slf4j.version>1.7.21</slf4j.version>
                <!-- current log4j 2 release -->
                <log4j.version>2.5</log4j.version>

<!--            <jena.version>3.0.1</jena.version> -->
                <jena.version>3.1.0</jena.version>
    <!-- Cannot use higher version as jena-spatial is not prepare for it -->
                <lucene.version>4.10.4</lucene.version>
                <solr.version>4.10.4</solr.version>
                <spatial.version>0.5</spatial.version>

                <jboss.resteasy.version>3.0.19.Final</jboss.resteasy.version>
                <javax.cdi-api.version>1.2</javax.cdi-api.version>
                <javax.servlet.version>3.0-alpha-1</javax.servlet.version>

                <maven-compiler.plugin.version>3.5.1</maven-compiler.plugin.version>
                <maven-war.plugin.version>2.6</maven-war.plugin.version>
        </properties>

        <dependencies>
                <dependency>
                        <groupId>junit</groupId>
                        <artifactId>junit</artifactId>
                        <version>${junit.version}</version>
                        <scope>test</scope>
                </dependency>

                <!-- Binding for Log4J -->
                <dependency>
                        <groupId>org.apache.logging.log4j</groupId>
                        <artifactId>log4j-slf4j-impl</artifactId>
                        <version>${log4j.version}</version>
                        <exclusions>
                                <exclusion>
                                        <artifactId>slf4j-api</artifactId>
                                        <groupId>org.slf4j</groupId>
                                </exclusion>
                        </exclusions>
                </dependency>
                <!-- Log4j API and Core implementation required for binding -->
                <dependency>
                        <groupId>org.apache.logging.log4j</groupId>
                        <artifactId>log4j-api</artifactId>
                        <version>${log4j.version}</version>
                </dependency>
                <dependency>
                        <groupId>org.apache.logging.log4j</groupId>
                        <artifactId>log4j-core</artifactId>
                        <version>${log4j.version}</version>
                </dependency>

                <!-- Import the JAX-RS API, we use provided scope as the API is included
                        in JBoss WildFly -->
                <dependency>
                        <groupId>org.jboss.resteasy</groupId>
                        <artifactId>resteasy-jaxrs</artifactId>
                        <version>${jboss.resteasy.version}</version>
                        <scope>provided</scope>
                </dependency>
                <dependency>
                        <groupId>org.jboss.resteasy</groupId>
                        <artifactId>resteasy-servlet-initializer</artifactId>
                        <version>${jboss.resteasy.version}</version>
                        <scope>provided</scope>
                </dependency>
                <dependency>
                        <groupId>org.jboss.resteasy</groupId>
                        <artifactId>resteasy-jaxb-provider</artifactId>
                        <version>${jboss.resteasy.version}</version>
                        <scope>provided</scope>
                </dependency>
                <!-- <dependency> -->
                <!-- <groupId>com.fasterxml.jackson.jaxrs</groupId> -->
                <!-- <artifactId>jackson-jaxrs-xml-provider</artifactId> -->
                <!-- <version>2.7.4</version> -->
                <!-- </dependency> -->

                <dependency>
                        <groupId>javax.enterprise</groupId>
                        <artifactId>cdi-api</artifactId>
                        <version>${javax.cdi-api.version}</version>
                        <scope>provided</scope>
                </dependency>

                <dependency>
                        <groupId>javax.servlet</groupId>
                        <artifactId>servlet-api</artifactId>
                        <version>${javax.servlet.version}</version>
                        <scope>provided</scope>
                </dependency>

                <!-- <dependency> -->
                <!-- <groupId>org.hibernate.javax.persistence</groupId> -->
                <!-- <artifactId>hibernate-jpa-2.1-api</artifactId> -->
                <!-- <version>1.0.0.Final</version> -->
                <!-- <scope>provided</scope> -->
                <!-- </dependency> -->
                <!-- <dependency> -->
                <!-- <groupId>org.hibernate</groupId> -->
                <!-- <artifactId>hibernate-core</artifactId> -->
                <!-- <version>5.1.0.Final</version> -->
                <!-- </dependency> -->
                <dependency>
                        <groupId>org.hibernate</groupId>
                        <artifactId>hibernate-entitymanager</artifactId>
                        <version>5.1.0.Final</version>
                        <scope>provided</scope>
                </dependency>
                <dependency>
                        <groupId>org.hibernate</groupId>
                        <artifactId>hibernate-validator</artifactId>
                        <version>5.2.4.Final</version>
                        <scope>provided</scope>
                </dependency>
                <!-- For connection pooling -->
                <dependency>
                        <groupId>org.hibernate</groupId>
                        <artifactId>hibernate-c3p0</artifactId>
                        <version>5.2.0.Final</version>
                        <scope>provided</scope>
                </dependency>
                <dependency>
                        <groupId>org.hibernate</groupId>
                        <artifactId>hibernate-ehcache</artifactId>
                        <version>5.1.0.Final</version>
                        <scope>provided</scope>
                </dependency>


                <dependency>
                        <groupId>mysql</groupId>
                        <artifactId>mysql-connector-java</artifactId>
                        <version>5.1.39</version>
                </dependency>
                <dependency>
                        <groupId>xml-apis</groupId>
                        <artifactId>xml-apis</artifactId>
                        <version>1.4.01</version>
                        <!-- <scope>provided</scope> -->
                </dependency>
                <dependency>
                        <groupId>org.jboss.logging</groupId>
                        <artifactId>jboss-logging</artifactId>
                        <version>3.3.0.Final</version>
                        <scope>provided</scope>
                </dependency>

                <!-- Jena library -->
                <dependency>
                        <groupId>org.apache.jena</groupId>
                        <artifactId>apache-jena-libs</artifactId>
                        <type>pom</type>
                        <version>${jena.version}</version>
                        <exclusions>
                                <exclusion>
                                        <artifactId>log4j</artifactId>
                                        <groupId>log4j</groupId>
                                </exclusion>
                                <exclusion>
                                        <artifactId>slf4j-log4j12</artifactId>
                                        <groupId>org.slf4j</groupId>
                                </exclusion>
                        </exclusions>
                </dependency>

                <!-- Jena Spatial library -->
                <dependency>
                        <groupId>org.apache.jena</groupId>
                        <artifactId>jena-spatial</artifactId>
                        <version>${jena.version}</version>
                        <exclusions>
                          <exclusion>
          <groupId>log4j</groupId>
          <artifactId>log4j</artifactId>
        </exclusion>
                                <exclusion>
                                        <groupId>org.slf4j</groupId>
                                        <artifactId>slf4j-log4j12</artifactId>
                                </exclusion>
                        </exclusions>
                </dependency>

                <!-- Lucene libraries -->
                <dependency>
                        <groupId>org.apache.lucene</groupId>
                        <artifactId>lucene-core</artifactId>
                        <version>${lucene.version}</version>
                </dependency>
                <dependency>
                        <groupId>org.apache.lucene</groupId>
                        <artifactId>lucene-spatial</artifactId>
                        <version>${lucene.version}</version>
                </dependency>
                <dependency>
                        <groupId>org.apache.lucene</groupId>
                        <artifactId>lucene-analyzers-common</artifactId>
                        <version>${lucene.version}</version>
                </dependency>
                <dependency>
                        <groupId>org.apache.lucene</groupId>
                        <artifactId>lucene-queryparser</artifactId>
                        <version>${lucene.version}</version>
                </dependency>
                <dependency>
                        <groupId>com.spatial4j</groupId>
                        <artifactId>spatial4j</artifactId>
                        <version>${spatial.version}</version>
                </dependency>
                <dependency>
                        <artifactId>solr-solrj</artifactId>
                        <groupId>org.apache.solr</groupId>
                        <version>${solr.version}</version>
                </dependency>
    <!-- JTS Topology Suite libs -->
    <!-- To read geo data in 2) WKT literal format -->
                <dependency>
                        <groupId>com.vividsolutions</groupId>
                        <artifactId>jts</artifactId>
                        <version>1.13</version>
                </dependency>

                <!-- Hashids library -->
                <dependency>
                        <groupId>org.hashids</groupId>
                        <artifactId>hashids</artifactId>
                        <version>1.0.1</version>
                </dependency>

                <dependency>
                        <groupId>org.jboss.resteasy</groupId>
                        <artifactId>resteasy-client</artifactId>
                        <version>${jboss.resteasy.version}</version>
                </dependency>
        </dependencies>

        <build>
                <finalName>myservice</finalName>
                <plugins>
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-compiler-plugin</artifactId>
                                <version>${maven-compiler.plugin.version}</version>
                                <configuration>
                                        <source>1.8</source>
                                        <target>1.8</target>
                                </configuration>
                        </plugin>
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-war-plugin</artifactId>
                                <version>${maven-war.plugin.version}</version>
                                <configuration>
                                        <failOnMissingWebXml>false</failOnMissingWebXml>
                                </configuration>
                        </plugin>
                </plugins>
        </build>
</project>

1 个答案:

答案 0 :(得分:2)

问题是因为在运行时类路径中有多个版本的>>> a = 'abcdefg hijk @ 123 cdezyxwvu' >>> "".join([i for i in a if i.isalpha() or i==" "])[:20] 'abcdefg hijk cdezy' 个jar。您可以通过对项目执行以下命令来检查依赖关系。

jena-core