Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can't access to servlet page through apache

Status
Not open for further replies.

KerenE

Programmer
Nov 20, 2003
10
IL
Hi.
I upgraded to tomcat4.1.29. Apache version is 1.3.19.
I defined ajp13 connector is server.xml as follows:

<Service name=&quot;Tomcat-Apache&quot;>
<Connector className=&quot;org.apache.ajp.tomcat4.Ajp13Connector&quot; port=&quot;8009&quot; minProcessors=&quot;5&quot; maxProcessors=&quot;75&quot; acceptCount=&quot;10&quot; debug=&quot;0&quot;/>

I also defined http connector:

<Connector className=&quot;org.apache.catalina.connector.http.HttpConnector&quot; port=&quot;10990&quot; minProcessors=&quot;5&quot; maxProcessors=&quot;75&quot; acceptCount=&quot;10&quot; debug=&quot;0&quot;/>

I'm using mod_jk.conf-local, located under apache conf directory (&quot;Include&quot; was added to httpd.conf ).

My contexts were defined as:

JkMount /examples ajp13_hpd301
JkMount /examples/* ajp13_hpd301

JkMount /amc_hpd301/servlet/AmcGateway ajp13_hpd301

where &quot;examples&quot; is tomcat example application(comes with installation) and &quot;amc_hpd301&quot; is my own application.
I created directory named &quot;amc_hpd301&quot; under webapps directory and put my jar file(which includes servlet classes) under WEB-INF/classes.

After starting apache and tomcat, it seems like servlets init method is called sucessfully. But, while trying to access through the browser( I'm getting apache 404 error.

Same error is appeared even if I'm trying to access directly to tomcat(
Anyway, I tried also to create test.jsp file and locate it under amc_hps301 directory.Here, access is successful.
(both and
Access to tomcat examples is successful too.

Do you have any idea why is this happened?
Is it because I'm using jar and not just classes files?
(jar location is passed by CLASSPATH to tomcat, and it seems like servlets are running in background).

Please help me. Its an urgent matter.
Thanks in advanced
Keren.
 
In web.xml in amc_hp301/WEB-INF you need to define your mapping and servlet :

<servlet>
<servlet-name>MyServlet</servlet-name>
<servlet-class>MyServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>MyServlet</servlet-name>
<url-pattern>/servlet/MyServlet</url-pattern>
</servlet-mapping>

If your servlet is in a a package you'll need to define it as so :

<servlet>
<servlet-name>MyServlet</servlet-name>
<servlet-class>com.acme.MyServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>MyServlet</servlet-name>
<url-pattern>/servlet/MyServlet</url-pattern>
</servlet-mapping>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top