Hi

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?


Regards,
   Steffen


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to