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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:26:48+00:00 2026-05-24T20:26:48+00:00

I’m trying to run a TestNG+Spring+JPA+Hibernate ‘Hello World’ test. The execution results in a

  • 0

I’m trying to run a TestNG+Spring+JPA+Hibernate ‘Hello World’ test. The execution results in a NullPointerException, the tiles configurer bean fails.

The exception:

2011-08-20 18:12:18,547 [main] INFO  org.springframework.web.servlet.view.tiles2.TilesConfigurer  - TilesConfigurer: adding definitions [/WEB-INF/tiles/tiles.xml]
        2011-08-20 18:12:18,552 [main] INFO  org.springframework.beans.factory.support.DefaultListableBeanFactory  - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@68cb6b: defining beans [org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler#0,org.springframework.security.access.method.DelegatingMethodSecurityMetadataSource#0,org.springframework.security.access.vote.AffirmativeBased#0,org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor#0,org.springframework.security.methodSecurityMetadataSourceAdvisor,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter,org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0,org.springframework.web.servlet.handler.SimpleUrlHandlerMapping#0,nethawalaDS,jspViewResolver,tilesViewResolver,tilesConfigurer,nethawalaEMF,transactionManager,jpaVendorAdapter,validator,auditLog,org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor#0,logoutHandlerBean,userDetailsService,customAuthenticationFailureHandlerBean,customAuthenticationSuccessHandlerBean,httpSessionEventListener,org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0,org.springframework.format.support.FormattingConversionServiceFactoryBean#0,org.springframework.validation.beanvalidation.LocalValidatorFactoryBean#0,org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter#0,org.springframework.web.servlet.handler.MappedInterceptor#0,org.springframework.scheduling.annotation.internalAsyncAnnotationProcessor,org.springframework.scheduling.annotation.internalScheduledAnnotationProcessor,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,homeController,userSessionController,NHUserDAOImpl,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,nethawalaProperties,placeholderConfig]; root of factory hierarchy
        2011-08-20 18:12:18,563 [main] ERROR org.springframework.test.context.TestContextManager  - Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@fdfc58] to prepare test instance [com.tigermindz.test.FacultyDaoTest@1afae45]
        java.lang.IllegalStateException: Failed to load ApplicationContext
            at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:308)
            at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)
            at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
            at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:321)
            at org.springframework.test.context.testng.AbstractTestNGSpringContextTests.springTestContextPrepareTestInstance(AbstractTestNGSpringContextTests.java:133)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:76)
            at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:525)
            at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:202)
            at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:130)
            at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:173)
            at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:105)
            at org.testng.TestRunner.runWorkers(TestRunner.java:1147)
            at org.testng.TestRunner.privateRun(TestRunner.java:749)
            at org.testng.TestRunner.run(TestRunner.java:600)
            at org.testng.SuiteRunner.runTest(SuiteRunner.java:317)
            at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:312)
            at org.testng.SuiteRunner.privateRun(SuiteRunner.java:274)
            at org.testng.SuiteRunner.run(SuiteRunner.java:223)
            at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
            at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
            at org.testng.TestNG.runSuitesSequentially(TestNG.java:1039)
            at org.testng.TestNG.runSuitesLocally(TestNG.java:964)
            at org.testng.TestNG.run(TestNG.java:900)
            at org.testng.TestNG.privateMain(TestNG.java:1182)
            at org.testng.TestNG.main(TestNG.java:1146)
        Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tilesConfigurer' defined in class path resource [nethawala-servlet.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
            at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
            at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
            at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
            at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
            at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
            at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
            at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
            at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:84)
            at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:1)
            at org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:280)
            at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:304)
            ... 28 more
        Caused by: java.lang.NullPointerException
            at org.springframework.web.servlet.view.tiles2.SpringTilesApplicationContextFactory$SpringWildcardServletTilesApplicationContext.(SpringTilesApplicationContextFactory.java:72)
            at org.springframework.web.servlet.view.tiles2.SpringTilesApplicationContextFactory.createApplicationContext(SpringTilesApplicationContextFactory.java:55)
            at org.springframework.web.servlet.view.tiles2.TilesConfigurer.afterPropertiesSet(TilesConfigurer.java:335)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
            ... 41 more

My applicationContext.xml, only showing the tiles config bean def:

<bean id="tilesConfigurer"
class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
<property name="definitions">
    <list>
        <value>/WEB-INF/tiles/tiles.xml</value>
    </list>
</property>
</bean>

