Dushyant Chhetri

Ranch Hand
+ Follow
since Oct 28, 2009
Merit badge: grant badges
For More
India
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Dushyant Chhetri

Found it ,

had'nt put in the listener for contextloader in my web.xml file



https://coderanch.com/t/586046/Spring/NoSuchBeanDefinitionException-spring-mybatis#2667497


Thanks
12 years ago
Hi All,

I am learning spring and am trying to create a simple login example where the authentication is done by comparing the username and password from a database.

I have autowired in the controller as follows:



My dao class is as follows:



The application context xml is as follows:



I have also kept

in the spring-servlet.xml file.

Despite all these I am getting
Exception Error creating bean with name 'loginController'


org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [com.dao.LoginDao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}


Please suggest where I am going wrong.
12 years ago
Hi Geeta, Rakesh,

I am having a similar problem.

I am using the Spring validator but getting exactly the same error Geeta was getting earlier.


I have tried the solution advised by Rakesh but in vain.









PLEASE HELP..
12 years ago
Hi Thanks,

Seems funny but the error was just a typo.

I had typed in


instead of


in the applicationContext.xml file

12 years ago
Hi All,

I am trying a basic tutorial to write a Web MVC Spring applicationusing Spring 3

In short
an html form is used to capture some i/p data and the Spring classes using SimpleJdbcDaoSupport is trying to push the data to some DB table.

I have my project structure as attached image.

My xml files are as follows:

web.xml


dispatcher-servlet.xml


applicationContext.xml


On trying to execute I am getting an error as :

SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personsDao' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'jdbcTemplateBean' while setting bean property 'jdbcTemplate'; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.jdbc.core.jdbcTemplate] for bean with name 'jdbcTemplateBean' defined in ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.jdbc.core.jdbcTemplate
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1305)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1067)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:557)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:842)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:416)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:261)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:192)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.jdbc.core.jdbcTemplate] for bean with name 'jdbcTemplateBean' defined in ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.jdbc.core.jdbcTemplate
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1208)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:427)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
... 30 more
Caused by: java.lang.ClassNotFoundException: org.springframework.jdbc.core.jdbcTemplate
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:258)
12 years ago
Solved it..




had missed this small bit..




13 years ago
Hi All,

I am trying to use pagination to display a grid view where multiple entries need to be displayed. Now the problem is the page size is coming as desired but when i hit the next the entries vanish and " NO RECORD TO DISPLAY IS DISPLAYED"



userList is an arraylist of type



Please suggest where I am going wrong.



13 years ago
Thanks for the reply Mohan,

Does this mean that Session Handling has to be done entirely by the developer , Is there no interceptor to do the same at all ??
13 years ago
Hi,

What is the best way to maintain the scope of a session in a struts2 web application.

I mean if a user logs in and after validation say the user can remain idle for 10 mins after which his session will be over or uptill the time he logs out himself.

any special means in STRUTS 2 which helps us to maintain the session or should we control the session variables ourselves using SessionAware??
13 years ago
I am running a web Application and want to keep the SQL Queries in a properties file.
Now I am having a problem to load the properties file and getting a .


My code snippet is here , Please help:




I am getting the sysout given above to



Running the cod elocaly via a main method is able top fetch the properties file
13 years ago
Hi All,

I am trying to implement a dropdown which changes on the previous dropdown.

I am using ajax with the help of dojo and have so far been able to populate the values in second dropdown with the changes in the values of the first one.
However now I want to change the values of this combo and try and populate the 3rd combo depending on the selected values.

On the first jsp I am using something like

The DetailAction populates the list and passes to the another jsp detail.jsp

the codes of which are


Now I am stuck as onchange here is not working , so I am not being able to cooenct to another action and then to a third jsp.

Please suggest or any other work around..
13 years ago
Hi All,

I am trying to create a dropdown menu on using struts2 .
I am implementing the UI on jsp with struts taglib.

Now I want to populate the data on the dropdown froma database.
For this I have used the following and created an arraylist



The action for the above submit form is



However I am getting the following error


Please suggest me where I am going wrong.

13 years ago
Hi All,

I am trying to create a dropdown menu on using struts2 .
I am implementing the UI on jsp with struts taglib.

Now I want to populate the data on the dropdown froma database.
For this I have used the following and created an arraylist



The action for the above submit form is



However I am getting the following error




Please suggest me where I am going wrong.

13 years ago
Hi Eric ,

Thanks for the reply.

Any other method than this?

Regards,
Dush