Bug 836827

Summary: Connection to datasource could not be established using gcj
Product: [Fedora] Fedora Reporter: Robin Green <greenrd>
Component: libreofficeAssignee: Stephan Bergmann <sbergman>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 17CC: caolanm, dtardon, erack, ltinkl, mstahl, sbergman
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libreoffice-3.5.6.2-5.fc17 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-12-20 11:01:48 EST Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:

Description Robin Green 2012-07-01 15:55:17 EDT
Description of problem:
I tried to create a database, and I got an error message saying The connection to the data source "MetaRel" could not be established.

Version-Release number of selected component (if applicable):
libreoffice-base-3.5.4.2-4.fc17.x86_64

How reproducible:
Haven't tried

Steps to Reproduce:
1. Create database
  
Actual results:
3 errors:

The connection to the data source "MetaRel" could not be established.

Error code: 1000

The driver class 'org.hsqldb.jdbcDriver' could not be loaded.The additional driver class path is 'vnd.sun.star.expand:$BRAND_BASE_DIR/program/classes/hsqldb.jar vnd.sun.star.expand:$BRAND_BASE_DIR/program/classes/sdbc_hsqldb.jar'.

Error code: -1

org.hsqldb.jdbcDriver

and in the terminal:
Jul 1, 2012 8:54:01 PMĀ® com.sun.star.wizards.db.DBMetaData getConnection
SEVERE: 
com.sun.star.sdbc.SQLException: The driver class 'org.hsqldb.jdbcDriver' could not be loaded.The additional driver class path is 'vnd.sun.star.expand:$BRAND_BASE_DIR/program/classes/hsqldb.jar vnd.sun.star.expand:$BRAND_BASE_DIR/program/classes/sdbc_hsqldb.jar'.
   at com.sun.star.bridges.jni_uno.JNI_proxy.invoke(JNI_proxy.java:175)
   at $Proxy28.getConnection(Unknown Source:0)
   at com.sun.star.wizards.db.DBMetaData.getConnection(DBMetaData.java:699)
   at com.sun.star.wizards.db.DBMetaData.getConnection(DBMetaData.java:666)
   at com.sun.star.wizards.db.DBMetaData.getConnection(DBMetaData.java:644)
   at com.sun.star.wizards.db.TableDescriptor.getConnection(TableDescriptor.java:116)
   at com.sun.star.wizards.table.TableWizard.startTableWizard(TableWizard.java:370)
   at com.sun.star.wizards.table.CallTableWizard$TableWizardImplementation.trigger(CallTableWizard.java:95)

Expected results:
No error
Comment 1 Caolan McNamara 2012-08-22 10:20:47 EDT
soffice --base, create new database, finish, give it a filename, save "works for me". Is there still a problem for you ?, if there is what java is listed under tools->options->libreoffice->java ?
Comment 2 Robin Green 2012-08-23 16:16:47 EDT
gcj is selected in that dialog. If I select Oracle Corporation's OpenJDK and try again, it works.
Comment 3 Caolan McNamara 2012-08-24 05:48:09 EDT
aha. I wonder if there's a mix of bytecode versions or some such, or if its just some gcj suckiness, Definitely *used* to work at some stage.
Comment 4 Stephan Bergmann 2012-09-24 10:09:11 EDT
connectivity::java_sql_Connection::loadDriverFromProperties (connectivity/source/drivers/jdbc/JConnection.cxx:716) fails to instantiate Java class org.hsqldb.jdbcDriver (via JNI) due to

  java.lang.NoClassDefFoundError: org.hsqldb.jdbcDriver
   at java.lang.Class.initializeClass(libgcj.so.13)
   at java.lang.Class.newInstance(libgcj.so.13)
  Caused by: java.lang.ClassNotFoundException: java.sql.SQLFeatureNotSupportedException not found in java.net.URLClassLoader{...}
   at java.net.URLClassLoader.findClass(libgcj.so.13)
   at java.lang.ClassLoader.loadClass(libgcj.so.13)
   at java.lang.ClassLoader.loadClass(libgcj.so.13)
   at java.lang.Class.forName(libgcj.so.13)
   at java.lang.Class.initializeClass(libgcj.so.13)
   ...1 more

This regression was introduced with <http://cgit.freedesktop.org/libreoffice/core/commit/?id=7dbfc0012cc75e7dac9a416b53149ad8ec33f071> "make hsqldb build with java 1.7":  java.sql.Driver was changed incompatibly in Java 7, adding getParentLogger throwing SQLFeatureNotSupportedException, where that exception was only introduced in Java 6.  Trying to use that exception in Java 5 gcj causes the above NoClassDefFoundError.

This has been fixed upstream as <http://cgit.freedesktop.org/libreoffice/core/commit/?id=93a0d9eee0f4dced348b040961f44f977e9504a7> "rhbz#836827: SQLFeatureNotSupportedException only in Java 6" and the fix will be backported to libreoffice-3.5.6.2-5.fc17.
Comment 5 Caolan McNamara 2012-09-24 14:50:38 EDT
probably worth having a look at the fedora hsqldb package because I think I lifted the build with java 1.7 fix from the fedora hsqldb srpm
Comment 6 Stephan Bergmann 2012-09-25 07:59:58 EDT
(In reply to comment #5)
> probably worth having a look at the fedora hsqldb package because I think I
> lifted the build with java 1.7 fix from the fedora hsqldb srpm

That fix in itself is just right for building with Java 7.  The problem is LO's  somewhat broken approach of cross-compiling to also support older JREs via --with-java-target-version:  While that sets javac's --target to generate old class file formats, it does not set javac's --bootclasspath to build against an old rt.jar.  While this appears to work most of the time, it obviously requires the occasional tweak.
Comment 7 Fedora Update System 2012-09-26 04:21:48 EDT
libreoffice-3.5.6.2-5.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/libreoffice-3.5.6.2-5.fc17
Comment 8 Fedora Update System 2012-09-27 00:30:27 EDT
Package libreoffice-3.5.6.2-5.fc17:
* should fix your issue,
* was pushed to the Fedora 17 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing libreoffice-3.5.6.2-5.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-14896/libreoffice-3.5.6.2-5.fc17
then log in and leave karma (feedback).
Comment 9 Fedora Update System 2012-12-20 11:01:50 EST
libreoffice-3.5.6.2-5.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.