Aaron got me pointed in the right direction. Between him and the bsd lists I figured it out.

I ended up giving two people free hosting for a year. But that's O.K. because I got this box working now.

Here is the fix.

Here's what I did.  I added the following line to /etc/rc.conf:

jakarta_tomcat55_java_opts="-Djava.net.preferIPv4Stack=true"

JDK1.5 chokes on binding to any address with FreeBSD 6.0 because of the IPv6 stack.

The JDK documentation on IPv6 documents this command line define, also.

On a related note, when I tried to build JDK1.5 with IPV6 support, I got an error. But, that's a subject for another thread on another list, I think.


Richard

Richard Schilling wrote:
I'm getting some good feedback, and I think I'm narrowing down the problem now. Thanks Aaron. Yes, if this is it I'll give him the hosting.


I'm narrowing down a problem with BindAddress on jdk1.5, FreeBSD RELENG_6 .

uname -a output:
FreeBSD newbox.cognitiongroup.biz 6.0-STABLE FreeBSD 6.0-STABLE #3: Fri Nov 4 23:36:56 PST 2005 [EMAIL PROTECTED]:/usr/obj/usr/src/sys/PRODUCTION amd64

Here's the error:

$ java TestServer localhost 8080
Host Address=localhost
Port        =8080
Exception in thread "main" java.net.BindException: Can't assign requested address
        at java.net.PlainSocketImpl.socketBind(Native Method)
        at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
        at java.net.ServerSocket.bind(ServerSocket.java:319)
        at java.net.ServerSocket.bind(ServerSocket.java:277)
        at TestServer.main(TestServer.java:15)
$


Check out http;//bugs.sun.com/bugdatabase/view_bug.do?bug_id=6206527

I'm able to reproduce the error with the following code, with IPv6 enabled and with IPv6 disabled...

import java.net.*;

public class TestServer {

        public static void main (String[] args) throws Exception {
                if (args.length   != 2) {
System.out.println("Usage: java TestServer <host_address_ipv6> <port>");
                        System.exit(1);
                }

                System.out.println("Host Address="+args[0]);
                System.out.println("Port        ="+args[1]);
                ServerSocket ss = new ServerSocket();

ss.bind(new InetSocketAddress(InetAddress.getByName(args[0]), Integer.parseInt(args[1])));

                System.out.println("ServerSocket Bound");

                ss.accept();
        }
}





Richard



Aaron Hamid wrote:

Hi Richard,

I don't have the time at the moment, but typically when Java can't bind to a port that is /in use/ it says something like:

Address already in use: JVM_Bind

Your error is different. It's saying it can't /assign/ the address. That speaks of a lower level problem to me. I'd double check any firewall/ipchains/etc. settings.

There apparently was a bug in Java 1.4 on SuSE, maybe this will help:

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6206527

Something to do with IPv6.  Might want to check that too.

Aaron


Richard Schilling wrote:

I've been trying for about 12 hours now, and can't figure out why Tomcat won't bind to a port. The ports aren't being used, and in JVMs are running.

I'm out of ideas and this is delaying a production box.

I'll give free webhosting for a year to anyone who wants to take the time to log onto the box and can fix this while talking to me on the phone. The web server that does the hosting has e-mail, awstats, pgsql, mysql, postnuke, Apache 1.3, mod_ssl, mod_perl, mod_jk and of course Tomcat (when you get it running).

Using JDK1.5 and FreeBSD 6.0.


I get theses errors in stdout.log:


Nov 11, 2005 11:49:14 AM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8180
Nov 11, 2005 11:49:15 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 3095 ms
Nov 11, 2005 11:49:15 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Nov 11, 2005 11:49:15 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.9
Nov 11, 2005 11:49:15 AM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Nov 11, 2005 11:49:21 AM org.apache.catalina.core.ApplicationContext log
INFO: org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache. webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News / Redirect URL: http://www.cnn.com], [org.apache.webapp.bal ancer.rules.RequestParameterRule: Target param name: paramName / Target param va lue: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balanc
er.rules.AcceptEverythingRule: Redirect URL: http://jakarta.apache.org]]
Nov 11, 2005 11:49:22 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Nov 11, 2005 11:49:22 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Nov 11, 2005 11:49:22 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Nov 11, 2005 11:49:22 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Nov 11, 2005 11:49:23 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8180
Nov 11, 2005 11:49:23 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Nov 11, 2005 11:49:23 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/17  config=null
Nov 11, 2005 11:49:24 AM org.apache.catalina.storeconfig.StoreLoader load
INFO: Find registry server-registry.xml at classpath resource
Nov 11, 2005 11:49:24 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 9128 ms
Nov 11, 2005 11:49:24 AM org.apache.catalina.core.StandardServer await
SEVERE: StandardServer.await: create[8005]:
java.net.BindException: Can't assign requested address
        at java.net.PlainSocketImpl.socketBind(Native Method)
        at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
        at java.net.ServerSocket.bind(ServerSocket.java:319)
        at java.net.ServerSocket.<init>(ServerSocket.java:185)
at org.apache.catalina.core.StandardServer.await(StandardServer.java:346
)
        at org.apache.catalina.startup.Catalina.await(Catalina.java:600)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:560)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to