Closed meamens closed 6 years ago
Nexus 3 doesn't really have a proper REST API yet, so the migrator uses the plugins API to extract the information it needs. Basically, it deploys a special plugin script to Nexus, runs the script and processes the output, and then removes the script from the instance. The problem you're having appears to occur in the run step; the plugin script is encountering an error.
I'm pretty certain this can be fixed in the tool, but I need more information to know what exactly is going wrong. First, if you can tell me what version of Nexus you're running, I can try to reproduce the issue, which will make it easier for me to fix. Second, since this error is occurring in the script running on the Nexus instance, I would expect the Nexus logs to provide some more information about what went wrong, so if I could take a look at those that would be fantastic.
Thanks!
We are running v3.0.2-02 OSS Edition. I've just ran it again and the Nexus logs are as follows:-
2018-02-14 19:46:43,860+0000 INFO [qtp1363346944-1146] eamensm org.sonatype.nexus.internal.atlas.SystemInformationGeneratorImpl - Generating system information report
2018-02-14 19:49:43,512+0000 ERROR [qtp1363346944-1161] eamensm org.sonatype.nexus.script.plugin.internal.rest.ScriptResource - Exception in script execution for script named: artifactorymigrator
javax.script.ScriptException: javax.script.ScriptException: java.lang.NullPointerException: Cannot invoke method browse() on null object
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:130) [na:na]
at org.sonatype.nexus.internal.script.ScriptServiceImpl.eval(ScriptServiceImpl.java:153) [na:na]
at org.sonatype.nexus.internal.script.ScriptServiceImpl.eval(ScriptServiceImpl.java:162) [na:na]
at org.sonatype.nexus.common.script.ScriptService$eval$3.call(Unknown Source) [na:na]
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) [groovy-all:2.4.4]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) [groovy-all:2.4.4]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:141) [groovy-all:2.4.4]
at org.sonatype.nexus.script.plugin.internal.rest.ScriptResource.run(ScriptResource.groovy:124) [org.sonatype.nexus.plugins.nexus-script-plugin:3.0.2.02]
at org.sonatype.nexus.script.plugin.internal.rest.ScriptResource$$EnhancerByGuice$$def0ba1.CGLIB$run$12(
Thanks, Marc
Looks like the problem was that prior to Nexus 3.1, content selectors were not fully supported, so the part of the plugin script that dealt with content selectors is given an unexpected null. The latest change should fix it.
I haven't actually done the migration yet as we have several things on this morning, but this is looking much better now as I can configure the tool in its entirety!
Fantastic, thank you DarthFennec 👍
I hope to migrate the repo this afternoon. I am right in thinking that it won't remove anything from Nexus, just copy it all to Artifactory?
Correct, no changes will be made to Nexus. Hope the migration goes well, and let me know if you have any other issues. Thanks!
I'm trying to migrate a single repo (currently) using this tool, it accepts the data directory as valid but when I enter the URL and credentials it then marks the data directory as invalid.
I think the debug logs show a problem with a missing script on Nexus (but this might be a red herring): -
2018-02-14 11:50:41,429 [MainThread] [INFO] (nex2art.core.Nexus3:221) - System ping completed, status: 200. 2018-02-14 11:50:41,429 [MainThread] [INFO] (nex2art.core.Nexus3:42) - Reading repository config from Nexus. 2018-02-14 11:50:41,430 [MainThread] [INFO] (nex2art.core.Nexus3:135) - Attempting to communicate with Nexus server. 2018-02-14 11:50:41,430 [MainThread] [INFO] (nex2art.core.Nexus3:151) - Deploying extraction plugin to Nexus. 2018-02-14 11:50:41,436 [MainThread] [INFO] (nex2art.core.Nexus3:241) - http://nexus.REDACTED.com/service/siesta/rest/v1/script responded with 204. 2018-02-14 11:50:41,436 [MainThread] [INFO] (nex2art.core.Nexus3:155) - Executing Nexus extraction. 2018-02-14 11:50:41,481 [MainThread] [ERROR] (nex2art.core.Nexus3:236) - Error connecting to Nexus: { "name" : "artifactorymigrator", "result" : "javax.script.ScriptException: java.lang.NullPointerException: Cannot invoke method browse() on null object" } Traceback (most recent call last): File "/root/nexus2artifactory-master/nex2art/core/Nexus3.py", line 232, in dorequest else: resp = urllib2.urlopen(req) File "/usr/lib64/python2.7/urllib2.py", line 154, in urlopen return opener.open(url, data, timeout) File "/usr/lib64/python2.7/urllib2.py", line 435, in open response = meth(req, response) File "/usr/lib64/python2.7/urllib2.py", line 548, in http_response 'http', request, response, code, msg, hdrs) File "/usr/lib64/python2.7/urllib2.py", line 473, in error return self._call_chain(args) File "/usr/lib64/python2.7/urllib2.py", line 407, in _call_chain result = func(args) File "/usr/lib64/python2.7/urllib2.py", line 556, in http_error_default raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) HTTPError: HTTP Error 400: Bad Request 2018-02-14 11:50:41,482 [MainThread] [INFO] (nex2art.core.Nexus3:241) - http://nexus.REDACTED.com/service/siesta/rest/v1/script/artifactorymigrator/run responded with 400. 2018-02-14 11:50:41,482 [MainThread] [ERROR] (nex2art.core.Nexus3:244) - Unable to execute Nexus plugin: 400. 2018-02-14 11:50:41,482 [MainThread] [INFO] (nex2art.core.Nexus3:158) - Deleting extraction plugin from Nexus.
I've tried multiple Nexus accounts including 'admin', and multiple URLs to access the server (i.e. localhost:8081 and FQDN).
Is this fixable in the tool or do we potentially have an issue with our Nexus install? I'm happy to provide any further details required.
Thanks for any help