travis-ci / travis-ci

Free continuous integration platform for GitHub projects.
https://travis-ci.org
8.42k stars 721 forks source link

java misconfigured and/or unavailable #6928

Closed izhangzhihao closed 7 years ago

izhangzhihao commented 7 years ago
jdk:
  - oraclejdk8

what's wrong with my config?

BanzaiMan commented 7 years ago

This looks like a bug. For some reason, we are removing the symlink, but not reloading jdk_switcher. The function still thinks that the $JAVA_HOME is the symlink that's removed, and the switch fails.

Could you try setting $JAVA_HOME to /usr/lib/jvm/java-8-oracle until we fix this?

BanzaiMan commented 7 years ago

I think this is the relevant commit: https://github.com/travis-ci/travis-build/commit/59a3db66d697ca44cb60154cc8ab9c1f83d648d6

maximgubar commented 7 years ago

I have similar issue, in my travis config I use php language and sudo trusty dist. but I install solr on top of it, and some time ago it started to erroring:

The currently defined JAVA_HOME (/usr/lib/jvm/java-8-oracle-amd64) refers to a location where Java could not be found. Aborting. Either fix the JAVA_HOME variable or remove it from the environment so that the system PATH will be searched.

I've tried to solved it as you recommended, defining JAVA_HOME directly, but it still keeps show me the message with old home path.

I have private repo, and payed travis plan, is it the right communication channel, or I should contact you in different channel ?

BanzaiMan commented 7 years ago

@maximgubar Sorry about the continued problem. Please email us at support@travis-ci.com.

izhangzhihao commented 7 years ago

@BanzaiMan thx! I try "export JAVA_HOME=/usr/lib/jvm/java-8-oracle" and it fixed!

BanzaiMan commented 7 years ago

I'm reopening this, since the bug still exists and it should be fixed.

fyockm commented 7 years ago

Just started seeing the same issue this morning when trying to start elasticsearch on trusty:

$ sudo service elasticsearch start
Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME

FWIW, my .travis.yml looks like this:

sudo: required
dist: trusty
language: node_js
node_js: '6'
cache:
  directories:
  - node_modules
services:
- mongodb
- elasticsearch
addons:
  apt:
    sources:
    - elasticsearch-2.x
    packages:
    - elasticsearch
MariadeAnton commented 7 years ago

Since the promotion of the edge image to stable, see: https://docs.travis-ci.com/user/build-environment-updates/2016-12-01/

This issue can now happen for the default configuration.

sudo: required
dist: trusty

jdk:
  - oraclejdk8

Known workarounds are:

before_install:
  - source /opt/jdk_switcher/jdk_switcher.sh
  - jdk_switcher use oraclejdk8

Thank you, we'll post an update when it's resolved!

meatballhat commented 7 years ago

I have a runtime patch on the way via https://github.com/travis-ci/travis-build/pull/902

fyockm commented 7 years ago

@MariadeAnton thanks for the workarounds. I tried setting JAVA_HOME in before_install. However, that's too late in the build cycle for me because elasticsearch is installed and started via "APT Sources", which occurs prior to before_install.

@meatballhat what's the timeframe for the patch? Will I need to set group: edge, or will it be pushed directly to stable?

meatballhat commented 7 years ago

@fyockm that patch will apply to all jobs, and should be live in under ~20m

meatballhat commented 7 years ago

@fyockm travis-ci/travis-build#902 is live now, btw :+1: Thanks for your patience! :heart:

scasagrande-d2l commented 7 years ago

@meatballhat I now see that source /opt/jdk_switcher/jdk_switcher.sh is being run, but I'm still getting java is not present on your PATH.. Is it now expected that I specify which JRE to use for xvfb?

meatballhat commented 7 years ago

@scasagrande-d2l the exact behavior depends on multiple variables. Do you have a job URL to which you can link?

scasagrande-d2l commented 7 years ago

