WSO2 Carbon Identity Server - Build and run - wso2

I've modified a .jsp file in the org.wso2.carbon.identity.entitlement.ui package, in order to customize the server for my purposes.
The problem is that when I build the project with Eclipse, the build is successful, but I don't understand how I can actually run the compiled code. How can I do it?

Once you build the project with maven, in the target directory you will find the jar (OSGi bundle). In your IS Server under /repository/component/patches, create a new directory something similar to "patch0100". Copy the jar inside this "patch0100" directory and restart the IS server.
The number in the patch directory (0100 in this case) is important. If you put the same jar to a patch directory with a higher number, say pactch0200, that particular jar with override the earlier one. That's how patching works in WSO2 Carobon Server, which is the platform on which the products are built.

Related

WSO2 API Manager not applying changes to external jar files in repository/components/lib

I've implemented a billing engine library based on monetization interface and copied it to repository/components/lib folder. And done all the configurations related to monetization base on Monetizing an API. Now whenever I change the code in this library and build and copy the new jar file to this folder, it doesn't get applied. I also restart the server every time I make a change. Is there any mechanisms for caching the library files or some other reasons that I overlooked?
JAR artifacts are converted to OSGi bundles during the startup of the servers. If you place any JAR artifacts in the /components/lib directory, they will be converted as OSGi bundles by WSO2 and added to the /components/dropins directory.
If you have changed the package names of the JAR, or the artifact names, you have to remove the existing OSGi bundle from the /components/dropins directory. Once removed, place the new JAR inside the /components/lib directory and restart the servers to load the packages again.

What is it the best way to replace custom lib version in WSO2 ESB?

I am using Enterprise Integrator 6.5.0.
I have a custom mediator that generate a file .jar that have a version 1.0.0, I saw when I put this .jar in the lib folder with the same version, all work fine. However, when I delete this .jar from lib folder and add the same .jar but with the version 1.0.1, I detected that the ESB was working with the 1.0.0 version.
Doing research, I saw that the ESB is generating two files, one in dropins folder and another in wso2\components\default\configuration\org.eclipse.osgi\bundles\6\1.cp
So I think I need to delete manually the 3 files in order to add the new version.
Is there any other option to delete automatically this files or am I doing something wrong?
Thank you
When you add a jar file to the lib directory, at the server startup the ESB server will convert the jar to an OSGI bundle and add to the dropins directory. If you want to remove the jar file it would be sufficient to remove the jar file from both the lib and dropins directory.
Make sure that when you add a new jar file you need to perform a server restart for the ESB server to pick up the new jar file

How to patch and recompile axis2_1.6.1.wso2v14.jar in wso2esb 4.9.0

If I modify manually axis2_1.6.1.wso2v14.jar, wso2esb 4.9.0 crashes at startup with the following message:
Could not start: null(reference:file:../plugins/axis2_1.6.1.wso2v14.jar:17). It's state is uninstalled.
In my case, I want to apply the following patch : https://github.com/wso2/wso2-axis2/commit/0f826cbf230b8c855b041ea1db3a751319cd3e91 that was released for wso2esb 5.0.0
Note:
This happens even if I only unzip the jar, and then recreate it as it with
$ jar cf *
How can I patch and recompile axis2_1.6.1.wso2v14.jar in wso2esb 4.9.0 ?
You can basically follow the below steps. But before that check if the same fix was issued using a WUM update. If not
You need to download the relevant tag first v1.6.1-wso2v14
Cherry-pick the commit that you wanna include. (This may be straightforward in some cases, but there might be issues in some scenarios since there can be a lot of changes or dependency classes been changed. So be careful on that)
Build the tag with the fix
Get the build axis2_1.6.1-wso2v14.jar
Create a new patch directory with a higher number inside <ESB-Home>/repository/component/patches directory
Copy the jar file to that directory e.g. patch1000/axis2_1.6.1-wso2v14.jar (Check the jar file name, it should be same as in plugins directory)
Restart the server
You can refer to Doc1, Doc2 for more info
Edited
Don't try to package it using jar cf command. Run mvn clean install. This is not a standard jar but an OSGi bundle. So copy the jar file you get from mvn clean install. If the name differs just rename the jar name (- to _)

wso2 carbon: how to hack the source and deploy the changes to a carbon server

I have the carbon source tree set up in eclipse - and have made some code changes.
Can I build just one component (e.g. org.wso2.carbon.feature.mgt.ui-4.1.0.jar) using maven / eclipse, and then deploy that to an existing carbon server?
I have tried dropping the built jar in the repository\deployment directory and restarting the server, but the changes don't appear to have been picked up.
Am I doing something wrong?
Place the jars at <CARBON_HOME>/repository/components/plugins. Also delete the relevant existing jars from repository/components/plugins

How can I run gradle wrapper behind a firewall / using a proxy maven server?

I have been trying to get Gradle working on our Continuous Integration server, which has no access to internet (external) URLs.
Currently, we get our maven-style dependencies from an internal proxy server. So I uploaded the gradle wrapper onto that server too, such that when the CI server starts up it can download the wrapper from the internal maven proxy server.
Problem solved, I thought; the build will carry on and pull down the project dependencies from the internal proxy server as well (it's set up in the build script) and should be OK now.
But in between getting the wrapper Zip file and starting the build, it's doing the following:
Downloading http://maven.internal.mycompany.com:8081/nexus/content/repositories/thirdparty/org/gradle/gradle/1.0-milestone-3/gradle-1.0-milestone-3-bin.zip ................
Unzipping /home/user/.gradle/wrapper/dists/gradle-1.0-milestone-3-bin.zip to /home/user/.gradle/wrapper/dists
Set executable permissions for: /home/user/.gradle/wrapper/dists/gradle-1.0-milestone-3/bin/gradle
Download http://repo1.maven.org/maven2/org/codehaus/groovy/groovy/1.7.3/groovy-1.7.3.pom
Download http://repo1.maven.org/maven2/antlr/antlr/2.7.7/antlr-2.7.7.pom
etc...
*** then the actual build starts ***
Download http://maven.internal.mycompany.com:8081/nexus/content/groups/public/commons-lang/commons-lang/2.6/commons-lang-2.6.jar
E.g. it's trying to pull down extra dependencies for the gradle executable from repo1.maven.org which fails on the continous integration server, as it has no access to this server.
In my build.gradle file I have:
repositories {
mavenRepo urls: "http://maven.internal.mycompany.com:8081/nexus/content/groups/public"
}
and in my ./gradle/wrapper/gradle-wrapper.properties file I have :
distributionUrl=http\://maven.internal.mycompany.com:8081/nexus/content/repositories/thirdparty/org/gradle/gradle/1.0-milestone-3/gradle-1.0-milestone-3-bin.zip
So is there another place I can specify which server the wrapper should use to get it's additional dependencies ? Or is this hard-coded into the wrapper itself ? Or I might be missing a trick here, as Google doesn't seem to show up anyone else having this issue at all !
Ben
Picked up a hint from another forum that led me to the answer - a plugin for cobertura that I was pulling down had it's own gradle build file that included the default maven repositories.
I've removed that now, and the calls to external maven have ceased.