Uploaded image for project: 'Dev - Nexus Repo'
  1. Dev - Nexus Repo
  2. NEXUS-11732

prevent ClassCastException when handling StorageLinkItem during upgrade to Nexus 3

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.14.1, 3.1.0
    • Fix Version/s: 2.14.2, 3.2.0
    • Component/s: Migration
    • Labels:
      None

      Description

      Migration does not seem to handle finding a org.sonatype.nexus.proxy.item.DefaultStorageLinkItem in a maven2 hosted repo well. It throws a ClassCastException trying to cast it to StorageFileItem.

      2016-11-30 15:09:42 DEBUG [qtp498541853-82] - com.sonatype.nexus.migrationagent.repository.RepositoryMigrationManagerImpl - Finding configuration extractor for: maven2-hosted
      2016-11-30 15:09:42 DEBUG [qtp498541853-82] - com.sonatype.nexus.migrationagent.repository.RepositoryMigrationManagerImpl - Finding configuration extractor for: maven2-hosted
      2016-11-30 15:09:42 DEBUG [qtp498541853-82] - com.sonatype.nexus.migrationagent.repository.extractors.Maven2HostedConfigurationExtractor - Extracted Repository configuration Releases (releases), {browseable=true, exposed=true, indexable=true, notFoundCacheActive=false, notFoundCacheTimeToLive=1440, pathPrefix=releases, searchable=true, writePolicy=allow-write-once, rhcConfigured=false, rhcEnabled=false, fileTypeValidation=false, versionPolicy=release}
      2016-11-30 15:09:45 WARN  [qtp498541853-82] - org.sonatype.sisu.siesta.server.internal.mappers.ThrowableExceptionMapper - java.lang.ClassCastException: org.sonatype.nexus.proxy.item.DefaultStorageLinkItem cannot be cast to org.sonatype.nexus.proxy.item.StorageFileItem
      java.lang.ClassCastException: org.sonatype.nexus.proxy.item.DefaultStorageLinkItem cannot be cast to org.sonatype.nexus.proxy.item.StorageFileItem
      	at com.sonatype.nexus.migrationagent.repository.RepositoryMigratorSupport.resolveItem(RepositoryMigratorSupport.java:292) ~[na:na]
      	at com.sonatype.nexus.migrationagent.repository.RepositoryMigratorSupport.extract(RepositoryMigratorSupport.java:246) ~[na:na]
      	at com.sonatype.nexus.migrationagent.repository.RepositoryMigrator$extract.call(Unknown Source) ~[na:na]
      	at com.sonatype.nexus.migrationagent.rest.RepositoryChangelogResource$_get_closure1$_closure2.doCall(RepositoryChangelogResource.groovy:115) ~[na:na]
      	at sun.reflect.GeneratedMethodAccessor164.invoke(Unknown Source) ~[na:na]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_101]
      	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_101]
      	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93) ~[na:na]
      	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) ~[na:na]
      	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294) ~[na:na]
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1019) ~[na:na]
      	at groovy.lang.Closure.call(Closure.java:426) ~[na:na]
      	at groovy.lang.Closure.call(Closure.java:442) ~[na:na]
      	at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2030) ~[na:na]
      	at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2015) ~[na:na]
      	at org.codehaus.groovy.runtime.dgm$158.invoke(Unknown Source) ~[na:na]
      	at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274) ~[na:na]
      	at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56) ~[na:na]
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) ~[na:na]
      	at com.sonatype.nexus.migrationagent.rest.RepositoryChangelogResource$_get_closure1.doCall(RepositoryChangelogResource.groovy:107) ~[na:na]
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_101]
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_101]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_101]
      	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_101]
      	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93) ~[na:na]
      	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) ~[na:na]
      	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294) ~[na:na]
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1019) ~[na:na]
      	at groovy.lang.Closure.call(Closure.java:426) ~[na:na]
      	at groovy.lang.Closure.call(Closure.java:442) ~[na:na]
      	at org.codehaus.groovy.runtime.IOGroovyMethods.withCloseable(IOGroovyMethods.java:1622) ~[na:na]
      	at org.codehaus.groovy.runtime.NioGroovyMethods.withCloseable(NioGroovyMethods.java:1754) ~[na:na]
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_101]
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_101]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_101]
      	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_101]
      	at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke(ReflectionMetaMethod.java:54) ~[na:na]
      	at org.codehaus.groovy.runtime.metaclass.NewInstanceMetaMethod.invoke(NewInstanceMetaMethod.java:56) ~[na:na]
      	at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274) ~[na:na]
      	at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56) ~[na:na]
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) ~[na:na]
      	at com.sonatype.nexus.migrationagent.rest.RepositoryChangelogResource.get(RepositoryChangelogResource.groovy:106) ~[na:na]
      	at com.sonatype.nexus.migrationagent.rest.RepositoryChangelogResource.getAsSmile(RepositoryChangelogResource.groovy:145) ~[na:na]
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_101]
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_101]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_101]
      	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_101]
      	at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60) ~[nexus-siesta-plugin-2.14.1-01/:na]
      	at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205) ~[nexus-siesta-plugin-2.14.1-01/:na]
      	at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75) ~[nexus-siesta-plugin-2.14.1-01/:na]
      	at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302) ~[nexus-siesta-plugin-2.14.1-01/:na]
      	at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108) ~[nexus-siesta-plugin-2.14.1-01/:na]
      	at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) ~[nexus-siesta-plugin-2.14.1-01/:na]
      	at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84) ~[nexus-siesta-plugin-2.14.1-01/:na]
      	at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1511) [nexus-siesta-plugin-2.14.1-01/:na]
      	at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1442) [nexus-siesta-plugin-2.14.1-01/:na]
      	at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1391) [nexus-siesta-plugin-2.14.1-01/:na]
      	at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1381) [nexus-siesta-plugin-2.14.1-01/:na]
      	at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416) [nexus-siesta-plugin-2.14.1-01/:na]
      	at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538) [nexus-siesta-plugin-2.14.1-01/:na]
      	at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716) [nexus-siesta-plugin-2.14.1-01/:na]
      	at org.sonatype.sisu.siesta.server.internal.SiestaServlet.service(SiestaServlet.java:121) [nexus-siesta-plugin-2.14.1-01/:na]
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) [javax.servlet-3.0.0.v201112011016.jar:na]
      	at com.google.inject.servlet.ServletDefinition.doServiceImpl(ServletDefinition.java:297) [guice-servlet-3.2.6.jar:3.2.6]
      	at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:281) [guice-servlet-3.2.6.jar:3.2.6]
      	at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:186) [guice-servlet-3.2.6.jar:3.2.6]
      	at com.google.inject.servlet.AbstractServletPipeline.service(AbstractServletPipeline.java:65) [guice-servlet-3.2.6.jar:3.2.6]
      	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:85) [guice-servlet-3.2.6.jar:3.2.6]
      	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:112) [shiro-web-1.3.2.jar:1.3.2]
      	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82) [guice-servlet-3.2.6.jar:3.2.6]
      	at com.google.inject.servlet.AbstractFilterPipeline.dispatch(AbstractFilterPipeline.java:100) [guice-servlet-3.2.6.jar:3.2.6]
      	at org.sonatype.nexus.web.internal.NexusGuiceFilter$MultiFilterChain.doFilter(NexusGuiceFilter.java:82) [nexus-core-2.14.1-01.jar:2.14.1-01]
      	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:89) [guice-servlet-3.2.6.jar:3.2.6]
      	at com.sonatype.nexus.analytics.internal.RestRequestCollector.doFilter(RestRequestCollector.java:81) [nexus-analytics-plugin-2.14.1-01/:na]
      	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82) [guice-servlet-3.2.6.jar:3.2.6]
      	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61) [shiro-web-1.3.2.jar:1.3.2]
      	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108) [shiro-web-1.3.2.jar:1.3.2]
      	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137) [shiro-web-1.3.2.jar:1.3.2]
      	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) [shiro-web-1.3.2.jar:1.3.2]
      	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66) [shiro-web-1.3.2.jar:1.3.2]
      	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) [shiro-web-1.3.2.jar:1.3.2]
      	at org.sonatype.nexus.web.internal.SecurityFilter.executeChain(SecurityFilter.java:90) [nexus-core-2.14.1-01.jar:2.14.1-01]
      	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) [shiro-web-1.3.2.jar:1.3.2]
      	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) [shiro-core-1.3.2.jar:1.3.2]
      	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) [shiro-core-1.3.2.jar:1.3.2]
      	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383) [shiro-core-1.3.2.jar:1.3.2]
      	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) [shiro-web-1.3.2.jar:1.3.2]
      	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) [shiro-web-1.3.2.jar:1.3.2]
      	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82) [guice-servlet-3.2.6.jar:3.2.6]
      	at com.google.inject.servlet.AbstractFilterPipeline.dispatch(AbstractFilterPipeline.java:100) [guice-servlet-3.2.6.jar:3.2.6]
      	at org.sonatype.nexus.web.internal.NexusGuiceFilter$MultiFilterChain.doFilter(NexusGuiceFilter.java:82) [nexus-core-2.14.1-01.jar:2.14.1-01]
      	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:89) [guice-servlet-3.2.6.jar:3.2.6]
      	at com.yammer.metrics.web.WebappMetricsFilter.doFilter(WebappMetricsFilter.java:76) [metrics-web-2.2.0.jar:na]
      	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82) [guice-servlet-3.2.6.jar:3.2.6]
      	at org.sonatype.nexus.web.internal.CommonHeadersFilter.doFilter(CommonHeadersFilter.java:69) [nexus-core-2.14.1-01.jar:2.14.1-01]
      	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82) [guice-servlet-3.2.6.jar:3.2.6]
      	at org.sonatype.nexus.web.internal.ErrorPageFilter.doFilter(ErrorPageFilter.java:71) [nexus-core-2.14.1-01.jar:2.14.1-01]
      	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82) [guice-servlet-3.2.6.jar:3.2.6]
      	at org.sonatype.nexus.web.internal.BaseUrlHolderFilter.doFilter(BaseUrlHolderFilter.java:66) [nexus-core-2.14.1-01.jar:2.14.1-01]
      	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82) [guice-servlet-3.2.6.jar:3.2.6]
      	at com.google.inject.servlet.AbstractFilterPipeline.dispatch(AbstractFilterPipeline.java:100) [guice-servlet-3.2.6.jar:3.2.6]
      	at org.sonatype.nexus.web.internal.NexusGuiceFilter$MultiFilterChain.doFilter(NexusGuiceFilter.java:82) [nexus-core-2.14.1-01.jar:2.14.1-01]
      	at org.sonatype.nexus.web.internal.NexusGuiceFilter$MultiFilterPipeline.dispatch(NexusGuiceFilter.java:56) [nexus-core-2.14.1-01.jar:2.14.1-01]
      	at com.google.inject.servlet.GuiceFilter$1.call(GuiceFilter.java:133) [guice-servlet-3.2.6.jar:3.2.6]
      	at com.google.inject.servlet.GuiceFilter$1.call(GuiceFilter.java:130) [guice-servlet-3.2.6.jar:3.2.6]
      	at com.google.inject.servlet.GuiceFilter$Context.call(GuiceFilter.java:203) [guice-servlet-3.2.6.jar:3.2.6]
      	at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:130) [guice-servlet-3.2.6.jar:3.2.6]
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1476) [jetty-servlet-8.1.16.v20140903.jar:8.1.16.v20140903]
      	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:501) [jetty-servlet-8.1.16.v20140903.jar:8.1.16.v20140903]
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137) [jetty-server-8.1.16.v20140903.jar:8.1.16.v20140903]
      	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557) [jetty-security-8.1.16.v20140903.jar:8.1.16.v20140903]
      	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231) [jetty-server-8.1.16.v20140903.jar:8.1.16.v20140903]
      	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086) [jetty-server-8.1.16.v20140903.jar:8.1.16.v20140903]
      	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429) [jetty-servlet-8.1.16.v20140903.jar:8.1.16.v20140903]
      	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193) [jetty-server-8.1.16.v20140903.jar:8.1.16.v20140903]
      	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020) [jetty-server-8.1.16.v20140903.jar:8.1.16.v20140903]
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) [jetty-server-8.1.16.v20140903.jar:8.1.16.v20140903]
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) [jetty-server-8.1.16.v20140903.jar:8.1.16.v20140903]
      	at com.yammer.metrics.jetty.InstrumentedHandler.handle(InstrumentedHandler.java:200) [metrics-jetty-2.2.0.jar:na]
      	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154) [jetty-server-8.1.16.v20140903.jar:8.1.16.v20140903]
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) [jetty-server-8.1.16.v20140903.jar:8.1.16.v20140903]
      	at org.eclipse.jetty.server.Server.handle(Server.java:370) [jetty-server-8.1.16.v20140903.jar:8.1.16.v20140903]
      	at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494) [jetty-server-8.1.16.v20140903.jar:8.1.16.v20140903]
      	at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:971) [jetty-server-8.1.16.v20140903.jar:8.1.16.v20140903]
      	at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1033) [jetty-server-8.1.16.v20140903.jar:8.1.16.v20140903]
      	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644) [jetty-http-8.1.16.v20140903.jar:8.1.16.v20140903]
      	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235) [jetty-http-8.1.16.v20140903.jar:8.1.16.v20140903]
      	at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82) [jetty-server-8.1.16.v20140903.jar:8.1.16.v20140903]
      	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696) [jetty-io-8.1.16.v20140903.jar:8.1.16.v20140903]
      	at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53) [jetty-io-8.1.16.v20140903.jar:8.1.16.v20140903]
      	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608) [jetty-util-8.1.16.v20140903.jar:8.1.16.v20140903]
      	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543) [jetty-util-8.1.16.v20140903.jar:8.1.16.v20140903]
      	at java.lang.Thread.run(Thread.java:745) [na:1.8.0_101]
      2016-11-30 15:09:45 WARN  [qtp498541853-82] - org.sonatype.sisu.siesta.server.internal.mappers.ThrowableExceptionMapper - (ID db8ac9d3-212d-424e-a1f2-0aa9d02bc77c) Response: [500] (no entity/body) mapped from java.lang.ClassCastException/org.sonatype.nexus.proxy.item.DefaultStorageLinkItem cannot be cast to org.sonatype.nexus.proxy.item.StorageFileItem
      2016-11-30 15:09:45 INFO  [qtp498541853-82] - org.sonatype.nexus.velocity.VelocityEngineProvider - Creating Nexus VelocityEngine
      
      

      Expected:

      • migrate that item
      • if an exception is thrown like this related to storage items migration, ALWAYS log the file name trying to be processed ( not sure if scouring code to ensure this does warrant a separate issue )

        Attachments

          Activity

            People

            Assignee:
            dbradicich Damian Bradicich
            Reporter:
            plynch Peter Lynch
            Last Updated By:
            Peter Lynch
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Date of First Response:

                tigCommentSecurity.panel-title