@meatballhat https://travis-ci.com/Brightspace/bulk-exemptions/jobs/58169122

fyockm commented 7 years ago

@meatballhat I am also still getting the same error.

here's my job url: https://travis-ci.com/BessemerAlliance/voyant-models/jobs/58184176

meatballhat commented 7 years ago

@fyockm @scasagrande-d2l It looks like update-java-alternatives is not successfully switching the system java. Still looking...

scasagrande-d2l commented 7 years ago

Any news @meatballhat ?

kiulkiel commented 7 years ago

sorry all. so has all my computer issues been you guys? Just not sure if I blamed the wrong person or if it was her. If you have any idea what I'm talking about it would help (ha me asking for help) to know what has been happening. Or do I just sound crazy?

david-wilson-mcn commented 7 years ago

the workaround of putting "group: deprecated" in the .travis.yml has been working for me.

meatballhat commented 7 years ago

@scasagrande-d2l Sorry for delay. Spinning multiple plates. No update yet for group: stable. Please use group: deprecated to get un-blocked :+1: :heart:

sideshowbarker commented 7 years ago

I’ve worked around this by just calling java with the full path:

/usr/lib/jvm/java-8-oracle/jre/bin/java

I’m sure that won’t work for all cases but it worked in mine at least.

mp-jgoetzinger commented 7 years ago

@scasagrande-d2l you have to add

jdk:
  - oraclejdk8

to tell the switcher to switch ;). this fixed it for me.

scasagrande-d2l commented 7 years ago

@mp-jgoetzinger Our problem is that we have several repos across multiple teams, so I'd rather not try to wrangle that mess.

meatballhat commented 7 years ago

This update included a fix that tested correctly during image mastering, yet I have confirmation that non-jvm language jobs do not have java in $PATH. I'm still working on a permanent fix. In the meantime, please continue to either stay on group: deprecated or explicitly invoke jdk_switcher use default (or whatever jdk you choose). Thanks for your patience and understanding, everyone :heart:

meatballhat commented 7 years ago

Latest cookbook changes look promising, fwiw.

meatballhat commented 7 years ago

I've hit a snag with one of the stacks that performs a deferred installation of lein. Working on it...

meatballhat commented 7 years ago

There are some fresh Trusty stack images available that I'm very much hoping address the remaining issues. I'd appreciate input from anyone here who's able to run their jobs with:

group: edge
xhochy commented 7 years ago

Can confirm that the edge images fixes the problem, build with edge: https://travis-ci.org/xhochy/arrow/jobs/180921629

(Failing build with stable: https://travis-ci.org/xhochy/arrow/jobs/180629177 )

andrerom commented 7 years ago

Can confirm getting solr to run on a language: php job is broken as of last week. Besides group: edge/deprecated and script: jdk_switcher use oraclejdk8workarounds, when is eta for fix in stable?

scasagrande-d2l commented 7 years ago

Can also confirm that group: edge is working for me now :D

meatballhat commented 7 years ago

@andrerom I'm preparing a release for group: stable right now, which will likely go out tomorrow morning US/Eastern 👍

fyockm commented 7 years ago

I'll jump on the bandwagon - group: edge fixes it for my use case as well. Thanks @meatballhat!

meatballhat commented 7 years ago

This is the group: stable push that will include the fix currently available via group: edge: https://docs.travis-ci.com/user/build-environment-updates/2016-12-06/

Please note that we currently do not have support for multiple group assignment, which means that once the above update goes live, anyone using group: edge will likely experience a regression, as the image most recently tagged group: edge will be from The Past ⌛️

meatballhat commented 7 years ago

This build env update is complete https://docs.travis-ci.com/user/build-environment-updates/2016-12-06/. Please holler if you are still experiencing issues on sudo-enabled Trusty that you believe are related to this issue 💖 .

scasagrande-d2l commented 7 years ago

Everything is back to normal for us now :) many thanks @meatballhat, I owe you one :D