Andrea Girardi - It's my blog!

Tag: error handling

dataSource: The name of the property, following JavaBean naming conventions.

Suppose you defined TemplateDao Spring bean in this way:

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">	
	<property name="driverClassName"><value>com.mysql.jdbc.Driver</value></property>	
	<property name="url"><value>jdbc:mysql://${mysql.hostname}:${mysql.port}/${mysql.db}</value></property>
	<property name="username"><value>${mysql.user}</value></property>
	<property name="password"><value>${mysql.password}</value></property>
</bean>	
 
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
	<property name="dataSource" ref="dataSource"/>
</bean> 
 
<bean id="TemplateRequestDao" class="com.afm.admin.dao.mysql.TemplateDaoMySql">
	<property name="dataSource" ref="dataSource" />
</bean>

and you get this error message: The name of the property, following JavaBean naming conventions. The reason is probably you forgot to extend your implementation class:

public class TemplateDaoMySql extends JdbcDaoSupport implements TemplateDao {
 
	@Override
	public List<TemplateRequest> getTemplateRequest(UserProfile userProfile) {
		// TODO Auto-generated method stub
		return null;
	}
 
}

Time lost to fix this issue: more or less 1 hour. Image the how many I was frustrated when I discovered what was the problem.

No suitable driver found for jdbc:mysql://localhost:3306/schema

If the exception “Could not get JDBC Connection; nested exception is java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/schema” is raised probably you forgot to add the

<property name="driverClassName"><value>com.mysql.jdbc.Driver</value></property>

property to your dataSource bean:

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">		
	<property name="driverClassName"><value>com.mysql.jdbc.Driver</value></property>
	<property name="url"><value>jdbc:mysql://172.16.0.11:3306/test_vale</value></property>
	<property name="username"><value>root</value></property>
	<property name="password"><value>password</value></property>
</bean>

Copyright © 2017 Andrea Girardi – It's my blog!

Theme by Anders NorenUp ↑