Alex George

Greenhorn
+ Follow
since Oct 31, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Alex George

Sorry about saying c was small letter. "c" was small letter in my Weblogic server and I didn't have access to the machine I have Tomcat. I thought I have the exact same name and structure on both of the machines(I wanted to have it that way). I looked at the file name on Weblogic and it was small c. So I said "small c".
Thank you so much for finding it out.
Anyway would you prefer one server over other?
Would I be able to learn ejbs, jdbc...etc on Tomcat
18 years ago
Don't worry I got the probelm solved.
Thanks.
Thank you so much Ben. It was because of the capital letter in �Classes�. I changed it to �classes� and it worked. I spend so much time on this and I got it solved in the end.
And NO it was not because of the capital �C� in Ch1.
My question about context root is that I set context root in Weblogic server in application.xml. Is there any file to set the context root in Tomcat? Or what ever under webapps is the default context root?
18 years ago
I think it was "classes" small c.
Is that a problem?
It is "classes" in my Weblogic server. It has to be "Classes" in Tomcat?
18 years ago
Hi Bert. I have one questio for you. I tried the first example in HFS&J in my Tomcat server. I followed the steps you have in the book. I am able to compile. But I don't see the output when I go to http://localhost:8080/ch1/Ch1serv
The whole issue is posted under Servlets section, started by Alex George.
This book is the best book in this area. Thank you very much and keep up good work.
I have another index.html page, which I can see when I go to http://localhost:8080. This page is under webapp/ROOT.
I have Tomcat5.0.28
My java version is 1.4 or later (well I think I have a couple of versions. Is that a problem?).
Given below is the error I am getting when I go to http://localhost:8080/Ch1/Ch1Servlet

type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Wrapper cannot find servlet class Ch1Servlet or a class it depends on org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118) org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160) org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705) org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577) org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683) java.lang.Thread.run(Thread.java:534)
root cause
java.lang.ClassNotFoundException: Ch1Servlet org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1340) org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1189) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118) org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160) org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799) org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577) org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683) java.lang.Thread.run(Thread.java:534)

I have one qustion. How does Tomcat know my context root is ch1?
18 years ago
Good to know that my code is working fine in your Tomcat server.
I am able to compile.
So there is something wrong in the way I deploy it. I basically created the following directory structure under webapp:
ch1/WEB-INF/src
/classes

I have web.xml in the WEB-INF folder.
I compiled the source code outside Tomcat and copy the class file into /classes.
Then restarted Tomcat.
Is there another file to set the context root? May be I should set the context root to "ch1", which I did when I deployed the servlet into Weblogic.
18 years ago
Another thing I want to tell everybody is that I am able to compile and deploy it on Weblogic. It is just something with Tomcat? Any clues
18 years ago
I was having some problems with some of the examples in HFS&J.
I am able to compile but not able to see if after deploying it.
I guess the compilation problem will go away if you set classpath.
Before you compile it set classpath
>set CLASSPATH=C:/path.../Tomcat/common/lib/servlet-api.jar
Then compile it without the classpath parameter.

Let me know if it helps.
18 years ago
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class Ch1Servlet extends HttpServlet{

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException{

java.util.Date today=new java.util.Date();
PrintWriter out = response.getWriter();
out.println("<html>");

out.println("<head>");
out.println("<title>Hello World!</title>");
out.println("</head>");

out.println("<body>");
out.println("<h1>Time is! "+today+" </h1>");
out.println("</body>");

out.println("</html>");

}
}
18 years ago
I am sorry to see where this is going. How can I get a real suggestion. There is something wrong going on when I deploy it. Can some body step in?
18 years ago
I am able to compile it. I compiled it and moved it into /path../Tomcat 5.0\webapps\Ch1\WEB-INF\Classes.
I have the following in my web.xml
<web-app>
<display-name>Examples</display-name>
<description>Examples</description>

<servlet>
<servlet-name>Chapter1 Servlet</servlet-name>
<servlet-class>Ch1Servlet</servlet-class>
</servlet>

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

But when I go to http://localhost:8080/Ch1/Ch1Servlet
I can not see my servlet.
18 years ago
My classpath pointing to
C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib\servlet-api.jar
May be I am pointing to the wrong place??
18 years ago
The problem is it complains about the javax package.
18 years ago
How can I compile and deploy a servlet into Tomcat? I tried a lot and gave up. First of all how can I compile using javac?
18 years ago