Search code examples
glassfishjndi

Add several properties in a custom resource in GlassFish


I need to add a JNDI custom resource in GlassFish of class Properties that has several properties. I need to do that with the command line. This is what I am using to create the custom resource with one parameter:

asadmin create-custom-resource --restype=java.util.Properties --factoryclass=org.glassfish.resources.custom.factory.PropertiesFactory --property param1="this is param1" my.parameter.name 

But what I want is to add more than one property. I have tried to do this but it doesn't work:

asadmin create-custom-resource --restype=java.util.Properties --factoryclass=org.glassfish.resources.custom.factory.PropertiesFactory --property param1="this is param1" param2="this is param2" my.parameter.name 

I don't need to create all the parameters in one command, if there is a way to add the properties after creating the first, would also work for me. I know I can go to the admin console, edit the custom resource and add the new property there, but I need to do it with the command line.


Solution

  • I found the solution:

    asadmin create-custom-resource --restype=java.util.Properties --factoryclass=org.glassfish.resources.custom.factory.PropertiesFactory --property "param1=\"this is param1+":param2=\"this is param2\" my.parameter.name