The OSGi repository of WSO2 Carbon is located inside the $CARBON_HOME/repository/components folder. $CARBON_HOME is the folder where you extracted an Carbon or Carbon based product.
You can use following directories to drop external user libraries. But you need to restart the server after adding libraries.
$CARBON_HOME/repository/components/dropins
This is the place where you can drop OSGi bundles.
$CARBON_HOME/repository/components/lib
The jar files you drop into this folder will be converted to OSGi bundles during the next server startup.
So if you want to hot deploy your custom jar files without adding to $CARBON_HOME/repository/components/lib as mentioned, you can use Java Library Project and follow below steps in WSO2 Developer Studio.
Java Library Project
With Java Library Project, you can refer a jar file or a project in your workspace and make it a bundle which will be available in to bundle classpath during the runtime.
1) Create a Java Library Project, open WSO2 Developer Studio Dashboard and select Java Library Project from Carbon category
2) Provide a project name and click Next, Then you will navigate to a screen where you have to add your artifact.
There are two ways to create a Java Library Artifact.
- From File System
- From Workspace
In here we go for "File System" option, since we assume that we do have the custom jar created in our file system.
3) Upload your custom jar and click Finish.
4) Then create Carbon Application Project, add the created Library Project to it and make a Carbon Application Archive out of it. (Make sure to set the Server Role to "Enterprise Service Bus" for Library Project)
5) Upload the .CAR to ESB server, then you will be able to see following log for successful deployment of the custom jar file.
[2017-01-17 10:25:01,731] INFO - ApplicationManager Deploying Carbon Application : DISCOVERY_1.0.0.car... [2017-01-17 10:25:02,710] INFO - DefaultAppDeployer OSGi bundle in file:///home/sachini/Documents/Projects/DISCOVERY/wso2esb-5.0.0/tmp/carbonapps/-1234/1484628901732DISCOVERY_1.0.0.car/JavaLibProject_1.0.0/JavaLibProject-1.0.0.jar location is about to be installed to Carbon Server. [2017-01-17 10:25:02,712] INFO - DefaultAppDeployer OSGi bundle JavaLibProject installed to Carbon Server. [2017-01-17 10:25:02,718] INFO - DefaultAppDeployer OSGi bundle JavaLibProject successfully started on Carbon Server.
So from this, you don't need to add the .jar manually to lib folder. You can add all your synapse configurations (proxy,api etc) along with the dependent custom jars to a single .car and deploy it in ESB server at run time.
Thanks...
No comments:
Post a Comment