Tuesday, 9 October 2018

Restoring WebSphere Application Server Profiles - NullPointerExceptions

So, for some reason, I was having a crisis of confidence  / memory.

I was trying/failing to restore a WebSphere Application Server (WAS) profile, using the following command: -

/opt/ibm/WebSphere/AppServer/bin/manageprofiles.sh -restoreProfile -backupFile /home/wasadmin/wasbackups/BPM86_Dmgr01.zip 

which failed with: -

...
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:508)
at com.ibm.wsspi.bootstrap.WSLauncher.launchMain(WSLauncher.java:234)
at com.ibm.wsspi.bootstrap.WSLauncher.main(WSLauncher.java:96)
at com.ibm.wsspi.bootstrap.WSLauncher.run(WSLauncher.java:77)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:508)
at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java:587)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:198)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:508)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:340)
at org.eclipse.core.launcher.Main.basicRun(Main.java:282)
at org.eclipse.core.launcher.Main.run(Main.java:981)
at com.ibm.wsspi.bootstrap.WSPreLauncher.launchEclipse(WSPreLauncher.java:407)
at com.ibm.wsspi.bootstrap.WSPreLauncher.main(WSPreLauncher.java:170)
Caused by: java.lang.NullPointerException: entry
at java.util.zip.ZipFile.getInputStream(ZipFile.java:404)
at com.ibm.ws.profile.utils.FileUtils.getInputStreamFromZipFile(FileUtils.java:364)
at com.ibm.wsspi.profile.WSProfile.restore(WSProfile.java:2097)
at com.ibm.wsspi.profile.WSProfile.restore(WSProfile.java:2069)
at com.ibm.ws.profile.cli.WSProfileCLIRestoreProfileInvoker.executeWSProfileAccordingToMode(WSProfileCLIRestoreProfileInvoker.java:106)
at com.ibm.ws.profile.cli.WSProfileCLIModeInvoker.invokeWSProfile(WSProfileCLIModeInvoker.java:462)
at com.ibm.ws.profile.WSProfileJob.run(WSProfileJob.java:94)
at com.ibm.ws.profile.utils.WSProfileUtils.executeAllJobs(WSProfileUtils.java:793)
at com.ibm.wsspi.profile.WSProfileCLI.invokeWSProfile(WSProfileCLI.java:228)
at com.ibm.wsspi.profile.WSProfileCLI.main(WSProfileCLI.java:62)
... 26 more
...

view /opt/ibm/WebSphere/AppServer/logs/manageprofiles/restoreProfile.log 

...
  <record>
    <date>2018-10-09T12:31:06</date>
    <millis>1539084666088</millis>
    <sequence>24</sequence>
    <logger>com.ibm.ws.profile.cli.WSProfileCLIModeInvoker</logger>
    <level>WARNING</level>
    <class>com.ibm.ws.profile.cli.WSProfileCLIModeInvoker</class>
    <method>getArgumentValue</method>
    <thread>1</thread>
    <message>Could not resolve templatePath from command line</message>
  </record>


It took me a while of faffing around ….. including creating new profiles ….

And then I realised where I was going wrong ….

Given that I had backed up the profiles: -

mkdir wasbackups
cd wasbackups/
/opt/ibm/WebSphere/AppServer/profiles/AppSrv01/bin/backupConfig.sh BPM86_AppSrv01.zip
/opt/ibm/WebSphere/AppServer/profiles/Dmgr01/bin/backupConfig.sh BPM86_Dmgr01.zip

perhaps it'd have made more sense to use …. restoreConfig.sh instead.

Guess what …..

/opt/ibm/WebSphere/AppServer/bin/restoreConfig.sh /home/wasadmin/wasbackups/BPM86_Dmgr01.zip 

ADMU0116I: Tool information is being logged in file
           /opt/ibm/WebSphere/AppServer/profiles/Dmgr01/logs/restoreConfig.log
ADMU0128I: Starting tool with the Dmgr01 profile
ADMU0505I: Servers found in configuration:
ADMU0506I: Server name: dmgr
ADMU2010I: Stopping all server processes for node Dmgr
ADMU0512I: Server dmgr cannot be reached. It appears to be stopped.
ADMU5502I: The directory /opt/ibm/WebSphere/AppServer/profiles/Dmgr01/config
           already exists; renaming to
           /opt/ibm/WebSphere/AppServer/profiles/Dmgr01/config.old
ADMU5504I: Restore location successfully renamed
ADMU5505I: Restoring file /home/wasadmin/wasbackups/BPM86_Dmgr01.zip to
           location /opt/ibm/WebSphere/AppServer/profiles/Dmgr01/config
...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................ADMU5506I: 3,179 files successfully restored
ADMU6001I: Begin App Preparation -
ADMU6009I: Processing complete.
ADMU6002I: Begin Asset Preparation -
ADMU6009I: Processing complete.

No comments:

Note to self - use kubectl to query images in a pod or deployment

In both cases, we use JSON ... For a deployment, we can do this: - kubectl get deployment foobar --namespace snafu --output jsonpath="{...