Search code examples
coldfusionapache-commonscoldfusion-10

Changing JAR files in ColdFusion WEB-INF lib


Context

I'm working on a project where we use JUNG libraries. My custom java code and the Jung libraries are all placed under the wwwroot/WEB-INF/lib.

Note that, Certain classes of JUNG depend on Apache commons-collections.jar which is also present in the same folder (given by default by CF).

Problem

We are in plan to move from CF7 to CF10, so, I'm doing a pilot testing on all the code in the project and found that certain code (that uses the JUNG) are failing with a 'class not found' exception.

On debug and checking the methods in the commons-collections-2.1.jar given in CF 10, I found that its different from the one present in CF 7. If I update the JAR to the latest commons-collections-3.2.1 version, the code works fine as it found all those classes needed.

I can change my code base to suit the default commons-collections-2.1.jar, but that would result in atleast 2-3 months of dev-test cycle. I want to take it as last option and better avoid it if at all possible.

Now, my questions are -

  1. What would be the problem if I change(update) the 2.1 with 3.2.1?
  2. What could be the parts of core CF that uses this JAR ?
  3. Why does CF uses this outdated 2.1 (i feel so) JAR version ?

Home work I did

  • Testing : For not effecting the rest of applications, I have created a separate instance, changed the JAR to the latest 3.2.1, hosted my application on it and done some testing. Everything seems fine as I have not encountered any problems. But, I worry that there may be areas in CF that depends on this JAR and might break.

  • cfusion\lib : I have found that the commons-collections-3.2.1 already exists in the main lib (cfusion\lib) folder. So, may be, changing the JAR in the WEB-INF/lib does not make any difference.

  • cfusion\wwwroot\WEB-INF\lib : I have read that any JAR files placed in this folder are used for the applications only and not by the CF itself. I may be wrong or completely misunderstood the meaning. Correct Me!

Answers to this Q would help to my understanding of CF more as well as solve the problem.


Solution

  • I think I have found the answer.

    Its a misunderstanding by me that Adobe has changed the commons-collections.jar in its WEB-INF/lib when it made CF10. It did not and even if it did (assuming), it was noway related to my problem.

    After reading the comments from @Miguel-F, and @Leigh, I have checked through the previous installations and compared the lib changes. During that I found one of the previous developers have purposefully changed the commons-collections from the original given by CF to the custom one with with JUNG works properly. I confirmed this from the JAR compilation signatures and small note in them corresponding to the change.

    Now, I have copied the same file into the new CF 10 and my reports are working all good.

    Take Away:

    1. The changes to JAR in /WEB-INF/lib/ does not effect your CF Installation on a whole ONLY if your working on custom code an importantly you know what you are doing.
    2. If at all possible, please document such changes as part of application development logs so that when you leave the place, the next developer gets to know these customization without much hassle.
    3. Talk about your problem to the community and during the process making them understand the problem, you may find an answer. :)

    Thank you

    I want to thank @Miguel-F and @Brian for their inputs on system configuration. And more thanks to @Leigh for his Different how?. It made me think again and find my answer.