How to point to a separate Carbon OSGi Repository?
November 18, 2009 1 Comment
It’s a well-known fact that all Carbon based products can be deployed on top of other application servers like Tomcat, JBoss, Web Logic etc. For example, WSAS on tomcat, WSAS on Web Logic and ESB on tomcat. When deploying Carbon on a separate application server, we have to point to a Carbon home directory through the CARBON_HOME environment variable.
Some users may set up more than one instance of Carbon, pointing to the same Carbon home. In this case, everything under Carbon home directory is shared by these Carbon instances. That includes configuration files (CARBON_HOME/conf), Axis2 repository (CARBON_HOME/repository) and Carbon OSGi repository (CARBON_HOME/repository/components). Even though sharing of configurations and Axis2 repository is perfectly OK, Carbon OSGi repository can cause problems when it is shared by more than one instance of Carbon.
So this is where we want to point to a separate Carbon OSGi repository while sharing the other stuff. In Carbon 2.x, you can do that by using the CARBON_REPOSITORY environment variable. Set it to some folder and create a folder called ‘components’ inside that folder. Finally start the server.
Example: If your Carbon OSGi repository is at /carbonRepo, set CARBON_REPOSITORY=/carbonRepo and create a folder /carbonRepo/components. Now start the server.
Now your Carbon instance uses the above place as the OSGi repository. After starting the server, you can see lot of folders inside your components folder.
There is something important to remember here. Even though you separate the OSGi repository from CARBON_HOME, if you want to use components/lib folder or components/extensions folder, you have to use them inside CARBON_HOME.
Example : If you want the my-sql driver, you have to place it in CARBON_HOME/repository/components/lib folder. NOT in /carbonRepo/components/lib folder.
So If you are also trying to use the same CARBON_HOME for multiple Carbon instances, make sure you use separate Carbon OSGi repository for each and every instance as shown in the following diagram.