This week's book giveaway is in the Beginning Java forum.
We're giving away four copies of Learn Java with Math: Using Fun Projects and Games and have Ron Dai on-line!
See this thread for details.
Win a copy of Learn Java with Math: Using Fun Projects and Games this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Junilu Lacar
  • Martin Vashko
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Scott Selikoff
  • salvin francis
  • Piet Souris

database connection Spring framework unresolved

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i had earlier created the spring framework, then replaced with the database connection, but there is problem in creating the beans.

also receiving the below error during the deployment.

Error


deploy?DEFAULT=C:\Users\gopc\Documents\NetBeansPro jects\HelloSpringJDBC\build\web&name=HelloSpringJD BC&contextroot=/HelloSpringJDBC&force=true failed on GlassFish Server 3.1.2 Error occurred during deployment: Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'productManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyExcep tion: Invalid property 'productDao' of bean class [SimpleProductManager]: Bean property 'productDao' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?. Please see server.log for more details. C:\Users\gopc\Documents\NetBeansProjects\HelloSpri ngJDBC\nbproject\build-impl.xml:1029: The module has not been deployed. See the server log for details.

Source

applicationContext.xml



spirngapp-servlet.xml





JdbcProductDao.java



SimpleProductManager.java



HelloController.java


 
ranger
Posts: 17344
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, one thing I notice

public List<Product> getProductDao() {
//throw new UnsupportedOperationException();
return productDao.getProductList();
}

This is not a getter. getProductDao should return this.productDao. That is probably why you get the error.

Mark
 
gopal krishnan
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks, i had changed the getter method now, but still getting the same error...

error
----
Error occurred during deployment: Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'productManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Instantiation of bean failed; nested exception is java.lang.ExceptionInInitializerError. Please see server.log for more details.




also i had modified the Controller and springapp-servlet.xml as below..

springapp-servlet.xml
---------------------------

<bean name="/hello.htm" class="HelloController">
<property name="simpleProductManager" ref="simpleProductManager"/>
</bean>


HelloController.java
-------------------------

 
gopal krishnan
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey the problem got resovled, after i had modified, the following..

1) applicationContext with mapping for the bean "productManager" with ref productDao
2) ProductManager interface with new method call getProducts(), then implemenent in the SimpleProductManager and which call the ProductDao.getProducts(), where the sql query is being defined.
 
See ya later boys, I think I'm in love. Oh wait, she's just a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!