JOnAS v2.4 Tutorial | ||
---|---|---|
<<< Previous | Getting started with JOnAS | Next >>> |
There are several ways to lad and unload beans in JOnAS. You have to be careful that the CLASSPATH used to start the EJB Server must allow the access to your beans classes. There is no way to dynamically update the CLASSPATH after JOnAS has been started.
You can statically define the beans you want to load at JOnAS startup in the jonas.properties file. Here are some examples:
If you want to load all the beans of your application defined in a single ejb-jar.xml file, put this line in your jonas.properties:
jonas.service.ejb.descriptors META-INF/ejb-jar.xml |
If you want to load two beans each of them having their own deployment descriptor, the syntax is as follows:
jonas.service.ejb.descriptors Bean1.xml,Bean2.xml |
If you want to load all the beans of your application you can give the name of the application jar file, but you must store your xml deployment descriptor in the META-INF directory:
jonas.service.ejb.descriptors myApp.jar |
JOnAS provides a command-line console that allows you to perform many administration tasks such as dynamically loading beans. Here is how to load beans with JonasAdmin:
Loading all beans of the application stored in myApp.jar into the JOnAS server named jonas (default name):
JonasAdmin -a myApp.jar |
Loading all beans described in an ejb-jar.xml deployment descriptor into a JOnAS server named jonas2:
JonasAdmin -n jonas2 -a ejb-jar.xml |
Same as the previous example but using the interactive console:
> JonasAdmin You must first choose a jonas server. (command `name`) Type `help` to get the list of available commands JonasAdmin (jonas) > name jonas2 JonasAdmin (jonas2) > addbeans ejb-jar.xml |
A complete description of JonasAdmin can be found in JOnAS Tools documentation.
Beans can be unloaded either by stopping JOnAS or using JonasAdmin. Here is how to unload beans with JonasAdmin:
Unload all beans described in an ejb-jar.xml deployment descriptor from a JOnAS server named jonas2:
JonasAdmin -n jonas2 -r ejb-jar.xml |
Same as the previous example but using the interactive console:
> JonasAdmin You must first choose a jonas server. (command `name`) Type `help` to get the list of available commands JonasAdmin (jonas) > name jonas2 JonasAdmin (jonas2) > removebeans ejb-jar.xml |
<<< Previous | Home | Next >>> |
JOnAS configuration files | Up | JOnAS administration |