1

I want to create a JMSProvider object with a custom classpath. Here's how I'm doing it in jython:

... classpath = "a.jar:b.jar:c.jar".replace(":", "\n") properties = [ ['name', name], ['description', description], ['classpath', classpath], ['externalInitialContextFactory', externalInitialContextFactory], ['externalProviderURL', externalProviderURL], ['nativepath',[]], ['supportsASF','true'] ] AdminConfig.create('JMSProvider', node, properties) AdminConfig.save()

The JMSProvider is created, but the classpath variable has the newlines escaped:

a.jar\nb.jar\nc.jar

How can I tell wsadmin to not escape the newlines?

Danubian Sailor
  • 1
  • 38
  • 145
  • 223
Synesso
  • 37,610
  • 35
  • 136
  • 207
  • How do you get `a.jar\nb.jar\nc.jar` string? Is it a literal string in the config file created by `AdminConfig`? – jfs Dec 16 '11 at 06:48
  • The above code created that string. The input `"a.jar:b.jar:c.jar"` comes from Ant. – Synesso Dec 18 '11 at 01:58

2 Answers2

3

Whilst the WAS admin console (the web page) requires you to enter the classpath with newlines, the wsadmin tool requires that it be separated by the host O/S file separator. So there is no need to modify the input string at all.

classpath = "a.jar;b.jar;c.jar"

Will work just fine.

Synesso
  • 37,610
  • 35
  • 136
  • 207
  • The semicolons are converted into newlines, when opening created object in admin console. Not intuitive, that you must use semicolons in scripts. – Danubian Sailor Oct 01 '13 at 07:04
1

"\n" is a real newline.

Compare repr(classpath) immediately after classpath.replace() with the repr(classpath) that JMSProvider sees they should be the same.

jfs
  • 399,953
  • 195
  • 994
  • 1,670
  • `"\n"` is represented by one byte? That's not how I interpreted the answer in the linked question, but I believe you. Perhaps I need to be sending a windows carriage return, as websphere is running on windows. – Synesso Dec 15 '11 at 22:40
  • This seems to be a problem with how websphere's AdminConfig object handles the newlines when creating JMSProviders. I'm going to rephrase the question. – Synesso Dec 16 '11 at 00:13