开发者

Spring Error in creating bean with name propertyPlaceholderConfigurer defined in Classpath

开发者 https://www.devze.com 2023-01-13 23:13 出处:网络
Hi Experts We are loading the beans with xml files in class path using the ClassPathXmlApplicationContext. It finds and loads the xml files from classpath ,but in one of xml files which has propertyP

Hi Experts

We are loading the beans with xml files in class path using the ClassPathXmlApplicationContext. It finds and loads the xml files from classpath ,but in one of xml files which has propertyPlaceholderConfigurer bean referring the property file from classpath. It throws the null pointer exception with unable to create the propertyPlaceholderConfigurer bean.

Not sure whether it reads the property file even though it is classpath as it can read other xml files? Any chance of property file having corrupted data? Any clues on what could be the issue ?

Error creating bean with name 'propertyPlaceholderConfigurer' defined in class path resource [ws.xml]: Initialization of bean failed; nested exception is java.lang.NullPointerException
    at com.ibm.ejs.container.StatelessBeanO.initialize(StatelessBeanO.java:375)
    at com.ibm.ejs.container.BMStatelessBeanOFactory.create(BMStatelessBeanOFactory.java:45)
    at com.ibm.ejs.container.EJSHome.createBeanO(EJSHome.java:1031)
    at com.ibm.ejs.container.EJSHome.createBeanO(EJSHome.java:1141)
    at com.ibm.ejs.container.activator.UncachedActivationStrategy.atActivate(UncachedActivationStrategy.java:84)
    at com.ibm.ejs.container.activator.Activator.activateBean(Activator.java:599)
    at com.ibm.ejs.container.EJSContainer.preInvokeActivate(EJSContainer.java:3964)
    at com.ibm.ejs.container.EJSContainer.preInvoke(EJSContainer.java:3269)
    at com.ibm.websphere.scheduler.EJSRemoteStatelessMeFBatchHandler_fb00fe87.process(EJSRemoteStatelessMeFBatchHandler_fb00f开发者_如何学编程e87.java:27)
    at com.ibm.websphere.scheduler._TaskHandler_Stub.process(_TaskHandler_Stub.java:269)
    at com.ibm.ws.scheduler.tasks.BeanTaskInfoWork.doWork(BeanTaskInfoWork.java:126)
    at com.ibm.ws.scheduler.AlarmListener.executeTaskWithNotification(AlarmListener.java:796)
    at com.ibm.ws.scheduler.AlarmListener.access$700(AlarmListener.java:121)
    at com.ibm.ws.scheduler.AlarmListener$TaskWork.doWork(AlarmListener.java:427)
    at com.ibm.ws.scheduler.AlarmListener$TaskWork.run(AlarmListener.java:213)
    at com.ibm.ws.asynchbeans.J2EEContext.run(J2EEContext.java:782)
    at com.ibm.ws.asynchbeans.ExecutionContextImpl.go(ExecutionContextImpl.java:86)
    at com.ibm.ws.scheduler.AlarmListener.fireTask(AlarmListener.java:1401)
    at com.ibm.ws.scheduler.AlarmListener.fired(AlarmListener.java:1319)
    at com.ibm.ws.asynchbeans.AlarmImpl.callListenerMethod(AlarmImpl.java:340)
    at com.ibm.ws.asynchbeans.timer.GenericTimer.run(GenericTimer.java:216)
    at com.ibm.ws.asynchbeans.J2EEContext.run(J2EEContext.java:1150)
    at com.ibm.ws.asynchbeans.AlarmImpl.runListenerAsCJWork(AlarmImpl.java:175)
    at com.ibm.ws.asynchbeans.am._Alarm.fireAlarm(_Alarm.java:333)
    at com.ibm.ws.asynchbeans.am._Alarm.run(_Alarm.java:230)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1550)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'propertyPlaceholderConfigurer' defined in class path resource [ws.xml]: Initialization of bean failed; nested exception is java.lang.NullPointerException
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:478)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
    at java.security.AccessController.doPrivileged(AccessController.java:224)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:217)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:516)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:363)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)


new ClassPathXmlApplicationContext(a.xml ,b.xml,c.xml);

returns null pointer exception because of propertyPlaceholderConfigurer bean defined iin c.xml ,which refers the property file in classpath.


Check your Spring libraries. If they are with mixed/mismatched version then remove the old version jars and replace with new version jars.

0

精彩评论

暂无评论...
验证码 换一张
取 消