Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ERROR] No app.jar file located in /opt/openshift #11

Open
dhanugithub opened this issue Jul 31, 2018 · 6 comments
Open

[ERROR] No app.jar file located in /opt/openshift #11

dhanugithub opened this issue Jul 31, 2018 · 6 comments

Comments

@dhanugithub
Copy link

Hello,

I am trying to use this repo to create builder image and use it with source code (git repo) to create a docker image of an application (using s2i build). While the build is successful, I still get following error:

Copying all jar artifacts from /opt/app-root/src/source/target directory into /opt/openshift for later deployment...
ls: cannot access /opt/openshift/*.jar: No such file or directory
[ERROR] No app.jar file located in /opt/openshift
Build failed
ERROR: An error occurred: non-zero (13) exit code from openmeetings-builder

Here, openmeetings-builder is my builder image. I am a beginner in Docker, s2i. I am failing to understand the issue.
Can anyone please point out where I am making mistake?
Thank you.

@dhanugithub
Copy link
Author

@jorgemoralespou can you please help me with this?
Thank you.

@mcurcija
Copy link

mcurcija commented Aug 6, 2018

A good starting point to solve your problem is an assemble script: s2i-java/sti/bin/assemble.

If you are using gradle build then following line in the script:

if [ $(ls ${DEPLOY_DIR}/*${APP_SUFFIX}.jar | wc -l) -eq 1 ]; then

results with following error:
ls: cannot access /opt/openshift/*.jar: No such file or directory

Obviously no jars were copied to the deploy directory. You should probably set ARTIFACT_DIR which points to directory where build artifact resides.

@der-ali
Copy link

der-ali commented Sep 27, 2018

i had also the problem. After i defined the "ARTIFACT_DIR" variable i got the problem solved. Is there any way to get only the artifacts into the container without the source code ?

@welshstew
Copy link

@uocxp you're probably wanting to use the binary-build option. Particularly if you've got a "fat jar".
oc start-build myapp --from-dir . --follow that would push any artifacts you've got in your local folder into the build.

https://docs.openshift.com/container-platform/3.10/dev_guide/dev_tutorials/binary_builds.html

@der-ali
Copy link

der-ali commented Sep 27, 2018

@welshstew I am not sure if you got my point. When i use this s2i i get in addition to the jar file also the whole source code of the app in the container which makes the docker image really heavy. Usually i have a multistaging dockerfile to avoid this problem. Therefore i asked if it's possible while using this s2i to get only the jar file staged to the image without the source code.

@welshstew
Copy link

@uocxp checkout the buildconfig in this template: https://github.com/welshstew/fis2-generic-buildtemplate/blob/master/template.yml you'll have to change the imagestream to this one - that one is using the red hat fis-java-openshift - but should get the same results.

Note that the buildconfig doesn't have any git repository source defined, and is a binary build.

Once you have the buildconfig ensure you're building from a directory which only has a fat jar in it, and run:
oc start-build my-app --from-dir=. -w --follow

hope these may help:
https://github.com/welshstew/fis2-generic-buildtemplate
https://github.com/welshstew/fis2-generic-runtemplate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants