gpt4 book ai didi

java - 在 websphere 8.5.5.9 上初始化 Spring Boot

转载 作者:搜寻专家 更新时间:2023-11-01 03:16:30 26 4
gpt4 key购买 nike

我正在尝试在 Webpshere 8.5.5.9 上运行 Spring boot 应用程序

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

如果我进入服务器上下文路径,我会收到一个 hello world! (耳朵部署成功)但是在休息服务的地址我得到一个 404(找不到文件)

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

  • Java 8
  • JEE 6
  • Spring Boot 1.5.9 发布
  • Maven 3.5.X
  • Websphere 8.5.5.9

有什么建议吗?谢谢

开始上课

    @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. 确保 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

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

这对我有用。请尝试

苏吉思·卡斯图里

关于java - 在 websphere 8.5.5.9 上初始化 Spring Boot,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48506488/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com