aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Error on my first aplication 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 "Error on my first aplication" Watch "Error on my first aplication" New topic
Author

Error on my first aplication

Caio Marcelo
Greenhorn

Joined: Jun 26, 2011
Posts: 6
Hello for everybody... I bought the Head First! Servlets and JSP on these days. I had been installed the Tom Cat 5.5 (the version 6 or above don't executes of any ways on my Windows 7, and my friends talked with me that this version is the best), and i can see the index.jsp normally.

One problem have happened... I created all the directory files that the book says, created the web.xml and placed it on WEB-INF. I maked the same with form.html, but I placed it in the correct folder.

When I tested the archive "form.html" (in the http://localhost8080/Beer-v1/form.html), my Tomcat says that the requested resource () is not available. Can anyone help me please?

PS.: Sorry for my bad english...
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1717
    
  25

Hi Marcelo,

Welcome to javaranch!

Mostly the error you are getting is because of a directory structure error or a type error somewhere in the URL or HTML form. Try to follow this instruction and see if your problem gets solved. If not, please post you code here and use the [Code] button when adding code to your reply.

Regards,
Frits
Caio Marcelo
Greenhorn

Joined: Jun 26, 2011
Posts: 6
Thank you, but my troubles isn't with the servlet, because I can't open just a simple HTML on my TomCat. I create both the fallow structure of folders:



I have all others default folders of Tomcat... Now the other structure the book wants:



Here's the web.xml code:



And them the form.html code:



PS.: The form.html code was tested in Mozilla Firefox, IE and Opera... All those browsers the archive are executed normally.
PS².: Sorry for my bad english again.

Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1717
    
  25

Thank you, but my troubles isn't with the servlet, because I can't open just a simple HTML on my TomCat


Maybe I am not getting you, but do you mean that you are expecting Tomcat to open an internal browser? But you also mention that you tested the html on all the browsers? Did you just open the file directly?

Is the URL wrong?
http://localhost8080/Beer-v1/form.html

should be:
http://localhost:8080/Beer-v1/form.html

Regards,
Frits
Caio Marcelo
Greenhorn

Joined: Jun 26, 2011
Posts: 6
No, I don't try anything you mean
URL isn't wrong, really :/
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3855

...URL isn't wrong, really

As Frits noted what URL you really accessed? Can you show us your browser screen with the URL while you get this error?


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Caio Marcelo
Greenhorn

Joined: Jun 26, 2011
Posts: 6
Ya, sure, I can ^^

http://i55.tinypic.com/208fcbb.png
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3855

And the directory structure inside Tomcat/webapps? What modifications in your web.xml and any in the configurations globally (conf/server.xml etc...)?
Caio Marcelo
Greenhorn

Joined: Jun 26, 2011
Posts: 6
All they're like the book says... I make all the steps again, but continue with the error... This is the web.xml (in WEB-INF):

Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3855

Are these (looks like apostrophe) characters in front of tags in your real web.xml too? Have you checked the logs ($TOMCAT_HOME/logs) for any failures? Probably you might want to look in to that? Make a fresh start of the server and check the logs.
Abhay Agarwal
Ranch Hand

Joined: Feb 29, 2008
Posts: 1212
    
    1

check in Tomcat Manager console whether Beer-v1 got successful added in deployed project list or not.
Problem seems to be that Beer-v1 is not successfully deployed.

~ abhay


Oracle Java Web Service Developer (1z0-897), Oracle certified Java 7 Programmer, SCJA 1.0, SCJP 5.0, SCWCD 5.0, Oracle SQL Fundamentals I, CIW Certified Ecommerce specialist
Caio Marcelo
Greenhorn

Joined: Jun 26, 2011
Posts: 6
Vijitha Kumara wrote:Are these (looks like apostrophe) characters in front of tags in your real web.xml too? Have you checked the logs ($TOMCAT_HOME/logs) for any failures? Probably you might want to look in to that? Make a fresh start of the server and check the logs.


Yeah, the code in the book uses that apostrophe. My Logs don't have much things, also .txt archives that says when TomCat started the service or stopped.

Abhay Agarwal wrote:check in Tomcat Manager console whether Beer-v1 got successful added in deployed project list or not.
Problem seems to be that Beer-v1 is not successfully deployed.

~ abhay


And how I can check Tomcat Manager?
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3855

Caio Marcelo wrote:
Vijitha Kumara wrote:Are these (looks like apostrophe) characters in front of tags in your real web.xml too? Have you checked the logs ($TOMCAT_HOME/logs) for any failures? Probably you might want to look in to that? Make a fresh start of the server and check the logs.

Yeah, the code in the book uses that apostrophe. My Logs don't have much things, also .txt archives that says when TomCat started the service or stopped.

No apostrophe can be placed there, you must have parser exceptions in logs. What ".txt archives" are you talking about?
And how I can check Tomcat Manager?

Go to the tomcat home (http://localhost:<port>;) you will find a link on the top left under the "Administration". Just click that then you'll be presented the login.
Note: To enable manager login you have to edit the <Tomcat Home>/conf/tomcat-users.xml file as described in here.
Jorge Iparraguirre
Greenhorn

Joined: Jul 28, 2011
Posts: 2
Hi Marcelo:
I think I am newer than you I just bought the book yesterday and I am still in the Chapter1 exercise. Didn't you have any trouble with it???
I did all exactly as the book says and I am having that "type Status report", "message " and "description The requested resource () is not available" errors.
here is my java code:
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

public class Ch1Servlet extends HttpServlet {

public void doget(HttpServletRequest request,
HttpServletResponse response)
throws IOException {
PrintWriter out = response.getWriter();
java.util.Date today = new java.util.Date();
out.println("<html>" +
"<body>" +
"<h1 align=center>HF\' Chapter1 Servlet</h1>" +
"<br>" + today + "</body>" + "</html>");
}
}

It compiled good. I did both directory structures as the book says and I put the files in the right place.
here is my xml file:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<servlet>
<servlet-name>Chapter1 Servlet</servlet-name>
<servlet-class>Ch1/WEB-INF\classes\Ch1Servlet</servlet-class>

<servlet-mapping>
<servlet-name>Chapter1 Servlet</servlet-name>
<url-pattern>Serv1</url-pattern>
</servlet-mapping>
</web-app>

my class file in C:\Tomcat\webapps\ch1\WEB-INF\classes
and xml file in C:\Tomcat\webapps\ch1\WEB-INF
I point my browser to this:http://localhost:8080/ch1/Serv1
and I got the error.

Please do you or somebody else have an Idea of what could be happening.

Thank you
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3855

Welcome to CodeRanch, Jorge Iparraguirre!

You may post your question in separate thread. And please make sure you use code tags (UseCodeTags) when posting code in the forums. Unformatted code makes it harder to read.

If this is the exact code you have in there then you have missed the end servlet tag in the web.xml... Can you check the logs whether any deployment errors exist (<TomcatHome>/logs/)?
Jorge Iparraguirre
Greenhorn

Joined: Jul 28, 2011
Posts: 2
Thank you very much Vijitha Kumara.
Yeah, that was it and it is Ok now.
Sorry I didn’t know about the use of these code tags.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error on my first aplication