Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- org.springframework.beans.factory.BeanCreationException:
- Error creating bean with name 'EProfileConfigureSimulator':
- Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException:
- 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: {}
- 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'
- org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:287)
- org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1106)
- org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
- org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
- . . . .
- <Resource name="jdbc/SimulatorDB" auth="Container"
- type="javax.sql.DataSource"
- driverClassName="org.hsqldb.jdbc.JDBCDriver"
- url="jdbc:hsqldb:hsql://localhost:9001/SIMULATORDB"
- username="SA"
- password=""
- initialSize="25"
- maxActive="100"
- maxIdle="30"
- maxWait="10000" />
- <resource-ref>
- <description>HSQL Database</description>
- <res-ref-name>jdbc/SimulatorDB</res-ref-name> <!-- Must match the Server Resource name -->
- <res-type>javax.sql.DataSource</res-type> <!-- Must match the Server type -->
- <res-auth>Container</res-auth> <!-- Must match the server auth attribute. -->
- </resource-ref>
- <!-- Enable annotations -->
- <context:annotation-config />
- <jee:jndi-lookup id="dataSource" jndi-name="java:comp/env/jdbc/SimulatorDB" expected-type="javax.sql.DataSource" />
- <!--
- <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
- <property name="jndiName" value="java:comp/env/jdbc/SimulatorDB"/>
- <property name="lookupOnStartup" value="true"/>
- <property name="resourceRef" value="true" />
- <property name="expectedType" value="javax.sql.DataSource" />
- <property name="proxyInterface" value="javax.sql.DataSource"/>
- </bean> -->
- import javax.sql.DataSource;
- import org.springframework.beans.factory.annotation.Autowired;
- class JdbcHelper {
- private DataSource dataSource;
- @Autowired
- public void setDataSource(DataSource dataSource) {
- this.dataSource = dataSource;
- }
- public DataSource getDataSource() {
- return this.dataSource;
- }
- }
- <bean id="dbDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
- <property name="jndiName" value="java:comp/env/jdbc/SimulatorDB"/>
- </bean>
Add Comment
Please, Sign In to add comment