Open jflute opened 1 year ago
Tomcat10にしたら、どれだけコンパイルエラーになるだろうか?
あれ?単純にアップグレードしてもコンパイルエラーにならないぞぅ?
<tomcat.version>10.1.13</tomcat.version>
javax.servletを使ってる箇所はある:
// TomcatBoot
import javax.servlet.ServletException;
javax.servletの依存が入っちゃってるから通ってるだけかな。
<!-- servlet -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>${servlet.version}</version>
<scope>provided</scope>
</dependency>
jakartaにして、6.0.0にしたらちゃんとコンパイルエラーになった
<!-- servlet -->
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>${servlet.version}</version>
<scope>provided</scope>
</dependency>
ServletExceptionのimportを直すだけでコンパイルは通った。
import jakarta.servlet.ServletException;
意外に内部構造は変わってないのかも。 ただ、動かしてみたい。
そういえばTomcatBootが単独で動く環境って用意してないかも。 (LastaFlute環境だと、LastaFluteで対応しないと動かせない)
なぜか、Eclipse上でTestクラスでtestスコープのライブラリのクラスが補完できない。 これはTomcat9のときから同じだろうか?ちょっと環境問題を解決しないと。
これはtomcat9のときから同じだったようだ。テストクラスが一個もなかったから気付かなかった。
harborの.classpathを持ってきたら補完できるようになった:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry including="**/*.java" kind="src" path="src/main/java"/>
<classpathentry excluding="**/*.java" kind="src" path="src/main/resources"/>
<classpathentry including="**/*.java" kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**/*.java" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
BootBootを作って...
public class BootBoot extends PlainTestCase {
public static void main(String[] args) {
new TomcatBoot(8159, "/boot").asDevelopment(true).bootAwait();
}
}
動かしてみたら、ClassVersionError。
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/catalina/startup/Tomcat has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
Java8じゃ動かないか。 java8のworkspaceじゃなくてjava17のworkspaceで開発しないと。
java17環境にて:
...Booting the Tomcat: port=8159 contextPath=/boot
...Registering the shutdown hook for the Tomcat: lastModified=2023/08/31 23:26:29.452
...Finding project webapp from stack trace: webappRelativePath=./src/main/webapp
Exception in thread "main" *Not found the project webapp by derived path: /Users/xxx/xxx/workspace/tomcat-boot/./src/main/webapp
java.lang.IllegalStateException: Not found the webapp directory: ./src/main/webapp
webappがないと怒られた。まあそりゃそうだ。 テスト用のwebappの環境を作ってみようかな。
今日はここまで。
再開、とりあえずMaven pluginたちを整備している。 あと、java21環境を作ったので、課題を整理し直して色々と試してみよう。
TomcatBootをTomcat10にアップグレードして対応できるか?
branch: tomcat10 pull request: https://github.com/dbflute-session/tomcat-boot/pull/191