jakarta-eeglassfishejbejb-jar.xml

Modify configuration properties of ejb-jar.xml during deployment in GlassFish 4.0


I have an ejb-jar.xml that contains configuration information for one of my MDB. In there is a configuration of:

 <activation-config-property>
        <activation-config-property-name>addressList</activation-config-property-name>
        <activation-config-property-value>mq://test.server.uk:7676</activation-config-property-value>
</activation-config-property>

As my project is built and packaged and then distributed off to users I need to be able to make sure this value can be modified as users have different server addresses.

Currently I have the option to set the address in a properties file. Is there anyway that I could modify this xml during deployment on glassfish 4.0 with the property value?

If not am I going to have to set the value every time someone wants the application and re-build it?

I am open to putting the configuration else where I just need to have it dynamic so that users can set the server addresses in a properties file.


Solution

  • I found a simple way of modifying the address list in glassfish 4.0. This solution allows the rest of your @ActivationConfigProperty to still be used. For me when a user uses a setup script for the installation I can run the following commands:

    asadmin server.jms-service.type = REMOTE
    
    asadmin set configs.config.server-config.jms-service.jms-host.default_JMS_host.host=
    "testserver.test.te.uk" 
    
    asadmin restart-domain
    

    You set the default JMS host to type REMOTE this then tells the broker to use the address defined in the default JMS host.

    You then set the host address with the asadmin set command.

    Once that is done you need to restart your glassfish.

    This is obviously glassfish container dependant but that is all I required.