Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Basic Question????

 
Frederik Ericsson
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Guys

I Installed tomcat. its showing the index page correctly,

when am trying to deploy my servlet its not invoking the tomcat properly..

it says http: resource (myservlet name) is not available...pl guide me how to fix it.

its working only with the files which r in ROOT (i.e) given files only...I cant able to do it mine,

and 1 mor thing

i have tried so many times, after that whenever am starting the tomcat there are so many text messages running in the cmd, how to clear that as well??? please guide me...guys..

I want to fix it soon.
thx
Bye
Chiyan
 
Satish SN
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
u need to mention the servlet information in the web.xml of the web application u can find the same in the examples of the tomcat
 
Frederik Ericsson
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kumar,
I did. eventhough....
Sethu.
 
shri mon
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have not stated your problem clearly.

Where in the tomcat directory have you installed your app

It should be under webapps directory



Thanks,
Shrimon.
 
Frederik Ericsson
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I put the class file in the classes directory

C:..../webapps/chapter1/WEB-INF/classes

and I put the xml file in the WEB-INF directory.

Actually i have created these (chapter1/WEB-INF/classes) directories.

Tel me whz the pb now??

bye
Sethu.
 
shri mon
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sethu please give the entire statck trace of the error you are getting.

And also the url you typed in the browser.
So that i get a picture of the directory structure.



Thanks,
Shrimon.
 
S.L.Narayanan
Ranch Hand
Posts: 431
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can u tell us the things that are getting printed on the command line when u start ur Tomcat?...If they are related with the web.xml file then it means that either you made a mistake in that file or u didnt follow the order of declaration...If the problem is due to the order of declaration, Tomcat itself will show the acceptable order while starting it...

It would be better for me if u can post the contents of the web.xml file...
 
Frederik Ericsson
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Shri,

type Status report

message /chapter1/servlet/HelloWorldServlet

description The requested resource (/chapter1/servlet/HelloWorldServlet) is not available.

URL: http://localhost:8080/chapter1/servlet/HelloWorldServlet

Thankx,
Sethu.
 
Frederik Ericsson
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Narayanan,


at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.rootElementSpecified(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source)
at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java.260)
at org.apache.catalina.core.StandardHost.install(StandardHostDeployer.java.741)

going on.....nealy 100 lines

XML file

<web-app>
<servlet>
<servlet-name>HelloWorldServlet</servlet-name>
<servlet-class>HelloWorldServlet</servlet-class>
</servlet>
</web-app>

Actually whenever am running the tomcat it shows these many lines.

pl help me to get rid of it.

Thx buddy
Sethu.
 
S.L.Narayanan
Ranch Hand
Posts: 431
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sethu

Where is the <servlet-mapping> in your DD. Have u missed that or didnt type here?...

From ur DD i could infer that you are putting HelloWorld.class file inside the WEB-INF/classes with out creating any subfolders. But why <servlet-mapping> is missing in the DD?...

So do the following if u have not done..

(1).Put the HelloWorldServlet.class file inside $APACHE_WEBAPP/Chapter1/WEB-INF/classes.
(2).Modify the web.xml file as follows:


(3). Start Apache Tomcat.
(4). Type http://localhost:8080/Chapter1/HelloServlet.do.

This should work.
[ June 14, 2005: Message edited by: S.L.Narayanan ]
 
shri mon
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have a malformed web.xml.

You should have the servlet mapping tag in your web.xml

<servlet-mapping>
<servlet-name>HelloWorldServlet</servlet-name>
<url-pattern>/HelloWorldServlet</url-pattern>
</servlet-mapping>

add these lines and then try again
It should work


Thanks,
Shrimon.
 
Frederik Ericsson
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Guys,

am getting the same error.

description The requested resource(/chapter1/HelloServlet.do) is not available

I did the changes. my class file is in classes dir

do help me.
Sethu.
 
S.L.Narayanan
Ranch Hand
Posts: 431
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have a folder structure like this?

X:>../Apache Tomcat/webapps/Chapter1/WEB-INF/classes/HelloWorldServlet.class

X:>../Apache Tomcat/webapps/Chapter1/WEB-INF/web.xml

And try to replace the contents of web.xml with the contents that i have given in my previous message.

And also tell me whether still u r getting the error while starting tomcat..
 
Frederik Ericsson
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Narayanan,

dir struct is exactly like this,
Still getting same error

bye
 
S.L.Narayanan
Ranch Hand
Posts: 431
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not understand why this problem comes for u? ...Same thing is working fine in my system. Anyone else faced with this kind of problem preiously?...
 
S.L.Narayanan
Ranch Hand
Posts: 431
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sethu
You told that u are able to get the index page of Apache Tomcat after starting it...now try to run any of the servlet examples given in it and try to execute them...if they are running, problem is with ur part only...
[ June 14, 2005: Message edited by: S.L.Narayanan ]
 
Frederik Ericsson
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
do I need to put my Chapeter dir inside the ROOT dir???
 
S.L.Narayanan
Ranch Hand
Posts: 431
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No need...

But check whether u r already having a folder named Chapter1 inside ROOT...if so then delete / rename it...
 
Frederik Ericsson
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no I did not have previously
 
Frederik Ericsson
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can able to browse normal html file thru browser

http://localhost:8080/hello.html

but not the servlet
 
S.L.Narayanan
Ranch Hand
Posts: 431
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try changing ur folder name to something else than Chapter1...this is the final thing that i can tell u...i could not find out why it is failing in ur machine?...Are u able to run the servlet examples?
 
Frederik Ericsson
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
where is the servlet example???
 
shri mon
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do not type .do

Just use HelloWorldServlet


Thanks,
Shrimon.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic