Error Building H2 Console Servlet

76 views
Skip to first unread message

Bruce Alspaugh

unread,
May 31, 2021, 1:37:13 AM5/31/21
to h2-da...@googlegroups.com
My apologies if this has been reported before. When I tried building
the h2console.war file using the build.sh script as described in "Using
the H2 Console Servlet" I got the following exception:

Downloading
http://repo1.maven.org/maven2/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar
Exception in thread "main" java.lang.RuntimeException: Error
downloading
http://repo1.maven.org/maven2/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar
to ext/servlet-api-3.1.0.jar
at org.h2.build.BuildBase.download(BuildBase.java:680)
at
org.h2.build.BuildBase.downloadUsingMaven(BuildBase.java:636)
at org.h2.build.Build.downloadOrVerify(Build.java:405)
at org.h2.build.Build.downloadOrVerify(Build.java:363)
at org.h2.build.Build.download(Build.java:359)
at org.h2.build.Build.compile(Build.java:263)
at org.h2.build.Build.compile(Build.java:108)
at org.h2.build.Build.jar(Build.java:536)
at org.h2.build.Build.warConsole(Build.java:1162)
at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMe
thodAccessorImpl.java:62)
at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Dele
gatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.h2.build.BuildBase.invoke(BuildBase.java:273)
at org.h2.build.BuildBase.runTarget(BuildBase.java:238)
at org.h2.build.BuildBase.run(BuildBase.java:219)
at org.h2.build.Build.main(Build.java:42)
Caused by: java.io.IOException: Server returned HTTP response code: 501
for URL:
http://repo1.maven.org/maven2/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar
at java.base/sun.net.
www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1924)
at java.base/sun.net.
www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1520)
at java.base/java.net.URL.openStream(URL.java:1165)
at org.h2.build.BuildBase.download(BuildBase.java:662)
... 16 more

I was able to correct the problem by editing the
file: h2/src/tools/org/h2/build/BuildBase.java In the
downloadUsingMaven method, I changed the 'http' to 'https'.

That said, I got a lot of deprecation warnings when using JDK11, so I'm
not sure how long this fix is going to work.

Bruce







Evgenij Ryazanov

unread,
May 31, 2021, 3:10:21 AM5/31/21
to H2 Database
Hello.

Unfortunately, if you want to compile H2 1.4.200 or older versions from their sources you have to patch them by yourself or you can pre-download their dependencies. Current H2 can be compiled without any changes or additional actions.

H2 1.4.200 should normally be compiled with (completely outdated) JDK 7.

Current H2 should normally be compiled with JDK 8.

In Java 9 a new doclet API  appears and old was deprecated and it was finally removed in Java 13, so you can't compile H2 in normal way with JDK 13 and later versions, but you can run H2 compiled with older versions of JDK on newer Java versions. There is a related issue: https://github.com/h2database/h2database/issues/1983
Reply all
Reply to author
Forward
0 new messages