Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composer plugin is not working on NXRM 3.71 #157

Closed
hadavand opened this issue Aug 10, 2024 · 31 comments · Fixed by #158
Closed

Composer plugin is not working on NXRM 3.71 #157

hadavand opened this issue Aug 10, 2024 · 31 comments · Fixed by #158

Comments

@hadavand
Copy link

I tried to use composer bundle/plugin 0.0.29 with nexus repository version 3.71 but i got the following error during nexus start.

2024-08-10 20:11:16,269+0330 ERROR [FelixStartLevel]  *SYSTEM Felix - Bundle org.sonatype.nexus.extender [95] EventDispatcher: Error during dispatch. (com.google.inject.CreationException: Unable to create injector, see the following errors:

1) [Guice/MissingImplementation]: No implementation for ComposerJsonProcessor annotated with interface TypeArguments$Implicit was bound.

Did you mean?
    * ComposerJsonProcessor bound at LocatorWiring

Requested by:
1  : LocatorWiring

Learn more:
  https://github.com/google/guice/wiki/MISSING_IMPLEMENTATION

1 error

======================
Full classname legend:
======================
ComposerJsonProcessor:  "org.sonatype.nexus.repository.composer.internal.ComposerJsonProcessor"
LocatorWiring:          "org.eclipse.sisu.wire.LocatorWiring"
TypeArguments$Implicit: "org.eclipse.sisu.inject.TypeArguments$Implicit"
========================
End of classname legend:
========================
)
com.google.inject.CreationException: Unable to create injector, see the following errors:

1) [Guice/MissingImplementation]: No implementation for ComposerJsonProcessor annotated with interface TypeArguments$Implicit was bound.

Did you mean?
    * ComposerJsonProcessor bound at LocatorWiring

Requested by:
1  : LocatorWiring

Learn more:
  https://github.com/google/guice/wiki/MISSING_IMPLEMENTATION

1 error

======================
Full classname legend:
======================
ComposerJsonProcessor:  "org.sonatype.nexus.repository.composer.internal.ComposerJsonProcessor"
LocatorWiring:          "org.eclipse.sisu.wire.LocatorWiring"
TypeArguments$Implicit: "org.eclipse.sisu.inject.TypeArguments$Implicit"
========================
End of classname legend:
========================

so the plugin is not working

@mnjadidi
Copy link

I have the same problem

@stklcode
Copy link
Contributor

stklcode commented Aug 12, 2024

Obviously. 3.71 dropped OrientDB support and this plugin is several versions behind, so quite a few transitions to new internal structures to be done.

  • missing H2/PostgreSQL DB schema support
  • migration to new APIs required
  • missing migration strategy (unsure if that will ever be done without additional tooling effort)

