NullPointerException from ACLI using SSH protocol

Started by jp77, January 06, 2022, 15:41:52 PM

Previous topic - Next topic



I have some scripts that use the Archi Command Line Interface for model cloning.

These scripts worked perfectly with Archi 4.8.0 + CoArchi 0.6 but after upgrading to Archi 4.9.1 + CoArchi 0.8 when using SSH protocol there is a NullPointer exception from the ACLI.  Could this be an issue in the 4.9.1 ACLI or CoArchi?

Thanks in advance for any advice. More information below.

Our current versions being used are:
Previously working - Archi 4.8.0 / CoArchi
Current versions - Archi 4.9.1 / CoArchi
Ubuntu 18.04.6 LTS

To isolate and recreate the problem repeatably, the Archi Command Line interface has been tested standalone (from Ubuntu command line), with 4 variants:
Archi 4.9.1 using SSH credentials (id_rsa)
Archi 4.9.1 using password file
Archi 4.8.0 using SSH credentials (id_rsa)
Archi 4.8.0 using password file

When using Archi 4.9.1 [CoArchi 0.8] with SSH credentials, the NullPointer exception occurs:

/opt/Archi-4.9.1/Archi -application -consoleLog -nosplash --modelrepository.cloneModel ssh://git@server:1234/ndaf/repo.git --modelrepository.loadModel /home/user/.archi4/model-repository/test --modelrepository.identityFile /home/user/.ssh/id_rsa

at com.archimatetool.commandline.CentralScrutinizer.runProviderOptions(   
at com.archimatetool.commandline.CentralScrutinizer.start(   
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(   
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(   
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)   
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)   
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)   
at java.base/java.lang.reflect.Method.invoke(Unknown Source)   
at org.eclipse.equinox.launcher.Main.invokeFramework(   
at org.eclipse.equinox.launcher.Main.basicRun(   
at org.eclipse.equinox.launcher.Main.main(

[LoadModelFromRepositoryProvider] Cloning from ssh://git@server:1234/ndaf/repo.git to /home/user/.archi4/model-repository/test

Note: The SSH credentials (id_rsa public/private keys) remain unchanged since the Archi 4.8.0 install.  Just in case, also tried generating new keys (and applying public key to Git account) but this makes no difference.

When using Archi 4.9.1 [CoArchi 0.8] with password file,  the command completes normally:

/opt/Archi-4.9.1/Archi -application -consoleLog -nosplash --modelrepository.cloneModel http://server:1234/scm/ndaf/repo.git --modelrepository.loadModel /home/user/.archi4/model-repository/test --modelrepository.userName username --modelrepository.passFile /home/user/.ssh/pf.txt

[LoadModelFromRepositoryProvider] Cloning from http://server:1234/scm/ndaf/repo.git to /home/user/.archi4/model-repository/test
[LoadModelFromRepositoryProvider] Model cloned!
[LoadModelFromRepositoryProvider] Loading model at /home/user/.archi4/model-repository/test
[LoadModelFromRepositoryProvider] Loaded model: 'NDEA'

When using Archi 4.8.0 [CoArchi 0.6] to see if things still work as they did before upgrading to 4.9.1, both methods (SSH credentials or password file) result in no output from the Archi Command Line Interface.  This could be because the models being imported have been updated since moving to Archi 4.9.1, and the Archi 4.8.0 version can no longer open these (Archi stops processing?).   Note: When using "–help" option the help is displayed, but all other options and even invalid options result in no output.

Phil Beauvoir

The NPE seems to be because the password is null. For SSH, the password has to be provided to access the identity File.
If you value and use Archi please consider making a donation. :-)


With previous versions (Archi 4.8.0 + CoArchi 0.6) was getting errors when SSH passphrase was set so was using with no passphrase set.

Using Archi 4.9.1 + CoArchi 0.8, have regenerated the id_rsa SSH keys again this time setting a passphrase and applied to Git account.  Still getting the same result with exactly the same NPE.

Phil Beauvoir

Are you using the --modelrepository.passFile option?

There is a bug in coArchi ACLI in that it expects to see a password from the password file in all cases. This can be worked around by providing a password in the password file even if it is a dummy one.
If you value and use Archi please consider making a donation. :-)


Thanks Phil that workaround resolves it.

When using SSH, if I provide any passphrase when generating the id_rsa key this always gives a USERAUTH exception from the ACLI, but if I leave the passphrase blank it works fine. Not a big deal, but any idea why that's happening?

Phil Beauvoir

It should be the same behaviour as using a password to access the id_rsa file in the main app. Does it work there?
If you value and use Archi please consider making a donation. :-)