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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:39:26+00:00 2026-06-12T23:39:26+00:00

I am practicing with Spring, and am getting a java.lang.ExceptionInInitializerError exception when I try

  • 0

I am practicing with Spring, and am getting a java.lang.ExceptionInInitializerError exception when I try to instantiate the context. The Exception appears below, with my code following it. I have simplified my experiment from before.

The Exception

Oct 17, 2012 5:54:22 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@570c16b7: startup date [Wed Oct 17 17:54:22 CDT 2012]; root of context hierarchy
Exception in thread "main" java.lang.ExceptionInInitializerError
at org.springframework.context.support.AbstractRefreshableApplicationContext.createBeanFactory(AbstractRefreshableApplicationContext.java:195)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:128)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:535)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:449)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
at helloworld.HelloWorldTest.main(HelloWorldTest.java:13)
Caused by: java.lang.NullPointerException
at org.springframework.beans.factory.support.DefaultListableBeanFactory.<clinit>(DefaultListableBeanFactory.java:105)
... 7 more

My configuration XML

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:c="http://www.springframework.org/schema/c"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">

<bean id="messageContainer" class="helloworld.MessageContainer">
    <property name="message" value="Hello World">
    </property>
</bean>

<bean id="messageOutputService" class="helloworld.MessageOutputService">
</bean>

My test class.

package helloworld;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class HelloWorldTest {

/**
 * @param args
 */
public static void main(String[] args)
{
    ApplicationContext context = new ClassPathXmlApplicationContext("HelloWorldTest-context.xml");

    MessageContainer message = context.getBean(MessageContainer.class);

    MessageOutputService service = context.getBean(MessageOutputService.class);

    service.outputMessageToConsole(message);

}

}
  • 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-12T23:39:27+00:00Added an answer on June 12, 2026 at 11:39 pm

    Line 17 does not correspond to the context.getBean("userRepository" line, it corresponds to the line before that where you initialize the Spring context. And actually you can also see that through stacktrace, it says it failed on Line 83 of ClassPathXmlApplicationContext where exists the constructor of that class.

    Anyway, this exception is generally thrown when Spring can not create any bean for whatever reason (Exceptions in constructors, resource loading issues, class loading issues, etc.). I would suggest decreasing the log level for spring classes and for your own libraries to see what’s going on underneath.

    org.springframework=TRACE
    com.gamemanagertest=TRACE
    com.gamemanagertest=TRACE
    

    And also check your resource files whether they’re accessible by your application and constructors of all your objects if they produce any errors, etc.

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

Sidebar

Related Questions

practicing programming with MyProgrammingLab and getting following compile error: ApartmentBuilding.java:4: error: expected its also
When I run the following code, I get an error. package practicing.io; import java.io.FileInputStream;
I'm practicing my gui skills with Java and I have been doing menus and
While practicing a tutorial on GTK+ I have encountered sample code that looks like
Hello i'm practising C and i have a little problem with the following code.
I am running the following code to try and read from a text file.
Practicing what is written here: ScalaForms , I have created the following form: val
I am practicing using GUIs. I have been following a set of instructions however
Started practicing with XML and C# and I have an error message of There
I am practicing at getting consistent with my error handling, and I keep hoping

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.