Did a lot of googling, only thing found, people mentioned about cglib and/or asm jars in conflict with spring and hibernate dependencies. I don’t think that is applicable here however my lib folder has the following jars, sorry not in order:

    ./tiles-template-2.2.2.jar
    ./spring-security-acl-3.0.5.RELEASE.jar
    ./org.springframework.context-3.0.5.RELEASE.jar
    ./hibernate-jpa-2.0-api-1.0.0.Final.jar
    ./tiles-api-2.2.2.jar
    ./validation-api-1.0.0.GA.jar
    ./org.springframework.web.servlet-3.0.5.RELEASE.jar
    ./hsqldb.jar
    ./spring-security-taglibs-3.0.5.RELEASE.jar
    ./commons-pool-1.5.6.jar
    ./aspectjrt-1.6.8.jar
    ./commons-beanutils-1.8.3.jar
    ./org.springframework.aop-3.0.5.RELEASE.jar
    ./spring-security-core-3.0.5.RELEASE.jar
    ./commons-collections-3.1.jar
    ./org.springframework.web-3.0.5.RELEASE.jar
    ./jstl-1.2.jar
    ./org.springframework.expression-3.0.5.RELEASE.jar
    ./dom4j-1.6.1.jar
    ./org.springframework.orm-3.0.5.RELEASE.jar
    ./log4j-1.2.16.jar
    ./org.springframework.beans-3.0.5.RELEASE.jar
    ./tiles-servlet-2.2.2.jar
    ./poi-3.7-20101029.jar
    ./spring-security-aspects-3.0.5.RELEASE.jar
    ./slf4j-api-1.6.1.jar
    ./aopalliance-1.0.jar
    ./slf4j-simple-1.6.1.jar
    ./hibernate3.jar
    ./slf4j-ext-1.6.1.jar
    ./spring-security-web-3.0.5.RELEASE.jar
    ./jta-1.1.jar
    ./asm-3.3.1.jar
    ./org.springframework.test-3.0.5.RELEASE.jar
    ./spring-security-config-3.0.5.RELEASE.jar
    ./org.springframework.core-3.0.5.RELEASE.jar
    ./org.springframework.asm-3.0.5.RELEASE.jar
    ./tiles-jsp-2.2.2.jar
    ./testng-6.0.1.jar
    ./commons-digester-2.1.jar
    ./commons-logging-1.1.1.jar
    ./org.springframework.transaction-3.0.5.RELEASE.jar
    ./javax.inject.jar
    ./commons-dbcp-1.4.jar
    ./slf4j-log4j12-1.6.1.jar
    ./hibernate-validator-4.1.0.Final.jar
    ./javassist-3.12.0.GA.jar
    ./tiles-core-2.2.2.jar
    ./aspectjweaver-1.6.8.jar
    ./org.springframework.jdbc-3.0.5.RELEASE.jar
    ./jackson-all-1.7.5.jar
    ./jstl-api-1.2.jar
    ./antlr-2.7.6.jar
    ./cglib-2.2.jar

The test class is as follows:

@ContextConfiguration(locations = { "classpath:test-servlet.xml" })
public class FacultyDaoTest extends AbstractTransactionalTestNGSpringContextTests {

    private final XLogger logger = XLoggerFactory.getXLogger(FacultyDaoTest.class);

    @Inject
    FacultyDAO facultyDao;

    @BeforeClass
    public void setUp() {
        logger.entry();    
        System.out.println("Inside setup");    
    }

    @Test(groups = { "fast" })
    @Rollback(value = false)
        public void createFaculty() {
        Faculty f = new Faculty();
        f.setFirstName("John");
        f.setLastName("Frost");
        f.setCpsoNumber("23198");

        f = facultyDao.makePersistent(f);

        assert(f.getId() > 0);    
    }

    @Test(groups = { "fast" })
    public void aFastTest() {
        logger.entry();    
        logger.info("Inside a Fast test");
    }

    @Test(groups = { "slow" })
    public void aSlowTest() {
        logger.entry();    
        logger.info("Inside a Slow test");
    }
}

Any pointers will be greatly appreciated.

  • 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-24T20:26:49+00:00Added an answer on May 24, 2026 at 8:26 pm

    Your test load a web app specific configuration file, but your test environment does not provide the required files:

    You need to separate the Web Application specific configuration from the one the works wihtout web application context.

    Then use for the test the one that works without Web Application.

    For you that mean: remove the Tiles Configuration for the test configuration. Because in the test the /WEB-INF/tiles/tiles.xml file is not available.

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

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
Specifically, suppose I start with the string string =hello \'i am \' me And
I am trying to render a haml file in a javascript response like so:
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka

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.