When trying to deploy to tomcat, Caused by: java.lang.NoSuchFieldError: NULL

后端 未结 1 1244
情歌与酒
情歌与酒 2020-12-10 20:23

Dao-hbm.xml:

    


        
1条回答
  •  -上瘾入骨i
    2020-12-10 20:51

    You are mixing Spring versions and you are mixing Spring Security Versions (3.1.3 and 3.1.4), Spring Security 3.1 has a dependency on Spring 3.0 whereas you are trying to use 3.1. Spring WS 2.1 depends on Spring 3.2... So you have a whole mixture going on.

    I would suggest upgrading to Spring 3.2.4 (the latest version) and use a properties element to determine the version instead of specifing it for each dependency. Next to that I also suggest using tag to force dependencies on a certain version. And finally (or maybe firstly) I suggest the use of the maven-enforcer-plugin with a dependency convergence rule, this will break the build if there are conflicting versions of certain dependencies.

    Enforcer plugin

    
       
           
                org.apache.maven.plugins
                maven-enforcer-plugin
                1.3.1
                
                    
                        enforce-banned-dependencies
                        
                            enforce
                        
                        
                            
                                
                                
                                    true
                                    
                                        commons-logging:commons-logging
                                        org.slf4j:slf4j-simple
                                    
                                
                            
                            true
                        
                    
                
            
            
    
    

    Use Properties

    
        3.2.4.RELEASE
        3.1.4.RELEASE
        2.1.3.RELEASE
    
    
    
        
            org.springframework.security
            spring-security-web
        
        
            org.springframework.security
            spring-security-config
        
    
    
    

    Use Dependency Management

    
        
            
            
                org.springframework
                spring-aop
                ${spring-framework.version}
            
            
                org.springframework
                spring-aspects
                ${spring-framework.version}
            
            
                org.springframework
                spring-beans
                ${spring-framework.version}
            
            
                org.springframework
                spring-context
                ${spring-framework.version}
            
            
                org.springframework
                spring-context-support
                ${spring-framework.version}
            
            
                org.springframework
                spring-core
                ${spring-framework.version}
                
                    
                        commons-logging
                        commons-logging
                    
                
            
            
                org.springframework
                spring-expression
                ${spring-framework.version}
            
            
                org.springframework
                spring-jdbc
                ${spring.version}
            
            
                org.springframework
                spring-jms
                ${spring-framework.version}
                
                    
                        commons-logging
                        commons-logging
                    
                
            
            
                org.springframework
                spring-orm
                ${spring-framework.version}
            
            
                org.springframework
                spring-oxm
                ${spring-framework.version}
            
            
                org.springframework
                spring-tx
                ${spring-framework.version}
            
            
                org.springframework
                spring-web
                ${spring-framework.version}
            
            
                org.springframework
                spring-webmvc
                ${spring-framework.version}
            
            
        
        org.springframework.security
        spring-security-web
        ${spring-security.version}
        
        
        org.springframework.security
        spring-security-config
        ${spring-security.version}
        
            
            
                org.springframework.ws
                spring-ws-core
                ${spring-ws.version}
                
                    
                        commons-logging
                        commons-logging
                    
                
            
            
                org.springframework.ws
                spring-ws-support
                ${spring-ws.version}
                
                    
                        commons-logging
                        commons-logging
                    
                
            
    

    When you use this you can ommit the version number in de section.

    This xml excludes commons-logging because we don't use that we use SLF4J with the jcl-over-slf4j wrapper jar. If you want to use commons-logging simply remove the exclusions and rule from the enforcer plugin.

    0 讨论(0)
提交回复
热议问题