• spring boot 1.5.3项目放到resin4.0.53报错


    报错信息:

    {main} java.lang.AbstractMethodError: org.hibernate.validator.internal.engine.ConfigurationImpl.getDefaultParameterNameProvider()Ljavax/validation/ParameterNameProvider;
                               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                               at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                               at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                               at java.lang.reflect.Method.invoke(Method.java:498)
                               at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:216)
                               at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:201)
                               at org.springframework.validation.beanvalidation.LocalValidatorFactoryBean.configureParameterNameProviderIfPossible(LocalValidatorFactoryBean.java:313)
                               at org.springframework.validation.beanvalidation.LocalValidatorFactoryBean.afterPropertiesSet(LocalValidatorFactoryBean.java:282)
                               at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687)
                               at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624)
                               at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
                               at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
                               at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
                               at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
                               at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
                               at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
                               at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208)
                               at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)
                               at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)
                               at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835)
                               at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741)
                               at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:467)
                               at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173)
                               at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067)
                               at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
                               at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
                               at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
                               at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
                               at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
                               at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
                               at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:223)
                               at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:702)
                               at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:527)
                               at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
                               at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737)
                               at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370)
                               at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
                               at org.springframework.boot.web.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:151)
                               at org.springframework.boot.web.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:131)
                               at org.springframework.boot.web.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:86)
                               at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:169)
                               at com.caucho.server.webapp.WebApp.callInitializer(WebApp.java:3605)
                               at com.caucho.server.webapp.WebApp.callInitializers(WebApp.java:3486)
                               at com.caucho.server.webapp.WebApp.startImpl(WebApp.java:3811)
                               at com.caucho.server.webapp.WebApp.access$700(WebApp.java:209)
                               at com.caucho.server.webapp.WebApp$StartupTask.run(WebApp.java:5370)
                               at com.caucho.env.thread2.ResinThread2.runTasks(ResinThread2.java:173)
                               at com.caucho.env.thread2.ResinThread2.run(ResinThread2.java:118)

    根据简书网友的文章Spring Boot部署到Resin遇到的问题的方法,只要从war包排除三个jar即可。

    hibernate-validator-5.3.5.Final.jar
    jboss-logging-3.3.1.Final.jar
    validation-api-1.1.0.Final.jar

    最终pom描述如下:

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>com.xxx.projA</groupId>
        <artifactId>projA</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <name>projA</name>
        <packaging>war</packaging>
        <url>http://maven.apache.org</url>
    
    
        <build>
            <finalName>projA</finalName>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin </artifactId>
                    <configuration>
                        <excludes>
                            <exclude>
                                <artifactId>hibernate-validator</artifactId>
                                <groupId>org.hibernate</groupId>
                            </exclude>
                            <exclude>
                                <artifactId>jboss-logging</artifactId>
                                <groupId>org.jboss.logging</groupId>
                            </exclude>
                            <exclude>
                                <artifactId>validation-api</artifactId>
                                <groupId>javax.validation</groupId>
                            </exclude>
                            <exclude>
                                <artifactId></artifactId>
                            </exclude>
                        </excludes>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-war-plugin</artifactId>                
                    <configuration> <!-- Exclude JCL and LOG4J since all logging should go through SLF4J. Note 
                            that we're excluding log4j-<version>.jar but keeping log4j-over-slf4j-<version>.jar -->
                        <packagingExcludes>
                            WEB-INF/lib/hibernate-validator-*.jar,
                            WEB-INF/lib/jboss-logging-*.jar,
                            WEB-INF/lib/validation-api-*.jar,
                            WEB-INF/lib/tomcat-embed-*.jar,
                            WEB-INF/lib/spring-boot-starter-tomcat-*.jar,
                            WEB-INF/lib/*tomcat*.jar
                        </packagingExcludes>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    
    
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
                <exclusions>
                    <exclusion>
                        <artifactId>hibernate-validator</artifactId>
                        <groupId>org.hibernate</groupId>
                    </exclusion>
                    <exclusion>
                        <artifactId>jboss-logging</artifactId>
                        <groupId>org.jboss.logging</groupId>
                    </exclusion>
                    <exclusion>
                        <artifactId>validation-api</artifactId>
                        <groupId>javax.validation</groupId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <scope>test</scope>
            </dependency>
    
            <!-- <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> 
                </dependency> -->
            <!--打包war必须的依赖 -->
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>javax.servlet-api</artifactId>
                <version>3.1.0</version>
            </dependency>
            <!--<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> 
                <scope>provided</scope> </dependency> -->
    
        </dependencies>
        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>1.5.3.RELEASE</version>
        </parent>
    </project>

    排除三个jar包以后再把war放到resin就能正常运行了

    上班忙,没有时间细细整理,大家参考一下吧

  • 相关阅读:
    定制自己的PHP语法-在PHP中实现unless
    欢迎使用CSDN-markdown编辑器
    在 Laravel 中通过 Artisan View 扩展包创建及删除应用视图文件
    直接可用的loading.js
    vue后退判断是否有历史记录,有就返回上一级,否则返回指定路由
    js防抖和节流
    IE增加Meta标签(IE=Edge,chrome=1)兼容IE问题
    如何覆盖 node_modules 里的文件
    js运行代码计时器
    vue打包font字体文件路径错误的问题处理
  • 原文地址:https://www.cnblogs.com/passedbylove/p/8966887.html
Copyright © 2020-2023  润新知