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

Could not find or load the firebird client library [JDBC272] #319

Closed
firebird-automations opened this issue Sep 3, 2012 · 14 comments
Closed

Comments

@firebird-automations
Copy link

Submitted by: Paolo (pcucchi)

Attachments:
loaddebug.log

I've set library path to FirebirdCS-2.5.1.26351-0.amd64/buildroot/opt/firebird/lib/libfbclient.so or /opt/firebird/lib (after installing it) or /usr/lib64 but I always have "Could not find or load the firebird client library"

If I statically load library through System.loadlibrary() I've no error.
System.loadLibrary("icudata");
System.loadLibrary("icuuc");
System.loadLibrary("icui18n");
System.loadLibrary("ib_util");
System.loadLibrary("fbembed");
System.loadLibrary("fbclient");

What could be wrong?

My system properties:
Jaybird 2.2 (generic Linux download)
Java 1.7.0_06 64 bit downloaded from Oracle
OS: Ubuntu 12.04 64 bit

Command line option: -Djava.library.path=/opt/firebird/lib or /usr/lib64
Debugged with netbeans 7.2

Runtime error:

org.firebirdsql.gds.impl.jni.InternalError: FirebirdApiBinding::Initialize - Could not find or load the firebird client library.
at org.firebirdsql.gds.impl.jni.JniGDSImpl.nativeInitilize(Native Method)
at org.firebirdsql.gds.impl.jni.JniGDSImpl.attemptToLoadAClientLibraryFromList(JniGDSImpl.java:92)
at org.firebirdsql.gds.impl.jni.EmbeddedGDSImpl.<init>(EmbeddedGDSImpl.java:31)
at org.firebirdsql.gds.impl.jni.EmbeddedGDSImpl.<init>(EmbeddedGDSImpl.java:21)
at org.firebirdsql.gds.impl.jni.EmbeddedGDSFactoryPlugin.getGDS(EmbeddedGDSFactoryPlugin.java:40)
at org.firebirdsql.gds.impl.GDSFactory.getGDSForType(GDSFactory.java:220)
at org.firebirdsql.jdbc.FBConnectionProperties.getGds(FBConnectionProperties.java:502)
at org.firebirdsql.jdbc.FBConnectionProperties.getDatabaseParameterBuffer(FBConnectionProperties.java:393)
at org.firebirdsql.jca.FBManagedConnectionFactory.getDatabaseParameterBuffer(FBManagedConnectionFactory.java:205)
at org.firebirdsql.jca.FBManagedConnectionFactory.getDefaultConnectionRequestInfo(FBManagedConnectionFactory.java:407)
at org.firebirdsql.pool.AbstractFBConnectionPoolDataSource.allocateConnection(AbstractFBConnectionPoolDataSource.java:265)
at org.firebirdsql.pool.PooledConnectionQueue.addConnection(PooledConnectionQueue.java:491)
at org.firebirdsql.pool.PooledConnectionQueue.start(PooledConnectionQueue.java:155)
at org.firebirdsql.pool.AbstractConnectionPool.getQueue(AbstractConnectionPool.java:205)
at org.firebirdsql.pool.AbstractFBConnectionPoolDataSource.getPooledConnection(AbstractFBConnectionPoolDataSource.java:372)
at org.firebirdsql.pool.FBWrappingDataSource.getConnection(FBWrappingDataSource.java:219)
at com.tecnosens.ladon.dbInterface.DbConnection.connectEmbeddedDS(DbConnection.java:213)

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

Paolo, do you have a specific reason for setting the security level to developers only?

Is your Firebird installation from the Ubuntu repository, or is it the generic linux zip download from http://Firebirdsql.org?

@firebird-automations
Copy link
Author

Commented by: Paolo (pcucchi)

No specific reason.

Firebird installation is the generic linux zip download.

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

security: Developers [ 10012 ] =>

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

I managed to reproduce the issue on a VM with Oracle Java 7 update 7 and the generic-linux Firebird 2.5.1 CS from http://firebirdsql.org.

setting:
export LD_DEBUG=libs

produces the following log. As far as I can tell from this output it is not looking for the libraries in the java.library.path

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

Attachment: loaddebug.log [ 12210 ]

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

I have found a solution:
execute as root (eg using sudo -i):
for f in $(ls -d /opt/firebird/lib/*); do ln -s $f /usr/lib/x86_64-linux-gnu; done

(NOTE: It might be sufficient to only symlink http://libfbclient.so, I didn't try that).

This will create symbolic links to the firebird libraries in a folder that is in the ld.so.conf.d (this is also what the normal Firebird install from the Ubuntu repository does).

Another solution would be to add the /opt/firebird/lib folder to a conf file in /etc/ld.so.conf.d/
see: http://blog.andrewbeacock.com/2007/10/how-to-add-shared-libraries-to-linuxs.html

I am not entirely sure, but I think using LD_LIBRARY_PATH will also work, but I think the solutions above are better. I guess that Oracle Java on linux only uses java.library.path for locating libraries loaded directly from Java, which is probably why loading the libraries first using System.loadLibrary() did work), and doesn't add java.library.path to the ld searchpath. So when a native library itself attempts to load another library, that fails.

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

Just checked, only symlinking http://libfbclient.so into /usr/lib/x86_64-linux-gnu should be sufficient.

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

For Jaybird 2.2.1 and 2.3 I will add additional instructions to the releasenotes.

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

priority: Major [ 3 ] => Minor [ 4 ]

Fix Version: Jaybird 2.2.1 [ 10474 ]

Fix Version: Jaybird 2.3 [ 10440 ]

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

assignee: Roman Rokytskyy [ rrokytskyy ] => Mark Rotteveel [ avalanche1979 ]

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

Added additional info to releasenotes

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

Marked as won't fix, as this does not involve a code change.

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Won't Fix [ 2 ]

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

status: Resolved [ 5 ] => Closed [ 6 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment