问题
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?
回答1:
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.
回答2:
"\n"
is a real newline.
Compare repr(classpath)
immediately after classpath.replace()
with the repr(classpath)
that JMSProvider
sees they should be the same.
来源:https://stackoverflow.com/questions/8516038/how-to-get-newlines-in-classpath-for-jmsprovider-using-wsadmin