Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8226139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T15:39:41+00:00 2026-06-07T15:39:41+00:00

what was i doing wrong ?? I am running Apache tomcat 7 as a

  • 0

what was i doing wrong ??

I am running Apache tomcat 7 as a service in win 7

my jsp code […\webapps\test\index.jsp ]

<jsp:useBean id="Counter" scope="session" class="aaa.Counter" />
<html>
<title>sfcsv</title>

<%
    try{
        int x = Counter.read_count(),z = Counter.get_id();
        if(x%2==0)
            out.println(x + " = even");
        else
            out.println(x + " = odd");

        out.println(z);
    }catch(Exception e){
    out.println(e);
    }
%>


</html>

the java code [..\webapps\test\WEB-INF\classes\aaa\Counter.java ]

package aaa;

public class Counter {

    private int count;
    private static int instance_counter;
    private final int id;

    public Counter(){
        instance_counter ++;
        id = instance_counter;
        count = 0;
    }

    public int read_count(){
        return count++;
    }

    public int get_id(){
        return id;
    }

}

expected output :

24 = even    1

output that I was getting :

24 = even      

or

HTTP Status 500 - Unable to compile class for JSP: An error occurred at line: 8 in the jsp file: /index.jsp The method     get_id() is undefined for the type Counter 5: 6: <% 7: try{ 8: int x = Counter.read_count(),z = Counter.get_id(); 9:     if(x%2==0) 10: out.println(x + " = even"); 11: else Stacktrace:

type Exception report

message Unable to compile class for JSP: An error occurred at line: 8 in the jsp file: /index.jsp The method get_id()     is undefined for the type Counter 5: 6: <% 7: try{ 8: int x = Counter.read_count(),z = Counter.get_id(); 9: if(x%2==0)     10: out.println(x + " = even"); 11: else Stacktrace:

description The server encountered an internal error (Unable to compile class for JSP: An error occurred at line: 8 in     the jsp file: /index.jsp The method get_id() is undefined for the type Counter 5: 6: <% 7: try{ 8: int x =     Counter.read_count(),z = Counter.get_id(); 9: if(x%2==0) 10: out.println(x + " = even"); 11: else Stacktrace:) that     prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: 8 in the jsp file: /index.jsp
The method get_id() is undefined for the type Counter
5: 
6: <%
7:  try{
8:      int x = Counter.read_count(),z = Counter.get_id();
9:      if(x%2==0)
10:             out.println(x + " = even");
11:         else


Stacktrace:
    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:102)
    org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:331)
    org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:469)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:378)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.29 logs.

Apache Tomcat/7.0.29

EDIT: On restarting the computer the problem vanished

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T15:39:42+00:00Added an answer on June 7, 2026 at 3:39 pm

    You already solved your problem but here are the appropriate options to get all your classes and JSP files to be reloaded or recompiled which might help in understanding what was going on in your case:

    Refreshing Java classes – Be sure to recompile your classes after applying changes to them. Also see the reloadable option for you web application context (default is false).

    Set to true if you want Catalina to monitor classes in /WEB-INF/classes/ and /WEB-INF/lib for changes, and automatically reload the web application if a change is detected.


    Refreshing JSP files – Please see the Tomcat Jasper docs for details on the development variable (defaults to true so I guess this is its value in your case) and the modificationTestInterval variable (defaults to 4 seconds) with which you may set the interval in which JSP files are checked for changes and compiled if necessary. Both are usually set in $CATALINA_BASE/conf/web.xml.

    Is Jasper used in development mode? If true, the frequency at which JSPs are checked for modification may be specified via the modificationTestInterval parameter.true or false, default true.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

what am I doing wrong in this code.. I should get the class name
I have Sventon running on port 8090 of my server under Apache Tomcat. I
what am I doing wrong? Tried this in the console, and yet the typeahead
What am I doing wrong? Im trying to send a email using c# with
What am I doing wrong? I have a CheckBoxList and I want to handle
What am I doing wrong? #include <vector> #include <boost/graph/adjacency_list.hpp> #include <boost/graph/dijkstra_shortest_paths.hpp> using namespace std;
What am I doing wrong? FGallery is not starting in thumbnail view? FotosGalleryViewController *vc
What am I doing wrong? I expected the Java program to print private. My
What am I doing wrong here folks? <?php include 'header.php'; /** * Display a
What am I doing wrong here? I'm trying to get started with jQuery UI

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.