PDA

View Full Version : Tomcat problem


roger600
12th October 2005, 10:59 AM
Hi. I have installed tomcat5 and CATALINA_HOME=/usr/share/tomcat5.

I have created on CATALINA_HOME/webapps a folder called sprova, with the war structure (WEB-INF, classes,lib...), which contains prova.html.

To access folder i have created a context on server.xml. This is my server.xml file:

--------------------------------------------------------------------------------------------------------------
<Server port="8005" shutdown="SHUTDOWN" debug="0">


<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
debug="0"/>
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycl eListener"
debug="0"/>


<GlobalNamingResources>


<Environment name="simpleValue" type="java.lang.Integer" value="30"/>

<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved">
</Resource>
<ResourceParams name="UserDatabase">
<parameter>
<name>factory</name>
<value>org.apache.catalina.users.MemoryUserDatabaseFactor y</value>
</parameter>
<parameter>
<name>pathname</name>
<value>conf/tomcat-users.xml</value>
</parameter>
</ResourceParams>

</GlobalNamingResources>

<Service name="Catalina">

<Connector port="8080"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
debug="0" connectionTimeout="20000"
disableUploadTimeout="true" />
<Connector port="8009"
enableLookups="false" redirectPort="8443" debug="0"
protocol="AJP/1.3" />

<Engine name="Catalina" defaultHost="localhost" debug="0">

<Logger className="org.apache.catalina.logger.FileLogger"
prefix="catalina_log." suffix=".txt"
timestamp="true"/>

<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
debug="0" resourceName="UserDatabase"/>

<Host name="localhost" debug="0" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">

<Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
managerClassName="org.apache.catalina.cluster.session.DeltaManager"
expireSessionsOnShutdown="false"
useDirtyFlag="true">

<Membership
className="org.apache.catalina.cluster.mcast.McastService"
mcastAddr="228.0.0.4"
mcastPort="45564"
mcastFrequency="500"
mcastDropTime="3000"/>

<Receiver
className="org.apache.catalina.cluster.tcp.ReplicationListene r"
tcpListenAddress="auto"
tcpListenPort="4001"
tcpSelectorTimeout="100"
tcpThreadCount="6"/>

<Sender
className="org.apache.catalina.cluster.tcp.ReplicationTransmi tter"
replicationMode="pooled"/>

<Valve className="org.apache.catalina.cluster.tcp.ReplicationValve"
filter=".*\.gif;.*\.js;.*\.jpg;.*\.htm;.*\.html;.*\.txt;"/>

<Deployer className="org.apache.catalina.cluster.deploy.FarmWarDeployer"
tempDir="/tmp/war-temp/"
deployDir="/tmp/war-deploy/"
watchDir="/tmp/war-listen/"
watchEnabled="false"/>
</Cluster>




<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="localhost_log." suffix=".txt"
timestamp="true"/>

<Context path="/sprova" docBase="/usr/share/tomcat5/webapps/sprova" debug="0" reloadable="true" />

</Host>

</Engine>

</Service>

</Server>
-------------------------------------------------------------------------------------------------------------------
The problem is that when i try to acces localhost:8080/sprova/prova.htm a 404 not found error appears.

I can't create context /sprova.

Any idea?? I can't access html file. Is any problem on server.xml??

Thanks.

cyaconi
12th October 2005, 02:57 PM
Did you put the web.xml file in the WEB-INF folder??

And, if your web-app is in the $CATALINA_HOME/webapps/ folder, this line:

<Context path="/sprova" docBase="/usr/share/tomcat5/webapps/sprova" debug="0" reloadable="true" />

is unnecesary.

roger600
12th October 2005, 05:46 PM
Yes, i have putted web.xml in WEB-INF folder, but i'm not trying to access a servlet, i'm just trying to access prova.htm.

I don't know if so as to view an html file is necessary web.xml....

My web.xml file is:
<?xml version="1.0" encoding="ISO-8859-15"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">

<web-app>
<servlet>
<servlet-name>sprova</servlet-name>
<servlet-class>prova</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>sprova</servlet-name>
<url-pattern>aa</url-pattern>
</servlet-mapping>
</web-app>

Why tomcat can't find /sprova folder?? if not necessary to put <context>, why it can't access sprova folder??

I can't do anything if i don't resolve this problem.... Thanks!!!

cyaconi
12th October 2005, 06:28 PM
Why tomcat can't find /sprova folder??
Because tomcat isn't a web server, it's a web container, so it hosts web applications, not web pages, and for so, you need to configure the application.


if not necessary to put <context>, why it can't access sprova folder??
Maybe because your web application isn't well installed or configured. Post the catalina.out to see what does tomcat says when starting up.

Why in your web.xml you define a servlet??? Does that servlet exists??