Cannot use colons in custom properties?

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

How should that work? The colons are inside an environment variable, and I am not aware of any escaping command supported by Windows Batch.

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.

TBH I overlooked that you are using Windows. We are using Linux.

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! :slight_smile:

1 Like

Glad it helped in some way. :wink:

1 Like