Error launching tomcat6 on opensuse 11.1

Hi all!

Tomcat6 has been installed then removed then installed again with YAST.
As far as java is concerned, there are java_1_6_0_openjdk and java_1_6_0_openjdk_plugin, java_1_6_0_sun_plugin, java_1_6_0_sun, java_1_6_0_sun_jdbc packages.

echo $JAVA_HOME => /usr/lib/jvm/jre
that is a link to /etc/alternatives/jre
that is a link to /usr/lib/jvm/jre-1.6.0-openjdk

When I start Tomcat6, there are several errors in the catalina.out logfile.
The first one:
1 déc. 2009 23:26:59 org.apache.coyote.http11.Http11AprProtocol init
GRAVE: Erreur à l’initialisation du point de contact
java.lang.Exception: Socket bind failed: [22] Invalid argument

Second one:
1 déc. 2009 23:26:59 org.apache.catalina.startup.Catalina load
GRAVE: Catalina.start
LifecycleException: L’initialisation du gestionnaire de protocole a échoué: java.lang.Exception: Socket bind failed: [22] Invalid argument

And http://localhost:8080 is unreachable with my browser, neither http://localhost:8005.

And a nestat command gives me this:
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 2995/httpd2-prefork
tcp 0 0 127.0.0.1:8005 :::* LISTEN 15130/java

Has anyone got an idea about how to solve my problem ?

Thank you very much.

Have you checked that /etc/tomcat6/server.xml contains a correct declaration for the connector for port 8080?

Thank You for your answer ken_yap.
According to me everything looks OK. I did not change anything.
There is this line for the Server section:
<Server port=“8005” shutdown=“SHUTDOWN”>

And then these lines for the connector section in the server section:
<Connector port=“8080” protocol=“HTTP/1.1”
connectionTimeout=“20000”
redirectPort=“8443” />

It should work, souldn’t it ?

I forgot exactly what I did but I see that on a working server, I didn’t use the supplied server.xml but created a new one. I think the meaning of the directives changed a bit. It looks like the main difference is the <Server> element has no port declaration. Here’s the one I used:

<?xml version='1.0' encoding='utf-8'?>
<Server>
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  <GlobalNamingResources>
    <Environment name="simpleValue" type="java.lang.Integer"
    value="30" />
    <Resource auth="Container"
    description="User database that can be updated and saved"
    name="UserDatabase" type="org.apache.catalina.UserDatabase"
    factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
    pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>
  <Service name="Catalina">
    <Connector acceptCount="100" connectionTimeout="20000"
    disableUploadTimeout="true" port="8080" redirectPort="8443"
    maxSpareThreads="75" maxThreads="150" minSpareThreads="25">
    </Connector>
    <Connector port="8009" protocol="AJP/1.3"
    protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"
    redirectPort="8443"></Connector>
    <Engine defaultHost="localhost" name="Catalina">
      <Host appBase="webapps" name="localhost">
        <Logger className="org.apache.catalina.logger.FileLogger"
        prefix="localhost_log" suffix=".txt" />
      </Host>
      <Logger className="org.apache.catalina.logger.FileLogger"
      prefix="catalina_log" suffix=".txt" />
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm" />
    </Engine>
  </Service>
</Server>

I tried “<server>” instead of the line in the previous version with the port that is specified: it did not work (http://localhost:8080 still unreachable).
I tried your server.xml, and it did not work either (http://localhost:8080 still unreachable).

And when I gat back to the original server.xml, that’s the errors the catalina.out file contains:

2 déc. 2009 22:41:14 org.apache.coyote.http11.Http11AprProtocol init
GRAVE: Erreur ??? l’initialisation du point de contact
java.lang.Exception: Socket bind failed: [22] Invalid argument
at org.apache.tomcat.util.net.AprEndpoint.init(AprEndpoint.java:612)
at org.apache.coyote.http11.Http11AprProtocol.init(Http11AprProtocol.java:107)
at org.apache.catalina.connector.Connector.initialize(Connector.java:1058)
at org.apache.catalina.core.StandardService.initialize(StandardService.java:677)
at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:795)
at org.apache.catalina.startup.Catalina.load(Catalina.java:530)
at org.apache.catalina.startup.Catalina.load(Catalina.java:550)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:260)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:412)
2 déc. 2009 22:41:14 org.apache.catalina.startup.Catalina load
GRAVE: Catalina.start
LifecycleException: L’initialisation du gestionnaire de protocole a ???chou???: java.lang.Exception: Socket bind failed: [22] Invali
d argument
at org.apache.catalina.connector.Connector.initialize(Connector.java:1060)
at org.apache.catalina.core.StandardService.initialize(StandardService.java:677)
at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:795)
at org.apache.catalina.startup.Catalina.load(Catalina.java:530)
at org.apache.catalina.startup.Catalina.load(Catalina.java:550)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:260)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:412)
2 déc. 2009 22:41:14 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 885 ms