I tried to get into it and start migration (see #158), but this will take some time and does not have any priority on my side.

Current status: plugin starts, tables are created, hosted repository works mostly (cleanup and deletion to be done)

@stklcode
Copy link
Contributor

Update from my side:

Think I'm mostly done with the migration. As far as my tests tell me, the project is now on par with the 0.29 state.

  • hosted repo works including upload mask and cleanup
    • some minor improvements to package/provider file generation and removal
    • new feature: list.json with filter support
  • proxy repo works ... except for the actual zipballs, but I don't think they worked before
  • group repo works

I'd appreciate testing, if anyone is willing to do it. Can attach a snapshot JAR or KAR, if requested.

@hadavand
Copy link
Author

Thank you
Could you please attach KAR bundle?

@stklcode
Copy link
Contributor

stklcode commented Aug 14, 2024

This one is built from 527a512 using OpenJDK 17.0.12

Use at own risk 😉
[removed old version link, see below]
(extract the ZIP, KAR files are not supported for upload here)

Already mentioned, but like overread... It does not support migration from OrientDB to H2 (or at least I did not test it)
I performed a scripted export and uploaded all ZIPs to the new hosted repo for now.

@hadavand
Copy link
Author

This one is built from 527a512 using OpenJDK 17.0.12

Use at own risk 😉 nexus-repository-composer-0.1.0-SNAPSHOT-bundle.kar.zip (extract the ZIP, KAR files are not supported for upload here)

Already mentioned, but like overread... It does not support migration from OrientDB to H2 (or at least I did not test it) I performed a scripted export and uploaded all ZIPs to the new hosted repo for now.

composer hosted works fine. but composer proxy respond with 500 ERROR

2024-08-14 21:47:45,754+0330 WARN  [qtp892284664-684]  *UNKNOWN org.sonatype.nexus.repository.httpbridge.internal.ViewServlet - Failure servicing: GET /repository/composer-proxy/packages.json
java.lang.NullPointerException: null
	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:903)
	at org.sonatype.nexus.repository.composer.internal.proxy.ComposerProxyFacet.generatePackagesJson(ComposerProxyFacet.java:191)
	at org.sonatype.nexus.repository.composer.internal.proxy.ComposerProxyFacet.store(ComposerProxyFacet.java:121)
	at org.sonatype.nexus.repository.proxy.ProxyFacetSupport.doGet(ProxyFacetSupport.java:356)
	at org.sonatype.nexus.repository.proxy.ProxyFacetSupport.lambda$1(ProxyFacetSupport.java:321)
	at org.sonatype.nexus.common.cooperation2.ScopedCooperation2Support$ScopedCooperation2Builder.perform(ScopedCooperation2Support.java:85)
	at org.sonatype.nexus.common.cooperation2.datastore.internal.CooperatingFuture.performCall(CooperatingFuture.java:126)
	at org.sonatype.nexus.common.cooperation2.datastore.internal.CooperatingFuture.call(CooperatingFuture.java:68)
	at org.sonatype.nexus.common.cooperation2.ScopedCooperation2Support$ScopedCooperation2Builder.cooperate(ScopedCooperation2Support.java:102)
	at org.sonatype.nexus.repository.proxy.ProxyFacetSupport.get(ProxyFacetSupport.java:331)
	at org.sonatype.nexus.repository.proxy.ProxyFacetSupport.get(ProxyFacetSupport.java:308)
	at org.sonatype.nexus.repository.proxy.ProxyHandler.handle(ProxyHandler.java:53)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at org.sonatype.nexus.repository.view.handlers.ContentHeadersHandler.handle(ContentHeadersHandler.java:46)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at org.sonatype.nexus.repository.http.PartialFetchHandler.handle(PartialFetchHandler.java:59)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at org.sonatype.nexus.repository.view.handlers.ConditionalRequestHandler.handle(ConditionalRequestHandler.java:67)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at org.sonatype.nexus.repository.cache.NegativeCacheHandler.handle(NegativeCacheHandler.java:72)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at com.sonatype.nexus.clm.internal.datastore.FirewallContributedHandler.handle(FirewallContributedHandler.java:114)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at com.sonatype.analytics.internal.handler.AnalyticsBytesTransferredHandler.handle(AnalyticsBytesTransferredHandler.java:51)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at com.sonatype.analytics.internal.handler.AnalyticsBytesTransferredHandler.handle(AnalyticsBytesTransferredHandler.java:51)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at org.sonatype.nexus.repository.view.handlers.HandlerContributor.handle(HandlerContributor.java:67)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at org.sonatype.nexus.repository.view.handlers.ExceptionHandler.handle(ExceptionHandler.java:42)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at com.sonatype.analytics.internal.LoginsCounterHandler.handle(LoginsCounterHandler.java:87)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at org.sonatype.nexus.repository.security.SecurityHandler.handle(SecurityHandler.java:64)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at org.sonatype.nexus.repository.view.Context$proceed.call(Unknown Source)
	at org.sonatype.nexus.repository.composer.internal.recipe.ComposerRecipeSupport$_closure1.doCall(ComposerRecipeSupport.groovy:114)
	at jdk.internal.reflect.GeneratedMethodAccessor100.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:107)
	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323)
	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:274)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1030)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1135)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1030)
	at groovy.lang.Closure.call(Closure.java:427)
	at org.codehaus.groovy.runtime.ConvertedClosure.invokeCustom(ConvertedClosure.java:50)
	at org.codehaus.groovy.runtime.ConversionHandler.invoke(ConversionHandler.java:112)
	at jdk.proxy28/jdk.proxy28.$Proxy350.handle(Unknown Source)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at com.sonatype.analytics.internal.handler.AnalyticsMeteringHandler.handle(AnalyticsMeteringHandler.java:69)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at org.sonatype.nexus.repository.view.handlers.TimingHandler.handle(TimingHandler.java:58)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at org.sonatype.nexus.repository.view.Context.start(Context.java:179)
	at org.sonatype.nexus.repository.view.Router.dispatch(Router.java:65)
	at org.sonatype.nexus.repository.view.ConfigurableViewFacet.dispatch(ConfigurableViewFacet.java:52)
	at org.sonatype.nexus.repository.view.ConfigurableViewFacet.dispatch(ConfigurableViewFacet.java:43)
	at org.sonatype.nexus.repository.httpbridge.internal.ViewServlet.dispatchAndSend(ViewServlet.java:212)
	at org.sonatype.nexus.repository.httpbridge.internal.ViewServlet.doService(ViewServlet.java:174)
	at org.sonatype.nexus.repository.httpbridge.internal.ViewServlet.service(ViewServlet.java:126)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at com.google.inject.servlet.ServletDefinition.doServiceImpl(ServletDefinition.java:293)
	at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:283)
	at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:184)
	at com.google.inject.servlet.DynamicServletPipeline.service(DynamicServletPipeline.java:71)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:85)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:154)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:154)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:154)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:154)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:458)
	at org.sonatype.nexus.security.SecurityFilter.executeChain(SecurityFilter.java:96)
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:373)
	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:387)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:370)
	at org.sonatype.nexus.security.SecurityFilter.doFilterInternal(SecurityFilter.java:112)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:154)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
	at com.codahale.metrics.servlet.AbstractInstrumentedFilter.doFilter(AbstractInstrumentedFilter.java:112)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:154)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:154)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:154)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:154)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:458)
	at org.sonatype.nexus.security.SecurityFilter.executeChain(SecurityFilter.java:96)
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:373)
	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:387)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:370)
	at org.sonatype.nexus.security.SecurityFilter.doFilterInternal(SecurityFilter.java:112)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:154)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
	at org.sonatype.nexus.repository.httpbridge.internal.ExhaustRequestFilter.doFilter(ExhaustRequestFilter.java:80)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:154)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:154)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
	at com.sonatype.nexus.licensing.internal.LicensingRedirectFilter.doFilter(LicensingRedirectFilter.java:116)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
	at com.codahale.metrics.servlet.AbstractInstrumentedFilter.doFilter(AbstractInstrumentedFilter.java:112)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
	at org.sonatype.nexus.internal.web.ErrorPageFilter.doFilter(ErrorPageFilter.java:79)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
	at org.sonatype.nexus.internal.web.EnvironmentFilter.doFilter(EnvironmentFilter.java:101)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
	at org.sonatype.nexus.internal.web.HeaderPatternFilter.doFilter(HeaderPatternFilter.java:98)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
	at com.google.inject.servlet.DynamicFilterPipeline.dispatch(DynamicFilterPipeline.java:104)
	at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:133)
	at org.sonatype.nexus.bootstrap.osgi.DelegatingFilter.doFilter(DelegatingFilter.java:73)
	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:201)
	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1626)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:552)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:600)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1440)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:505)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1355)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
	at com.codahale.metrics.jetty9.InstrumentedHandler.handle(InstrumentedHandler.java:239)
	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
	at org.eclipse.jetty.server.Server.handle(Server.java:516)
	at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487)
	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
	at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)
	at java.base/java.lang.Thread.run(Thread.java:840)
	```

@stklcode
Copy link
Contributor

stklcode commented Aug 14, 2024

Thanks for testing! Good catch.

Missed one leading slash, so fetching <upstream>//packages/list.json (for proxy packages.json is internally built from list.json) returns 404 from packagist.org and then there is this (old) TODO "Better logging and error checking" ...

Fixed that one: [removed old version link, see below]

@nesc58
Copy link

nesc58 commented Aug 15, 2024

Already mentioned, but like overread... It does not support migration from OrientDB to H2 (or at least I did not test it) I performed a scripted export and uploaded all ZIPs to the new hosted repo for now.

Could you please provide the scripts for downloading and uploading the files?
I would love to test your pull request

@hadavand
Copy link
Author

hadavand commented Aug 15, 2024

2024-08-14 21:47:45,754+0330 WARN [qtp892284664-684] *UNKNOWN org.sonatype.

Thank you for fixing previous error. now it works but as you mentioned there is another problem with composer proxy. all requests respond with 404.
2024-08-15_13-40

@hadavand
Copy link
Author

hadavand commented Aug 15, 2024

also in previous stable version there is no leading slash for path

2
1

3

@stklcode
Copy link
Contributor

Yes, paths do require leading slashes for most internal APIs now. Will have a look into it and see at which point I have to remove it again.

The proxy should also be a solvable problem, fetch the upstream link and store the cached asset. But likely not before the weekend.

@stklcode
Copy link
Contributor

stklcode commented Aug 16, 2024

Got it. In both cases I just had to remove a leading / again, in the internal package path for the proxy and in the frontend JavaScript for the links. Database entries look fine.

[removed old version, see below]

@stklcode
Copy link
Contributor

One think I thought about when looking into the plugin: Is the component structure really "good"?

We have /vendor/project/version/vendor-project-version.zip with always exactly one component below the version path.

/
├─ vendor1
│  └─ package1
│     ├─ v1
│     │  └── vendor1-package1-v1.zip
│     └─ v2
│        └── vendor1-package1-v2.zip
├─ vendor2
│  └─ package1
│     ├─ v1
│     │  └── vendor1-package2-v1.zip
│     └─ v2
│        └── vendor1-package2-v2.zip
└─ vendor2
   └─ package3
      └─ v1
         └── vendor2-package3-v1.zip

Maybe this is a good point in time to switch to NPM-style layout skipping the version path:

/
├─ vendor1
│  └─ package1
│     ├─ vendor1-package1-v1.zip
│     └─ vendor1-package1-v2.zip
├─ vendor2
│  └─ package1
│     ├─ vendor1-package2-v1.zip
│     └─ vendor1-package2-v2.zip
└─ vendor2
   └─ package3
      └─ vendor2-package3-v1.zip

@nesc58
Copy link

nesc58 commented Aug 16, 2024

Internal server errors produced when uploading different packages concurrent:

WARN  [qtp606369538-488] admin org.sonatype.nexus.repository.httpbridge.internal.ViewServlet - Failure servicing: PUT /repository/hosted/packages/upload/vendor/package/0.0.24
java.lang.NullPointerException: Cannot invoke "org.sonatype.nexus.repository.content.fluent.FluentAsset.hasBlob()" because "asset" is null
     at org.sonatype.nexus.repository.composer.internal.ComposerJsonProcessor.buildPackageJson(ComposerJsonProcessor.java:361)
     at org.sonatype.nexus.repository.composer.internal.hosted.ComposerHostedFacetImpl.rebuildPackageJson(ComposerHostedFacetImpl.java:126)
     at org.sonatype.nexus.repository.composer.internal.hosted.ComposerHostedUploadHandler.handle(ComposerHostedUploadHandler.java:138)

Sometimes the error is triggered by

java.lang.NullPointerException: Cannot invoke "org.sonatype.nexus.repository.content.fluent.FluentAsset.hasBlob()" because "asset" is null
     at org.sonatype.nexus.repository.composer.internal.ComposerJsonProcessor.buildProviderJson(ComposerJsonProcessor.java:297)
     at org.sonatype.nexus.repository.composer.internal.hosted.ComposerHostedFacetImpl.rebuildProviderJson(ComposerHostedFacetImpl.java:113)
     at org.sonatype.nexus.repository.composer.internal.hosted.ComposerHostedUploadHandler.handle(ComposerHostedUploadHandler.java:137)

I have no idea if this is an old existing bug or a new one. I have never uploaded so many packages as now.

Thank you so much for working on this issues

@stklcode
Copy link
Contributor

stklcode commented Aug 16, 2024

Interesting, did not experience that one, tried with ~300 artifacts several times both on a local container and a remote system.

My scripts. Not very elegant, but straight forward and likely good enough for one-time use...

backup-composer.sh
#!/usr/bin/env bash

set -euo pipefail

REPO_URL="http://localhost:8081/repository/composer-hosted"
TARGET_DIR="composer"

# get package list
PACKAGE_NAMES=$(curl --fail -s "${REPO_URL}/packages/list.json" | jq -r '.packageNames[]')

# iterate over packages
for P in ${PACKAGE_NAMES}; do
  VENDOR="${P%/*}"
  PROJECT="${P#*/}"
  # fetch package details
  INFOS="$(curl -s "${REPO_URL}/p2/$VENDOR/$PROJECT.json" | jq -r ".packages.\"$VENDOR/$PROJECT\"[] | .version + \";\" + .dist.url")"

  # create target directory structure and download blob
  mkdir -p "${TARGET_DIR}/$VENDOR/$PROJECT"

  echo "$VENDOR/$PROJECT"

  # iterate over versions
  for INFO in $INFOS; do
    VERSION="${INFO%;*}"
    DIST_URL="${INFO#*;}"

    # download blob
    curl --fail -s -o "${TARGET_DIR}/$VENDOR/$PROJECT/$VENDOR-$PROJECT-$VERSION.zip" "$DIST_URL"

    echo "  $VERSION"
  done
done
restore-composer.sh
#!/usr/bin/env bash

set -euo pipefail

# repo URL (add credentials like "https://user:[email protected]/..."
REPO_URL="http://localhost:8081/repository/composer-hosted"
# local directory with vendor/project/artifacts structure
SOURCE_DIR="composer"

# iterate over packages
for VD in $(find "${SOURCE_DIR}" -mindepth 1 -maxdepth 1 -type d); do
  VENDOR="$(basename "$VD")"
  for PD in $(find "$VD" -mindepth 1 -maxdepth 1 -type d); do
    PROJECT="$(basename "$PD")"
    echo "$VENDOR/$PROJECT"
    for FILE in $(find "$PD" -mindepth 1 -maxdepth 1 -type f -name "*.zip"); do
      VERSION="$(basename "$FILE")"
      VERSION="${VERSION#"$VENDOR-$PROJECT-"}"
      VERSION="${VERSION%.zip}"
      # upload
      curl --fail --show-error --upload-file "$FILE" "${REPO_URL}/packages/upload/$VENDOR/$PROJECT/$VERSION"
      echo "  $VERSION"
    done
  done
done

@nesc58
Copy link

nesc58 commented Aug 16, 2024

Your scripts does not work concurrent. When I disable concurrency on my application it works like a charm.

I have updated the restore script to work concurrent. The error only occurred when the packages not exists yet. I have tested it with only 54 packages per project.

The errors should look like.

curl: (22) The requested URL returned error: 500
curl: (22) The requested URL returned error: 500
restore.sh
#!/bin/bash
set -euo pipefail
upload() {
  curl -k --fail --show-error --upload-file "$1" "$2" &
}

# repo URL (add credentials like "https://user:[email protected]/..."
REPO_URL="http://localhost:8081/repository/composer-hosted"
# local directory with vendor/project/artifacts structure
SOURCE_DIR="composer"

for FILE in $(find "$SOURCE_DIR" -type f -name "*.zip"); do
  RF=${FILE//$SOURCE_DIR\/}
  VENDOR=${RF%%/*}
  PROJECT="${RF//$VENDOR\/}"
  PROJECT="${PROJECT%%/*}"
  VERSION="$(basename "$FILE")"
  VERSION="${VERSION#"$VENDOR-$PROJECT-"}"
  VERSION="${VERSION%.zip}"
  # upload
  upload $FILE $REPO_URL/packages/upload/$VENDOR/$PROJECT/$VERSION &
done
wait

@hadavand
Copy link
Author

One think I thought about when looking into the plugin: Is the component structure really "good"?

We have /vendor/project/version/vendor-project-version.zip with always exactly one component below the version path.

/
├─ vendor1
│  └─ package1
│     ├─ v1
│     │  └── vendor1-package1-v1.zip
│     └─ v2
│        └── vendor1-package1-v2.zip
├─ vendor2
│  └─ package1
│     ├─ v1
│     │  └── vendor1-package2-v1.zip
│     └─ v2
│        └── vendor1-package2-v2.zip
└─ vendor2
   └─ package3
      └─ v1
         └── vendor2-package3-v1.zip

Maybe this is a good point in time to switch to NPM-style layout skipping the version path:

/
├─ vendor1
│  └─ package1
│     ├─ vendor1-package1-v1.zip
│     └─ vendor1-package1-v2.zip
├─ vendor2
│  └─ package1
│     ├─ vendor1-package2-v1.zip
│     └─ vendor1-package2-v2.zip
└─ vendor2
   └─ package3
      └─ vendor2-package3-v1.zip

Thank you, Composer proxy now works fine. I think npm style directory structure is better.

@hadavand
Copy link
Author

Dear @stklcode Do you have a plan to change directory structure? or any other update?

@stklcode
Copy link
Contributor

stklcode commented Aug 20, 2024

I'm currently looking into layout migration. I do have some other points in mind that would be nice to adjust, bug I don't want to get this too big at this point, so we actually have a chance to get the update released.

Looking at NPM the node above the tarballs is actually a PACKAGE_ROOT node which is somewhat equivalent to our PACKAGE asset. With provider and package JSON it might also be a possibility to move these out of p/p2 and place them next to the ZIPBALLs

/
├─ vendor1
│  └─ package1
│     ├─ package.json
│     ├─ provider.json
│     ├─ vendor1-package1-v1.zip
│     └─ vendor1-package1-v2.zip

or maybe

├─ vendor1
│  └─ package1
│     ├─ package.json
│     ├─ provider.json
│     ├─ v1
│     │  └─vendor1-package1-v1.zip
│     └─ v2
│        └─ vendor1-package1-v2.zip
└─ vendor2
   └─ ...

(actual package/provider URLs have to remain at p/p2 of course)

Layout could also be migrated in a following change with a corresponding migration step, it's just some URL replacement in the BrowseNode and/or Component paths.

@yu-shiba
Copy link

I also tried the following zip(kar) and got an error when restoring.

curl: (22) The requested URL returned error: 500

However, the curl upload returns a 500 error, but the artifact exists in the repository.

The following is logged in the nexus log, does this have anything to do with it?

2024-08-22 12:09:41 nexus  | 2024-08-22 03:09:41,492+0000 WARN  [qtp543365083-114] admin org.sonatype.nexus.repository.httpbridge.internal.ViewServlet - Failure servicing: PUT /repository/composer-hosted/packages/upload/vendor1/package1/1.0.0
2024-08-22 12:09:41 nexus  | java.lang.NullPointerException: Cannot invoke "org.sonatype.nexus.repository.content.fluent.FluentAsset.hasBlob()" because "asset" is null
2024-08-22 12:09:41 nexus  |    at org.sonatype.nexus.repository.composer.internal.ComposerJsonProcessor.buildProviderJson(ComposerJsonProcessor.java:297)
2024-08-22 12:09:41 nexus  |    at org.sonatype.nexus.repository.composer.internal.hosted.ComposerHostedFacetImpl.rebuildProviderJson(ComposerHostedFacetImpl.java:113)
2024-08-22 12:09:41 nexus  |    at org.sonatype.nexus.repository.composer.internal.hosted.ComposerHostedUploadHandler.handle(ComposerHostedUploadHandler.java:137)
2024-08-22 12:09:41 nexus  |    at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)

@hadavand
Copy link
Author

Hi @stklcode, Could you please send latest KAR bundle?

@stklcode
Copy link
Contributor

stklcode commented Sep 1, 2024

This one's built from stklcode@23ddc10 Not much difference from the previous version, some minor fix and working integration tests.

[removed old link, see new version below]

@hadavand
Copy link
Author

hadavand commented Sep 3, 2024

This one's built from stklcode@23ddc10 Not much difference from the previous version, some minor fix and working integration tests.

nexus-repository-composer-23ddc10.zip

Hi, this snapshot is terribly slow and has error

2024-09-03 15:20:29,864+0330 WARN  [qtp1009957696-664]  *UNKNOWN org.sonatype.nexus.repository.httpbridge.internal.ViewServlet - Failure servicing: GET /repository/composer-group/symfony/polyfill-php83/symfony-polyfill-php83-v1.30.0.zip
java.lang.NullPointerException: Cannot invoke "java.util.Map.get(Object)" because "versionInfo" is null
	at org.sonatype.nexus.repository.composer.internal.ComposerJsonProcessor.getDistUrl(ComposerJsonProcessor.java:658)
	at org.sonatype.nexus.repository.composer.internal.proxy.ComposerProxyFacet.getZipballUrl(ComposerProxyFacet.java:243)
	at org.sonatype.nexus.repository.composer.internal.proxy.ComposerProxyFacet.getUrl(ComposerProxyFacet.java:173)
	at org.sonatype.nexus.repository.proxy.ProxyFacetSupport.fetch(ProxyFacetSupport.java:493)
	at org.sonatype.nexus.repository.composer.internal.proxy.ComposerProxyFacet.fetch(ComposerProxyFacet.java:73)
	at org.sonatype.nexus.repository.proxy.ProxyFacetSupport.doGet(ProxyFacetSupport.java:354)
	at org.sonatype.nexus.repository.proxy.ProxyFacetSupport.lambda$1(ProxyFacetSupport.java:321)
	at org.sonatype.nexus.common.cooperation2.ScopedCooperation2Support$ScopedCooperation2Builder.perform(ScopedCooperation2Support.java:85)
	at org.sonatype.nexus.common.cooperation2.datastore.internal.CooperatingFuture.performCall(CooperatingFuture.java:126)
	at org.sonatype.nexus.common.cooperation2.datastore.internal.CooperatingFuture.call(CooperatingFuture.java:68)
	at org.sonatype.nexus.common.cooperation2.ScopedCooperation2Support$ScopedCooperation2Builder.cooperate(ScopedCooperation2Support.java:102)
	at org.sonatype.nexus.repository.proxy.ProxyFacetSupport.get(ProxyFacetSupport.java:331)
	at org.sonatype.nexus.repository.proxy.ProxyFacetSupport.get(ProxyFacetSupport.java:308)
	at org.sonatype.nexus.repository.proxy.ProxyHandler.handle(ProxyHandler.java:53)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at org.sonatype.nexus.repository.view.handlers.ContentHeadersHandler.handle(ContentHeadersHandler.java:46)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at org.sonatype.nexus.repository.http.PartialFetchHandler.handle(PartialFetchHandler.java:59)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at org.sonatype.nexus.repository.view.handlers.ConditionalRequestHandler.handle(ConditionalRequestHandler.java:67)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at org.sonatype.nexus.repository.cache.NegativeCacheHandler.handle(NegativeCacheHandler.java:72)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at com.sonatype.nexus.clm.internal.datastore.FirewallContributedHandler.handle(FirewallContributedHandler.java:114)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at com.sonatype.analytics.internal.handler.AnalyticsBytesTransferredHandler.handle(AnalyticsBytesTransferredHandler.java:51)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at com.sonatype.analytics.internal.handler.AnalyticsBytesTransferredHandler.handle(AnalyticsBytesTransferredHandler.java:51)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at org.sonatype.nexus.repository.view.handlers.HandlerContributor.handle(HandlerContributor.java:67)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at org.sonatype.nexus.repository.view.handlers.ExceptionHandler.handle(ExceptionHandler.java:42)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at org.sonatype.nexus.repository.security.SecurityHandler.handle(SecurityHandler.java:64)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at org.sonatype.nexus.repository.view.Context$proceed.call(Unknown Source)
	at org.sonatype.nexus.repository.composer.internal.recipe.ComposerRecipeSupport$_closure1.doCall(ComposerRecipeSupport.groovy:114)
	at jdk.internal.reflect.GeneratedMethodAccessor108.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:107)
	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323)
	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:274)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1030)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1135)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1030)
	at groovy.lang.Closure.call(Closure.java:427)
	at org.codehaus.groovy.runtime.ConvertedClosure.invokeCustom(ConvertedClosure.java:50)
	at org.codehaus.groovy.runtime.ConversionHandler.invoke(ConversionHandler.java:112)
	at jdk.proxy28/jdk.proxy28.$Proxy350.handle(Unknown Source)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at com.sonatype.analytics.internal.handler.AnalyticsMeteringHandler.handle(AnalyticsMeteringHandler.java:69)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at org.sonatype.nexus.repository.view.handlers.TimingHandler.handle(TimingHandler.java:58)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at org.sonatype.nexus.repository.view.Context.start(Context.java:179)
	at org.sonatype.nexus.repository.view.Router.dispatch(Router.java:65)
	at org.sonatype.nexus.repository.view.ConfigurableViewFacet.dispatch(ConfigurableViewFacet.java:52)
	at org.sonatype.nexus.repository.group.GroupHandler.getFirst(GroupHandler.java:139)
	at org.sonatype.nexus.repository.group.GroupHandler.doGet(GroupHandler.java:116)
	at org.sonatype.nexus.repository.group.GroupHandler.handle(GroupHandler.java:100)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at com.sonatype.nexus.clm.internal.datastore.FirewallContributedHandler.handle(FirewallContributedHandler.java:114)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at com.sonatype.analytics.internal.handler.AnalyticsBytesTransferredHandler.handle(AnalyticsBytesTransferredHandler.java:51)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at com.sonatype.analytics.internal.handler.AnalyticsBytesTransferredHandler.handle(AnalyticsBytesTransferredHandler.java:51)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at org.sonatype.nexus.repository.view.handlers.HandlerContributor.handle(HandlerContributor.java:67)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at org.sonatype.nexus.repository.view.handlers.ExceptionHandler.handle(ExceptionHandler.java:42)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at com.sonatype.analytics.internal.LoginsCounterHandler.handle(LoginsCounterHandler.java:87)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at org.sonatype.nexus.repository.security.SecurityHandler.handle(SecurityHandler.java:64)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at org.sonatype.nexus.repository.view.Context$proceed.call(Unknown Source)
	at org.sonatype.nexus.repository.composer.internal.recipe.ComposerRecipeSupport$_closure1.doCall(ComposerRecipeSupport.groovy:114)
	at jdk.internal.reflect.GeneratedMethodAccessor108.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:107)
	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323)
	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:274)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1030)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1135)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1030)
	at groovy.lang.Closure.call(Closure.java:427)
	at org.codehaus.groovy.runtime.ConvertedClosure.invokeCustom(ConvertedClosure.java:50)
	at org.codehaus.groovy.runtime.ConversionHandler.invoke(ConversionHandler.java:112)
	at jdk.proxy28/jdk.proxy28.$Proxy350.handle(Unknown Source)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at com.sonatype.analytics.internal.handler.AnalyticsMeteringHandler.handle(AnalyticsMeteringHandler.java:69)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at org.sonatype.nexus.repository.view.handlers.TimingHandler.handle(TimingHandler.java:58)
	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
	at org.sonatype.nexus.repository.view.Context.start(Context.java:179)
	at org.sonatype.nexus.repository.view.Router.dispatch(Router.java:65)
	at org.sonatype.nexus.repository.view.ConfigurableViewFacet.dispatch(ConfigurableViewFacet.java:52)
	at org.sonatype.nexus.repository.view.ConfigurableViewFacet.dispatch(ConfigurableViewFacet.java:43)
	at org.sonatype.nexus.repository.httpbridge.internal.ViewServlet.dispatchAndSend(ViewServlet.java:212)
	at org.sonatype.nexus.repository.httpbridge.internal.ViewServlet.doService(ViewServlet.java:174)
	at org.sonatype.nexus.repository.httpbridge.internal.ViewServlet.service(ViewServlet.java:126)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at com.google.inject.servlet.ServletDefinition.doServiceImpl(ServletDefinition.java:293)
	at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:283)
	at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:184)
	at com.google.inject.servlet.DynamicServletPipeline.service(DynamicServletPipeline.java:71)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:85)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:154)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:154)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:154)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:154)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:458)
	at org.sonatype.nexus.security.SecurityFilter.executeChain(SecurityFilter.java:96)
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:373)
	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:387)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:370)
	at org.sonatype.nexus.security.SecurityFilter.doFilterInternal(SecurityFilter.java:112)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:154)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
	at com.codahale.metrics.servlet.AbstractInstrumentedFilter.doFilter(AbstractInstrumentedFilter.java:112)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:154)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:154)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:154)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:154)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:458)
	at org.sonatype.nexus.security.SecurityFilter.executeChain(SecurityFilter.java:96)
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:373)
	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:387)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:370)
	at org.sonatype.nexus.security.SecurityFilter.doFilterInternal(SecurityFilter.java:112)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:154)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
	at org.sonatype.nexus.repository.httpbridge.internal.ExhaustRequestFilter.doFilter(ExhaustRequestFilter.java:80)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:154)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:154)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
	at com.sonatype.nexus.licensing.internal.LicensingRedirectFilter.doFilter(LicensingRedirectFilter.java:116)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
	at com.codahale.metrics.servlet.AbstractInstrumentedFilter.doFilter(AbstractInstrumentedFilter.java:112)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
	at org.sonatype.nexus.internal.web.ErrorPageFilter.doFilter(ErrorPageFilter.java:79)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
	at org.sonatype.nexus.internal.web.EnvironmentFilter.doFilter(EnvironmentFilter.java:101)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
	at org.sonatype.nexus.internal.web.HeaderPatternFilter.doFilter(HeaderPatternFilter.java:98)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
	at com.google.inject.servlet.DynamicFilterPipeline.dispatch(DynamicFilterPipeline.java:104)
	at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:133)
	at org.sonatype.nexus.bootstrap.osgi.DelegatingFilter.doFilter(DelegatingFilter.java:73)
	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:201)
	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1626)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:552)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:600)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1440)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:505)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1355)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
	at com.codahale.metrics.jetty9.InstrumentedHandler.handle(InstrumentedHandler.java:239)
	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
	at org.eclipse.jetty.server.Server.handle(Server.java:516)
	at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487)
	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
	at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)
	at java.base/java.lang.Thread.run(Thread.java:840)

@stklcode
Copy link
Contributor

stklcode commented Sep 3, 2024

Sorry, I messed up with the modified URL schema which should have been extracted to a different branch. Missing /v1.30.0/ in the package/provider JSON.

  "dist": {
    "url": "http://localhost:8081/repository/composer-proxy/symfony/polyfill-php83/symfony-polyfill-php83-v1.30.0.zip",
                                                                                ^^^^^
    "type": "zip",
    "reference": "dbdcdf1a4dcc2743591f1079d0c35ab1e2dcbbc9",
    "shasum": ""
  }

@stklcode
Copy link
Contributor

stklcode commented Sep 3, 2024

Apparently the code is okay and I just uploaded the wrong bundle. But anyway, I've added a unit test for this and ran a clean build.

nexus-repository-composer-2184cce.zip

@ar1307
Copy link

ar1307 commented Oct 11, 2024

@stklcode

My scripts. Not very elegant, but straight forward and likely good enough for one-time use...
backup-composer.sh
restore-composer.sh

For which plugin/nexus version are these scripts? I still have < 3.71 with 0.0.29 for exporting, but the repository/composer-hosted/packages/list.json always returns a 404 for different (test) instances. I came to it by this answer #163 (comment), the problem of migration is still not really solved, right?

@stklcode
Copy link
Contributor

For which plugin/nexus version are these scripts?

Should work with any version as the public API has not changed. Tested backup with 3.70/0.0.29 and restore with 3.71/0.1.x (that’s obviously the use case)

but the repository/composer-hosted/packages/list.json always returns a 404

Is the repository you want to backup actually named composer-hosted? If not, the URL has to be adjusted.

@ALX-TH
Copy link

ALX-TH commented Oct 25, 2024

same i have, composer fully lost
Nexus: v3.37.3
Plugin: 0.1.5

@ar1307
Copy link

ar1307 commented Oct 25, 2024

I used https://github.com/Col-E/Recaf to edit the nexus-db-migrator.jar a bit and just added composer in the com.sonatype.nexus.db.migrator.config.
It may not be the most elegant way, but it worked very well in my case and so far everything has been fine after the migration.

@EvgenPavlyuchek
Copy link

I used https://github.com/Col-E/Recaf to edit the nexus-db-migrator.jar a bit and just added composer in the com.sonatype.nexus.db.migrator.config. It may not be the most elegant way, but it worked very well in my case and so far everything has been fine after the migration.

Could you clarify what exactly needs to be done in com.sonatype.nexus.db.migrator.config. ?

@ar1307
Copy link

ar1307 commented Nov 14, 2024

@EvgenPavlyuchek
I opened the nexus-db-migrator.jar in the appropriate version in Recaf and edited the “file” Classes/com/sonatype/nexus/db/migrator/config/Format :

public enum Format {
    RAW(true),
    MAVEN2(true),
    NUGET(true),
    HELM(true),
    DOCKER(true),
    PYPI(true),
    YUM(true),
    NPM(true),
    APT(true),
    CONDA(true),
    CONAN(true),
    R(true),
    GITLFS(true),
    COCOAPODS(true),
    RUBYGEMS(true),
    GO(true),
    COMPOSER(true), // add this line to migrate Composer
    P2(true);

I then migrated the database as described in the official documentation.
This is absolutely not a good solution, but as far as I can tell, everything seems to be working well so far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants