File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

database connection Spring framework unresolved

 
gopal krishnan
Greenhorn
Posts: 18
  • 0
  • 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


 
Mark Spritzler
ranger
Sheriff
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • 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
  • 0
  • 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
  • 0
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic