Skip to main content

Admin REST jvm-options error "is invalid because it does not start with a '-'"

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
No replies
kamilzuzda
Offline
Joined: 2008-02-17

Hello,

I have been playing with admin rest services and almost everything works except setting jvm-options. When I try to set an option first of all the option is not set second all existing JVM options are cleared from configuration.

These are the examples that I have tried against the 3.1.2.2 and 4.0.b89

curl -X POST -H "X-Requested-By: GlassFish REST HTML interface" -d id=-test http://localhost:4848/management/domain/configs/config/server-config/jav... -v
curl -X POST -H "X-Requested-By: GlassFish REST HTML interface" -d id=\-test http://localhost:4848/management/domain/configs/config/server-config/jav... -v
curl -X POST -H "X-Requested-By: GlassFish REST HTML interface" -d "id=-test" http://localhost:4848/management/domain/configs/config/server-config/jav... -v
curl -X POST -H "X-Requested-By: GlassFish REST HTML interface" -d "id=--test" http://localhost:4848/management/domain/configs/config/server-config/jav... -v
curl -X POST -H "X-Requested-By: GlassFish REST HTML interface" -d "id=%2Dtest" http://localhost:4848/management/domain/configs/config/server-config/jav... -v
curl -X POST -H "X-Requested-By: GlassFish REST HTML interface" -d "id=%97test" http://localhost:4848/management/domain/configs/config/server-config/jav... -v
curl -X POST -H "X-Requested-By: GlassFish REST HTML interface" -d "id=-%2Dtest" http://localhost:4848/management/domain/configs/config/server-config/jav... -v

REST Request and response

curl -X POST -H "X-Requested-By: GlassFish REST HTML interface" -d id=-test http://localhost:4848/management/domain/configs/config/server-config/jav... -v
* About to connect() to localhost port 4848 (#0)
*   Trying ::1...
* connected
* Connected to localhost (::1) port 4848 (#0)
> POST /management/domain/configs/config/server-config/java-config/jvm-options HTTP/1.1
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8r zlib/1.2.5
> Host: localhost:4848
> Accept: */*
> X-Requested-By: GlassFish REST HTML interface
> Content-Length: 8
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 8 out of 8 bytes
< HTTP/1.1 400 Bad Request
< Content-Type: application/json;charset=UTF-8
< Date: Sun, 02 Jun 2013 17:01:54 GMT
< Connection: close
< Content-Length: 320
<
* Closing connection #0
{"message":"JVM option id=-test is invalid because it does not start with a '-'","command":"create-jvm-options AdminCommand","exit_code":"FAILURE","extraProperties":{"commandLog":["create-jvm-options --profiler false --target server-config --DEFAULT id=-test --jvm_option_name id=-test"]},"children":[{"properties":{}}]}

The same happens if I try to set the option from rest admin through http://localhost:4848/management/domain/configs/config/server-config/jav....

Are you having the same problem? Is it a bug ?

Thanks