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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T19:28:13+00:00 2026-05-29T19:28:13+00:00

I have a simple Action class which I want to unit test: package com.gam.action.test;

  • 0

I have a simple Action class which I want to unit test:

package com.gam.action.test;
import org.apache.struts2.StrutsTestCase;

public class HelloWorldActionTest extends StrutsTestCase{

    /**
     * Test method for {@link com.gam.action.HelloWorldAction#execute()}.
     */
    public void testExecute() {
        fail("Not yet implemented");
    }

}

I’ve created this test case using JUnit wizard in eclipse. I get the following error when I run the test:

Class: com.opensymphony.xwork2.spring.SpringObjectFactory
File: SpringObjectFactory.java
Method: getClassInstance
Line: 230 - com/opensymphony/xwork2/spring/SpringObjectFactory.java:230:-1
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:449)
    at org.apache.struts2.util.StrutsTestCaseHelper.initDispatcher(StrutsTestCaseHelper.java:54)
    at org.apache.struts2.StrutsTestCase.initDispatcher(StrutsTestCase.java:196)
    at org.apache.struts2.StrutsTestCase.setUp(StrutsTestCase.java:182)
    at junit.framework.TestCase.runBare(TestCase.java:132)
    at junit.framework.TestResult$1.protect(TestResult.java:110)
    at junit.framework.TestResult.runProtected(TestResult.java:128)
    at junit.framework.TestResult.run(TestResult.java:113)
    at junit.framework.TestCase.run(TestCase.java:124)
    at junit.framework.TestSuite.runTest(TestSuite.java:243)
    at junit.framework.TestSuite.run(TestSuite.java:238)
    at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.NullPointerException
    at com.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance(SpringObjectFactory.java:230)
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyResultType(XmlConfigurationProvider.java:538)
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addResultTypes(XmlConfigurationProvider.java:509)
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:465)
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:278)
    at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:112)
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:204)
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:390)
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:436)
    ... 17 more

The problem is I don’t know which jar files should be provided. I’m not using spring in my project but if I don’t provide spring jar files I get some error and when I provide it I get this one.
What combination of jar files are needed to simply run the test! (As you can see I’ve degraded my test method to a dummy method.)

  • 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-29T19:28:16+00:00Added an answer on May 29, 2026 at 7:28 pm

    The struts2-junit-plugin introduces its own dependencies, shown by this Maven output:

    [INFO] +- org.apache.struts:struts2-junit-plugin:jar:2.3.1:compile
    [INFO] |  +- org.springframework:spring-test:jar:3.0.5.RELEASE:compile
    [INFO] |  +- org.springframework:spring-core:jar:3.0.5.RELEASE:compile
    [INFO] |  |  +- org.springframework:spring-asm:jar:3.0.5.RELEASE:compile
    [INFO] |  |  \- commons-logging:commons-logging:jar:1.1.1:compile
    [INFO] |  +- org.springframework:spring-context:jar:3.0.5.RELEASE:compile
    [INFO] |  |  +- org.springframework:spring-aop:jar:3.0.5.RELEASE:compile
    [INFO] |  |  |  \- aopalliance:aopalliance:jar:1.0:compile
    [INFO] |  |  +- org.springframework:spring-beans:jar:3.0.5.RELEASE:compile
    [INFO] |  |  \- org.springframework:spring-expression:jar:3.0.5.RELEASE:compile
    [INFO] |  \- junit:junit:jar:4.8.2:compile
    

    It sounds like you’re not using Maven, which is almost certainly a Bad Idea. Managing transitive dependencies yourself is not terribly entertaining–save yourself some time and manual labor.

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

Sidebar

Related Questions

I want to create simple dummy tag which can work with Struts2. I have
I have simple SSIS package which reads data from flat file and insert into
For a simple action class with these member variables: ... private TestConverterEnum test; private
I want to make a simple action in which when i press a button
I have a map with only one annotation.I created a simple class which I
I have a simple c2dm message receiver class which is called whenever the device
I have a simple email address sign up form as follows: <form action= id=newsletterform
I have a simple form like this: <form name=serachForm method=post action=/home/search> <input type=text name=searchText
I have simple form. <form target=_blank action=somescript.php method=Post id=simpleForm> <input type=hidden name=url value=http://...> <input
I have controller which gets list of keys and i want to pass them

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.