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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:14:01+00:00 2026-06-18T03:14:01+00:00

i have a problem is: java.lang.Exception: ServletConfig has not been initialized I searched for

  • 0

i have a problem is:

java.lang.Exception: ServletConfig has not been initialized

I searched for it nearly 2 days but i did not have a solution for me. Every one had said that
super.init(config) must be used. I have tried this, but there is nothing change for me.

My init method;

@Override
public void init(ServletConfig config) throws ServletException {

    super.init(config);

    AppServiceServlet service = new AppServiceServlet();
    try {
        service.getir();
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    AutoCheckStatus.autoCheckStatus(600000);
}

and my AppServiceServlet;

    public List<SswAppServiceDto> getir() throws Exception {
    try {
        final WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(this
                .getServletContext());
        setiAppServiceBusinessManager((IAppServiceBusinessManager) context.getBean(BEAN_ADI));

        List<SswAppService> result = getiAppServiceBusinessManager().getir();

        List<SswAppServiceDto> list = DtoConverter.convertSswAppServiceDto(result);

        for (int i = 0; i < result.size(); i++) {
            AppService appService = new AppService();
            appService.setServiceName(result.get(i).getName());
            appService.setUid(result.get(i).getServiceUid());
            appService.setHost(result.get(i).getHost());
            appService.setPort((int) result.get(i).getPort());
            SystemConfiguration.appServiceList.put(appService.getUid(), appService);
        }
        return list;

    } catch (RuntimeException e) {
        throw new Exception(e.getMessage(), e.getCause());
    }
}

The exception is thrown in this line;

          final WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());

in AppServiceServlet and says:

java.lang.Exception: ServletConfig has not been initialized.

Pls help.

  • 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-18T03:14:03+00:00Added an answer on June 18, 2026 at 3:14 am

    This call:

    AppServiceServlet service = new AppServiceServlet();
    

    Instantiates a servlet instance via new, which circumvents the normal, container managed creation of a servlet. As such, critical class variables (for example, the servlet config) don’t get properly initialized.

    Later on, you are making a call to getServletContext, which simply redirects to getServletConfig().getServletContext(), but because the servlet configuration was never completed you get an exception.

    Infact, calling new on a servlet the way you are is non-compliant with the specification – servlets are supposed to be maintained by the web app container. The proper way to launch a startup servlet is either via configuration in your web.xml file, or via annotation.

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

Sidebar

Related Questions

Seem to have a problem starting my Java app: Exception in thread main java.lang.NoClassDefFoundError:
I have a problem when my GCMIntentService is called, an exception is thrown: java.lang.ClassCastException:
I have a problem with my Java progam suddenly exiting, without any exception thrown
I have a erratic problem with Java JMS. For moments works fine, but throws
I have some problem with my java application, I did build it with Eclipse
I have a problem with a junit ant build, i'm getting a java.lang.OutOfMemoryError: PermGen
I have a problem regarding java.lang.NoSuchMethodError. This program is about Compiler API (JSR 199).
I have a problem,I dont want show full stack-trace when an exception occurs but
So I have a problem where Java is telling me that the following line
Good evening ladies and gentlemen, I have a problem with Java Swing that I

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.