Spring Boot App不会在Glassfish 4.1上部署 [英] Spring Boot App does not deploy on Glassfish 4.1

查看:169
本文介绍了Spring Boot App不会在Glassfish 4.1上部署的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个由以下pom.xml组成的香草弹簧启动应用程序

 <?xml version =1.0 encoding =UTF-8?> 
< project xmlns =http://maven.apache.org/POM/4.0.0xmlns:xsi =http://www.w3.org/2001/XMLSchema-instancexsi:schemaLocation =http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">
< modelVersion> 4.0.0< / modelVersion>

< groupId> xxx.alexius< / groupId>
< artifactId> myapp< / artifactId>
< version> 1.0-SNAPSHOT< / version>
<包装>战争< / packaging>

<名称>我的应用程式< / name>
< description>核心应用程序平台< / description>
< parent>
< groupId> org.springframework.boot< / groupId>
< artifactId> spring-boot-starter-parent< / artifactId>
< version> 1.2.2.RELEASE< / version>
< relativePath /> <! - 从存储库查找父级 - >
< / parent>
<属性>
< project.build.sourceEncoding> UTF-8< /project.build.sourceEncoding>
< java.version> 1.7< /java.version>
< / properties>

<依赖关系>
< dependency>
< groupId> org.springframework.boot< / groupId>
< artifactId> spring-boot-starter-data-jpa< / artifactId>
< /依赖关系>
< dependency>
< groupId> org.springframework.boot< / groupId>
< artifactId> spring-boot-starter-data-mongodb< / artifactId>
< /依赖关系>
< dependency>
< groupId> org.springframework.boot< / groupId>
< artifactId> spring-boot-starter-mobile< / artifactId>
< /依赖关系>
< dependency>
< groupId> org.springframework.boot< / groupId>
< artifactId> spring-boot-starter-security< / artifactId>
< /依赖关系>
< dependency>
< groupId> org.springframework.boot< / groupId>
< artifactId> spring-boot-starter-social-facebook< / artifactId>
< /依赖关系>
< dependency>
< groupId> org.springframework.boot< / groupId>
< artifactId> spring-boot-starter-social-twitter< / artifactId>
< /依赖关系>
< dependency>
< groupId> org.springframework.boot< / groupId>
< artifactId> spring-boot-starter-thymeleaf< / artifactId>
< /依赖关系>
< dependency>
< groupId> org.springframework.boot< / groupId>
< artifactId> spring-boot-starter-web< / artifactId>
< /依赖关系>
< dependency>
< groupId> mysql< / groupId>
< artifactId> mysql-connector-java< / artifactId>
< scope>运行时< / scope>
< /依赖关系>
< dependency>
< groupId> org.postgresql< / groupId>
< artifactId> postgresql< / artifactId>
< version> 9.4-1201-jdbc41< / version>
< scope>运行时< / scope>
< /依赖关系>
< dependency>
< groupId> org.springframework.boot< / groupId>
< artifactId> spring-boot-starter-test< / artifactId>
< scope> test< / scope>
< /依赖关系>
< /依赖关系>

< build>
< plugins>
< plugin>
< groupId> org.apache.maven.plugins< / groupId>
< artifactId> maven-compiler-plugin< / artifactId>
< version> 2.3.2< / version>
<配置>
< source> 1.7< / source>
< target> 1.7< / target>
< compilerArgument> -Xlint:all< / compilerArgument>
< showWarnings> true< / showWarnings>
< showDeprecation> true< / showDeprecation>
< / configuration>
< / plugin>
< / plugins>
< / build>



当我将它部署到Tomcat一切正常,但当我尝试在GlassFish 4.1服务器上部署时,出现以下错误:

  SEVERE:Class [liquibase / integration / spring / SpringLiquibase]找不到。加载时出错[class org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration $ LiquibaseConfiguration] 
SEVERE:部署应用程序时出现异常[平台]
SEVERE:生命周期处理期间的异常
java.lang .ArrayStoreException:sun.reflect.annotation.TypeNotPresentExceptionProxy

有什么想法出错?它是Spring还是Glassfish错误?

解决方案

它看起来像Glassfish中的一个错误: GLASSFISH-21265



您可以尝试通过在你的 web.xml 中添加 metadata-complete =true像这样:

 <?xml version =1.0encoding =UTF-8?> 
< web-app version =3.1
metadata-complete =true
xmlns =http://xmlns.jcp.org/xml/ns/javaee
xmlns:xsi =http://www.w3.org/2001/XMLSchema-instance
xsi:schemaLocation =http://xmlns.jcp.org/xml/ns/javaee http:/ /xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd\">
< / web-app>




metadata-complete =true表示JAR文件在
/ WEB-INF / lib不需要针对特定​​于Servlet 3.0的
注释进行扫描,但webapp自己的类仍然会被扫描。


另见:


I have a vanilla spring boot app that consists of the following pom.xml

 <?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>xxx.alexius</groupId>
    <artifactId>myapp</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>

    <name>my app</name>
<description>Core Application Platform</description>
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.2.2.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <java.version>1.7</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-mongodb</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-mobile</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-social-facebook</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-social-twitter</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-thymeleaf</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <version>9.4-1201-jdbc41</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
                <compilerArgument>-Xlint:all</compilerArgument>
                <showWarnings>true</showWarnings>
                <showDeprecation>true</showDeprecation>
            </configuration>
        </plugin>
    </plugins>
</build>

When I deploy this to a Tomcat everything works fine but when I try to deploy this on a Glassfish 4.1 server I get the following error

SEVERE:   Class [ liquibase/integration/spring/SpringLiquibase ] not found. Error while loading [ class org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration$LiquibaseConfiguration ]
SEVERE:   Exception while deploying the app [platform]
SEVERE:   Exception during lifecycle processing
java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy

Any ideas on what is going wrong? Is it a Spring or Glassfish bug?

解决方案

It looks like this a bug in Glassfish: GLASSFISH-21265

You can try to get around that by adding metadata-complete="true" in your web.xml like this:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" 
         metadata-complete="true"
         xmlns="http://xmlns.jcp.org/xml/ns/javaee" 
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
</web-app>

The metadata-complete="true" indicates that the JAR files in /WEB-INF/lib doesn't need to be scanned for Servlet 3.0 specific annotations, but the webapp's own classes will still be scanned.

See also:

这篇关于Spring Boot App不会在Glassfish 4.1上部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