Help: Image with adoptium+tomcat crashing on startup #212
sirish-bajpai
started this conversation in
Java Team
Replies: 3 comments 3 replies
-
I think I get the problem. Looks like Tomcat is not participating in the build and the image tries to run as standalone jar. |
Beta Was this translation helpful? Give feedback.
2 replies
-
Thanks Daniel for the reply.
The war is a pre-built artifact from Oracle. I did explode it, remove main
class from manifest and repackaged.
That worked!!
But that may not be the best way forward, since the war gets updated quite
frequently. I will try the 2nd approach.
The README on paketo tomcat GitHub, does say that presence of main class in
manifest will exclude the buildpack. I wish CNBs would provide a
configuration flag to force the pack into a build, rather than these
workarounds.
Thanks a ton again.
Sirish
…On Wed, 6 Sept, 2023, 6:36 pm Daniel Mikusa, ***@***.***> wrote:
I will try to see which condition for tomcat is not being met.
I don't think that's the issue, it could be, but my guess is that it's an
order problem. Your WAR has a main class entry set and the executable-jar
buildpack runs first, so it detects true. The lifecycle short-circuits
detection when it finds a match, so it's just that it matches
executable-jar first.
You've got a couple of options:
1. You can modify the META-INF/MANIFEST.MF file so that it does not
contain the Main-Class entry. That will stop executable-jar from
kicking in.
2. You can set your own set of buildpacks, when you run pack build you
can include a list of -b arguments to set the exact list of buildpacks
to use. In this case, just don't include executable-jar and it won't run.
Ex from your build you have:
paketo-buildpacks/ca-certificates 3.6.3
paketo-buildpacks/adoptium 11.1.7
paketo-buildpacks/bellsoft-liberica 10.2.7
paketo-buildpacks/syft 1.33.0
paketo-buildpacks/executable-jar 6.7.4
paketo-buildpacks/dist-zip 5.6.4
paketo-buildpacks/spring-boot 5.26.1
paketo-buildpacks/image-labels 4.5.2
so pack build -b paketo-buildpacks/ca-certificates -b
paketo-buildpacks/adoptium -b paketo-buildpacks/syft -b
paketo-buildpacks/apache-tomcat -b paketo-buildpacks/spring-boot -b
paketo-buildpacks/image-labels ...
I removed bellsoft cause you clearly want adoptium instead and I also
dropped dist-zip cause I suspect you're not using that (it just has a very
permissive detection policy). I left in Spring Boot, but if you're not
using that you could drop it as well. Basically, whatever you include will
run, what you don't include will not run.
Hope that helps!
—
Reply to this email directly, view it on GitHub
<#212 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AZNEDMMR7URYDGKBQP6LTJ3XZBYONANCNFSM6AAAAAA4M2ITQ4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
1 reply
-
Thanks for the feature request!
An update:
I did try excluding unwanted buildpacks(including executable jar) and
specifying the correct order of required packs in the build.
That didn't work.
Tomcat still did not work, because it just doesn't want the main-class
entry in manifest.
So the only way out is painful process of
unpack-war->edit-manifest->repack-war.
Had to device a crude gradle task to make it happen.
Thanks
Sirish
…On Fri, 15 Sept, 2023, 9:49 am Daniel Mikusa, ***@***.***> wrote:
Yes, that sounds reasonable. I added a feature request,
paketo-buildpacks/executable-jar#232
<paketo-buildpacks/executable-jar#232>.
—
Reply to this email directly, view it on GitHub
<#212 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AZNEDMKCHILWJD5K7LLVMDDX2PJO7ANCNFSM6AAAAAA4M2ITQ4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am trying to host a Oracle Rest Data Services war, packaged in a paketo image on kubernetes. The pod crashes immediately with following log dump. Running with docker on local also has the same result:
java.io.FileNotFoundException: /workspace (Is a directory)
java.lang.IllegalStateException: java.io.FileNotFoundException: /workspace (Is a directory)
at oracle.dbtools.jarcl.zip.Bytes$MappedBytes.(Bytes.java:670)
at oracle.dbtools.jarcl.zip.Bytes$MappedBytes.(Bytes.java:660)
at oracle.dbtools.jarcl.zip.Bytes.map(Bytes.java:254)
at oracle.dbtools.jarcl.JarClassLoader.(JarClassLoader.java:39)
at oracle.dbtools.jarcl.JarClassLoader.classLoader(JarClassLoader.java:178)
at oracle.dbtools.jarcl.Entrypoint.invoke(Entrypoint.java:47)
at oracle.dbtools.jarcl.Entrypoint.main(Entrypoint.java:77)
Caused by: java.io.FileNotFoundException: /workspace (Is a directory)
at java.base/java.io.RandomAccessFile.open0(Native Method)
at java.base/java.io.RandomAccessFile.open(Unknown Source)
at java.base/java.io.RandomAccessFile.(Unknown Source)
at java.base/java.io.RandomAccessFile.(Unknown Source)
at oracle.dbtools.jarcl.zip.Bytes$MappedBytes.(Bytes.java:666)
... 6 more
The same war works perfectly on a standalone tomcat.
Any help/pointers for debugging would be greatly appreciated.
Using:
Builder: paketobuildpacks/builder-jammy-buildpackless-base:0.0.86
Packs:
gcr.io/paketo-buildpacks/ca-certificates:3.6.3
gcr.io/paketo-buildpacks/adoptium:11.1.7
gcr.io/paketo-buildpacks/java:9.20.0
Output from pack command is this:
===> ANALYZING
Restoring data for SBOM from previous image
===> DETECTING
8 of 27 buildpacks participating
paketo-buildpacks/ca-certificates 3.6.3
paketo-buildpacks/adoptium 11.1.7
paketo-buildpacks/bellsoft-liberica 10.2.7
paketo-buildpacks/syft 1.33.0
paketo-buildpacks/executable-jar 6.7.4
paketo-buildpacks/dist-zip 5.6.4
paketo-buildpacks/spring-boot 5.26.1
paketo-buildpacks/image-labels 4.5.2
===> RESTORING
Restoring metadata for "paketo-buildpacks/ca-certificates:helper" from app image
Restoring metadata for "paketo-buildpacks/adoptium:helper" from app image
Restoring metadata for "paketo-buildpacks/adoptium:java-security-properties" from app image
Restoring metadata for "paketo-buildpacks/adoptium:jre" from app image
Restoring metadata for "paketo-buildpacks/syft:syft" from cache
Restoring data for "paketo-buildpacks/syft:syft" from cache
Restoring data for SBOM from cache
===> BUILDING
Paketo Buildpack for CA Certificates 3.6.3
https://github.com/paketo-buildpacks/ca-certificates
Launch Helper: Reusing cached layer
Paketo Buildpack for Adoptium 11.1.7
https://github.com/paketo-buildpacks/adoptium
Build Configuration:
$BP_JVM_JLINK_ARGS --no-man-pages --no-header-files --strip-debug --compress=1 configure custom link arguments (--output must be omitted)
$BP_JVM_JLINK_ENABLED false enables running jlink tool to generate custom JRE
$BP_JVM_TYPE JRE the JVM type - JDK or JRE
$BP_JVM_VERSION 11 the Java version
Launch Configuration:
$BPL_DEBUG_ENABLED false enables Java remote debugging support
$BPL_DEBUG_PORT 8000 configure the remote debugging port
$BPL_DEBUG_SUSPEND false configure whether to suspend execution until a debugger has attached
$BPL_HEAP_DUMP_PATH write heap dumps on error to this path
$BPL_JAVA_NMT_ENABLED true enables Java Native Memory Tracking (NMT)
$BPL_JAVA_NMT_LEVEL summary configure level of NMT, summary or detail
$BPL_JFR_ARGS configure custom Java Flight Recording (JFR) arguments
$BPL_JFR_ENABLED false enables Java Flight Recording (JFR)
$BPL_JMX_ENABLED false enables Java Management Extensions (JMX)
$BPL_JMX_PORT 5000 configure the JMX port
$BPL_JVM_HEAD_ROOM 0 the headroom in memory calculation
$BPL_JVM_LOADED_CLASS_COUNT 35% of classes the number of loaded classes in memory calculation
$BPL_JVM_THREAD_COUNT 250 the number of threads in memory calculation
$JAVA_TOOL_OPTIONS the JVM launch flags
Using Java version 11 from BP_JVM_VERSION
Adoptium JRE 11.0.20: Reusing cached layer
Launch Helper: Reusing cached layer
Java Security Properties: Reusing cached layer
Paketo Buildpack for Syft 1.33.0
https://github.com/paketo-buildpacks/syft
Downloading from https://github.com/anchore/syft/releases/download/v0.86.1/syft_0.86.1_linux_amd64.tar.gz
Verifying checksum
Writing env.build/SYFT_CHECK_FOR_APP_UPDATE.default
Paketo Buildpack for Executable JAR 6.7.4
https://github.com/paketo-buildpacks/executable-jar
Class Path: Contributing to layer
Writing env/CLASSPATH.delim
Writing env/CLASSPATH.prepend
Process types:
executable-jar: java oracle.dbtools.jarcl.Entrypoint (direct)
task: java oracle.dbtools.jarcl.Entrypoint (direct)
web: java oracle.dbtools.jarcl.Entrypoint (direct)
Paketo Buildpack for Image Labels 4.5.2
https://github.com/paketo-buildpacks/image-labels
Build Configuration:
$BP_IMAGE_LABELS ******* arbitrary image labels
$BP_OCI_AUTHORS the org.opencontainers.image.authors image label
$BP_OCI_CREATED the org.opencontainers.image.created image label
$BP_OCI_DESCRIPTION the org.opencontainers.image.description image label
$BP_OCI_DOCUMENTATION the org.opencontainers.image.documentation image label
$BP_OCI_LICENSES the org.opencontainers.image.licenses image label
$BP_OCI_REF_NAME the org.opencontainers.image.ref.name image label
$BP_OCI_REVISION ************ the org.opencontainers.image.revision image label
$BP_OCI_SOURCE the org.opencontainers.image.source image label
$BP_OCI_TITLE ************** the org.opencontainers.image.title image label
$BP_OCI_URL the org.opencontainers.image.url image label
$BP_OCI_VENDOR ****** the org.opencontainers.image.vendor image label
$BP_OCI_VERSION ********* the org.opencontainers.image.version image label
Image labels:
com.****
com.*****
org.opencontainers.image.revision
org.opencontainers.image.title
org.opencontainers.image.vendor
org.opencontainers.image.version
===> EXPORTING
Reusing layer 'paketo-buildpacks/ca-certificates:helper'
Reusing layer 'paketo-buildpacks/adoptium:helper'
Reusing layer 'paketo-buildpacks/adoptium:java-security-properties'
Reusing layer 'paketo-buildpacks/adoptium:jre'
Reusing layer 'paketo-buildpacks/executable-jar:classpath'
Reusing layer 'buildpacksio/lifecycle:launch.sbom'
Reusing 1/1 app layer(s)
Reusing layer 'buildpacksio/lifecycle:launcher'
Reusing layer 'buildpacksio/lifecycle:config'
Reusing layer 'buildpacksio/lifecycle:process-types'
Adding label 'io.buildpacks.lifecycle.metadata'
Adding label 'io.buildpacks.build.metadata'
Adding label 'io.buildpacks.project.metadata'
Adding label 'com.'
Adding label 'com.'
Adding label 'org.opencontainers.image.revision'
Adding label 'org.opencontainers.image.title'
Adding label 'org.opencontainers.image.vendor'
Adding label 'org.opencontainers.image.version'
Setting default process type 'web'
Saving ghcr.io/******...
*** Images (3824d7560b2e):
ghcr.io/********
Reusing cache layer 'paketo-buildpacks/syft:syft'
Reusing cache layer 'buildpacksio/lifecycle:cache.sbom'
Successfully built image 'ghcr.io/********'
Beta Was this translation helpful? Give feedback.
All reactions