You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Christopher Schultz <ch...@christopherschultz.net> on 2013/03/21 15:46:40 UTC

Re: Adding Connectors

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Steffen,

I think this should be discussed on the users' list. I'm cross-posting
this message one time for that purpose. See below.

On 3/21/13 9:59 AM, Steffen Heil (Mailinglisten) wrote:
> I have a servlet that creates a new Connector and adds it to the
> Service it is running in. However it does this during startup of
> the Servlet.
> 
> Obviously the connectors specified in the server.xml are added and
> NOT started. So tomcat starts its connectors as last thing after
> loading other components (including servlets).
> 
> Therefor I get: INFO: The start() method was called on component
> [Connector[org.apache.coyote.http11.Http11NioProtocol-1001]] after
> start() had already been called. The second call will be ignored.
> 
> Now, that would not be a problem for me, but I would like to add my
> connectors without starting them, so that at the end of startup
> sequence tomcat would start them as it does for all other
> connectors defined in server.xml.
> 
> But I cannot. The following code shows the issue.
> 
> 
> package org.apache.catalina.core;
> 
> public class StandardService extends LifecycleMBeanBase implements
> Service {
> 
> public void addConnector(Connector connector) { ... if
> (getState().isAvailable()) { try { connector.start(); } catch
> (LifecycleException e) { 
> log.error(sm.getString("standardService.connector.startFailed",connector),
> e); } } ... }
> 
> }
> 
> 
> During servlet initialization getState().isAvailable() returns
> true, therefore the connector is started right away. Also, during
> start, if anything is accessed before the tomcat startup sequence
> completes, I get the following:
> 
> Mar 21, 2013 1:36:34 PM org.apache.tomcat.util.net.NioEndpoint
> processSocket SEVERE: Error allocating socket processor 
> java.lang.IllegalStateException: StandardThreadPool not started. at
> org.apache.catalina.core.StandardThreadExecutor.execute(StandardThreadExecutor.java:173)
>
> 
at
org.apache.tomcat.util.net.NioEndpoint.processSocket(NioEndpoint.java:728)
> at
> org.apache.tomcat.util.net.NioEndpoint$Poller.processKey(NioEndpoint.java:1257)
>
> 
at org.apache.tomcat.util.net.NioEndpoint$Poller.run(NioEndpoint.java:1193)
> at java.lang.Thread.run(Thread.java:662)
> 
> 
> This is probably, because my connector is already started, while
> the Executor is not.
> 
> 
> Now, my two questions:
> 
> 
> a) Can I assume that those error messages do no harm?
> 
> b) Isn't this a bug, that tomcat starts connectors while it regards
> all self-created connectors as not started?

What happens if you set bindOnInit=false in server.xml? That may only
affect those connectors defined there, but it may also put Tomcat into
a state where none of the Connectors are started until after webapp
initialization.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJRSx1PAAoJEBzwKT+lPKRYDvcP/2+PTj7cA4ebJ2wcYV0CzLI8
y6qc+aDvls6BJf84lzzOtbZrGEiWvbGwp/dtNmHBmRJkOShlF790qqdKfhglhVCx
HckjEi0bpQLLv9IXB3y/5+byDITM43SAtgI2otUhaKy/vonE/TuHbE91pQZIZV4B
jHWpYUIhDXO6fzwfF69/mjEny6ekg1QtGfDTYVqG8Qle4HpXCEZFpSMAo8W97n2n
s6AMD/lbf2NRXbyExeV9vLcLd8XKXcxm4hUrOxiDVeEXk3OFUcoLR3+yLYVD4gfV
C7hUvmWdhiWPVjnAaTqY+JYHdgSTXfDdLg0dswtHtzKKRVxky0aR3ydDiZ3PqHR+
lGDZFJLfFGN6KXhYUMUhgnV4R0Mr6084zwCs5Af4LTP6yaeaeEtP7fQHFbQbZezr
gpA0+gaw3LWTJJWZw/hb4VHRt23XB+0N07xgHAL0g5FpPxPk0l1LxOzGPEtEW1vo
M35xTjA6eZQmYa9NGTW4gWQakSdjq+m341+OrFZmjmU4QMAPakcqfnzAS/IxA3TR
CaL2nw9b4kejDYBIxdI++CpOnTBnB4xTd+nnbD6XqMt0UUsm9kacNy4LkzJnwht/
hLZsmUpWBDCID2b3A8nB80ODDcnCxcvl7+0I+39IR5pWdWzArOTH1f32L9bZUP0j
KVPBk5kgar7W6/txeKsz
=sfnh
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


AW: Adding Connectors

Posted by "Steffen Heil (Mailinglisten)" <li...@steffen-heil.de>.
Hi


> I think this should be discussed on the users' list. I'm cross-posting this
> message one time for that purpose. See below.

Sorry, as I assumed that in a state where tomcat does not start connectors defined in server.xml it should also not start other connectors, I regarded this as a bug.  That's why I sent it to the developers' list...


> What happens if you set bindOnInit=false in server.xml? That may only affect
> those connectors defined there, but it may also put Tomcat into a state
> where none of the Connectors are started until after webapp initialization.

By documentation it only conrols, wheather it is bound on init or start, not when it is started...
Anyway I would have tried your suggestion, but:

From the documentation I see on a "bindOnInit" for connectors.
However I don't have any connectors in my tomcat for usual deploys. (I did include one for debugging only.)


Regards,
  Steffen