File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Spring and the fly likes database connection Spring framework unresolved Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "database connection Spring framework unresolved" Watch "database connection Spring framework unresolved" New topic
Author

database connection Spring framework unresolved

gopal krishnan
Greenhorn

Joined: Dec 17, 2007
Posts: 18
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

Joined: Feb 05, 2001
Posts: 17250
    
    6

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


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
gopal krishnan
Greenhorn

Joined: Dec 17, 2007
Posts: 18
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

Joined: Dec 17, 2007
Posts: 18
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
 
subject: database connection Spring framework unresolved