Guest User

Untitled

a guest
Feb 5th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.21 KB | None | 0 0
  1. org.springframework.beans.factory.BeanCreationException:
  2. Error creating bean with name 'EProfileConfigureSimulator':
  3. Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException:
  4. Could not autowire method: public void com.myproject.simulator.ConfigureSimulator.setDataSource(javax.sql.DataSource); nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [javax.sql.DataSource] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
  5.  
  6. Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Invocation of init method failed; nested exception is javax.naming.NamingException: Cannot create JDBC driver of class '' for connect URL 'jdbc:hsqldb:hsql://localhost:9001/SIMULATORDB'
  7.  
  8. org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:287)
  9. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1106)
  10. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
  11. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
  12. . . . .
  13.  
  14. <Resource name="jdbc/SimulatorDB" auth="Container"
  15. type="javax.sql.DataSource"
  16. driverClassName="org.hsqldb.jdbc.JDBCDriver"
  17. url="jdbc:hsqldb:hsql://localhost:9001/SIMULATORDB"
  18. username="SA"
  19. password=""
  20. initialSize="25"
  21. maxActive="100"
  22. maxIdle="30"
  23. maxWait="10000" />
  24.  
  25. <resource-ref>
  26. <description>HSQL Database</description>
  27. <res-ref-name>jdbc/SimulatorDB</res-ref-name> <!-- Must match the Server Resource name -->
  28. <res-type>javax.sql.DataSource</res-type> <!-- Must match the Server type -->
  29. <res-auth>Container</res-auth> <!-- Must match the server auth attribute. -->
  30.  
  31. </resource-ref>
  32.  
  33. <!-- Enable annotations -->
  34. <context:annotation-config />
  35.  
  36. <jee:jndi-lookup id="dataSource" jndi-name="java:comp/env/jdbc/SimulatorDB" expected-type="javax.sql.DataSource" />
  37.  
  38. <!--
  39. <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
  40. <property name="jndiName" value="java:comp/env/jdbc/SimulatorDB"/>
  41. <property name="lookupOnStartup" value="true"/>
  42. <property name="resourceRef" value="true" />
  43. <property name="expectedType" value="javax.sql.DataSource" />
  44. <property name="proxyInterface" value="javax.sql.DataSource"/>
  45. </bean> -->
  46.  
  47. import javax.sql.DataSource;
  48. import org.springframework.beans.factory.annotation.Autowired;
  49.  
  50. class JdbcHelper {
  51. private DataSource dataSource;
  52.  
  53. @Autowired
  54. public void setDataSource(DataSource dataSource) {
  55. this.dataSource = dataSource;
  56. }
  57.  
  58. public DataSource getDataSource() {
  59. return this.dataSource;
  60. }
  61. }
  62.  
  63. <bean id="dbDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
  64. <property name="jndiName" value="java:comp/env/jdbc/SimulatorDB"/>
  65. </bean>
Add Comment
Please, Sign In to add comment