前提
Springbootでアプリケーションの開発をおこなっております。
intellijで開発をおこなっており、gradleを活用しております。
実現したいこと
デスクトップアプリケーションとして配布をしたいと考えております。
発生している問題・エラーメッセージ
配布するにあたって、./gradlew buildでfat jarを作成し、それをjava -jarコマンドで実行すると、localhostにアクセスした際に、以下のエラーが発生します。
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Fri Jan 13 16:54:40 JST 2023
There was an unexpected error (type=Internal Server Error, status=500).
ERROR 21449 --- [nio-8888-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: org.thymeleaf.exceptions.TemplateInputException: Error resolving template [index], template might not exist or might not be accessible by any of the configured Template Resolvers] with root cause
org.thymeleaf.exceptions.TemplateInputException: Error resolving template [index], template might not exist or might not be accessible by any of the configured Template Resolvers
該当のソースコード
build.gradleは以下のようになっております。
plugins {
id 'java'
id 'org.springframework.boot' version '3.0.0'
id 'io.spring.dependency-management' version '1.1.0'
}
jar {
manifest {
attributes "Main-Class": "com.test.subSystem.SubSystemApplication"
}
}
group = 'com.test'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:3.0.0'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
runtimeOnly 'com.h2database:h2'
implementation group: 'org.apache.poi', name: 'poi-ooxml', version: '5.2.3'
implementation fileTree(dir: 'rapidreport', include: ['*.jar'])
}
tasks.named('test') {
useJUnitPlatform()
}
試したこと
intellij上のデバックでは問題なく動作しております。
また、./gradlew bootrunでも同様に動作しております。
補足情報(FW/ツールのバージョンなど)
回答2件
あなたの回答
tips
プレビュー