在websphere 8.5.5.9上初始化Spring Boot

时间:2018-01-29 17:08:15

标签: java spring-boot websphere maven-3

我试图在Webpshere 8.5.5.9上运行Spring启动应用程序

如果在嵌入式tomcat上作为java main运行,代码工作正常,但如果我尝试在webpshere上部署,则EAR启动时没有错误,但没有部署其他服务。我在服务器控制台中看不到SPRING BOOT LOG。它没有开始。

如果我进入服务器上下文路径,我会发现一个问候世界! (耳朵部署成功)但在休息服务的地址我得到404(找不到档案)

我使用spring boot作为父母的BOM,因为我已经有了父母。 我的软件堆栈是:

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

有什么建议吗?感谢

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

@RestController
public class ExampleController {

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

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 个答案:

答案 0 :(得分:2)

  1. 确保Webspehere指向sdk 1.7_64或32 请查看有关如何更改配置文件以使用sdkname的文档 {PROFILE} \ bin&gt; managesdk.bat -listEnabledProfile -profileName {PROFILE} -verbose 看它显示的是1.7_64或1.7_32
  2. {PROFILE} \ bin&gt; managesdk.bat -enableProfile -profileName {PROFILE} -sdkname 1.7_64 -enableServers

    1. 将JVM参数更改为-Dclassinfocachesize = 10000
    2. 这对我有用。 请尝试

      Sujith Kasthoori