Spring Boot app deployed to Glassfish is giving strange results

后端 未结 2 893
眼角桃花
眼角桃花 2020-12-17 01:58

As mentioned here, I am having a heck of a time getting my small Spring-Boot project to deploy \"correctly\" to Glassfish. It runs fine using the embedded Tomcat, but once

相关标签:
2条回答
  • 2020-12-17 02:29

    I had this problem with Payara 5, I understand the problem became from Glassfish.

    Versions:

    1. Payara 5.192
    2. Spring Boot 2.1.6

    The solution worked for me:

    I added this dependency in the pom.xml.

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-batch</artifactId>
        <version>2.1.4.RELEASE</version>
    </dependency>
    

    My glassfish-web configuration:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE glassfish-web-app PUBLIC ...>
    <glassfish-web-app error-url="">
        <class-loader delegate="true"/>
        <jsp-config>
            <property name="keepgenerated" value="true">
              <description>Keep a copy of the generated servlet class' java code.</description>
            </property>
          </jsp-config>
        <!-- set a friendly context root -->
        <context-root>/micuenta-api</context-root>
        <!-- Change the default character encoding from ISO-8859-1 to UTF-8 -->
        <parameter-encoding default-charset="UTF-8"/>
    </glassfish-web-app>
    
    0 讨论(0)
  • 2020-12-17 02:34

    This has been answered here: https://stackoverflow.com/a/29438821/508247

    There is a bug in Glassfish 3.1.X. You need to include metadata-complete="true" in your web.xml root element.

    <?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>
    
    0 讨论(0)
提交回复
热议问题