java.lang.ClassNotFoundException: org.apache.commons.codec.binary.Base64

后端 未结 3 828
情话喂你
情话喂你 2020-12-06 02:02

Here I\'m passing three parameters to this sign method. In this line

signature = new String(Base64.encodeBase64(mac.doFinal(data.getBytes(UTF_8_Encod

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-06 02:10

    There could be Two Reason for that:

    First Reason: 1. The jar itself is not added in the pom.xml. In that case, add the dependency version in the pom.xml which has the class for which you are getting error

    Second Reason: When there are multiple jars added in the project and the jar version which is near to the project doesn't have that class. You can check the nearest jar in your project below command

    mvn dependency:tree -Dverbose -Dincludes=jar-name-casuing-conflict
    

    Once you identify the Jar version which has that class. You can resolve by adding that jar directly in your project pom.xml

    or You can exclude the jar that is nearer to your project which doesn't has that class and can point to another jar in the project.

    Example: it will exclude the jar in the project "org.cassandraunit" then it will see the immediate next jar that's close to the project will be used in your project

       
                org.cassandraunit
                cassandra-unit
                3.1.3.2
                
                    
                        org.apache.commons
                        commons-lang3
                    
                
            
    

提交回复
热议问题