![](/img/trans.png)
[英]Spring Boot: ClassNotFoundException when configuring maxUploadSize of CommonMultipartResolver
[英]Spring boot batch - ClassNotFoundException when starting
我有一個帶有3個spring boot子模塊的spring boot項目:
dao子模塊由batch和ws使用。
在本地(使用Eclipse),我可以安裝/打包或啟動這些模塊,一切正常。
但是,當我嘗試使用java -jar在服務器中啟動批處理時,會獲得“ java.lang.ClassNotFoundException:com.at.mxm.suv.dao.domain.Report”。
dao pom.xml:
<parent>
<groupId>com.at.mxm</groupId>
<artifactId>mxm-suv</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>mxm-suv-dao</artifactId>
<name>mxm-suv-dao</name>
<properties>
<start-class>com.at.mxm.suv.dao.DataAccessApplication</start-class>
</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-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<classifier>exec</classifier>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
批處理pom.xml:
<parent>
<groupId>com.at.mxm</groupId>
<artifactId>mxm-suv</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>mxm-suv-batch</artifactId>
<name>mxm-suv-batch</name>
<properties>
<start-class>com.at.mxm.suv.batch.BatchApplication</start-class>
</properties>
<dependencies>
<dependency>
<groupId>com.at.mxm</groupId>
<artifactId>mxm-suv-dao</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-batch</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-quartz</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
BatchApplication.java:
@ComponentScan(basePackages = "com.at.mxm.suv.dao.*,com.at.mxm.suv.batch.*")
@SpringBootApplication
@EnableBatchProcessing
@EnableScheduling
public class BatchApplication {
public static void main(String[] args) throws Exception {
SpringApplication.run(BatchApplication.class, args);
}
}
有什么想法可能導致這種情況嗎?
參考這個git倉庫..我做了5個模塊。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.