sonatype-nexus-community / nexus-repository-composer

Composer support for the Nexus Repository Manager (work in progress!)
Eclipse Public License 1.0
211 stars 82 forks source link

Nexus fails starting with java.lang.IllegalStateException: Missing recipe: composer-proxy after upgrading to v3.53 (Docker based) #140

Closed gschafra closed 1 year ago

gschafra commented 1 year ago

What are you trying to do?

When trying to update our nexus from 3.52 to 3.53 with installed composer plugin nexus fails to start with following stack trace:

nexus3-nexus-1  | 2023-05-03 15:31:18,600+0000 ERROR [FelixStartLevel] *SYSTEM org.sonatype.nexus.repository.manager.internal.RepositoryManagerImpl - Failed transition: NEW -> STARTED
nexus3-nexus-1  | java.lang.IllegalStateException: Missing recipe: composer-proxy
nexus3-nexus-1  |       at com.google.common.base.Preconditions.checkState(Preconditions.java:591)
nexus3-nexus-1  |       at org.sonatype.nexus.repository.manager.internal.RepositoryManagerImpl.recipe(RepositoryManagerImpl.java:159)
nexus3-nexus-1  |       at org.sonatype.nexus.repository.manager.internal.RepositoryManagerImpl.newRepository(RepositoryManagerImpl.java:177)
nexus3-nexus-1  |       at org.sonatype.nexus.repository.manager.internal.RepositoryManagerImpl.restoreRepositories(RepositoryManagerImpl.java:274)
nexus3-nexus-1  |       at org.sonatype.nexus.repository.manager.internal.RepositoryManagerImpl.doStart(RepositoryManagerImpl.java:256)
nexus3-nexus-1  |       at org.sonatype.nexus.common.stateguard.StateGuardLifecycleSupport.start(StateGuardLifecycleSupport.java:69)
nexus3-nexus-1  |       at org.sonatype.nexus.common.stateguard.MethodInvocationAction.run(MethodInvocationAction.java:39)
nexus3-nexus-1  |       at org.sonatype.nexus.common.stateguard.StateGuard$TransitionImpl.run(StateGuard.java:193)
nexus3-nexus-1  |       at org.sonatype.nexus.common.stateguard.TransitionsInterceptor.invoke(TransitionsInterceptor.java:57)
nexus3-nexus-1  |       at org.sonatype.nexus.extender.NexusLifecycleManager.startComponent(NexusLifecycleManager.java:199)
nexus3-nexus-1  |       at org.sonatype.nexus.extender.NexusLifecycleManager.to(NexusLifecycleManager.java:111)
nexus3-nexus-1  |       at org.sonatype.nexus.extender.NexusContextListener.moveToPhase(NexusContextListener.java:319)
nexus3-nexus-1  |       at org.sonatype.nexus.extender.NexusContextListener.frameworkEvent(NexusContextListener.java:216)
nexus3-nexus-1  |       at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1597)
nexus3-nexus-1  |       at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
nexus3-nexus-1  |       at java.lang.Thread.run(Thread.java:750)
nexus3-nexus-1  | 2023-05-03 15:31:18,605+0000 ERROR [FelixStartLevel] *SYSTEM org.sonatype.nexus.extender.NexusContextListener - Failed to start nexus
nexus3-nexus-1  | java.lang.IllegalStateException: Missing recipe: composer-proxy
nexus3-nexus-1  |       at com.google.common.base.Preconditions.checkState(Preconditions.java:591)
nexus3-nexus-1  |       at org.sonatype.nexus.repository.manager.internal.RepositoryManagerImpl.recipe(RepositoryManagerImpl.java:159)
nexus3-nexus-1  |       at org.sonatype.nexus.repository.manager.internal.RepositoryManagerImpl.newRepository(RepositoryManagerImpl.java:177)
nexus3-nexus-1  |       at org.sonatype.nexus.repository.manager.internal.RepositoryManagerImpl.restoreRepositories(RepositoryManagerImpl.java:274)
nexus3-nexus-1  |       at org.sonatype.nexus.repository.manager.internal.RepositoryManagerImpl.doStart(RepositoryManagerImpl.java:256)
nexus3-nexus-1  |       at org.sonatype.nexus.common.stateguard.StateGuardLifecycleSupport.start(StateGuardLifecycleSupport.java:69)
nexus3-nexus-1  |       at org.sonatype.nexus.common.stateguard.MethodInvocationAction.run(MethodInvocationAction.java:39)
nexus3-nexus-1  |       at org.sonatype.nexus.common.stateguard.StateGuard$TransitionImpl.run(StateGuard.java:193)
nexus3-nexus-1  |       at org.sonatype.nexus.common.stateguard.TransitionsInterceptor.invoke(TransitionsInterceptor.java:57)
nexus3-nexus-1  |       at org.sonatype.nexus.extender.NexusLifecycleManager.startComponent(NexusLifecycleManager.java:199)
nexus3-nexus-1  |       at org.sonatype.nexus.extender.NexusLifecycleManager.to(NexusLifecycleManager.java:111)
nexus3-nexus-1  |       at org.sonatype.nexus.extender.NexusContextListener.moveToPhase(NexusContextListener.java:319)
nexus3-nexus-1  |       at org.sonatype.nexus.extender.NexusContextListener.frameworkEvent(NexusContextListener.java:216)
nexus3-nexus-1  |       at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1597)
nexus3-nexus-1  |       at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
nexus3-nexus-1  |       at java.lang.Thread.run(Thread.java:750)
nexus3-nexus-1  | 2023-05-03 15:31:18,608+0000 ERROR [FelixStartLevel] *SYSTEM Felix - Framework listener delivery error.
nexus3-nexus-1  | java.lang.IllegalStateException: Missing recipe: composer-proxy
nexus3-nexus-1  |       at com.google.common.base.Preconditions.checkState(Preconditions.java:591)
nexus3-nexus-1  |       at org.sonatype.nexus.repository.manager.internal.RepositoryManagerImpl.recipe(RepositoryManagerImpl.java:159)
nexus3-nexus-1  |       at org.sonatype.nexus.repository.manager.internal.RepositoryManagerImpl.newRepository(RepositoryManagerImpl.java:177)
nexus3-nexus-1  |       at org.sonatype.nexus.repository.manager.internal.RepositoryManagerImpl.restoreRepositories(RepositoryManagerImpl.java:274)
nexus3-nexus-1  |       at org.sonatype.nexus.repository.manager.internal.RepositoryManagerImpl.doStart(RepositoryManagerImpl.java:256)
nexus3-nexus-1  |       at org.sonatype.nexus.common.stateguard.StateGuardLifecycleSupport.start(StateGuardLifecycleSupport.java:69)
nexus3-nexus-1  |       at org.sonatype.nexus.common.stateguard.MethodInvocationAction.run(MethodInvocationAction.java:39)
nexus3-nexus-1  |       at org.sonatype.nexus.common.stateguard.StateGuard$TransitionImpl.run(StateGuard.java:193)
nexus3-nexus-1  |       at org.sonatype.nexus.common.stateguard.TransitionsInterceptor.invoke(TransitionsInterceptor.java:57)
nexus3-nexus-1  |       at org.sonatype.nexus.extender.NexusLifecycleManager.startComponent(NexusLifecycleManager.java:199)
nexus3-nexus-1  |       at org.sonatype.nexus.extender.NexusLifecycleManager.to(NexusLifecycleManager.java:111)
nexus3-nexus-1  |       at org.sonatype.nexus.extender.NexusContextListener.moveToPhase(NexusContextListener.java:319)
nexus3-nexus-1  |       at org.sonatype.nexus.extender.NexusContextListener.frameworkEvent(NexusContextListener.java:216)
nexus3-nexus-1  |       at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1597)
nexus3-nexus-1  |       at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
nexus3-nexus-1  |       at java.lang.Thread.run(Thread.java:750)

