1

尝试实例化 Artifactory 客户端时出现以下错误。

Artifactory artifactory = ArtifactoryClient.create(artifactoryUrl, "", "");

每当我在主函数中独立运行我的代码时,它都不会引发异常并且可以正常工作。但是当我在 MVC 架构(WebApp)中运行它时,它会停止工作并抛出以下错误:

没有方法签名:com.fasterxml.jackson.databind.ObjectMapper.addMixIn() 适用于参数类型:(java.lang.Class, java.lang.Class) 值:[interface org.jfrog.artifactory.client.model .Repository,接口 org.jfrog.artifactory.client.impl.jackson.RepositoryMixIn]

当它执行时,我得到下面的错误堆栈跟踪。我对这个问题进行了广泛的研究,除了这个问题中引用的错误之外,我没有发现任何人有类似的错误:https ://github.com/JFrogDev/artifactory-client-java/issues/85

上述问题是由于错误的依赖关系造成的。我也得到了 2.4.6 版本的 artifactory 客户端和 jackson 库。

groovy.lang.MissingMethodException:没有方法签名:com.fasterxml.jackson.databind.ObjectMapper.addMixIn() 适用于参数类型:(java.lang.Class, java.lang.Class) 值:[interface org.jfrog .artifactory.client.model.Repository,接口 org.jfrog.artifactory.client.impl.jackson.RepositoryMixIn] 14:04:21,684 +0000 INFO [stdout](默认任务 22)在 org.codehaus.groovy.runtime。 ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:55) 14:04:21,684 +0000 INFO [stdout](默认任务 22)在 org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46) 14: 04:21,684 +0000 INFO [stdout](默认任务 22)在 org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45) 14:04:21,684 +0000 INFO [stdout](默认任务-22) 在 org.codehaus.groovy.runtime。callsite.AbstractCallSite.call(AbstractCallSite.java:108) 14:04:21,684 +0000 INFO [stdout](默认任务 22)在 org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120) 14:04:21,684 +0000 INFO [stdout](默认任务 22)在 org.jfrog.artifactory.client.impl.ArtifactoryImpl.(ArtifactoryImpl.groovy:46) 14:04:21,684 +0000 INFO [stdout](默认task-22) 在 sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 14:04:21,684 +0000 INFO [stdout] (默认 task-22) 在 sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) 14:04:21,684 +0000 INFO [stdout](默认 task-22)在 sun.reflect.DelegatingConstructorAccessorImpl.newInstance(未知来源)14:04:21,684 +0000 INFO [stdout](默认 task-22)在 java.lang.reflect.Constructor。newInstance(Unknown Source) 14:04:21,684 +0000 INFO [stdout] (默认 task-22) at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77) 14:04:21,684 +0000 INFO [ stdout](默认任务 22)在 org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102) 14:04:21,684 +0000 INFO [stdout](默认任务 22)在 org .codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57) 14:04:21,692 +0000 INFO [stdout](默认任务 22)在 org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor (AbstractCallSite.java:182) 14:04:21,692 +0000 INFO [stdout] (默认任务 22) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:194) 14:04:21 ,692 +0000 INFO [stdout](默认任务 22)在 org.jfrog.artifactory.client.ArtifactoryClient.create(ArtifactoryClient.groovy:95) 14:04:21,693 +0000 INFO [stdout](默认任务 22)在org.jfrog.artifactory.client.ArtifactoryClient.create(ArtifactoryClient.groovy) 14:04:21,693 +0000 INFO [stdout](默认任务 22)在 com.xyz.abc.utils.WGArtifactoryUtils.getFiles(WGArtifactoryUtils.java: 41) 14:04:21,693 +0000 INFO [stdout](默认任务 22)在 com.xyz.abc.lakshya.controllers.ListPlController.findFilesFromArtifactory(ListPlController.java:196) 14:04:21,693 +0000 INFO [stdout ](默认 task-22)在 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)14:04:21,694 +0000 INFO [stdout](默认 task-22)在 sun.reflect.NativeMethodAccessorImpl.invoke(未知来源)14: 04:21,695 +0000 INFO [stdout](默认 task-22)在 sun.reflect.DelegatingMethodAccessorImpl.invoke(未知来源) 14:04:21,695 +0000 INFO [stdout](默认 task-22)在 java.lang.reflect.Method .invoke(Unknown Source) 14:04:21,695 +0000 INFO [stdout] (默认任务 22) at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215) 14:04:21,696 + org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132) 14:04:21,696 +0000 INFO [stdout](默认任务 22)处的 0000 信息 [stdout](默认任务 22) org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) 14:04:21,696 +0000 INFO [stdout](默认任务 22)在 org.springframework.web.servlet。 mvc.org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal( RequestMappingHandlerAdapter.java:690) 14:04:21,697 +0000 INFO [stdout] (默认 task-22) 在 org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83) 14:04: 21,697 +0000 INFO [stdout](默认任务 22)在 org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:945) 14:04:21,697 +0000 INFO [stdout](默认任务 22)在org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:876) 14:04:21,698 +0000 INFO [stdout] (default task-22) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961) 14:04:21,698 +0000 INFO [stdout] (默认任务 22) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java: 863) 14:04:21,698 +0000 INFO [stdout] (默认任务 22) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) 14:04:21,699 +0000 INFO [stdout] (默认任务-22) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837) 14:04:21,699 +0000 INFO [stdout] (默认 task-22) at javax.servlet.http.HttpServlet.service( HttpServlet.java:790) 14:04:21,699 +0000 信息 [stdout](默认任务 22)在 io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:86) 14:04:21,699 +0000 信息[stdout](默认任务 22)在 io.undertow.servlet.handlers。FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:130) 14:04:21,699 +0000 INFO [stdout](默认任务 22)在 com.adobe.jobcloud.spring.security.filters.SessionTimeoutFilter.doFilter(SessionTimeoutFilter.java: 65) 14:04:21,699 +0000 INFO [stdout] (默认任务 22) 在 io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60) 14:04:21,700 +0000 INFO [stdout] (默认任务 22)在 io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) 14:04:21,700 +0000 INFO [stdout](默认任务 22)在 com.adobe.jobcloud。 ws.security.filters.UiResponseFilter.doFilterInternal(UiResponseFilter.java:55) 14:04:21,700 +0000 INFO [stdout](默认任务 22)在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java: 108) 14:04:21,700 +0000 INFO [stdout](默认任务 22)在 io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60) 14:04:21,700 +0000 INFO [stdout](默认任务 22)在io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) 14:04:21,700 +0000 INFO [stdout](默认任务 22)在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain。 doFilter(FilterChainProxy.java:330) 14:04:21,700 +0000 INFO [stdout](默认任务 22)在 org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118) 14: 04:21,700 +0000 INFO [stdout](默认任务 22)在 org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84) 14:04:21,701 +0000 INFO [stdout](默认任务 22)在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 14:04:21,701 +0000 INFO [stdout](默认任务 22 ) at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113) 14:04:21,701 +0000 INFO [stdout] (默认任务 22) at org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java:342) 14:04:21,701 +0000 INFO [stdout](默认任务 22)在 org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103) 14: 04:21,701 +0000 INFO [stdout](默认任务 22)在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 14:04:21,702 +0000 INFO [stdout](默认任务 22)在 org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113) 14:04:21,702 +0000 INFO [stdout](默认任务 22 ) 在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 14:04:21,702 +0000 INFO [stdout] (默认任务 22) 在 org.springframework.security.web.servletapi。 SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154) 14:04:21,702 +0000 INFO [stdout](默认任务 22)在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 14: 04:21,703 +0000 INFO [stdout](默认任务 22)在 org.springframework.security.web.savedrequest.RequestCacheAwareFilter。doFilter(RequestCacheAwareFilter.java:45) 14:04:21,703 +0000 INFO [stdout](默认任务 22)在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 14:04: 21,703 +0000 INFO [stdout](默认任务 22)在 org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150) 14:04:21,703 +0000 INFO [stdout](默认任务-22)在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 14:04:21,704 +0000 INFO [stdout](默认任务 22)在 org.springframework.security.web。 authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199) 14:04:21,704 +0000 INFO [stdout](默认任务 22)在 org.springframework.security.web。FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 14:04:21,704 +0000 INFO [stdout] (默认任务 22) at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java: 110) 14:04:21,704 +0000 INFO [stdout] (默认任务 22) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 14:04:21,705 +0000 INFO [stdout ](默认任务 22)在 org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50) 14:04:21,705 +0000 INFO [stdout](默认任务 22)在org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108) 14:04:21,705 +0000 INFO [stdout](默认任务 22)在 org.springframework.security.web。FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 14:04:21,705 +0000 INFO [stdout](默认任务 22)在 org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87) 14:04:21,705 +0000 INFO [stdout](默认任务 22)在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 14:04:21,706 +0000 INFO [stdout] (默认任务 22)在 org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192) 14:04:21,706 +0000 INFO [stdout](默认任务 22)在 org.springframework.security.web。 FilterChainProxy.doFilter(FilterChainProxy.java:160) 14:04:21,706 +0000 INFO [stdout](默认任务 22)在 org.springframework.web.filter.DelegatingFilterProxy。invokeDelegate(DelegatingFilterProxy.java:344) 14:04:21,706 +0000 INFO [stdout] (默认任务 22) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261) 14:04:21,706 + io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60) 处的 0000 INFO [stdout](默认任务 22) 14:04:21,707 +0000 io 处的信息 [stdout](默认任务 22)。 undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) 14:04:21,707 +0000 io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler. java:85) 14:04:21,707 +0000 INFO [stdout](默认任务 22)在 io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62) 14:04:21,707 +0000 INFO [stdout](默认任务 22)在 io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) 14:04:21,709 +0000 INFO [stdout](默认任务 22)在在 io.undertow.server.handlers.PredicateHandler.handleRequest( PredicateHandler.java:43) 14:04:21,709 +0000 INFO [stdout](默认任务 22)在 io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131) 14:04:21,710 + 0000 信息 [stdout](默认任务 22)在 io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57) 14:04:21,710 +0000 INFO [stdout](默认任务 22)在 io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) 14:04:21,711 +0000 INFO [stdout ](默认 task-22)在 io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46) 14:04:21,711 +0000 INFO [stdout](默认 task-22)在 io.undertow.servlet。 handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64) 14:04:21,716 +0000 INFO [stdout](默认任务 22)在 io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58) 14:04:21,716 +0000 INFO [stdout](默认任务 22)在 io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler。handleRequest(CachedAuthenticatedSessionHandler.java:70) 14:04:21,716 +0000 io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76) 14:04:21,717 + io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) 14:04:21,719 +0000 INFO [stdout](默认任务 22)处的 0000 INFO [stdout](默认任务 22)。 io.undertow.server.handlers.PredicateHandler.handleRequest( PredicateHandler.java:43) 14:04:21,719 +0000 INFO [stdout](默认任务 22)在 io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) 14:04:21,719 +0000 INFO [stdout](默认任务 22)在 io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:261) 14:04:21,719 +0000 INFO [stdout](默认任务 22)在io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:248) 14:04:21,719 +0000 INFO [stdout](默认任务 22)在 io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler .java:77) 14:04:21,719 +0000 INFO [stdout](默认任务 22)在 io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:167) 14:04:21,720 +0000 INFO [stdout](默认 task-22)在 io.undertow.server.Connectors.executeRootHandler(Connectors.java:199) 14:04:21,720 +0000 INFO [stdout](默认 task-22)在 io.undertow.server。 HttpServerExchange$1。run(HttpServerExchange.java:761) 14:04:21,720 +0000 INFO [stdout] (默认任务 22) 在 java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) 14:04:21,720 +0000 INFO [stdout] (默认任务 22)在 java.util.concurrent.ThreadPoolExecutor$Worker.run(未知来源) 14:04:21,720 +0000 INFO [stdout](默认任务 22)在 java.lang.Thread.run(未知来源) )

我正在使用以下版本:

神器:2.4.6

杰克逊(数据绑定,注释,核心):2.4.6

4

1 回答 1

0

您至少需要使用 2.4.4 版的 jackson-databind。com.fasterxml.jackson.databind.ObjectMapper.addMixin(Class<?>, Class<?>)在低于此的版本中不存在。

<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-databind</artifactId>
    <version>2.4.4</version>
</dependency>

编辑:我误读了之前的评论,这使得这个答案不正确。暂时将其留在这里,一旦我们弄清楚就会编辑

于 2017-10-03T15:03:39.030 回答