-----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: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org