Do you already have something listening on port 8080? Do you have some sort of limitation on Tomcat like apparmor?

Sorry, no more ideas.

It looks as if nothing is listening on port 8080.
Concerning apparmor, I searched what was installed using YAST. I found this:
apparmor-docs
apparmor-parser
apparmor-profiles
apparmor-utils
libapparmor1
libapparmor-devel
pam-aparmor
perl-libaparmor
yast2-aparmor

I have Tomcat6 on 11.1 running production systems for years, so this must be something of a configuration problem on your side.

Let’s start at the beginning: how are you starting tomcat? Can you post the console feedback if you run the <tomcat-dir>/bin/startup.sh from a console? It should log the Java environment variables and the JVM used.

Hi twelveeighty!

Usually I start tomcat with the GUI of the system services. A message was displayed saying tomcat6 started succesfully.
I also execute this command:
/etc/init.d/tomcat6 start

And the result was:
Starting Tomcat (/usr/share/tomcat6)
Then I checked:
ps aux | grep tomcat

And it looks OK:
tomcat 3815 75.9 1.0 1250428 44768 pts/2 Sl 22:15 0:06 /etc/alternatives/jre/bin/java -classpath :/usr/share/tomcat6/bin/bootstrap.jar:/usr/share/tomcat6/bin/tomcat-juli.jar:/usr/share/java/commons-daemon.jar -Dcatalina.base=/usr/share/tomcat6 -Dcatalina.home=/usr/share/tomcat6 -Djava.endorsed.dirs= -Djava.io.tmpdir=/var/cache/tomcat6/temp -Djava.util.logging.config.file=/usr/share/tomcat6/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager org.apache.catalina.startup.Bootstrap start

But nothing was listening on the port 8080 or 8005:
netstat -lpn | grep 8080 and netstat -lpn | grep 8005 returned nothing.

instead of when I start tomcat using the GUI: java listens on port 8005.

Can you stop it from the system services (or use ‘rctomcat6 stop’) and then go to /usr/share/tomcat6/bin and run the ./startup.sh from a shell - you’ll probably have to run it as root. Paste the results back here (the environment listing). It’ll help with troubleshooting. To stop it, run ./shutdown.sh.

In general, I’ve had problems in the past with running Tomcat from the distro packages and it becomes a real pain if you want to have multiple instances running. I simply use the download from the tomcat site and unpack and run it locally.

Also, can you run the following command and paste the results back here - this will tell how many JVMs are running on your machine:

ps aux | grep java

Actually the /usr/share/tomcat6/bin directory contains only following files:
-rw-r–r-- 1 root root 18040 juin 13 16:37 bootstrap-6.0.18.jar
lrwxrwxrwx 1 root root 20 déc. 1 22:48 bootstrap.jar → bootstrap-6.0.18.jar
-rw-r–r-- 1 root root 2374 juin 13 16:37 catalina-tasks.xml
-rw-r–r-- 1 root root 19758 juin 13 16:37 tomcat-juli-6.0.18.jar
lrwxrwxrwx 1 root root 22 déc. 1 22:48 tomcat-juli.jar → tomcat-juli-6.0.18.jar

There are not startup.sh neither shutdown.sh.

But the ps -aux | grep java command gives me nothing… Perhaps that’s the problem ?

It’s been since 10.3 that I tried the distro version of tomcat. I think they put the files in “non-standard” locations. Can you do the following:

rpm -ql tomcat6

If that doesn’t return anything (I’m guessing the name of the rpm package here), do a ‘rpm -qa | grep tomcat’ first to see what the package name is and then run the 'rpm -ql ’ against it.

