You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ken Johanson <to...@kensystem.com> on 2009/10/15 08:18:43 UTC
Tomcat + APR non-root on linux: Socket bind failed: [98] Address
already in use
Hi everyone,
Trying to run Tomcat Tomcat/6.0.18 + apr-1.3.8.tar.gz, I get a:
Oct 15, 2009 12:11:20 AM org.apache.coyote.http11.Http11AprProtocol start
SEVERE: Error starting endpoint
java.lang.Exception: Socket bind failed: [98] Address already in use
at
org.apache.tomcat.util.net.AprEndpoint.init(AprEndpoint.java:612)
..
(no listener is actually running on 98; this is just generic Sun msg
when not allowed to bind to prv'd port)
I am also running Tomcat as a non-root user, e.g:
daemon --user www "$CATALINA_HOME/bin/startup.sh"
and also tried jsvc...
same problem.
Is there a configuration to change the port that APR uses from 98 to a
non-privileged (>1024) one?
TIA,
Ken
PS - Connector.xml excerpts:
<Connector
protocol="org.apache.coyote.http11.Http11AprProtocol"
port="8443"
enableLookups="false"
SSLEnabled="true"
scheme="https"
secure="true"
SSLCertificateFile="${catalina.base}/conf/cert.crt"
SSLCertificateKeyFile="${catalina.base}/conf/cert.key"
disableUploadTimeout="true"
/>
<Listener className="org.apache.catalina.core.AprLifecycleListener"
SSLEngine="on" />
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Tomcat + APR: 'Invalid Server SSL Protocol' (was 'Tomcat + APR
.. Socket bind failed')
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Ken Johanson [mailto:tomcat-user@kensystem.com]
> Subject: Re: Tomcat + APR: 'Invalid Server SSL Protocol' (was 'Tomcat +
> APR .. Socket bind failed')
>
> the solution to this was to add the element:
> <Listener className="org.apache.catalina.core.AprLifecycleListener"
> SSLEngine="on"/>
Perhaps the statement should be "do not remove the element", since it's present in the standard Tomcat download. If you are using a 3rd-party repackaged version of Tomcat that took out that <Listener> element, you could file a bug report with them.
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat + APR: 'Invalid Server SSL Protocol' (was 'Tomcat + APR
.. Socket bind failed')
Posted by Ken Johanson <to...@kensystem.com>.
Ken Johanson wrote:
> Ken Johanson wrote:
> <snip>
>
>> After doing a kill, then startup I now get:
>>
>> java.lang.Exception: Invalid Server SSL Protocol
>> at org.apache.tomcat.jni.SSLContext.make(Native Method)
>> at
>> org.apache.tomcat.util.net.AprEndpoint.init(AprEndpoint.java:693)
>> at
>> org.apache.coyote.http11.Http11AprProtocol.init(Http11AprProtocol.java:107)
>>
>> at
>> org.apache.catalina.connector.Connector.initialize(Connector.java:1058)
>> ...........
>> Oct 15, 2009 10:10:44 PM org.apache.catalina.startup.Catalina load
>> SEVERE: Catalina.start
>> LifecycleException: Protocol handler initialization failed:
>> java.lang.Exception: Invalid Server SSL Protocol
>> at
>> ......
>>
>> But I can't see where I'm deviating from docs with:
>> <Connector
>> port="8443"
>> enableLookups="false"
>> SSLEnabled="true" scheme="https" secure="true"
>> SSLCertificateFile="${catalina.base}/conf/cert.pem"
>> SSLCertificateKeyFile="${catalina.base}/conf/key.pem"
>> disableUploadTimeout="true"
>> SSLVerifyClient="optional"
>> sslProtocol="TLS"
>> />
>>
>> BTW I'm now tryng recent apache-tomcat-6.0.20 and rebuilt
>> tomcat-native-1.1.16.
>>
>> Any insight would be immensely appreciated!
>>
>> Best regards,
>> -Ken
>>
>>
>
> Presumably the shutdown failure is caused by this NPE interrupting the
> call:
>
> Oct 15, 2009 10:19:29 PM org.apache.coyote.http11.Http11AprProtocol destroy
> INFO: Stopping Coyote HTTP/1.1 on http-8080
> Oct 15, 2009 10:19:29 PM org.apache.catalina.connector.MapperListener
> destroy
> WARNING: Error unregistering MBeanServerDelegate
> java.lang.NullPointerException
> at
> org.apache.catalina.connector.MapperListener.destroy(MapperListener.java:171)
>
> at
> org.apache.catalina.connector.Connector.stop(Connector.java:1179)
> at
> org.apache.catalina.core.StandardService.stop(StandardService.java:593)
>
For the benefit of others:
the solution to this was to add the element:
<Listener className="org.apache.catalina.core.AprLifecycleListener"
SSLEngine="on"/>
as a child node of the 'Server' element.
This fact IS listed here:
http://tomcat.apache.org/tomcat-6.0-doc/apr.html
although it might be argued it is not clear that the Listener is
REQUIRED for SSL to work under APR (listener may imply to some people
that a user listener is offered for those who wish to intercept SSL
session events)
Regards,
-Ken
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Tomcat + APR: 'Invalid Server SSL Protocol' (was 'Tomcat + APR ..
Socket bind failed')
Posted by Ken Johanson <to...@kensystem.com>.
Ken Johanson wrote:
<snip>
> After doing a kill, then startup I now get:
>
> java.lang.Exception: Invalid Server SSL Protocol
> at org.apache.tomcat.jni.SSLContext.make(Native Method)
> at
> org.apache.tomcat.util.net.AprEndpoint.init(AprEndpoint.java:693)
> at
> org.apache.coyote.http11.Http11AprProtocol.init(Http11AprProtocol.java:107)
> at
> org.apache.catalina.connector.Connector.initialize(Connector.java:1058)
> ...........
> Oct 15, 2009 10:10:44 PM org.apache.catalina.startup.Catalina load
> SEVERE: Catalina.start
> LifecycleException: Protocol handler initialization failed:
> java.lang.Exception: Invalid Server SSL Protocol
> at
> ......
>
> But I can't see where I'm deviating from docs with:
> <Connector
> port="8443"
> enableLookups="false"
> SSLEnabled="true" scheme="https" secure="true"
> SSLCertificateFile="${catalina.base}/conf/cert.pem"
> SSLCertificateKeyFile="${catalina.base}/conf/key.pem"
> disableUploadTimeout="true"
> SSLVerifyClient="optional"
> sslProtocol="TLS"
> />
>
> BTW I'm now tryng recent apache-tomcat-6.0.20 and rebuilt
> tomcat-native-1.1.16.
>
> Any insight would be immensely appreciated!
>
> Best regards,
> -Ken
>
>
Presumably the shutdown failure is caused by this NPE interrupting the call:
Oct 15, 2009 10:19:29 PM org.apache.coyote.http11.Http11AprProtocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-8080
Oct 15, 2009 10:19:29 PM org.apache.catalina.connector.MapperListener
destroy
WARNING: Error unregistering MBeanServerDelegate
java.lang.NullPointerException
at
org.apache.catalina.connector.MapperListener.destroy(MapperListener.java:171)
at
org.apache.catalina.connector.Connector.stop(Connector.java:1179)
at
org.apache.catalina.core.StandardService.stop(StandardService.java:593)
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat + APR non-root on linux: Socket bind failed: [98] Address
already in use
Posted by Ken Johanson <to...@kensystem.com>.
Peter Crowther wrote:
> 2009/10/15 Ken Johanson <to...@kensystem.com>
>
>> SEVERE: Error starting endpoint
>> java.lang.Exception: Socket bind failed: [98] Address already in use
>> at org.apache.tomcat.util.net.AprEndpoint.init(AprEndpoint.java:612)
>> ..
>> (no listener is actually running on 98; this is just generic Sun msg when
>> not allowed to bind to prv'd port)
>>
>
> 98 is the errno (EADDRINUSE), not the port. The error message doesn't list
> which port failed.
>
>
>> Is there a configuration to change the port that APR uses from 98 to a
>> non-privileged (>1024) one?
>>
>
> APR doesn't use any ports other than the ones you configure in your
> connectors. Something is holding onto one of the ports you want. Check
> what ports Tomcat wants, and check there isn't another process running on
> the box that is using one of them - it might even be an old Tomcat. Don't
> forget to check the shutdown port (8005 by default), although from the stack
> trace it looks like the problem port is a connector, not the shutdown port.
>
>
>> PS - Connector.xml excerpts:
>> <Connector
>> protocol="org.apache.coyote.http11.Http11AprProtocol"
>> port="8443"
>> enableLookups="false"
>> SSLEnabled="true"
>> scheme="https"
>> secure="true"
>> SSLCertificateFile="${catalina.base}/conf/cert.crt"
>> SSLCertificateKeyFile="${catalina.base}/conf/cert.key"
>> disableUploadTimeout="true"
>> />
>> <Listener className="org.apache.catalina.core.AprLifecycleListener"
>> SSLEngine="on" />
>>
>
> Any other connectors defined?
>
> - Peter
>
Thank you Peter you are correct! The 98 being mentioned by itself is
very misleading, at least for a lay person like myself :)
It was indeed the normal listeners (8080 and 8443 in my case). I
COMPLETELY took for granted that my init script was handing the
shutdown... it is not. Using APR and an init-script* (or jsvc) that
worked just fine for JIO and NIO, the server does not shutdown for APR.
I have to `ps` for the java proc then send a kill signal to it. I'm not
sure why.... but it may be related to bad cleanup code for the
following, *newly observed problem*.....
After doing a kill, then startup I now get:
java.lang.Exception: Invalid Server SSL Protocol
at org.apache.tomcat.jni.SSLContext.make(Native Method)
at
org.apache.tomcat.util.net.AprEndpoint.init(AprEndpoint.java:693)
at
org.apache.coyote.http11.Http11AprProtocol.init(Http11AprProtocol.java:107)
at
org.apache.catalina.connector.Connector.initialize(Connector.java:1058)
...........
Oct 15, 2009 10:10:44 PM org.apache.catalina.startup.Catalina load
SEVERE: Catalina.start
LifecycleException: Protocol handler initialization failed:
java.lang.Exception: Invalid Server SSL Protocol
at
......
But I can't see where I'm deviating from docs with:
<Connector
port="8443"
enableLookups="false"
SSLEnabled="true" scheme="https" secure="true"
SSLCertificateFile="${catalina.base}/conf/cert.pem"
SSLCertificateKeyFile="${catalina.base}/conf/key.pem"
disableUploadTimeout="true"
SSLVerifyClient="optional"
sslProtocol="TLS"
/>
BTW I'm now tryng recent apache-tomcat-6.0.20 and rebuilt
tomcat-native-1.1.16.
Any insight would be immensely appreciated!
Best regards,
-Ken
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat + APR non-root on linux: Socket bind failed: [98] Address
already in use
Posted by Peter Crowther <pe...@melandra.com>.
2009/10/15 Ken Johanson <to...@kensystem.com>
> SEVERE: Error starting endpoint
> java.lang.Exception: Socket bind failed: [98] Address already in use
> at org.apache.tomcat.util.net.AprEndpoint.init(AprEndpoint.java:612)
> ..
> (no listener is actually running on 98; this is just generic Sun msg when
> not allowed to bind to prv'd port)
>
98 is the errno (EADDRINUSE), not the port. The error message doesn't list
which port failed.
> Is there a configuration to change the port that APR uses from 98 to a
> non-privileged (>1024) one?
>
APR doesn't use any ports other than the ones you configure in your
connectors. Something is holding onto one of the ports you want. Check
what ports Tomcat wants, and check there isn't another process running on
the box that is using one of them - it might even be an old Tomcat. Don't
forget to check the shutdown port (8005 by default), although from the stack
trace it looks like the problem port is a connector, not the shutdown port.
> PS - Connector.xml excerpts:
> <Connector
> protocol="org.apache.coyote.http11.Http11AprProtocol"
> port="8443"
> enableLookups="false"
> SSLEnabled="true"
> scheme="https"
> secure="true"
> SSLCertificateFile="${catalina.base}/conf/cert.crt"
> SSLCertificateKeyFile="${catalina.base}/conf/cert.key"
> disableUploadTimeout="true"
> />
> <Listener className="org.apache.catalina.core.AprLifecycleListener"
> SSLEngine="on" />
>
Any other connectors defined?
- Peter
Re: Tomcat + APR non-root on linux: Socket bind failed: [98] Address
already in use
Posted by Len Popp <le...@gmail.com>.
On Thu, Oct 15, 2009 at 10:39, Christopher Schultz
<ch...@christopherschultz.net> wrote:
> That's port 8443, not port 98. Where's your real <Connector> defined?
98 isn't a port number, it's an error code. It stands for "Address
already in use".
--
Len
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat + APR non-root on linux: Socket bind failed: [98] Address
already in use
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Jan,
On 10/15/2009 2:42 AM, Jan Pernica wrote:
> You cannot use port < 1024 as non-root. Use apache and AJP to connect
> tomcat running on eg. 8080.
The previous statement is *totally incorrect*. There are multiple ways
to run on privileged ports without running as root:
http://wiki.apache.org/tomcat/HowTo#How_to_run_Tomcat_without_root_priviledges.3F
Somehow, jsvc is not mentioned in this article for some reason.
> On 15.10.2009 8:18, Ken Johanson wrote:
>> (no listener is actually running on 98; this is just generic Sun msg
>> when not allowed to bind to prv'd port)
[snip]
>> PS - Connector.xml excerpts:
>> <Connector
>> protocol="org.apache.coyote.http11.Http11AprProtocol"
>> port="8443"
That's port 8443, not port 98. Where's your real <Connector> defined?
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkrXNBoACgkQ9CaO5/Lv0PAwWgCffPa3Z8fIr+eFcmfL9L2XJAAA
MBsAoIlCBV0NGbOvU+vebA8D0abY94nH
=hT6o
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat + APR non-root on linux: Socket bind failed: [98] Address
already in use
Posted by Ken Johanson <to...@kensystem.com>.
Jan Pernica wrote:
> You cannot use port < 1024 as non-root. Use apache and AJP to connect
> tomcat running on eg. 8080. Regards
>
> Jan
>
> On 15.10.2009 8:18, Ken Johanson wrote:
>> Hi everyone,
>>
>> Trying to run Tomcat Tomcat/6.0.18 + apr-1.3.8.tar.gz, I get a:
>>
>> Oct 15, 2009 12:11:20 AM org.apache.coyote.http11.Http11AprProtocol start
>> SEVERE: Error starting endpoint
>> java.lang.Exception: Socket bind failed: [98] Address already in use
>> at
>> org.apache.tomcat.util.net.AprEndpoint.init(AprEndpoint.java:612)
>> ..
>> (no listener is actually running on 98; this is just generic Sun msg
>> when not allowed to bind to prv'd port)
>>
>> I am also running Tomcat as a non-root user, e.g:
>> daemon --user www "$CATALINA_HOME/bin/startup.sh"
>> and also tried jsvc...
>>
>> same problem.
>>
>> Is there a configuration to change the port that APR uses from 98 to a
>> non-privileged (>1024) one?
>>
>> TIA,
>> Ken
>>
>> PS - Connector.xml excerpts:
>> <Connector
>> protocol="org.apache.coyote.http11.Http11AprProtocol"
>> port="8443"
>> enableLookups="false"
>> SSLEnabled="true"
>> scheme="https"
>> secure="true"
>> SSLCertificateFile="${catalina.base}/conf/cert.crt"
>> SSLCertificateKeyFile="${catalina.base}/conf/cert.key"
>> disableUploadTimeout="true"
>> />
>> <Listener className="org.apache.catalina.core.AprLifecycleListener"
>> SSLEngine="on" />
>>
>>
Thank you Jan. Actually I tried to show that I already knew that <1024
wont bind, if you noticed. That is the crux of the problem. I need a way
to config APR to *not* use the tcp/98 default. And the whole point of
using APR is to *not* use httpd and ajp...
Thanks again,
Ken
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat + APR non-root on linux: Socket bind failed: [98] Address
already in use
Posted by Jan Pernica <ja...@pernica.org>.
You cannot use port < 1024 as non-root. Use apache and AJP to connect
tomcat running on eg. 8080. Regards
Jan
On 15.10.2009 8:18, Ken Johanson wrote:
> Hi everyone,
>
> Trying to run Tomcat Tomcat/6.0.18 + apr-1.3.8.tar.gz, I get a:
>
> Oct 15, 2009 12:11:20 AM org.apache.coyote.http11.Http11AprProtocol start
> SEVERE: Error starting endpoint
> java.lang.Exception: Socket bind failed: [98] Address already in use
> at
> org.apache.tomcat.util.net.AprEndpoint.init(AprEndpoint.java:612)
> ..
> (no listener is actually running on 98; this is just generic Sun msg
> when not allowed to bind to prv'd port)
>
> I am also running Tomcat as a non-root user, e.g:
> daemon --user www "$CATALINA_HOME/bin/startup.sh"
> and also tried jsvc...
>
> same problem.
>
> Is there a configuration to change the port that APR uses from 98 to a
> non-privileged (>1024) one?
>
> TIA,
> Ken
>
> PS - Connector.xml excerpts:
> <Connector
> protocol="org.apache.coyote.http11.Http11AprProtocol"
> port="8443"
> enableLookups="false"
> SSLEnabled="true"
> scheme="https"
> secure="true"
> SSLCertificateFile="${catalina.base}/conf/cert.crt"
> SSLCertificateKeyFile="${catalina.base}/conf/cert.key"
> disableUploadTimeout="true"
> />
> <Listener className="org.apache.catalina.core.AprLifecycleListener"
> SSLEngine="on" />
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
--
Děkuji a s pozdravem
Jan Pernica
===========================================
Pernica IT Solutions
Masarykovo náměstí 8
664 51 Šlapanice
Czech Republic
tel,fax: +420 544 245 068
mobile: +420 777 634 665
mailto:jan.pernica@pernica.org
http://www.pernica.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org