Hello,
I am new to Tomcat and I was wondering if you could help me. I am trying to
use tomcat in an embedded scenario, but I am unable to get the tomcat connector
to support AJP connections.
During startup I get the following messages:
...
Nov 20, 2013 4:43:56 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-9010"]
...
INFO: Starting ProtocolHandler ["http-bio-9010"]
I was expecting it to say ["AJP-bio-9010"]. And mod_jk2 is unable to connect
to it.
The code is as follows:
void TomcatStartup(TreeMap conf) {
Tomcat tomcat = new Tomcat();
tomcat.setHostname("localhost");
tomcat.setPort(conf.getInt("Listener.service.port"));
org.apache.catalina.connector.Connector ajp = tomcat.getConnector();
ajp.setProtocol("AJP/1.3");
ajp.setAttribute("protocol", "AJP/1.3");
ajp.setAttribute("tomcatAuthentication", false);
ajp.setAttribute("port", conf.getInt("Listener.service.port"));
tomcat.setConnector(ajp);
org.apache.catalina.Context ctx =
tomcat.addContext("/", new File(".").getAbsolutePath());
TomcatHandler th = new TomcatHandler();
th.conf = conf;
Tomcat.addServlet(ctx, "sc", th);
ctx.addServletMapping("/*", "sc");
try {
tomcat.start();
} catch(Exception ex) {
ex.printStackTrace();
}
}
What I am doing wrong?
Thanks,
Edwin S. Ramirez
Senior Developer, Information Technology
Mount Sinai Medical Center
875 Avenue of the Americas (6th Ave.)
New York, NY 10001
Phone: 646-217-3112
Fax: 212-356-0085