How could we solve this issue? (Not knowing is okay!)

Fix compatibility with nexus v3.53

gschafra commented 1 year ago

My nexus docker file:

# declaration of NEXUS_VERSION must appear before first FROM command
# see: https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact
ARG NEXUS_VERSION=latest

FROM sonatype/nexus3:$NEXUS_VERSION

ARG NEXUS_COMPOSER_VERSION=0.0.29
ARG DEPLOY_DIR=/opt/sonatype/nexus/deploy/

ENV NEXUS_COMPOSER_VERSION=${NEXUS_COMPOSER_VERSION}
ENV DEPLOY_DIR=${DEPLOY_DIR}

USER root
RUN microdnf update -y && microdnf --setopt=install_weak_deps=0 --setopt=tsflags=nodocs install -y  wget
RUN wget -O ${DEPLOY_DIR}nexus-repository-composer-${NEXUS_COMPOSER_VERSION}-bundle.kar https://repo1.maven.org/maven2/org/sonatype/nexus/plugins/nexus-repository-composer/${NEXUS_COMPOSER_VERSION}/nexus-repository-composer-${NEXUS_COMPOSER_VERSION}-bundle.kar
# COPY ./nexus-repository-composer-*-bundle.kar ${DEPLOY_DIR}
USER nexus
gschafra commented 1 year ago

FYI: Looks like the plugin is not loading at all.

gschafra commented 1 year ago

As suspected... the problem also occurs with another third-party bundle/plugin: https://github.com/sonatype-nexus-community/nexus-repository-cargo. So, it's DEFINITLY NOT related the the bundle/plugin itself. This strengthens me in the assumption that it is a problem of Nexus itself.

mvanini commented 1 year ago

same problem here with some composer repository definend during Nexus upgrade passing from 3.45.1 to 3.53.0 each with plugin version 0.0.29. Only way I've found to get my Nexus start was using the "most permanent install" of the composer plugin.

I hope this save you some panic moment ;)

gschafra commented 1 year ago

I hope this save you some panic moment ;)

Ohh... thanks a lot... this REALLY provides relief... since I'm struggling with this problems for hours... and I thought I was kind of stupid.

gschafra commented 1 year ago

@mvanini Could you please confirm the corresponding issue (everything points to a nexus problem so far, https://github.com/sonatype/nexus-public/issues/106) at the public nexus repo. I am afraid "they" (or any GPT bot) do not believe me/us. Other third party bundles seem also to be affected.

texaclou commented 1 year ago

Hello, the issue seems to be resolved since 3.54. https://github.com/sonatype/nexus-public/issues/106#issuecomment-1552197498