I am developing webapplication using Spring MVC and Tomcat. Sometimes I am getting java.io.NotSerializableException exception.
Caused by:
java.io.NotSerializableException:
org.springframework.jdbc.datasource.DriverManagerDataSource
Here is my datasource in spring config.xml
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource" >
<property name="driverClassName" value="com.ibm.db2.jcc.DB2Driver" />
<property name="url" value="jdbc:db2:DB212cc" />
<property name="username" value="#XYZ" />
<property name="password" value="1234" />
</bean>
Can any one suggest me where and how to serialize this datasource.
I am using spring-jdbc-4.0.0.M2.jar
Inorder to avoid the above exception I added listener tag in web.xml and its working fine. That means,listener that exposes the request to the current thread through RequestContextListener.So, we have to register listener tag in web.xml. listeners are useful for third party-servlets..
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments