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

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

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.

How to deploy files for Sitecore using TDS

I'm starting a new Sitecore 9 project using Helix and TDS. I've got my basic structure setup, using Hedgehog's fork of the Habitat site as a guide. I'm also referencing Hedgehog's docs.
My solution is just a start, so it's very simple right now, only a Foundation.Serialization module that contains the TDS projects for the basic layer folders and a Project.Website module that contains a TDS project and an MVC Website project (MVC)....it's got a basic Razor view and some random CSS/JS files.
The TDS Habitat readme, says to use Solution > Deploy Solution to deploy the projects. When I do this on my project it builds and the Sitecore items are deployed to Sitecore, but my Views and CSS/JS are not....presumably because I haven't configured anything to facilitate this.
Looking at the docs and the TDS Habitat solution, it's not clear to me how to configure TDS to know anything about how to deploy files. I'm finding info on the web that says that TDS will deploy files, transform configs, etc but with no examples of how to actually make that happen.
How do I set things up so Deploy Solution will also deploy files from all of the web projects in a solution to my local web root?
First, you will need to make sure the Sitecore Deploy Folder is set. From the documentation:
Sitecore Deploy Folder – Contains the path to the ROOT of the Sitecore
instance on the file system. This setting is used to install the TDS
Classic service when needed and to deploy the compiled code when the
TDS Classic project is built.
You also need to make sure that file deployment has not been disabled:
Disable File Deployment – Stops TDS Classic deploying files to the
directory specified in the Sitecore Deploy Folder.
If you are still not seeing the files being deployed, you will need to check if the process has access to the deploy folder.
You can also deploy files as a .update package and then use another automated tool to deploy the .update package to the target environment.
I figured out the issue. On the properties page for a TDS project there is a field where you indicate which projects should be built and deployed along with the sitecore items:
https://www.hhogdev.com/help/tds/propgeneral

Nexus 3.5.1 proxies from snapshot repo nothing but maven metadata files

I have upgraded nexus repository from 2.x to 3.x through following path:
2.4.14 -> 3.4.0 -> 3.5.1
All nexus services were packed in docker with data directory mapped from host's. For all services I use default either sonatype/nexus or sonatype/nexus3 containers. Nexus web interface is hidden behind nginx with simple reverse proxying.
I use the nexus service with boot-cj (with no credentials) tools which manages dependencies the same way as maven. Anyway the tool first downloads nexus-maven.xml with relevant sha1 files and tries to download jars. It works fine with all 2.x I had.
I created a proxy repository against remote sonatype-snapshots repo. When I start compilation I have Could not find artifact error. I found that the meatdata files are cached but all poms and jars.
I have tried to fix it by cleaning cache with the clean_cache file trick and more rough rm -rfv /srv/nexus3/nexus-data/cache/* with no success. There are no any logs about error. Also I have checked manually that required artefact exists in the remote repository. More obvious Rebuild index button gave no solution. I do not thing it is a problem with nginx, but who knows? Also leaving overnight to run the scheduled tasks did not help.
The expected artifact is org.eclipse.rdf4j:rdf4j:pom:2.3-20170901.145510-11.

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