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

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

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

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

ClassNotFoundError even though class is included in lib/ext folder in Jetty 9.2.2

Just want to ask about my problem. I am trying to setup a jetty server and included my own webapp. I put the web application in the webapp folder of jetty server. I also included the necessary libraries needed by the web application in lib/ext folder of jetty, it is not included in the war file. when i run the jetty server and access the webapp, i get the 'NoClassDefFoundError'.
I run the jetty server using the 'java -jar start.jar'. I am also sure that the jar file which contains the class that causes the error is in the classpath.
Did i miss something?
Thank you.