简体   繁体   English

在websphere 8.5.5.9上初始化Spring Boot

[英]Initialize Spring Boot on websphere 8.5.5.9

i'm trying to run a Spring boot application on Webpshere 8.5.5.9 我正在尝试在Webpshere 8.5.5.9上运行Spring启动应用程序

The code works fine if runned as java main on a embedded tomcat, but if i try to deploy on webpshere, the EAR starts with no error but no rest services are deployed. 如果在嵌入式tomcat上作为java main运行,代码工作正常,但如果我尝试在webpshere上部署,则EAR启动时没有错误,但没有部署其他服务。 I don't see in server console the SPRING BOOT LOG. 我没有在服务器控制台中看到SPRING BOOT LOG。 It's not started. 它没有开始。

If i make a get on server context path i reveive an hello world! 如果我进入服务器上下文路径,我会想到一个问候世界! (ear deployed successfully) but at the address of rest service i get a 404 (File not found) (耳朵部署成功)但在休息服务的地址我得到404(找不到档案)

I used spring boot as BOM insted of parent because i already have a parent. 我使用spring boot作为父母的BOM,因为我已经有了父母。 My software stack is: 我的软件堆栈是:

  • Java 8 Java 8
  • JEE 6 JEE 6
  • Spring boot 1.5.9 RELEASE Spring boot 1.5.9 RELEASE
  • Maven 3.5.X Maven 3.5.X
  • Websphere 8.5.5.9 Websphere 8.5.5.9

Any suggestion? 有什么建议吗? Thanks 谢谢

START CLASS 开始课程

    @SpringBootApplication
    @Configuration
    @EnableAutoConfiguration(exclude = {
        org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration.class,
        org.springframework.boot.actuate.autoconfigure.ManagementWebSecurityAutoConfiguration.class})
    public class ApplicationConfiguration extends SpringBootServletInitializer {

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        System.out.println("*** CONFIGURING ***");
        return application.sources(ApplicationConfiguration.class);
    }

    public static void main(String[] args) {
        //ApplicationContext ctx = 
        System.out.println("*** STARTING MAIN ***");
        SpringApplication.run(ApplicationConfiguration.class, args);
        //System.out.println(ctx);
    }

    }

CONTROLLER CONTROLLER

@RestController
public class ExampleController {

    @GetMapping("/sayhello")
    String home() {
        return "Hello World! Test";
    }
}

A WAR is packed in a EAR Important part of POM.xml of WAR is: WAR包含在EAR中WAR的POM.xml的重要部分是:

<packaging>war</packaging>

<properties>    
  <failOnMissingWebXml>false</failOnMissingWebXml>
</properties>

 <dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-dependencies</artifactId>
            <version>1.5.9.RELEASE</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<dependencies>

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <exclusions>
            <exclusion>
               <groupId>org.springframework.boot</groupId>
               <artifactId>spring-boot-starter-tomcat</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <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-rest</artifactId>
    </dependency>

    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
    </dependency>

    <dependency>
        <groupId>com.fasterxml.jackson.dataformat</groupId>
        <artifactId>jackson-dataformat-xml</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <optional>true</optional>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-rest-hal-browser</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>

</dependencies>


<build>

    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
        </resource>
    </resources>

    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.6</version>
        </plugin>

        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <version>1.5.9.RELEASE</version>
            <executions>
                <execution>
                    <goals>
                        <goal>repackage</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <version>2.7</version>
            <configuration>
                <delimiters>
                    <delimiter>@</delimiter>
                </delimiters>
                <useDefaultDelimiters>false</useDefaultDelimiters>
            </configuration>
        </plugin>
    </plugins>
</build>    

  1. Make sure Webspehere is pointing to sdk 1.7_64 or 32 Please check documention on how to change profile to use sdkname {PROFILE}\\bin>managesdk.bat -listEnabledProfile -profileName {PROFILE} -verbose see it is displaying 1.7_64 or 1.7_32 确保Webspehere指向sdk 1.7_64或32请检查有关如何更改配置文件的文档以使用sdkname {PROFILE} \\ bin> managesdk.bat -listEnabledProfile -profileName {PROFILE} -verbose看到它显示1.7_64或1.7_32

{PROFILE}\\bin>managesdk.bat -enableProfile -profileName {PROFILE} -sdkname 1.7_64 -enableServers {PROFILE} \\ bin> managesdk.bat -enableProfile -profileName {PROFILE} -sdkname 1.7_64 -enableServers

  1. Change JVM Argument to -Dclassinfocachesize=10000 将JVM参数更改为-Dclassinfocachesize = 10000

This worked for me. 这对我有用。 Please try 请试试

Sujith Kasthoori Sujith Kasthoori

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM