Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Embedded Tomcat - adding connectors on the fly

843841Apr 26 2005
I have a copy of Tomcat embedded inside my application, and it runs great. During the processing, I'd like to open another port to service requests on. The documentation on the Embedded object states:

"After normal operations have begun, you can add and remove Connectors, Engines, Hosts, and Contexts on the fly."

Great, that's exactly what I want to do. However, I'm finding that if I try to add a new Connector to my Embedded object, I still can't connect on that port. Here's my code:
  CoyoteConnector connector = (CoyoteConnector)embedded.createConnector((InetAddress)null, newPort, false); 

  // not sure why/if these are necessary
  // I don't call these when I set up the initial port to listen on
  connector.initialize();
  connector.start();

  embedded.addConnector(connector);
I after running this code I call embedded.findConnectors(), my new connector shows up in the isAvailable state. However, I can't connect on the new port.

Any ideas on what could be going wrong? I'm running Tomcat 5.0.28.

Sander Smith
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 24 2005
Added on Apr 26 2005
0 comments
234 views