Results 1 to 12 of 12
  1. #1
    talbotmj is offline Member
    Join Date
    Aug 2013
    Posts
    4
    Rep Power
    0

    Default maven dependency, class loading issues in different builds across sandboxes

    I have a situation where - when I build our application/product in my environment using my local repository and deploy the ear to weblogic, the application performs as expected. I have log4j configured centrally in the ear using a log4j configuration module - I also have the log4j1.2.17 library in the ear and instruct weblogic to to use our version. For our specific logging needs (we log using a custom JMS appender that stores our logs in Oracle) we do not want or need to configure logging levels outside of our ear ...

    Our issue is a class loading issue when a xml file is being parsed in Spring. Other sandboxes encounter a class loading issue (I think from some transient dependency) and fail trying to parse a spring configuration file that uses a AOP to configure the JMS appender (connection factory, etc.).

    My question is if all sandboxes are using the same pom files - how does the ear in my sandbox work correctly (no class loading issues) while all other sandboxes do not. Somehow my sandbox loads into the ear a version (with the same version id of course) of some library that differs between the two spring libraries being used in the aop xml parsing.

    Has anyone seen this kind of issue? I have always assumed if the poms used are the same (which they are - we don't differ between environments) all the dependencies built into the ear would be identical.

    Any help - suggestions would be appreciated.

    Thank you.

  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,346
    Rep Power
    6

    Default Re: maven dependency, class loading issues in different builds across sandboxes

    Prove it. The libraries are in the ear which is a simple zip file so open it up in your favorite zip tool and check it out - are they actually physically different?

    And no it is not a 100% guarantee - the dependencies will be the same if the pom is the same AND the repositories used are 100% the same. If you put a proxy in between (generally a Nexus), or your local .m2 repository is screwed up, you can get differences already.

    Another tip: if you invoke mvn dependency:tree, you get an exact overview of the dependencies AND their transitive dependencies. You can also compare that output between your environments.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  3. #3
    talbotmj is offline Member
    Join Date
    Aug 2013
    Posts
    4
    Rep Power
    0

    Default Re: maven dependency, class loading issues in different builds across sandboxes

    Thanks Erik - yes we have compared the ears from different sandbox builds and we don't see any differences

    My local .m2 repository is different than other sandboxes - I have been exploring different things with logging, assembly plugins, etc., and I have additional libraries and/or additional versions of libraries. However, I have reverted all those dependencies in the poms. If a pom uses a a particular library version - why would that version differ between Nexus and my local sandbox. Are you suggesting that even if the spring aop version is 3.1.1.2 - if it came from a different repository it may in fact not have be the same version and therefore we experience a class loading issue in some builds? I thought that was the whole point of groupId, etc. that it tagged a jar (no matter where it is obtained) as being the same, especially something from Spring.

    MT

  4. #4
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,346
    Rep Power
    6

    Default Re: maven dependency, class loading issues in different builds across sandboxes

    it COULD be, but its not very likely. I've had a few conflicts with libraries in my day, but only when I had several repositories sharing the same dependencies and for example one of them was corrupt. Since I just stay clean and stick to the maven central and JBoss repositories, I haven't had any issues with conflicts.

    If the ears are the same, it must be the environment you deploy to that is different. In other words: Weblogic. Its a process of elimination.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  5. #5
    talbotmj is offline Member
    Join Date
    Aug 2013
    Posts
    4
    Rep Power
    0

    Default Re: maven dependency, class loading issues in different builds across sandboxes

    Thanks Erik - yes I've checked weblogic as well because I had previously setup central log4j configuration in weblogic but backed that out - I've compared setDomainEnv, config.xml and start scripts between weblogic environments - they all compare. We have narrowed the problem to the ear itself - if we deploy my sandbox ear into a different environment it works without any issues and if I install an ear into my sandbox that was built in a different environment it has the same class loading issues the others have that I normally do not have. The only ear that works without class loading issues is one built against my repository.

    It is a tricky issue to locate - I am using the mvn dependency:tree output you suggested - I am hoping it may expose some transient dependency that somehow is different between environments.

  6. #6
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,346
    Rep Power
    6

    Default Re: maven dependency, class loading issues in different builds across sandboxes

    I kind of doubt the problem lies in the dependencies to be honest. I would rather investigate what libraries there are installed in the different Weblogic environments; might yours have an extra one you forgot about?
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  7. #7
    talbotmj is offline Member
    Join Date
    Aug 2013
    Posts
    4
    Rep Power
    0

    Default Re: maven dependency, class loading issues in different builds across sandboxes

    sure I may have a library in my weblogic that some sandboxes don't have - for example mine is a 64 bit version of 10.3.5 - but another 64 bit version sandbox fails with the ear that sandbox builds but when it runs my ear from my sandbox it works - as my sandbox fails when I run their ear in my weblogic. The only ear that works in any environment it runs in is the one from my sandbox and because of that we don't think the issue is in weblogic but with the maven build - the ear loads classes in a different order - why that would be is what I need to find out. I think :)

  8. #8
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,346
    Rep Power
    6

    Default Re: maven dependency, class loading issues in different builds across sandboxes

    Hm that is certainly possible. If classloading order makes a difference then you must have library clashes - either different (duplicate?) libraries with the same classes but a different version of it, or a mismatching API and implementation jar (many Oracle APIs consist of those two jars). You might also get some shit with the cglib library as two different versions of it live in two different Maven groups, making it possible that two copies end up on the classpath. There are more such libraries where the Maven group changed half-way through its lifetime opening up the possibility for a duplicate, for example when the library changed ownership.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  9. #9
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,225
    Rep Power
    20

    Default Re: maven dependency, class loading issues in different builds across sandboxes

    Should be easy to spot if there are multiple versions of the same library, though.
    They'd be right there in your ear.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  10. #10
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,346
    Rep Power
    6

    Default Re: maven dependency, class loading issues in different builds across sandboxes

    In my ear? *pokes with finger*. Oooooh, you mean the file!

    (sorry)

    It becomes harder when you have dozens of libraries, spread over your EAR and one or more WARs though ;) I spent at least an hour goggling at one of mine only to realize there was a 'cglib' and a 'cglibfull' (or something along those lines) in two different locations that were causing me misery :/
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  11. #11
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,225
    Rep Power
    20

    Default Re: maven dependency, class loading issues in different builds across sandboxes

    Then list all *.jar from inside the ear.
    Some judicious *nix command should sort that out in no time.
    Stick them in a spreadsheet and order them.

    Most frameworks have jar files that begin with the same letters.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  12. #12
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,346
    Rep Power
    6

    Default Re: maven dependency, class loading issues in different builds across sandboxes

    Nowadays I just use the m2eclipse/jboss-tools Maven integration plugin features to make it easy and visible within Eclipse ;) Nice and cross-platform too.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. maven dependency and war file
    By szms in forum Apache Maven
    Replies: 1
    Last Post: 07-26-2012, 07:25 AM
  2. Maven Issues - mvn install
    By Paolo Futre in forum Advanced Java
    Replies: 0
    Last Post: 08-21-2009, 11:01 AM
  3. FYI: Ant-Netbean Dependency Issues & The Fix
    By angryboy in forum Advanced Java
    Replies: 0
    Last Post: 06-05-2009, 10:53 PM
  4. Maven Dependency Overview 1.1
    By Java Tip in forum Java Software
    Replies: 0
    Last Post: 07-02-2008, 08:13 PM
  5. Maven Dependency Overview 1.0
    By Java Tip in forum Java Software
    Replies: 0
    Last Post: 04-15-2008, 07:52 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •