pythonwebspherejythonwebsphere-9

Websphere 9X unable to deploy ear file via jython script


I'm writing due to an error I just cannot seem to work around.

WASX7017E: Exception received while running file "/root/wsDeploy.py"; exception information: com.ibm.ws.scripting.ScriptingException: WASX7115E: Cannot read input file "/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/installableApps/my_ear_file.ear,'[-node DefaultNode01 -cell DefaultCell01 -server server1 -MapWebModToVH [[ "Our War One" first_war.war,WEB-INF/web.xml default_host ]["Our War Two" second_war.war,WEB-INF/web.xml default_host]["Our War Three" third_war.war,WEB-INF/web.xml default_host]]]'"

Now that script has the following variables and syntax:

ParameterStr = "-node DefaultNode01 -cell DefaultCell01 -server server1 -MapWebModToVH [[ \"Our War One\" first_war.war,WEB-INF/web.xml default_host ][\"Our War Two\" second_war.war,WEB-INF/web.xml default_host][\"Our War Three\" third_war.war,WEB-INF/web.xml default_host]]"

EAR_FILE=/path/to/file/my_ear_file.ear

This is the portion of code which is choking when executed by websphere in jython(2.7) (Also fails in 2.1)

elif UpdateExistingorNewApp == "INITIAL" and ConditionForUpdate == 0:
      AdminApp.install(EAR_FILE + "," + "'" + "[" + ParameterStr + "]" + "'")
      AdminConfig.save()

I have tried

AdminApp.install( 'EAR_FILE' + "," + "'" + "[" + ParameterStr + "]" + "'")
AdminApp.install( "'" + EAR_FILE + "'" +"," + "'" + "[" + ParameterStr + "]" + "'")
AdminApp.install( \' EAR_FILE \' + "," + "'" + "[" + ParameterStr + "]" + "'")

I have even tried adding the "[ ]" pair inside the ParameterStr variables as well.

I have looked at the following documents for guidance:

https://www.ibm.com/developerworks/community/forums/html/topic?id=43cee700-9074-49e1-9223-7c4db2d89680

https://developer.ibm.com/answers/questions/258458/ucd-install-application-fails-with-wasx7115e-canno/

I have verified the path to the ear, the permissions on the ear, and the ownership of the ear.

Am I having an issue similar to globbing? The input file is there, and is world readable. I have even run the script from the same location as the (installableApps) folder for the AppSrv01 Profile.

Any help would be highly appreciated.

EDIT:

So it we're past this part now. So I imagine that I will need to start escaping any meta characters. I'm posting what a fully constructed argument looks like:

AdminApp.install('/opt/IBM/WebSphere/AppServer/installableApps/my_ear_file.ear','[-node DefaultNode01 -cell DefaultCell01 -server server1 -MapWebModToVH [[ \"Our War One\" first_war.war,WEB-INF/web.xml default_host ][\"Our War Two\" second_war.war,WEB-INF/web.xml default_host][\"Our War Three\" third_war.war,WEB-INF/web.xml default_host]]]')

Our argument is slightly different at this time, but that appears to still be acceptable to the interpreter

AdminApp.install( /opt/IBM/WebSphere/AppServer/installableApps/my_ear_file.ear,'[-node DefaultNode01 -cell DefaultCell01 -server server1 -MapWebModToVH [[ \"Our War One\" first_war.war,WEB-INF/web.xml default_host ][\"Our War Two\" second_war.war,WEB-INF/web.xml default_host][\"Our War Three\" third_war.war,WEB-INF/web.xml default_host]]]')

So that generates a

java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: WASX7122E: Expected "-"  not found.

So I am now trying to see which meta characters I can deal with via trial and errors.

I am basing this off of the comment response by kgibm.


Solution

  • You're concatenating the ear file name with the options, whereas those are two parameters separated by a comma. Try:

    AdminApp.install(EAR_FILE, "'" + "[" + ParameterStr + "]" + "'")