java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log

后端 未结 4 768
抹茶落季
抹茶落季 2020-12-17 09:19

I am getting this error while deploying my application

    java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Ma
      rker;Ljava         


        
4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-17 10:06

    I had the same problem when writing test cases while doing code refactoring in a Java 7 project. I fixed it by replacing the old logging imports by slf4j loggers

    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    

    in addition to it my pom dependencies looked like-

            
                javax.servlet
                servlet-api
                2.4
                provided
            
            
                javax.servlet
                jsp-api
                2.0
                provided
            
            
                log4j
                log4j
                1.2.14
            
            
                org.slf4j
                slf4j-log4j12
                1.7.25
            
            
                org.springframework
                spring
                2.5.6
            
            
                org.springframework
                spring-aop
                2.5.6
            
            
                org.springframework
                spring-web
                2.5.6
            
            
                org.springframework
                spring-webmvc-struts
                2.5.6
                
                    
                        struts
                        struts
                    
                
            
            
                org.hibernate
                hibernate
                3.2.6.ga
            
            
                org.apache.struts
                struts-core
                1.3.9
                
                    
                        antlr
                        antlr
                    
                
            
            
                org.apache.struts
                struts-taglib
                1.3.9
            
            
                org.apache.struts
                struts-tiles
                1.3.9
            
            
                org.apache.struts
                struts-extras
                1.3.9
            
            
                axis
                axis
                1.4
            
            
                org.apache.velocity
                velocity
                1.6
            
            
                velocity-tools
                velocity-tools
                1.4
            
            
                displaytag
                displaytag
                1.2.0-gema-2
                
                    
                        struts
                        struts
                    
                    
                        org.slf4j
                        slf4j-log4j12
                    
                    
                        org.springframework
                        spring-webmvc
                    
                    
                        taglibs
                        standard
                    
                    
                        commons-collections
                        commons-collections
                    
                    
                        commons-lang
                        commons-lang
                    
                    
                        commons-beanutils
                        commons-beanutils
                    
                    
                        com.lowagie
                        itext
                    
                
            
            
                org.apache.struts
                struts-el
                1.3.9
            
            
                struts
                struts-layout-wrapper
                1.2.19
                
                    
                        struts
                        struts
                    
                
            
            
                taglibs
                standard
                1.1.2
            
            
                com.lowagie
                itext
                1.4.8
            
            
                commons-logging
                commons-logging
                1.1.1
            
            
                commons-beanutils
                commons-beanutils
                1.7.0
            
            
                commons-lang
                commons-lang
                2.4
            
            
                commons-digester
                commons-digester
                1.8
            
            
                commons-collections
                commons-collections
                3.2.1
            
            
                com.oracle
                ojdbc6
                11.2.0.3.0
                provided
            
            
                de.gema.sso
                gema-sso-client
                1.2
                
                    
                        struts
                        struts
                    
                    
                        org.springframework
                        spring-web
                    
                
            
            
            
                commons-dbcp
                commons-dbcp
                1.2.2
                test
            
            
                junit
                junit
                4.4
                test
            
            
                org.springframework
                spring-test
                2.5.6
                test
            
            
                org.dbunit
                dbunit
                2.4.4
                test
            
        
    
    
        
            ${basedir}/target/filter.properties
        
        
            
                org.apache.maven.plugins
                maven-antrun-plugin
                1.3
                
                    
                        generate-resources
                        
                            run
                        
                        
                            
                                
                                
                                
                                    
                                
                                
                                    
                                
                                
                                    buildNr=${build.nr}
                                    buildTime=${build.time}
                                
                            
                        
                    
                
            
        
        
            
                src/main/resources
                true
            
        
        
            
                fr.jcgay.maven.extension
                unique-revision-maven-filtering
                1.0
            
        
    
    
        
            junit
            junit
        
        
            log4j
            log4j
        
    

提交回复
热议问题