It's not a secret anymore!
The moose likes Spring and the fly likes Error creating bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Error creating bean" Watch "Error creating bean" New topic

Error creating bean

iamiqbal.m Mohiuddin

Joined: May 11, 2006
Posts: 12
Hello All:

I am running into strange problem.

I am getting the above exception. I see i am able to get batchInitializer bean but not the sourceBean.
Any help is highly appreciated.

Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

Could not instantiate class [com.mst.batch.jdbc.MSTDataExtractThread]; constructor threw exception; nested exception is java.lang.NullPointerException: null

That is your error.

The funny thing about Spring exceptions is that unlike other exception reading. It is best to start at the bottom and get the root exception, and that will tell you what is wrong

So in the constructor of MSTDataExtractThread class you are getting a NullPointerException.


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
iamiqbal.m Mohiuddin

Joined: May 11, 2006
Posts: 12
Thanks for the reply.

I am not sure why its an issue in the constructor of MSTDatExtrachThread class.

If i change tthe spring beans configuration by removing sourceBean as reference proprty and put it as an isolated bean and get that bean through Bean factory
it works without any error.

<bean id="batchProcessor" class="com.mst.batch.BatchProcessor" singleton="false">
<property name="batchInitializer"><ref bean="batchInitializer" /></property>
<property name="sourceBean"><ref bean="sourceBean" /></property> </bean>

and in code:

This works but not the original one which i have posted.

Appreciate if anyone can put some light on this.
I agree. Here's the link:
subject: Error creating bean
It's not a secret anymore!