Spring Boot 2.0.0.RELEASE適用 → jarから起動時にクラスが見つからない [未解決]

先の変更を施して、無事アプリにログイン出来るようになりました。
しかし展開状態では動くんだけれども、jarから起動するとクラスファイルが見つからないと怒られて失敗します。

$ java -jar backend/target/samuraism-backend.jar
12:08:09,607 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
12:08:09,608 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
12:08:09,608 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [jar:file:[path]/samuraism-backend.jar!/BOOT-INF/classes!/logback.xml]
12:08:09,610 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs multiple times on the classpath.
12:08:09,610 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [jar:file:[path]/samuraism-backend.jar!/BOOT-INF/lib/core-1.0-SNAPSHOT.jar!/logback.xml]
12:08:09,610 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [jar:file:[path]/samuraism-backend.jar!/BOOT-INF/classes!/logback.xml]
12:08:09,633 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@5cb0d902 - URL [jar:file:[path]/samuraism-backend.jar!/BOOT-INF/classes!/logback.xml] is not of type file
12:08:09,779 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
12:08:09,780 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
12:08:09,788 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
12:08:09,794 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
12:08:09,859 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [samuraism.core.logging.SlackAppender]
12:08:09,860 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [SLACK]
12:08:09,861 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
12:08:09,862 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [samuraism.core.logging.SlackAppender]
12:08:09,862 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [SLACK-ALLDEBUG]
12:08:09,862 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
12:08:09,863 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
12:08:09,868 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [FILE]
12:08:09,879 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy@1190900417 - No compression will be used
12:08:09,881 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy@1190900417 - Will use the pattern /Users/yusuke/samuraismlog/samuraism_%d{yyyy-MM-dd}.log for the active file
12:08:09,888 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - The date pattern is 'yyyy-MM-dd' from file name pattern '/Users/yusuke/samuraismlog/samuraism_%d{yyyy-MM-dd}.log'.
12:08:09,888 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Roll-over at midnight.
12:08:09,893 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Setting initial period to Fri Mar 02 12:04:22 JST 2018
12:08:09,894 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
12:08:09,896 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[FILE] - Active log file name: /Users/yusuke/samuraismlog/samuraism.log
12:08:09,896 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[FILE] - File property is set to [/Users/yusuke/samuraismlog/samuraism.log]
12:08:09,897 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [twitter4j] to INFO
12:08:09,898 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [SLACK-ALLDEBUG] to Logger[twitter4j]
12:08:09,898 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.gargoylesoftware] to OFF
12:08:09,898 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.apache.http] to INFO
12:08:09,898 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [SLACK-ALLDEBUG] to Logger[org.apache.http]
12:08:09,898 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.zaxxer.hikari] to INFO
12:08:09,898 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [SLACK-ALLDEBUG] to Logger[com.zaxxer.hikari]
12:08:09,899 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.spring] to INFO
12:08:09,899 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [SLACK-ALLDEBUG] to Logger[org.spring]
12:08:09,899 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [samuraism] to DEBUG
12:08:09,899 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [SLACK] to Logger[samuraism]
12:08:09,899 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to INFO
12:08:09,899 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [FILE] to Logger[ROOT]
12:08:09,899 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
12:08:09,899 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
12:08:09,900 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@1698c449 - Registering current configuration as safe fallback point


  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.0.0.RELEASE)

2018-03-02 12:08:11,327 [background-preinit] WARN  org.springframework.http.converter.json.Jackson2ObjectMapperBuilder - For Jackson Kotlin classes support please add "com.fasterxml.jackson.module:jackson-module-kotlin" to the classpath
2018-03-02 12:08:10,857 [main] INFO  samuraism.backend.App - Starting App on yMacBookPro15.local with PID 27551 ([path]/samuraism-backend.jar started by yusuke in /Users/yusuke/Dropbox/samuraism/yabumi)
2018-03-02 12:08:11,813 [main] DEBUG samuraism.backend.App - Running with Spring Boot v2.0.0.RELEASE, Spring v5.0.4.RELEASE
2018-03-02 12:08:12,653 [main] INFO  samuraism.backend.App - No active profile set, falling back to default profiles: default
2018-03-02 12:08:13,037 [main] INFO  org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext - Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@424c0bc4: startup date [Fri Mar 02 12:08:13 JST 2018]; root of context hierarchy
2018-03-02 12:08:13,253 [main] WARN  org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: URL [jar:file:[path]/samuraism-backend.jar!/BOOT-INF/classes!/samuraism/backend/未入金.class]; nested exception is java.io.FileNotFoundException: JAR entry samuraism/backend/未入金.class not found in [path]/samuraism-backend.jar!/BOOT-INF/classes
y

この「未入金」というクラス、ちゃんと存在します。

$ jar tf backend/target/samuraism-backend.jar|grep 未入金
BOOT-INF/classes/templates/未入金/
BOOT-INF/classes/samuraism/backend/未入金.class
BOOT-INF/classes/templates/未入金/未入金一覧.html

Kotlinもほぼ同時に1.2.21から1.2.30へアップデートしたので、そちらの問題の可能性も。(1.2.21に戻しても同じだった)
現在調査中。

アップデート1:
未入金クラスをMinyukinとリネームしたところ、今度は消し込みKt.classが見つからないとして起動失敗。
jarファイル内のマルチバイトクラス名を拾い出せなくなっている可能性が?

アップデート2:
Spring Boot 2.0.0.M7では正常動作。Spring Boot 2.0.0.RC1からこの問題が発生する。

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です