我试图将一个简单的SpringBoot应用程序转换为在WebLogic中部署.它在buildin TomCat服务器中运行良好.然后我对它进行更改并创建一个新的war文件.当我尝试部署war文件时,我收到此错误.
用于web.xml的Servlet初始化程序
package demo;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.web.SpringBootServletInitializer;
public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(SampleStsApplication.class);
}
}
Run Code Online (Sandbox Code Playgroud)
Application.java文件
package demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.web.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.WebApplicationInitializer;
@SpringBootApplication
@Configuration
@ComponentScan
@EnableAutoConfiguration
public class Application extends SpringBootServletInitializer implements
WebApplicationInitializer {
@Override
protected SpringApplicationBuilder configure(
SpringApplicationBuilder application) {
return application.sources(Application.class);
}
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Run Code Online (Sandbox Code Playgroud)
的pom.xml
<?xml version="1.0" …Run Code Online (Sandbox Code Playgroud) 我试图将Maven支持添加到现有的企业项目中。这是一个多模块项目,前两个模块可以毫无问题地进行编译和打包,但是我遇到了编译错误,我试图在多个模块中使用相同的依赖项。我的结构是:
> + parent
> - pom.xml
> - module-1
> - pom.xml
> - module-2 (Depends on module-1)
> - pom.xml
> - module-3
> - pom.xml (Depends on both modules 1 and 2)
Run Code Online (Sandbox Code Playgroud)
我正在Eclipse上打开该项目,它没有显示任何错误。当我mvn clean install从父级运行时,它成功安装了模块1和2,但是在模块3上却说package xxx.yyy does not exist和失败Cannot find symbol XXXYYY。软件包xxx.yyy和符号XXXYYY都位于一个jar中,该jar在模块2和3的依赖关系中列出。
由于两个模块都依赖于同一个jar,因此我尝试仅在模块2上添加依赖项,并且我相信由于传递性依赖关系,模块3应该可以看到它,但无法看到该包。因此,我尝试将依赖项添加到模块2和3的pom中,问题仍然存在。
我已经检查/尝试过这些:
mvn dependency:copy-dependencies我项目的唯一特点是模块3依赖于模块2,并且依赖于模块2也依赖于的库。
下面,我将粘贴模块2和3中的poms。由于公司政策的缘故,我更改了一些名称。
模块2
<project xmlns="http://maven.apache.org/POM/4.0.0" ... >
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.company</groupId>
<artifactId>parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>Module2</artifactId>
<dependencies>
<dependency>
<groupId>com.company</groupId>
<artifactId>Module1</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.company</groupId> …Run Code Online (Sandbox Code Playgroud)