mkarg
November 3, 2022, 2:30pm
1
When executing this command (Payara 5-latest on Windows 10 / Zulu 11)…
asadmin create-custom-resource --restype=java.lang.String --factoryclass=org.glassfish.resources.custom.factory.PrimitivesAndStringFactory --property value=C:\MyPath\File.txt myFile
…then the result looks like this:
Invalid property syntax, missing property value: \MyPath\File.txt
This is a showstopper for us, as C:\MyPath\File.txt is not even a constant, but provided by resolving an %environment_variable%…!
How to make this work?
Did you try escaping the colons?
1 Like
mkarg
November 3, 2022, 4:44pm
3
How should that work? The colons are inside an environment variable, and I am not aware of any escaping command supported by Windows Batch.
mkarg
November 3, 2022, 4:52pm
4
Ok I found a replace command in Windows Batch: SET var=%var::=escapecharacter:% would do the job. But what is the escapecharacter expected by asadmin?
Thought it would work using back slash, that’s what we were using. This issue might be related.
opened 04:27PM - 31 Dec 19 UTC
closed 11:52AM - 11 Nov 20 UTC
Status: Accepted
Type: Enhancement
# Description #
----------
Creating a new JVM option with escaped characters… works fine in version 5.192, but no longer since version 5.193.
## Expected Outcome
A new JVM option is created and the console shows:
```
asadmin> create-jvm-options "-XX\:MaxPermSize=512m"
Created 1 option(s)
```
## Current Outcome
There is an error and the following output:
```
asadmin> create-jvm-options "-XX\:MaxPermSize=512m"
remote failure: JVM option MaxPermSize=512m is invalid because it does not start with a '-'
```
## Steps to reproduce (Only for bug reports)
1 -** Start the asadmin tool
sh asadmin
2 -** Start the domain
asadmin> start-domain
3 -** Create a new JVM option which requires escaping:
asadmin> create-jvm-options "-XX\:MaxPermSize=512m"
### Workarounds
1 -** Using the asadmin tool like this still works:
./asadmin create-jvm-options "-XX\:MaxPermSize=512m"
2 -** Using a second escaping backslash also works:
asadmin> create-jvm-options "-XX\\:MaxPermSize=512m"
## Environment ##
- **Payara Version**: 5.193, 5.193.1, 5.194
- **Edition**: Full
- **JDK Version**: 11.0.4 OpenJDK (WSL) / 8u201 Oracle (Mac)
- **Operating System**: Windows (WSL with Ubuntu) / Mac
TBH I overlooked that you are using Windows. We are using Linux.
mkarg
November 4, 2022, 8:12am
6
Thank you for your kind help. In fact, it works on Windows when doing the following:
SET a=C:\MyPath\File.txt
SET a=%a:\=\\%
SET a=%a::=\:%
asadmin create-custom-resource --restype=java.lang.String --factoryclass=org.glassfish.resources.custom.factory.PrimitivesAndStringFactory --property value="%a%" myFile
Unfortunately I could not find a shorter solution, as there seems to be no way to perform two replacements in a row as an inline instruction.
Anyways, this case is solved!
1 Like
Glad it helped in some way.
1 Like