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

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.

Related

where are dependencies installed in the production server?

I am using Grails 2.2 and the plugins are really old. For some reason the dependencies are not resolving. I think it used to work because the plugins and files were in my local cache. From the documentation grails stores the dependencies locally in home/.grails/ivy-cache
With all these declarative dependencies, you may wonder where all the
JARs end up. They have to go somewhere after all. By default Grails
puts them into a directory, called the dependency cache, that resides
on your local file system at user.home/.grails/ivy-cache. You can
change this either via the settings.groovy file:
So the only option i can think of is to go to my remote server and find this directory to copy the dependencies to my local system. So where is this ivy-cache directory in production server? I dont seem to find it. Thanks for any help.
The same issue also I was working in the last week, from 15th January maven had decommissioned the http protocol where the URL "http://repo1.maven.org/maven2/" has changed to"https://repo1.maven.org/maven2/". Also need to check the grails maven to secured.
In BuilConfig.groovy, you can add the dependencies and the changed maven repo else in the _Events.groovy need to change the repo address to secure protocol.
If still you have protocol issue because of JDK8 try this -Dhttps.protocols=TLSv1.2 -Djdk.tls.client.protocols=TLSv1.2 in the path or bat file.

WSO2 Carbon Identity Server - Build and run

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.

Why does wso2 server.sh not pick .jars from lib folder

The wos2 server.bat sets the carbon class path to pick up jars from the lib folder however the server.sh tries to pick them up from bin.. see code below.. this causes us a big problem because in the dss documentation it says to put the database connector jars in the lib folder:
CARBON_CLASSPATH=""
if [ -e "$JAVA_HOME/lib/tools.jar" ]; then
CARBON_CLASSPATH="$JAVA_HOME/lib/tools.jar"
fi
for f in "$CARBON_HOME"/bin/*.jar
do
if [ "$f" != "$CARBON_HOME/bin/*.jar" ];then
CARBON_CLASSPATH="$CARBON_CLASSPATH":$f
fi
done
for t in "$CARBON_HOME"/lib/commons-lang*.jar
do
CARBON_CLASSPATH="$CARBON_CLASSPATH":$t
done
Can anyone explain this?
WSO2 Carbon is the OSGi based platform for all WSO2 java products. In Carbon, there are four different “lib” folders. If you have ever tried any of the Carbon based products, you may have thought “why are there four different libs?”. If so, this post will provide you the answer for that question.
These are the “lib” folders that you can find in Carbon.
[1] CARBON_HOME/webapps/ROOT/WEB-INF/lib
Carbon is a web app which is deployed in an embedded tomcat instance. This is the lib folder which is specific to Carbon web app just like any other web app has in WEB-INF/lib folder. Bridge servlet is the one who forwards each and every incoming request into the OSGi environment of Carbon. We have used this lib to place our Bridge Servlet. Tomcat pics it up from there and hands over the incoming requests to it.
[2] CARBON_HOME/repository/components/lib
This is the place to put your normal jars if you want them to become pure bundles in the OSGi environment. All packages in these bundles are exported into the OSGi environment. As you may know, Carbon can be extended as you wish. You can add your own bundles into it. So If you have dependent jars for those bundles, you can place those in this lib.
[3] CARBON_HOME/repository/lib
This is the place where all client libraries exist. When you run ‘ant’ from CARBON_HOME/bin, all needed jars are put into this folder. If you want to write a client (or you can generate it using the WSDL2Java tool in WSAS) and test it, the set of all jars you need in the classpath can be found in this lib. For example, WSAS samples are run by adding all these libs into client classpath.
[4] CARBON_HOME/lib
This is the place where we put all jars which are needed by tomcat to start and some others for specific reasons. This is same as the Tomcat root lib. These libraries can be seen from all webapps deployed. And also, if you place the same jar in this lib and also inside Carbon web app, it will be picked up from this root lib as Tomcat uses parent first class loading.
*** there are few libraries that are available in bin folder to get initiate the OSGi service and some special things. You can't put any jars in to the bin to reflect OSGi level or any other class loaders.
You have to put the database connector jar into DSS_HOME/repository/components/lib directory and restart the server[1]. It adds them into server class path.
[1]https://docs.wso2.com/display/DSS301/Changing+the+RDBMS

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

a Web Service deployed (as an aar) file to Axis2

I have a Web Service deployed (as an aar) file to Axis2, but the dependencies (in the form of .jar files within the lib directory of the aar file) are not found on execution. They do get used properly if I copy them into the WEB-INF lib directory of the Axis2 installation, but this is not an ideal workaround.
Does anybody know of any configuration settings I might have missed? Has anybody got a
aar file (on OC4J or other server) with Axis2 v1.2? I'm not sure whether my problem is with Axis2, so might have to deploy the service to a Tomcat server to check but would rather not go through that cycle if someone can point me in the right direction.
Thanks,
You can put the jars into a lib directory inside the AAR. as pointed out in Where to deploy a jar dependency of my webservice?
This will help you understand the structure of the aar file -http://axis.apache.org/axis2/java/core/docs/quickstartguide.html