> > java.lang.NoClassDefFoundError: org/apache/tomcat/util/http/ServerCookie > > at > > org.apache.tomcat.util.http.Cookies.addCookie(Cookies.java:180, Compiled > > Code)
That's odd -- I can't find this package in the tomcat source distribution. Weird. Maybe this is in the "servlet api" package? but i thought that was no longer necessary with TC 4...ignore this if you don't know what i'm talking about. You seem to be using an apache connector. Maybe you should try just connecting to tomcat on its standalone port (http://localhost:8080/ if you haven't changed anything) and see what happens. This would be my first test. fillup On 5/24/02 11:46 AM, "Scott C Strecker" <[EMAIL PROTECTED]> wrote: > I am using the example program from the O'Reilly book > "Java Servlet Programming" by Jason Hunter. > > The code/servlet will run once and then hang. The > log file contains the error about the class ServletCookie > that I mention previous. > > Scott > > > ---------------- CODE ---------------------------- > > import java.io.*; > import java.text.*; > import java.util.*; > import javax.servlet.*; > import javax.servlet.http.*; > > > public class SessionTracker extends HttpServlet { > > public void doGet(HttpServletRequest req, HttpServletResponse res) > throws ServletException, IOException { > > res.setContentType("text/html"); > PrintWriter out = res.getWriter(); > > HttpSession session = req.getSession(); > > Integer count = (Integer)session.getAttribute("tracker.count"); > if(count == null) > count = new Integer(1); > else > count = new Integer(count.intValue() + 1 ); > > session.setAttribute("tracker.count",count); > > out.println("<html><head><title>Session Tracker</title></head>"); > out.println("<body><h1>Session Tracking Demo</h1>"); > > out.println("You have visited this page " + count + "time(s)"); > > out.println("<p>"); > > out.println("<h2>Here is your session data:</h2>"); > Enumeration enum = session.getAttributeNames(); > > while(enum.hasMoreElements()){ > String name = (String) enum.nextElement(); > out.println(name + ": " + session.getAttribute(name) + "<br>"); > } > > out.println("</body></html>"); > } > } > > ----------- END OF CODE ---------------------------------------- > > > Phillip Morelock wrote: >> >> please provide source code, or maybe at least the relevant lines. >> >> what is the fully qualified class name of your servlet? >> >> also if you send source code please include any "import" or "package" >> statement lines. >> >> fillup >> >> On 5/24/02 11:03 AM, "Scott C Strecker" <[EMAIL PROTECTED]> wrote: >> >>> I am trying to utilize Session Tracking in a servlet under tomcat 4.0.3. >>> When I try >>> a simple example I get the following error in my log file. >>> >>> java.lang.NoClassDefFoundError: org/apache/tomcat/util/http/ServerCookie >>> at >>> org.apache.tomcat.util.http.Cookies.addCookie(Cookies.java:180, Compiled >>> Code) >>> at >>> org.apache.tomcat.util.http.Cookies.processCookieHeader(Cookies.java:300, >>> Compiled Code) >>> at >>> org.apache.tomcat.util.http.Cookies.processCookies(Cookies.java:211, >>> Compiled Code) >>> at >>> org.apache.tomcat.util.http.Cookies.getCookieCount(Cookies.java:161, >>> Compiled Code) >>> at >>> org.apache.ajp.tomcat4.Ajp13Request.addCookies(Ajp13Request.java:184, >>> Compiled Code) >>> at >>> org.apache.ajp.tomcat4.Ajp13Request.setAjpRequest(Ajp13Request.java:146, >>> Compiled Code) >>> at >>> org.apache.ajp.tomcat4.Ajp13Processor.process(Ajp13Processor.java:417, >>> Compiled Code) >>> at >>> org.apache.ajp.tomcat4.Ajp13Processor.run(Ajp13Processor.java:495, >>> Compiled Code) >>> at java.lang.Thread.run(Thread.java:484, Compiled Code) >>> >>> Is this because of some setting in my configuration i.e. to turn >>> cookies on. Or am I missing a class >>> as the error seems to indicate. I have the stock setup for tomcat as it >>> came from the factory ( so to speak ). >>> I have not changed any settings on the tomcat web.xml. I was under the >>> impression that cookies=on was >>> the default. >>> >>> Any pointers would be much appreciated. >>> >>> Scott >>> >>> -- >>> To unsubscribe, e-mail: >>> <mailto:[EMAIL PROTECTED]> >>> For additional commands, e-mail: >>> <mailto:[EMAIL PROTECTED]> >>> >> >> -- >> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> >> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
