Subject | Re: [Firebird-Java] GDS Exception. 335544721 using localhost from apache/tomcat |
---|---|
Author | Mark Rotteveel |
Post date | 2013-12-23T19:30:29Z |
On 23-12-2013 16:23, Ray Holme wrote:
problem is that Java prefers to use the IPv6 address ::1 instead of
127.0.0.1 when resolving localhost.
Firebird only supports IPv4, so it only listens (and accepts
connections) on IPv4. The reason that isql works is that it only
connects to IPv4.
With Jaybird you either need to specify the IP address, or start Java
(tomcat) with -Djava.net.preferIPv4Stack=true
I have no explanation for the observed differences in behavior between
the two machines, although it could be that one returns the IPv4 address
first, and the other second.
What is the result for the following code on both machines:
for (InetAddress address : InetAddress.getAllByName("localhost")) {
System.out.println(address);
}
(preferably from within the tomcat process).
Mark
--
Mark Rotteveel
> When I bring tomcat up, it goes NUTS - the log file just grows.Have you tried using 127.0.0.1 instead of localhost? If that works the
>
> Here is a pruned version of the tomcat log file showing one instance of
> the failure with one application:
>
> ----
> INFO: Deploying configuration
> descriptor /opt/apache-tomcat-7.0.35/conf/Catalina/localhost/ledger.xml
> Dec 22, 2013 11:49:55 AM org.apache.naming.NamingContext lookup
> WARNING: Unexpected exception resolving reference
> org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544721. Unable to
> complete network request to host "localhost".
> at
> org.firebirdsql.jdbc.FBDataSource.getConnection(FBDataSource.java:123)
> at
> org.firebirdsql.jdbc.AbstractDriver.connect(AbstractDriver.java:126)
> at
> org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:278)
> at
> org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:182)
> ...
>
> I was using jaybird 2.2.3 and tried 2.2.4 - NO change.
>
> There are proper entries for localhost and the actual host in /etc/hosts
> - files are identical for both machines except loghost is added to the
> correct one below locally after the true hostname.
>
> 127.0.0.1 localhost localhost.rainbow
> ::1 localhost localhost.rainbow
> rainbow 192.168.101.101
> hapi 192.168.101.102
>
> I changed the firewall (should not matter, but ...) to allow both
> machines to access databases on the other machine (port 3050, of
> course). I am able to open databases on either machine from the other
> using the hostname or IP; and on BOTH machines I can open a database
> locally using
> isql localhost:/path_to_db
>
> The path to the DB is the same as listed in the web xml files in
> conf/Catalina/localhost (works on one machine); the entire tomcat
> directory is a clone; databases are local to each machine (copies for
> testing); both machines have tomcat as a member of group firebird; I
> have connected to both machines as "tomcat" (su; su tomcat; ...) and if
> using the proper isc_username/isc_password on the command line (same as
> in xml files) - I can do SQL and see data.
>
> There is a long dissertation by Dimitri on this on the net, but my
> Russian is not so good (I stop at the first letter), so perhaps it is
> solved.
>
> As an OLD unix / Interbase/Firebird hand, I have already pulled out most
> of my hair. This one makes NO sense.
>
> I have tried every trick I know and failed.
> Not a good way to start holiday festivities.
problem is that Java prefers to use the IPv6 address ::1 instead of
127.0.0.1 when resolving localhost.
Firebird only supports IPv4, so it only listens (and accepts
connections) on IPv4. The reason that isql works is that it only
connects to IPv4.
With Jaybird you either need to specify the IP address, or start Java
(tomcat) with -Djava.net.preferIPv4Stack=true
I have no explanation for the observed differences in behavior between
the two machines, although it could be that one returns the IPv4 address
first, and the other second.
What is the result for the following code on both machines:
for (InetAddress address : InetAddress.getAllByName("localhost")) {
System.out.println(address);
}
(preferably from within the tomcat process).
Mark
--
Mark Rotteveel