Alternatively, paste the contents of the tomcat6 script in here (should be in /etc/init.d/tomcat6.

Basically, I am trying to get you to run tomcat “interactively” so we can see the screen echo.

Alternatively, we may be wasting our time here - I would highly recommend downloading the zip from the tomcat site, unpack it into your home folder and run the bin/startup.sh. If that runs fine, something is wrong/happening with the distro version.

OK, thanks.
I will try this, since I don’t want us to waste our time with such silly things.
I will tell you if it works better.

There is stille an error, and the same one.
I installed tomcat6 in my home directory.
Then I started it using startup.sh command.
The URL was unreachable and the first lines of the catalina.out file was these:

3 déc. 2009 23:30:19 org.apache.catalina.core.AprLifecycleListener init
INFO: Loaded APR based Apache Tomcat Native library 1.1.14.
3 déc. 2009 23:30:19 org.apache.catalina.core.AprLifecycleListener init
INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
3 déc. 2009 23:30:19 org.apache.coyote.http11.Http11AprProtocol init
GRAVE: Erreur à l’initialisation du point de contact
java.lang.Exception: Socket bind failed: [22] Invalid argument
at org.apache.tomcat.util.net.AprEndpoint.init(AprEndpoint.java:623)
at org.apache.coyote.http11.Http11AprProtocol.init(Http11AprProtocol.java:107)
at org.apache.catalina.connector.Connector.initialize(Connector.java:1058)
at org.apache.catalina.core.StandardService.initialize(StandardService.java:677)
at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:795)
at org.apache.catalina.startup.Catalina.load(Catalina.java:535)
at org.apache.catalina.startup.Catalina.load(Catalina.java:555)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:260)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:412)
3 déc. 2009 23:30:19 org.apache.catalina.startup.Catalina load

Any other ideas ?
I really don’t know what the problem is.

I’m reading your post on my blackberry, so I may have missed it, but can you paste those five lines that get echoed in the console window when you run the ./startup.sh? They show the JDK, JRE, etc locations as Tomcat has found them.

The error trace log is the same as shown before. I need to see your Java environment variables as Tomcat sees them.

And, as I read back your earlier post, you issued the wrong ps command, there is no dash - before aux:

ps aux | grep java

Not sure whether it can help, but I found this link:
Tomcat fail to start : Socket bind failed: 22 - Invalid argument - tomcat archive

That guy seems to have a similar issue on Ubuntu.

The issue is related to a bug in APR in tomcat, also related to the native tomcat library (libtcnative).

Which version of libtcnative do you have ?

I have the following package versions on openSUSE 11.2, and it works:

  • tomcat6-6.0.20-24.5.noarch
  • libtcnative-1-0-1.3.3-24.5.i586

Hi twelveeighty !!
Here is what is printed in the window when I execute the ./startup.sh command:
Using CATALINA_BASE: /home/william/Téléchargements/apache-tomcat-6.0.20
Using CATALINA_HOME: /home/william/Téléchargements/apache-tomcat-6.0.20
Using CATALINA_TMPDIR: /home/william/Téléchargements/apache-tomcat-6.0.20/temp
Using JRE_HOME: /usr/lib/jvm/java/jre

Hi PVince81,

My libtcnative version seems to be 1-0-1.2.12-14.7-i586.
And tomcat6 version seems to be 6.0.20.

You’ll want to either disable ipv6 support, or your libcnative.

I’ve never had this issue and I never disabled ipv6. Did you install / configure something to get the libcnative library to kick in?

There’s tons of hits on this particular problem.

Google: java.lang.Exception: Socket bind failed: [22] Invalid argument

You’ll find that the consensus is to disable ipv6.

Hi Twelveeight!

I tried to do disable ipv6 following the steps that are described here:
SDB:Disabling IPv6 completely - openSUSE

I reboot my computer, I lanched the startup.sh command, but http://localhost:8080 is still unreachable and the catalina.out file contained the same error description:

9 déc. 2009 21:41:31 org.apache.catalina.core.AprLifecycleListener init
INFO: Loaded APR based Apache Tomcat Native library 1.1.14.
9 déc. 2009 21:41:32 org.apache.catalina.core.AprLifecycleListener init
INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
9 déc. 2009 21:41:32 org.apache.coyote.http11.Http11AprProtocol init
GRAVE: Erreur à l’initialisation du point de contact
org.apache.tomcat.jni.Error: Address family not supported by protocol
at org.apache.tomcat.jni.Socket.create(Native Method)
at org.apache.tomcat.util.net.AprEndpoint.init(AprEndpoint.java:612)
at org.apache.coyote.http11.Http11AprProtocol.init(Http11AprProtocol.java:107)
at org.apache.catalina.connector.Connector.initialize(Connector.java:1058)
at org.apache.catalina.core.StandardService.initialize(StandardService.java:677)
at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:795)
at org.apache.catalina.startup.Catalina.load(Catalina.java:535)
at org.apache.catalina.startup.Catalina.load(Catalina.java:555)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:260)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:412)

IPV6 should really be disabled since I have “inet6” when I run the ifconfig command.