我使用 spring boot 1.4.3.release(启动器父依赖项)和 hibernate 5.0.12 制作了一个 java 应用程序,并建立了与 Oracle 11g 的数据库连接,该应用程序将部署在 Websphere 8.5.5 上。 问题是上述应用程序的 war 文件部署在 websphere 上,但启动时出现错误,如下图所示。
- 我尝试过的事情:
- 成功部署 war 文件,且不依赖任何数据库
- 成功部署带有嵌入式数据库的 war 文件(H2、Derby)
- 在 Websphere 8.5.5 上提供第 3 方持久性提供程序
- 尝试使用 JNDI 数据源
我还尝试检查 Hibernate 版本和 JPA 问题是否有任何问题。
我添加的依赖项列表:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.3.RELEASE</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</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-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<!-- hot swapping, disable cache for template, enable live reload -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.15</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.15</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.3</version>
</dependency>
<!-- Optional, for bootstrap -->
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>3.3.7</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
</dependencies>
<build>
<finalName>oracleapp</finalName>
<plugins>
<!-- Package as an executable jar/war -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
请帮帮我。
下面给出的是项目结构
最佳答案
您遇到的问题是您的主类位于何处的问题。您需要将其移动到根包,在那里它可以看到所有其他包。类似于以下结构。
src/main/java
-> SpringBootWebApplication (which I believe is your Main class)
-> All other packages
这将使您的主程序能够找到您正在查找的文件。
关于java - 无法启动部署在 websphere 8.5.5 上的 springboot 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53098599/