Bug 1648601

Summary: Upgrade to 6.4 migrate candlepin fails in java version 1.7.0
Product: Red Hat Satellite Reporter: Paul Dudley <pdudley>
Component: PackagingAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED WONTFIX QA Contact: Lukas Pramuk <lpramuk>
Severity: high Docs Contact:
Priority: high    
Version: 6.4CC: bcourt, bkearney, egolov, ehelms, inecas, mbacovsk, pdudley, sadas
Target Milestone: UnspecifiedKeywords: Triaged, Upgrades
Target Release: Unused   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-07-21 17:07:28 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Paul Dudley 2018-11-10 22:27:34 UTC
Upgrade to 6.4 from 6.3.z results in:
Upgrade Step: migrate_candlepin...

########## ERROR ############
Error running command: liquibase --driver=org.postgresql.Driver --classpath=/usr/share/java/postgresql-jdbc.jar:/var/lib/tomcat/webapps/candlepin/WEB-INF/classes/ --changeLogFile=db/changelog/changelog-update.xml --url=jdbc:postgresql://localhost/candlepin --username=candlepin --password=2TAyYBggykkcjb4m5wFUgxsnyUPthJAW --logLevel=severe migrate -Dcommunity=False
Status code: 65280
Command output: Liquibase update Failed: org/candlepin/liquibase/FixDuplicatePoolsLiquibaseWrapper : Unsupported major.minor version 52.0
SEVERE 11/10/18 3:57 PM:liquibase: org/candlepin/liquibase/FixDuplicatePoolsLiquibaseWrapper : Unsupported major.minor version 52.0
java.lang.UnsupportedClassVersionError: org/candlepin/liquibase/FixDuplicatePoolsLiquibaseWrapper : Unsupported major.minor version 52.0
	at java.lang.ClassLoader.defineClass1(Native Method)
...
Configuring PostgreSQL with JDBC URL: jdbc:postgresql://localhost/candlepin
Migrating Candlepin database
--driver=org.postgresql.Driver --classpath=/usr/share/java/postgresql-jdbc.jar:/var/lib/tomcat/webapps/candlepin/WEB-INF/classes/ --changeLogFile=db/changelog/changelog-update.xml --url=jdbc:postgresql://localhost/candlepin --username=candlepin --password=2TAyYBggykkcjb4m5wFUgxsnyUPthJAW --logLevel=severe
Traceback (most recent call last):
  File "/usr/share/candlepin/cpdb", line 317, in <module>
    dbsetup.update()
  File "/usr/share/candlepin/cpdb", line 75, in update
    self._run_liquibase("db/changelog/changelog-update.xml")
  File "/usr/share/candlepin/cpdb", line 106, in _run_liquibase
    output = run_command("liquibase %s migrate -Dcommunity=%s" % (liquibase_options, self.community))
  File "/usr/share/candlepin/cpdb", line 38, in run_command
    error_out(command, status, output)
  File "/usr/share/candlepin/cpdb", line 46, in error_out
    raise Exception("Error running command")
Exception: Error running command
/usr/share/candlepin/cpdb --update --database '//localhost/candlepin' --user 'candlepin' --password '2TAyYBggykkcjb4m5wFUgxsnyUPthJAW' failed! Check the output for error!
Upgrade step migrate_candlepin failed. Check logs for more information.
                                      [FAIL]


How reproducible:
In Java 1.7.0, 100% reproducible in 6.4.z.

Setting this version in 6.4 also produces this traceback, so this is not specific to upgrade scenarios, but rather any scenario in which we have 6.4 packages and are *not* using JDK 1.8.0.

Comment 1 Paul Dudley 2018-11-10 22:33:07 UTC
This issue is corrected via the following:

 - # alternatives --config java
<select number for java-1.8.0>
 - # satellite-installer --upgrade

6.4 installs seem to always have 1.8.0 selected by default and this issue seems likely to only be hit by upgrade of Satellite whose Java version was never changed to 1.8.0.

Currently, the issue was reproduced on Satellites that were upgraded from 6.1 to 6.4 and from 6.2 to 6.4.

Comment 2 Barnaby Court 2018-11-13 13:57:16 UTC
The upgrade should be installing the newer java as we do require Java 1.8 in Satellite 6.4. Paul can you confirm what version of the candlepin rpm file has been installed? I know Candlepin 2.4.9 which should be part of Satellite 6.4 requires java > 1.8. 


Also, if you could include the version of the java rpm installed on the system it would be helpful as well.

Comment 3 Paul Dudley 2018-11-13 15:25:25 UTC
The requires set here ensure that 1.8.0 is installed, and so far having 1.8.0 installed is not the problem. The problem only comes with the 1.8.0 version not being used when an upgrade occurs.

[root@iridium ~]# rpm -q satellite foreman katello candlepin
satellite-6.4.0-15.el7sat.noarch
foreman-1.18.0.37-1.el7sat.noarch
katello-3.7.0-8.el7sat.noarch
candlepin-2.4.8-1.el7.noarch
[root@iridium ~]# yum deplist katello-3.7.0-8.el7sat.noarch | grep java
  dependency: java-openjdk >= 1:1.7.0
   provider: java-11-openjdk.x86_64 1:11.0.ea.28-7.el7
   provider: java-11-openjdk.i686 1:11.0.ea.28-7.el7
   provider: java-1.8.0-openjdk.x86_64 1:1.8.0.191.b12-1.el7_6
   provider: java-1.8.0-openjdk.i686 1:1.8.0.191.b12-1.el7_6
   provider: java-1.7.0-openjdk.x86_64 1:1.7.0.201-2.6.16.1.el7_6
  dependency: java-openjdk < 1:1.8.0.45
   provider: java-1.7.0-openjdk.x86_64 1:1.7.0.201-2.6.16.1.el7_6
[root@iridium ~]# yum deplist candlepin-2.4.8-1.el7.noarch | grep java
  dependency: java >= 1:1.8.0
   provider: java-11-openjdk.x86_64 1:11.0.ea.28-7.el7
   provider: java-11-openjdk.i686 1:11.0.ea.28-7.el7
   provider: java-1.8.0-openjdk.x86_64 1:1.8.0.191.b12-1.el7_6
   provider: java-1.8.0-openjdk.i686 1:1.8.0.191.b12-1.el7_6

It seems like availability of 1.8.0 isn't really a problem, just that we're not making sure java root 1.8.0 is set before the migration occurs?

Comment 4 Barnaby Court 2018-11-13 22:14:43 UTC
I am moving to packaging as the katello-3.7.0-8.el7sat.noarch should be depending on Java 1.8 or higher. However, this might be an installer issue in addition to a packaging issue.

Comment 5 Barnaby Court 2018-11-14 16:12:23 UTC
There is an upstream Patch that might be relevant. https://github.com/theforeman/foreman-packaging/commit/b9557f47bb05444f833e0e87c2f7c6f8978e3950

Comment 6 Evgeni Golov 2018-11-20 15:51:11 UTC
Barnaby,

would it be possible for Candlepin to use /usr/lib/jvm/jre-1.8.0-openjdk/bin/java directly if it needs Java 1.8? /usr/bin/java can point to *anything* and we don't manage this alternative in our installer.

Comment 7 Barnaby Court 2018-11-26 13:56:20 UTC
Evgeni, Candlepin does not select the version of Java that is used, that is used by Tomcat or whatever the installer has set up prior to running liquibase. This is not something the Candlepin team can fix.

Comment 11 Bryan Kearney 2020-07-21 17:07:28 UTC
6.4 is now EOL, I am closing this out.