• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
  • paul wheaton
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Rob Spoor
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:

A simple problem but a challenging mystery

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Here is a simple problem, but gives your Java Brain very interesting mistry to solve

I was working on a production issue and observed a strange behaviour.

When I rebuit the ear file with the same source code, the following 6 jars missing from the war file
On investigation I find these jars are the transitive dependency jars for hibernate-3.2.7.ga.jar

       antlr-2.7.6.jar
       asm-1.5.3.jar
       asm-attrs-1.5.3.jar
       cglib-2.1_3.jar
       dom4j-1.6.1.jar


From the very next version of Hibernate these jars arent defined as dependencies

I was hoping that the other jars (like spring jars...) were having a conflicting dependency and so while maven packaging it is excluding the ear file.
But very interestingly I was able to replicate the same ear with transitive jars included when I rebuild in a machine with a certain spec (Lets say success machine) [I will keep the surprise for now and let you know the spec in a minute]

In order to nail down the problem I created a simple helloHBM project which has no java files in it and just the hibernate-3.2.7.ga.jar defined as the only dependency.
when I build the ear in other machines, I dont get the transitive jars.
But when I build in success machines ( tried in 2 success machines ) i could see the app built with the transitive jars

Success machine is windows machine (any version) with 32 bit Java Version 1.6 and Maven build version is 3.0.3

I tried my level best to remove all the parameters and could nail down to the above two variables ( Java version and Maven version) but beyond that I wasnt able to reason out why it behaved differently

Can some one try this challanging strange behaviour?
I have simplified it to a simple helloHBM java program without any reference to my project and is very generic and basic in nature. The pom file is very simple too. But gives me sleepless nights until i uncover the mystry

You may Copy the pom.xml and web.xml contents to the below structure and run the command : mvn clean package -X

Directory Structure :
HelloHBM -> pom.xml
HelloHBM -> src -> main -> webapp -> WEB-INF -> web.xml


pom.xml          



-------------------------------------------------------------------------------------------------
web.xml



and check if you get the following 6 files as part of your war

[DEBUG] adding entry WEB-INF/lib/antlr-2.7.6.jar
[DEBUG] adding entry WEB-INF/lib/asm-1.5.3.jar
[DEBUG] adding entry WEB-INF/lib/asm-attrs-1.5.3.jar
[DEBUG] adding entry WEB-INF/lib/cglib-2.1_3.jar
[DEBUG] adding entry WEB-INF/lib/dom4j-1.6.1.jar



Success Criteria for this puzzle is to build the war file with the above 6 jars and to figure out why it is missing in few cases.



Trust me.. This will be a good Brainstormer
Enjoy your Challenge


Thanks in Advance for any suggestions



Regards,
Ghilli
The-Only-Difference.png
[Thumbnail for The-Only-Difference.png]
 
Saloon Keeper
Posts: 15252
349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is pretty simple. The only difference is the Maven version. The release notes of Maven 3.0.4 state that the following bug was fixed: https://issues.apache.org/jira/browse/MNG-5121
 
Ghilli Da
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:This is pretty simple. The only difference is the Maven version. The release notes of Maven 3.0.4 state that the following bug was fixed: https://issues.apache.org/jira/browse/MNG-5121



Hi Stephen,

Thanks for your response.
I tried with the maven 3.0.3 version too in other machines and it did not pull up transitive dependencies.
If the issue is with maven version it has to be consistent across all machines. but it isnt the case

here are few scenarios I tried.
Linux Machine + Java 1.6 +  Maven 3.0.3 -> Failure
Linux Machine + Java 1.6 + Maven 3.0.4 -> Failure
Windows Machine + Java 1.6 (64 bit) + Maven 3.0.3 -> Failure
Windows Machine + Java 1.6 (32 bit) + Maven 3.0.3 -> Success

would you be able to try the pom.xml in your machine and let me know your observation of the behaviour?
 
Stephan van Hulst
Saloon Keeper
Posts: 15252
349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your reasoning is that a bug behaves consistently. This is flawed reasoning, because some bugs don't have consistent behavior.

The fact of the matter is that in Maven 3.0.1 - 3.0.3 transitive dependencies were 'sometimes lost', due to a bug. If you want to know the cause of the bug, you'll have to take a look at the code changes made to Maven to fix that bug.
 
Ghilli Da
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:Your reasoning is that a bug behaves consistently. This is flawed reasoning, because some bugs don't have consistent behavior.

The fact of the matter is that in Maven 3.0.1 - 3.0.3 transitive dependencies were 'sometimes lost', due to a bug. If you want to know the cause of the bug, you'll have to take a look at the code changes made to Maven to fix that bug.




Thanks Stephan Again for your interest.

I have now run the build against Maven 3.3.9 and still missing the transitive dependencies that makes me to think less that it is dependent on the maven version or java version (and that makes it interesting).... I may be wrong and happy to be corrected.

here is the output


Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T03:41:47+11:00)
Maven home: C:\Ghilli\Programs\apache-maven-3.3.9\bin\..
Java version: 1.8.0_101, vendor: Oracle Corporation
Java home: C:\Ghilli\Programs\Java\jre1.8.0_101
Default locale: en_AU, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos"



[DEBUG] Processing: hibernate-3.2.7.ga.jar
[DEBUG]  + WEB-INF/lib/hibernate-3.2.7.ga.jar has been copied.
[INFO] Webapp assembled in [79 msecs]
[DEBUG] Excluding [] from the generated webapp archive.
[DEBUG] Including [**] in the generated webapp archive.
[INFO] Building war: C:\Geethai\Projects\DPC\HelloHBM\target\hbm-1.0.war
[DEBUG] adding directory META-INF/
[DEBUG] adding entry META-INF/MANIFEST.MF
[DEBUG] adding directory WEB-INF/
[DEBUG] adding directory WEB-INF/classes/
[DEBUG] adding directory WEB-INF/lib/
[DEBUG] adding entry WEB-INF/lib/hibernate-3.2.7.ga.jar
[DEBUG] adding entry WEB-INF/web.xml
[INFO] WEB-INF\web.xml already added, skipping
[DEBUG] adding directory META-INF/maven/
[DEBUG] adding directory META-INF/maven/com/
[DEBUG] adding directory META-INF/maven/com/hbm/
[DEBUG] adding entry META-INF/maven/com/hbm/pom.xml
[DEBUG] adding entry META-INF/maven/com/hbm/pom.properties
 
New rule: no elephants at the chess tournament. Tiny ads are still okay.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic