This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
I am trying to follow the code example in HeadFirst Servlet and JSP book to compile the first servlet (BeerSelect.java), although every time I enter the following command in the terminal:
You're forgetting to begin the path to your Java file with a slash: "/home/pav/..."
Also, why are you including the "classes" directory in your classpath when compiling...?? This is the directory you are storing the compiled class files in. You need these files to run the program, but not to compile it because compiling it is what creates these files in the first place!
Dependency? The "classes" directory he's including in the classpath is the one he's saving his compiled class files to. It makes no sense to include this in the classpath.
thirun pavan
Greenhorn
Joined: Jun 27, 2007
Posts: 22
posted
0
Hi All,
Thanks a lot for your help and time...please find my replies below:
Michael Angstadt: When I added the splash before home to be /home/pav, I got an error message:
javac: directory not found: classes
I am including classes as per the book, this line should compile and produce the new java class in the corresponding class directory
Now I tried again to remove classes from the line, to make it like this:
and it finally worked! Yet I am still confused why it didn't accept the -d directive?!!
Another amazing issue I've just found in this code is that now after it was compiled, and I've placed it exactly in the place they mentioned in the book, under tomcat/project directory/WEB-INF/classes when I try to load the project form using:
Please show us the actual Tomcat directory hierarchy and the web.xml. It's important to TellTheDetails, otherwise it's impossible for us to help.
thirun pavan
Greenhorn
Joined: Jun 27, 2007
Posts: 22
posted
0
David Newton wrote:Please show us the actual Tomcat directory hierarchy and the web.xml. It's important to TellTheDetails, otherwise it's impossible for us to help.
Thanks David for your reply, please find attached a screenshot for the Tomcat directory hierarchy, showing form.html which I am trying to load..
Also please find below code inside form.html
Please let me know if I should post any other info that can help, I am new here so I might not know everything that should be posted to help clarify my exact problem
I see no class files in your directory structure. But for non-pictures, please use text; it's a lot more convenient. Thanks!
thirun pavan
Greenhorn
Joined: Jun 27, 2007
Posts: 22
posted
0
Hi David,
Please find below the content of web.xml
Regarding classes, actually what's amazing here is that the book said that I should see the content of form.html even before compiling any class...which is what I am trying to do without any success
But anyway, there is only one class under /com/example/web/ folder with the name BeerSelect.class
Check the startup logs for any errors. Oh, and use the same case in the URL that you use for the directory name--you've shown /Beer-V1 instead of /Beer-v1 as your directory listing shows.
thirun pavan
Greenhorn
Joined: Jun 27, 2007
Posts: 22
posted
0
David Newton wrote:Check the startup logs for any errors. Oh, and use the same case in the URL that you use for the directory name--you've shown /Beer-V1 instead of /Beer-v1 as your directory listing shows.
Can you please elaborate what type of 'startup logs' you are pointing to? and if possible where they are located so that I can check them
I've already tried with /Beer-V1 and /Beer-v1 and even /beer-v1 and none of them worked
So any ideas?
Thanks in advance for your time and efforts
thirun pavan
Greenhorn
Joined: Jun 27, 2007
Posts: 22
posted
0
David,
I've searched the web for any reference to 'start logs' under Tomcat, or java and couldn't find anything...so can you please elaborate what are those 'start logs'?
Tomcat has a log (two, actually) under the "logs" directory. If there are startup errors, they're in those logs. Knowing about logging is very important.
thirun pavan
Greenhorn
Joined: Jun 27, 2007
Posts: 22
posted
0
Hi David,
I found two log files under /var/log/tomcat6/:
1. catalina.2010-08-03.log which happened to contain the following:
2. localhost.2010-08-03.log which happened to contain the following:
Keeping in consideration that I have no experience reading tomcat log files, I am not sure if it indicate any problem....so any idea what might be wrong in those log files? In other words doe they indicate any problem?