5 Replies Latest reply on Oct 17, 2012 6:50 PM by sfcoy

    How to deal with commons-codec version conflict?

    johnson_shawn

      I am getting the following error in my logs:

       

      java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Base64.decodeBase64(Ljava/lang/String;)

       

      I have version 1.6 of apache commons codec in: war/WEB-INF/lib/commons-codec-1.6.jar

       

      However, I also have a custom "module" - com.documentum, which includes:  commons-codec-1.3.jar

       

      Then of course we have the in-built module - org.apache.commons.codec, using: commons-codec-1.4.jar

       

       

      This particular method was changed/added in 1.5 or 1.6.  I don't want to needlessly mess with the other modules if not required.  I'm just not sure how to sort this out to tell my calling class, which is in my WEB-INF/classes to look first to the WEB-INF/lib/commons-codec-1.6.jar?

       

       

      Thanks!

        • 1. Re: How to deal with commons-codec version conflict?
          ctomc

          Hi,

           

          check the class loading docs https://docs.jboss.org/author/display/AS71/Class+Loading+in+AS7

          but basicly just define exclude for all modules you don't want to get imported.

           

           

          --

          tomaz

          • 2. Re: How to deal with commons-codec version conflict?
            johnson_shawn

            Thanks, I just re-read through the classloading link.  I think I'm starting to "get it", but may need a bit more help.

             

            I have a WAR only, so I understand that the "local resources" are #3 in line.

             

            I have a jboss-deployment-structure.xml:

             

             

            <jboss-deployment-structure>
                      <deployment>
                                <dependencies>
                                          <module name="com.bananaco.settings" />
                                          <module name="com.documentum" />
                                </dependencies>
              
                                <exclusions>
                                          <module name="org.apache.commons.codec" />
                                </exclusions>
              
                      </deployment>
            </jboss-deployment-structure>
            
            

             

            I was "trying" the exclusion above - it didn't do the trick I was hoping.  However, the com.documentum module has that commons-codec-1.3 and it is taking precedence.  So, is there a way to instead have an exclusion specifically for the commons-codec Jar within the com.documentum module?

            • 3. Re: How to deal with commons-codec version conflict?
              sfcoy

              Try updating the commons-codec version in your com.documentum module.

              1 of 1 people found this helpful
              • 4. Re: How to deal with commons-codec version conflict?
                johnson_shawn

                Sure, I could certainly update the commons-codec jar in com.documentum module.  That is essentially what I had prior to JBoss, I replaced the older with newer inside of WEB-INF/lib.

                 

                So, should I take it a step further and update the actual org.apache.common.codec/main/ - to the newer commons that I'm using, or do I risk breaking something in JBoss core?  Then of course adding the dependency to com.documentum.

                • 5. Re: How to deal with commons-codec version conflict?
                  sfcoy

                  I would not touch the built-in org.apache.common.codec module. In theory it will only be seen by JBoss code unless you explicitly import it.

                   

                  Just update the one in your documentum module, and leave it out of your WEB-INF/lib.

                   

                  If you still have issues then a complete stack trace will be needed.

                  1 of 1 people found this helpful