How to handle conflicting dependencies in Java (EE)

I am developing an enterprise application using the Java EE 6 platform. The IDE is NetBeans 7.2 and the application server is GlassFish 3.1.2.2.

Business logic should use a library (specific HBase-RDF) to handle some tasks in its core. The original HBase-RDF code depends on many packages, of which I believe their new versions are already in use by Glassfish. For example, I can see javax.xml, javax.activation, com.sun.jersey and similar packages already included in jar files.

Despite the fact that I used to develop not-so-trivial Java EE applications, I came across countless headaches developing an application that may or may not be related to this. From what I read on the Internet, including dozens of questions about the stack flow and bug tracking systems, I think I can get rid of some of these headaches if I can pack the source library (HBase-RDF) with all its dependencies like the entire jar file and prohibit their inclusion directly in the project.

My first question is: am I dealing with problems correctly? Could this be the source of my problems? I think the answer would be yes, because I already solved one of my problems by removing JAXB and Xerces jars from the class path, and, fortunately, the parts of Hbase-RDF that I have to work with do not affect them.

And the second question is that I am right about the previous question, how can I do this? How to limit the use of these libraries to only one library (Hbase-RDF)?


NOTE. It may be useful to say that the build process ends without any problems, but I have to face two serious problems when deploying and starting a project. Firstly, the application is successfully deployed on my local Glassfish instance that is installed next to netbeans, but the same .ear package cannot be deployed on another instance of the same version, and the server.log file does not contain anything useful to find the cause of the problem. Error very similar to, but the proposed solutions do not work. The second problem is very similar to, and again I tried every proposed solution with no luck. It is interesting to see that the web service inside the web module successfully starts EJB, but the JSF facelet index.html does not start.

+4
source share
1 answer

I am not sure if your problem is with the build process or deployment.
Because for deployment, if you have a library that depends on another version of the library that you are already deploying, it is impossible to work without resorting to OSGi (it cannot have both versions of the library with the same classloader).
You tried to completely remove dependent libraries and use only newer versions.
If your only dependencies are for JAXB and xml java package, you might be lucky

0
source

All Articles