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

  • Home
  • SEARCH
  • 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 6783113
In Process

The Archive Base Latest Questions

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

I have the next problem: I am trying to deploy an application on my

  • 0

I have the next problem:
I am trying to deploy an application on my Tomcat 7.0 with jre 6.0…I created a servlet called ListenerTester:

    package com.example;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

class ListenerTester extends HttpServlet {

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

            response.setContentType("text/html");           
            PrintWriter out = response.getWriter();

            out.println("text context attributes set by listener<br />");
            out.println("<br />");

            Dog dog = (Dog) getServletContext().getAttribute("dog");

            out.println("The dog`s breed is: " + dog.getBreed());

        }


    }

Class dog is a simple class which has only one field String breed and getter and Constructor with the parameter.

Next class is the MyServletContextListener:

   package com.example;

import javax.servlet.*;

class MyServletContextListener implements ServletContextListener {

    public void contextInitialized(ServletContextEvent e) {

        ServletContext sc = e.getServletContext();

        String dogBreed = sc.getInitParameter("breed");
        Dog f = new Dog(dogBreed);      
        sc.setAttribute("dog", f);

    }

    public void contextDestroyed(ServletContextEvent e) {



    }

}

they are in the package called com.example. The top folder of the application is listenerTester.

web.xml:

    <?xml version="1.0" encoding="UTF-8"?>  

<web-app xmlns="http://java.sun.com/xml/ns/javaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
                      http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" 
  version="3.0" >  

<servlet>
    <servlet-name>ListenerTester</servlet-name>
    <servlet-class>com.example.ListenerTester</servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>ListenerTester</servlet-name>
    <url-pattern>/ListenTest.do</url-pattern>
</servlet-mapping>

<context-param>
    <param-name>breed</param-name>
    <param-value>Sparky</param-value>
</context-param>

<listener>
    <listener-class>com.example.MyServletContextListener</listener-class>
</listener>
</web-app>

The problem is the next – when I try to run it – the browser does not show anything…at all..no mistake or anything.

When I look inside the catalina log file:

    08.11.2011 0:23:56 org.apache.coyote.AbstractProtocolHandler init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
08.11.2011 0:23:56 org.apache.coyote.AbstractProtocolHandler init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
08.11.2011 0:23:56 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 331 ms
08.11.2011 0:23:56 org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
08.11.2011 0:23:56 org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.8
08.11.2011 0:23:56 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory listenerTest
08.11.2011 0:23:56 org.apache.catalina.core.StandardContext startInternal
**SEVERE**: Error listenerStart
08.11.2011 0:23:56 org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/listenerTest] startup failed due to previous errors
08.11.2011 0:23:56 org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler ["http-bio-8080"]
08.11.2011 0:23:56 org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
08.11.2011 0:23:56 org.apache.catalina.startup.Catalina start
INFO: Server startup in 233 ms

Could you please tell me what to do and what the mistake is? What is a listenerStart?

  • 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-26T16:49:33+00:00Added an answer on May 26, 2026 at 4:49 pm

    You should have your classes public instead of package-private.

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

Sidebar

Related Questions

I'm trying to get a regexp to solve the next problem: I have some
Greetings, I have problem with errorPlacement, I'm trying to place the error message next
I have the next problem: I need to process only 1 request at a
I have the next problem. In one of the cells (UITableViewCell) I need to
I have the following problem: We need to find the next august. I other
I have a small problem where I want to find the next active item
I have the following problem: list.c struct nmlist_element_s { void *data; struct nmlist_element_s *next;
I have a problem when trying to update foreign keys. Using the merge function
I have the following problem, I am trying to find the following distances (F1
I have a next problem. When I'm running project from NetBeans IDE evrything is

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.