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 6706679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:32:56+00:00 2026-05-26T07:32:56+00:00

I get an exception whenever I try getting context parameter from we.XML into a

  • 0

I get an exception whenever I try getting context parameter from we.XML into a ServletContextListener class, I am really having hard times understanding why It is not working,
here’s the exception in Apache Tomcat 7.0.11 log :

 Oct 21, 2011 1:24:23 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class alaa.ServletContextListener
java.lang.ClassNotFoundException: alaa.ServletContextListener
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
at   
   org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:415)
at      

at    org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:118)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4618)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5184)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5179)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)

Here’s a part of my web.xml :

 <context-param>
    <param-name>catName</param-name>
    <param-value>meshmesh</param-value>
</context-param>
<context-param>
    <param-name>catBreed</param-name>
    <param-value>egyptian</param-value>
</context-param>  
<listener>
   <listener-class>alaa.CatLisenter</listener-class>
</listener>
<session-config>
      <session-timeout>
        30
      </session-timeout>
</session-config>

Here’s my ServletContextListener.java:

package alaa;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
public class CatLisenter implements ServletContextListener {

@Override
public void contextInitialized(ServletContextEvent sce) {
    ServletContext sc = sce.getServletContext();
    String name = sc.getInitParameter("catName");

    String breed = sc.getInitParameter("catBreed");

    Cat maCat = new Cat();
    maCat.setName(name);
    maCat.setBreed(breed);

    sc.setAttribute("cat", maCat);
}

@Override
public void contextDestroyed(ServletContextEvent sce) {
    throw new UnsupportedOperationException("Not supported yet.");
}   
}



Here's Cat.java : 





package alaa;

public class Cat {
private String name;
private String breed;


public String getName() {
    return name;
}

public void setName(String name) {
    this.name = name;
}

public String getBreed() {
    return breed;
}


public void setBreed(String breed) {
    this.breed = breed;
}
 }

many thanks 
  • 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-05-26T07:32:56+00:00Added an answer on May 26, 2026 at 7:32 am

    Try to clear the tomcat work directory and clean. After that, publish your project and run again.

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

Sidebar

Related Questions

Whenever I try to get a bitmap I have cached from the context I
I keep getting this exception (in the title) whenever I try to get the
I get this exception thrown whenever I try and submit data through a form
I get an error whenever I try to create a simple edge from a
I want to get Default Windows Forms Unhandled-Exception Dialog whenever my C# application encounters
I remove item from ArrayList in foreach loop and get follwing exception. Collection was
I keep getting an SerializationException whenever I try to deserialize a list of doubles
Whenever I try to copy a file that's bigger than 2GB, I get an
I get a run-time error NullPointerException whenever I try to click the options button
Whenever I try to post data values in PHP I get the following error:

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.