Using wsadmin to restore WAS server configuration

 

RAD is a terrible IDE, but sometimes you have to work on it.

 

One of the most frequently happened problem is that we always get an error like below:

AdminTask.importWasprofile(['-archive', '******.metadata/.plugins/com.ibm.ws.ast.st.v6.core/tmp0/WAS60ServerConfig.car'])
com.ibm.bsf.BSFException: exception from Jython:
Traceback (innermost last):
  File "<input>", line 1, in ?
TypeError: importWasprofile(): 1st arg can't be coerced to String

 

This is an error happened when we are trying to use .car file to restore the WAS configuration, you probably do it by this approach, right click a server profile in the server tab, select Server Configuration --> Restore...

Most times you will get the above error, I have tried many times on different versions of RAD, none of any attempt has been successfull.

 

This problem has been a pain in the ass for a very long time, till I found I can use wsadmin to restore the configuration instead of using the context menu of RAD.

 

Here is the steps:

 

1. Start the WAS Server

2. Run wsadmin in a cmd shell :

C:\Program Files\IBM\SDP\runtimes\base_v6\bin>wsadmin -conntype SOAP -host 127.0.0.1 -port 8881 -user wsadmin -password wsadmin 

Note: The host should be the server ip address, and the port number here may be different with yours, please check the SOAP port number of your own server.

if the your server profile is created with an admin user name and password, you should add -user wsadmin -password wsadmin at the end of the command line.

3. Once you have connected to the server you could get a prompt of wsadmin> and execute the following command:

wsadmin>$AdminTask importWasprofile {-archive C:\WAS60ServerConfig.car}
wsadmin>$AdminConfig save

Note: C:\WAS60ServerConfig.car is the .car file you should have and be used.and wait until it is executed.

4. Exit the cmd shell and it's done.

 

 To export current profile config for backup:

wsadmin>$AdminTask exportWasprofile {-archive C:\WAS60ServerConfig.car}

 

 To delete a profile:

IBM\WebSphere\AppServer\bin>manageprofiles.bat -delete -profileName AppSrv01

IBM\WebSphere\AppServer\bin>manageprofiles.bat -validateAndUpdateRegistry

 

 

 

 

 

 

 

你可能感兴趣的:(configuration)