WSO2 ESB 4.6.0 classpath issue: httpclient classes cannot be found - wso2

On WSO2ESB 4.6.0, I want to deploy a service that depends on redmine-java-api version 1.23. When I look at maven dependencies of the library, I see it requires httpclient 4.2. Although, I put httpclient jar in $ESB_HOME/repository/components/lib folder, I get the exception:
java.lang.ClassNotFoundException: org.apache.http.impl.conn.PoolingClientConnectionManager.
Inside the jar, there is a package named org.apache.http.impl.conn and that package contains the class definition of PoolingClientConnectionManager.
I cannot figure out the problem. What could be the possible solution?

I am not sure about the exact solution. But there is httpclient jar file that is shipped with WSO2ESB by default. I think, it is httpclient 4.1.X jar that does not contain the "PoolingClientConnectionManager" class. In OSGI run time, this jar file may set as the dependency for redmine-java-api (not your httplclient 4.2) However you can get some idea... by starting the WSO2ESB with OSGI console.
sh wso2server.sh -DosgiConsole
Using OSGI console, you check what are the jar files that "org.apache.http.impl.conn" package has been exposed to the OSGI run time of the WSO2ESB. And also it would list down the all the bundles which use the given package. Please use following command.
packages org.apache.http.impl.conn

Have you import the package in MANIFEST.INF file of the bundle ?

Related

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 _)

Setting priority for loading slf4j jar from custom path apart from JRE

Am upgrading jetty 4.2.24 to jetty 9.2.25,i got a dependency with slf4j version for jetty.
jetty 9.2.25 requires slf4j 1.7.5 but am using 1.5.6 version for both jetty web server and JACORB.
the problem am facing here is jetty is taking the jar directly under JVM /ext path, i cant replace the slf4j 1.5.6 under JVM directly since JACORB is using it.
I have searched in web and tried to dynamically exclude the jar, but its only showing with Maven which am not using.
please let me know if there is any way to give some priority for jars under jetty configuration , so that it will not take jar under JVM(slf4j 1.5.6 )
and take new jar (slf4j 1.7.5) in some other path.

Balana "evaluate" command causing NoClassDefFoundError

I got a jar for balana 1.0.5 from here:
http://maven.wso2.org/nexus/content/groups/wso2-public/org/wso2/balana/org.wso2.balana/1.0.5/
I have an instance of pdp with no configuration and I'm trying to pass it a sample xacml request string just to see if I can get output, then I can work on giving the PDP a policy configuration to run with, but I get this error when calling evaluate.
Caused by: java.lang.NoClassDefFoundError: org/apache/xerces/util/SecurityManager
at org.wso2.balana.utils.Utils.getSecuredDocumentBuilderFactory(Utils.java:107)
at org.wso2.balana.Balana.<init>(Balana.java:215)
at org.wso2.balana.Balana.getInstance(Balana.java:228)
at org.wso2.balana.ctx.RequestCtxFactory.getXacmlRequest(RequestCtxFactory.java:173)
at org.wso2.balana.ctx.RequestCtxFactory.getRequestCtx(RequestCtxFactory.java:87)
at org.wso2.balana.PDP.evaluate(PDP.java:119)
I'd like to know if I'm using the wrong source or if I'm using the right source improperly.
Is this from using the 1.0.5 balana?
Is this from using the jar instead of the source files?
If I should be downloading using mvn rather than browsing the wso2 maven repository?
I've tried tracking down the xercesimpl.jar which contains references to SecurityManager, but when I import that to the classpath, it breaks some w3c xml stuff which otherwise works fine. Is there a version of balana which uses System's SecurityManager rather than trying to depend on xerces?
I also tried loading the K-Market sample with the same 1.0.5 jar and I get the same error, and again with the 1.0.4 jar, but it stops happening with a different error if I go to the 1.0.3 jar.
Yes, the 1.0.5 balana contains a dependency that isn't present in the jar.
Maybe, but not likely, since the source files, assuming they're the same, would still contain the same dependencies.
No idea. I still haven't figured out maven 100% yet.
I think so. The error stops happening when backtracking to balana 1.0.3 jar

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

Ivy/gant include BlazeDS jars that aren`t in a public repo and have no version

Ive been trying to figure out the best way to include the BlazeDS jars in my Gant/Ivy build.
Ive been unable to find a public repo for these jars and Im new to ivy. Obviously with Maven youd just do a local maven install to your local repo. Whats the best way to do something similar with Ivy? Do I have to create a separate Ivy.xml file for each jar and then use Ivy Publish or is their another way?
Also does anyone know a public repo where the BlazeDS Jars are available
Just discovered if you use Spring BlazeDS Inetgration project and include its dependency in ivy it`ll pull in the Flex jars from Spring Bundle repository.