What is the best practice to handle duplicate jars - jar

I am including JBPM5.2 into my existing project. I have noticed some of the jar files are duplicated.
below is the list
my jbpm
activation-1.1.jar 1.1 1.1
antlr-2.7.7.jar 2.7.7 2.7.7
Common-collections 2.1 3.1
common-io 1.1 1.4
dom4j-1.6.1.jar 1.6.1 1.6.1
Jdom-1.0.jar 1.0 1.0
Jta.jar 1.0 1.1
Log4j 1.2.15 1.2.14
Mail.jar 1.4 1.4
I am not keen to upgrade those jar because that means I have to do thorough regression test on my existing functions which is a lot. Basically i am looking for a safe and easy way.
I believe this is a very common issue that many people encounter. Can someone share with me his/her approach in getting this over.

So, what kind of a dependency does your app have on jbpm? Will jbpm and your jar be in the same JVM under the same class loader? If so, you have a problem. Upgrading is the only correct solution.
Typically, in something like a web application, for example Tomcat or Jetty, the libraries needed by the server is on server's classpath. Each web application being deployed has its own class loader. The libraries that you depend on is available on this class loader which does not pollute the container itself.

Few options I can think of
If your unit of deployment is EAR (I am not sure if this is applicable for your app thought). Since the WAR can have its own classloader you can localize the jars to webapp. Go through this post Java EE class loading standard
Another possibility is to deploy JBPM as a separate application by itself.
Upgrade jars (my preference): From what I can see commons-* are the only jars that are deferring that too in MINOR versions only. So you no need to worry about anything. A smoke test or simple functional tests is all what you might need.

Related

How can I get corda-tools-ha-utilities-<version>.jar

