Sunday, 9 November 2014

WebSphere Application Server - Curiouser and curiouser - Unicode 0xB and Jython and wsadmin

So I'm responding to a comment on a previous post: -


with regard to creating WebSphere environment variables in Python, and I discover a new ( to me ) "bug" or "feature" in wsadmin / Jython.

Namely, the combination of the backslash ( \ ) and vee ( v ) and eight ( 8 ) characters inside a variable value, even when wrapped in quotes, are NOT a good combination.

Here's a test; try creating a variable with the value of \v8 and see what happens: -

AdminConfig.create('VariableSubstitutionEntry', '(cells/'+AdminControl.getCell()+'|variables.xml)', '[[symbolicName "foobar"] [description ""] [value "\v8"]]')

WASX7015E: Exception running command: "AdminConfig.create('VariableSubstitutionEntry', '(cells/'+AdminControl.getCell()+'|variables.xml)', '[[symbolicName "foobar"] [description ""] [value "\v8"]]')"; exception information:
com.ibm.websphere.management.exception.ConfigDocumentSaveException
java.lang.RuntimeException: java.lang.RuntimeException: An invalid XML character (Unicode: 0xb) was found in the element content:
                                                 8
Not only that, but it really really breaks the wasadmin SOAP data stream, as evidenced when you try and create something else: -

AdminConfig.create('VariableSubstitutionEntry', '(cells/'+AdminControl.getCell()+'|variables.xml)', '[[symbolicName "foobar"] [description ""] [value "\v"]]') 

WASX7015E: Exception running command: "AdminConfig.create('VariableSubstitutionEntry', '(cells/'+AdminControl.getCell()+'|variables.xml)', '[[symbolicName "foobar"] [description ""] [value "\v"]]')"; exception information:
com.ibm.websphere.management.exception.ConfigServiceException
com.ibm.websphere.management.exception.ConnectorException
org.apache.soap.SOAPException: [SOAPException: faultCode=SOAP-ENV:Protocol; msg=Unsupported response content type "text/html", must be: "text/xml". Response was:
<HTML><TITLE>500 - Internal Server Error</TITLE><BODY><h1>500 </h1></BODY></HTML>

with: -

[09/11/14 09:07:11:167 GMT] 00000101 JMXObjectOutp E   ADMC0001E: Unable to serialize object: com.ibm.ws.sm.workspace.migration.WSResourceSetImpl

appearing in the SystemOut.log.

Interestingly, though, one CAN achieve this via the Integrated Solutions Console, which generates virtually the same Jython: -

AdminConfig.create('VariableSubstitutionEntry', '(cells/PCCell1|variables.xml#VariableMap_1)', '[[symbolicName "snafu"] [description ""] [value "\v8"]]')

I'm guessing that there's something that one can do when starting the wsadmin client to ensure that these kind of characters don't "choke" the SOAP connection.

Oh, what fun :-)

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="{...