public class SQLConstants {
public static final String PACKAGE = ClassUtils.getPackageName(SQLConstants.class);
public static final String C_NUMBERS_LIST =
"CNumberList.sql";
/**
* Private constructor to prevent instantiation.
*/
private SQLConstants() {
super();
}
}
public class CListDAO extends JdbcDAO {
public List claims() {
List li = getJdbcTemplate().queryForList(
this.loadQuery(SQLConstants.PACKAGE,
SQLConstants.C_NUMBERS_LIST));
Iterator iter = li.iterator();
System.out.println("I want ===>>"+li.size());
while(iter.hasNext()){
System.out.println("I want->>>>"+iter.next());
}
return li;
}
java.lang.NullPointerException
at com…….CListDAO.getRecords(ClaimsListDAO.java:32)
at com……..runScheduledJob(GenerationScheduledJob.java :52)
at com….common.jobs.AbstractScheduledJob.execute(Abst ractScheduledJob.java:21)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.springframework.util.MethodInvoker.invoke(Meth odInvoker.java:276)
at org.springframework.scheduling.quartz.MethodInvoki ngJobDetailFactoryBean$MethodInvokingJob.executeIn ternal(MethodInvokingJobDetailFactoryBean.java:260 )
at org.springframework.scheduling.quartz.QuartzJobBea n.execute(QuartzJobBean.java:86)
at org.quartz.core.JobRunShell.run(JobRunShell.java:2 02)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run (SimpleThreadPool.java:529)
Last edited by java_dev; September 14th, 2009 at 02:58 AM.
I modified my post with code tags, Can you help me in solving my problem?
The point of the code tags is to preserve the formatting. If the code is unformatted, they won't help.
I am always doing that which I cannot do, in order that I may learn how to do it...
P. Picasso
Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.
Yes, I can understand, that the reason I changed as per your suggestion.
<sigh> Your code is not formatted, so putting it in code tags is pointless. jcaccia was asking for formatted (readable) code.
I need help in solving my problem.
Perhaps jcaccia might be more inclined to help if the code was formatted and readable...?
Programs must be written for people to read, and only incidentally for machines to execute...
H. Abelson and G. Sussman
Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.
<bean id="cListDAO"
class="com..jobs.activity.CListDAO"
p:dataSource-ref="dataSource" p:sqlLoader-ref="sqlLoader"
p:jdbcTemplate-ref="jdbcTemplate">
</bean>
<!-- The db JdbcTemplate class -->
<bean id="jdbcTemplate"
class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource">
<ref bean="dataSource" />
</property>
</bean>
I am getting exception, please help me.
Error:
Code:
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'activityGenerationJob' defined in ServletContext resource [/WEB-INF/Integration-scheduler.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [$Proxy1] to required type [com.....cc.jobs.activity.CListDAO] for property 'cListDAO'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy1] to required type [com....cc.jobs.activity.CListDAO] for property 'cListDAO': no matching editors or conversion strategy found
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:478)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'activityGenerationJob' defined in ServletContext resource [/WEB-INF/Integration-scheduler.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [$Proxy1] to required type [com.....cc.jobs.activity.CListDAO] for property 'cListDAO'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy1] to required type [com....cc.jobs.activity.CListDAO] for property 'cListDAO': no matching editors or conversion strategy found
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:478)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
This is due to the fact that Spring is dealing with your beans in terms of interface so that it can use the Java proxy mechanism to return you a decorated class, while making it look the same to you who is using it. I've ran into these problems when trying to wire or pass a reference to a concrete type rather than interface.
Take a look at what CListDAO if you are using @Autowired , and make sure that you pass the interface to your activityGenerationJob
------
If you are satisfied with the responses, add to the user's rep!
Bookmarks