I can't find this corda-tools-ha-utilities-.jar from internet or enterprise version, could anyone told me that how I could get it , version 4.4 to 4.7 is ok to me . thx.
For corda enterprise users you're gonna need to reach out to support as they have a specific repository for enterprise jars like the ha utilities.
The open source users can get pretty much any of the jars in their usual gradle builds. (repositories can be seen in the cordapp template here: https://github.com/corda/cordapp-template-java)

Realm support for Swift 3

So I updated to swift 3.0 and now my projects with realm 1.0.2 all give me an error.
RealmSwift compiled with older version of Swift language (2.0) than previous files (3.0)
I also tried to build a net new project and still get the build error, so I know it is not a conversion issue on the Swift side.
I found several Swift 3.0 beta users and tried to run the script to update my version to 3.0 and several other options. The last few posts appeared to use Cocoa Pods - which I don't currently use. Is that the supported fix path?
Any help or direction would be greatly appreciated.
I haven't tried it yet, but here is what should work.
Essentially, the compiler gives you a description of what went wrong. The framework was compiled with Swift 2.0, while your project or other files were compiled with Swift version 3.0 (which means you made the switch after upgrading to the new version of Xcode.
To fix this, you need to use the Realm framework compiled with a Swift 3.0 compiler. Since the Realm team doesn't yet provide a precompiled version compiled with Swift 3.0, you have to do so yourself. To do that, go to their Github repository, and follow the instructions in the README under "Building Realm":
Prerequisites:
Building Realm requires Xcode 7.3.
Building Realm documentation requires jazzy
Once you have all the necessary prerequisites, building
Realm.framework just takes a single command: sh build.sh build.
You'll need an internet connection the first time you build Realm to
download the core binary.
This should generate the Realm framework with the current compiler version, which you then just have to use to replace your current Realm framework with. After that, everything should compile as it used to.
As stated before, I don't know if this actually works, as I haven't tried it yet. I don't exactly know if Swift 3.0 is supported by Realm yet or if there are any other issues you could run into. So please let me know how this works out!

How to / where to find info on JBoss client dependencies? Any documentation?

It may be pretty basic question. But no luck Googling.
I was going through this URL. Because I had an issue accessing EJBs deployed on JBoss. After following this, it worked. Mainly this line.
jboss-ejb3-client.jar, jboss-aop-jdk50-client.jar, jboss-aspect-jdk50-client.jar and jbossall-client.jar -
all these .jar files are found in client folder of JBoss installation directory
But for a newbie of EJBs like me, this is following the steps without understanding the dependencies. So my question, can we find documentation like this somewhere? How do we know the jars we need to copy to client application classpath?
jbossall-client.jar for JBoss 4.X is enough - it contains all needed libraries.
For JBoss 5.X the story is more difficult - you need to reference in your project only jbossall-client.jar, but inside this JAR there are no actual classes, only MANIFEST file, which lists needed dependencies.
So, on JBoss 5, you need to have jbossall-client.jar added to classpath of your client plus all listed JARs lying next to it. Crazy, isnt't it?
JBoss 7 has sane approach. There is bin\client\jboss-client.jar that contains all dependencies needed by clients.

Need Pointers | Using JDBCTemplate | CQ 5.5

I need some pointers/suggestions on following scenario.
Scenario:
We are trying to use JDBCTemplate in CQ 5.5 for querying database (Oracle 11g). As first step we have integrated CQ with Spring Framework. Now for JDBCTemplate to work it requires JDBC driver that needs to be loaded separately into CQ as it is not available with Spring jars. The jar that is required is available here http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-112010-090769.html and jar in my case is “ojdbc6.jar” that contains OracleDriver class (JavaDoc: *http://docs.oracle.com/cd/E11882_01/appdev.112/e13995/oracle/jdbc/OracleDriver.html*) required to register the driver to create connection with Database.
Problems/Suggestions required on following points:
As oracle 11g is commercial product so there is no repository available online for it (for pom dependencies), we need to create a separate local repository for it. (Need pointers; is there any other way to do it?)
Jar mentioned above is not OSGi. So how to approach in that case? (I have created OSGi bundle by following directions mentioned here http://cq-ops.tumblr.com/post/21893960212/how-to-turn-a-jdbc-driver-jar-into-an-osgi-bundle-jar)
In this process of converting this jar to OSGi Bundle I have to remove versions mentioned with Imported Packages in MANIFEST.MF file. (As I understand that CQ by-default picks the latest version that is available for any class, there may be problem when a new version of any class is available that is not compatible with current version. Need pointers; should this be looked into priority? Has anybody faced any issue due to this in any project)
Current Status:
By converting ojdbc5.jar to OSGi bundle; I was able to use JDBCTemplate. But looking for some pointers to check is there any other approach someone has followed in other project to achieve scenario mentioned above?
The oracle driver is not published to any public maven repo. So indeed you will have to put the jar into your own maven repo
In Apache Karaf there is a nice feature where you write wrap: in front of a bundle url and it automatically creates a bundle on the fly using the bnd tool.
If CQ does not have such a feature then you will have to create the bundle on your own. In this case the maven bundle plugin can help you. You can depend on the oracle jar using a maven dependency. Then you can define exports for the packages of the oracle jar. Bnd should then automatically inline the classes in you bundle jar. Another option is the maven shade plugin. You can take a look at the source of the servicemix bundles. There you find poms to bundle a lot of plain jars.
Not sure what exactly you mean. As far as I know the oracle driver does not have any external dependencies.
I have written a DB tutorial for Apache Karaf that explains how to deal with the oracle driver and how to create data sources without depending on the concrete driver.
The solutions in the tutorial can not be used 1:1 in CQ but it will surely give you some pointers.

java.lang.NoSuchMethodError: javax.servlet.ServletContext.getServletRegistrations()Ljava/util/Map;

I followed the steps in BalusC's answer at JSF 2.0 File upload. The only step in which I went differently is the Tomahawk upload link in the answer. The link is broken, so I got tomahawk-1.1.11 from another place. When I try to start Tomcat 7.0.14 from Eclipse I get the following error:
java.lang.NoSuchMethodError:
javax.servlet.ServletContext.getServletRegistrations()Ljava/util/Map;
And Tomcat doesn't start. Any ideas? Also, the answer in the link is from March. Any developments with file upload in JSF 2?
The /WEB-INF/lib of your web project is cluttered with servletcontainer-specific libraries of a container of a different make/version, such as servlet-api.jar, javaee.jar, etc. Get rid of them.
The mentioned method is introduced in Servlet 3.0 and this error indicates that you've libraries of a Servlet 2.5 container or older in your /WEB-INF/lib. If you have included them to circumvent Eclipse's compilation errors on javax.servlet.* imports, then you should have solved it differently. Namely, by integrating the servletcontainer which you're actually going to use (which is Tomcat 7 in your case) as target runtime in Eclipse and associating the project with it.
Please note that this problem is not related to JSF 2.0. You got an exception pointing to a method of the javax.servlet package, not javax.faces package.
See also:
How do I import the javax.servlet API in my Eclipse project?

Resources