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!

Help setting up servlet Tomcat 5.0.16

Status
Not open for further replies.

cdeardor

MIS
Oct 25, 2002
49
US
I'm new to Tomcat, and am having some trouble. I setup installed tomcat 5.0.16, and setup an apache server. The two are talking over mod_jk. I can open tomcat via the browser and run all the test servlets, etc. I can also reach them through apache. My problem is, I have a servlet, and cannot seem to get Tomcat to execute it. I've tried several different configuations. I keep getting "The requested resource (/domainlinker/) is not available". The files included with this are domainlinker$MyX509TrustManager.class, jcert.jar, jsse.jar,
domainlinker.class, and jnet.jar. I was formerly using Sun's Enterprise server and this works fine. Can someone please explaing to me, or point me to the proper documentation for getting tomcat to see and execute this? Any help would be greatly appreciated.
 
Sounds like your mappings are screwed :

Code:
<?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot;?>

<!DOCTYPE web-app
    PUBLIC &quot;-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN&quot;
    &quot;[URL unfurl="true"]http://java.sun.com/dtd/web-app_2_3.dtd&quot;>[/URL]

<web-app>
	<servlet>
		<servlet-name>TestServlet</servlet-name>
		<servlet-class>acme.com.TestServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>

	<servlet-mapping>
		<servlet-name>TestServlet</servlet-name>
		<url-pattern>/servlet/TestServlet</url-pattern>
	</servlet-mapping>
</web-app>

Try adding this web.xml file in your WEB-INF file, and then hit the URL like so
Code:
[URL unfurl="true"]http://servername:8080/servlet/TestServlet[/URL]
 
I tried following your example, but was still unable to get to my servlet. I do agree though, it's definately the web.xml file. I'm in the midst of researching that. Thanks for pointing me in the right direction. I really appreciate it!
 
Hmmm, I'm still having problems. I dont' know if it's totally web.xml, or if I might have my directory structure wrong. I have an index.htm in /webapps/domainlinker. I can get to that by As stated in the earlier post, here are the files I have: domainlinker$MyX509TrustManager.class, jcert.jar, jsse.jar, domainlinker.class, and jnet.jar. All class files are in webapps/domainlinker/WEB-INF/classes. All jar files are in webapps/domainlinker/WEB-INF/lib. When I try and access the servlet, I still get resourse not available. Here is what my web.xml file looks like...

<?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot;?>

<!DOCTYPE web-app
PUBLIC &quot;-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN&quot;
&quot;
<web-app>
<servlet>
<servlet-name>domainlinker</servlet-name>
<servlet-class>domainlinker</servlet-class>
<load-on-startup>10</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>domainlinker</servlet-name>
<url-pattern>/servlet/domainlinker</url-patter>
</servlet-mapping>
</web-app>

I know I'm doing something stupid. So, if anyone needs more info, I'd be happy to oblige because this is driving me crazy. Thanks in advance...
 
check your Tomcat config file, <tomcat>/conf/server.xml, make sure it have a context with path &quot;domainlinker&quot; defined in there. If not, you are missing a context defination for your web application.
 
I take it the domainlinker class is not in a package ? (ie acme.com.domainlinker)
 
Okay, it's working PERFECTLY now!!!! Thanks everyone for your help. The problem did turn out to be the web.xml file. Here is the working file....

<web-app>
<session-config>
<session-timeout>30</session-timeout> </session-config>
<servlet>
<servlet-name>domainlinker</servlet-name>
<servlet-class>domainlinker</servlet-class>
<display-name>domainlinker</display-name>
<description></description>
</servlet>
<servlet-mapping>
<servlet-name>domainlinker</servlet-name>
<url-pattern>/domainlinker</url-pattern> </servlet-mapping></web-app>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top