我正在尝试在 Jboss 7.1.1 上部署一个简单的 Spring boot 应用程序。我已经做了相应的设置,但是不断出现错误:“JBAS015852: Could not index class module-info.class”
我做了以下设置:
@SpringBootApplication
public class DemoApplication extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(DemoApplication.class);
}
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
@RestController
class Hellocontroller {
@RequestMapping("/hello")
@GetMapping
String hello() {
return "Hola";
}
}
Run Code Online (Sandbox Code Playgroud)
并在 pom.xml 中
<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>
Run Code Online (Sandbox Code Playgroud)
但我有以下结果
16:12:16,317 WARN [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015852: Could not index class org/hibernate/validator/spi/scripting/AbstractCachingScriptEvaluatorFactory.class at /C:/Users/User/Downloads/jboss-as-7.1.1.Final/jboss-as-7.1.1.Final/standalone/deployments/demo.war/WEB-INF/lib/hibernate-validator-6.0.19.Final.jar: …Run Code Online (Sandbox Code Playgroud) 我在我的 html 中声明 FileUpload 如下
<p-fileUpload name="file" url="http://localhost:8080/integra/services/upload" (onUpload)="onUpload($event)" accept=".txt"></p-fileUpload>
Run Code Online (Sandbox Code Playgroud)
它指向我的后端
@PostMapping(value="/upload", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public ResponseEntity uploadFile(@RequestParam("file") MultipartFile file) throws IOException {
File convertFile = new File("C:\\upload\\"+file.getOriginalFilename());
convertFile.createNewFile();
FileOutputStream fout = new FileOutputStream(convertFile);
fout.write(file.getBytes());
fout.close();
return new ResponseEntity("OK", HttpStatus.OK);
}
Run Code Online (Sandbox Code Playgroud)
但是当在我的打字稿中执行 onload 事件时,它不起作用......甚至放置了一个 console.log 来测试,但它不起作用。这是我的打字稿
onUpload(event) {
console.log(event.files.length);
console.log(event.progress);
}
Run Code Online (Sandbox Code Playgroud)
当我运行文件上传时,加载栏被卡住,不允许我执行另一个文件上传。因此,当加载栏从未完成时,不会执行提到的事件 在此处输入图像描述
最后,文件保存在上述路径中,但我无法正确处理该事件
如果有人能帮助我,我将不胜感激。谢谢