aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Basic Question???? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Basic Question????" Watch "Basic Question????" New topic
Author

Basic Question????

Frederik Ericsson
Ranch Hand

Joined: Apr 27, 2005
Posts: 128
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

Joined: Apr 19, 2005
Posts: 70
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


Satish SN<br />SCJP 1.4 & SCWCD 1.4
Frederik Ericsson
Ranch Hand

Joined: Apr 27, 2005
Posts: 128
Kumar,
I did. eventhough....
Sethu.
shri mon
Ranch Hand

Joined: Jan 11, 2005
Posts: 63
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

Joined: Apr 27, 2005
Posts: 128
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

Joined: Jan 11, 2005
Posts: 63
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

Joined: Apr 01, 2005
Posts: 431
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...


SCJP 1.4, SCWCD 1.4, SCBCD 1.3, NEXT--->IBM XML
Frederik Ericsson
Ranch Hand

Joined: Apr 27, 2005
Posts: 128
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

Joined: Apr 27, 2005
Posts: 128
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

Joined: Apr 01, 2005
Posts: 431
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

Joined: Jan 11, 2005
Posts: 63
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

Joined: Apr 27, 2005
Posts: 128
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

Joined: Apr 01, 2005
Posts: 431
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

Joined: Apr 27, 2005
Posts: 128
Narayanan,

dir struct is exactly like this,
Still getting same error

bye
S.L.Narayanan
Ranch Hand

Joined: Apr 01, 2005
Posts: 431
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

Joined: Apr 01, 2005
Posts: 431
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

Joined: Apr 27, 2005
Posts: 128
do I need to put my Chapeter dir inside the ROOT dir???
S.L.Narayanan
Ranch Hand

Joined: Apr 01, 2005
Posts: 431
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

Joined: Apr 27, 2005
Posts: 128
no I did not have previously
Frederik Ericsson
Ranch Hand

Joined: Apr 27, 2005
Posts: 128
I can able to browse normal html file thru browser

http://localhost:8080/hello.html

but not the servlet
S.L.Narayanan
Ranch Hand

Joined: Apr 01, 2005
Posts: 431
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

Joined: Apr 27, 2005
Posts: 128
where is the servlet example???
shri mon
Ranch Hand

Joined: Jan 11, 2005
Posts: 63
Do not type .do

Just use HelloWorldServlet


Thanks,
Shrimon.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Basic Question????