Failed to look up JNDI DataSource with name 'jdbc / imobiliariaDB'; nested

0

When trying to set up a datasource in spring mvc it is giving the following error.

Caused by: org.springframework.jdbc.datasource.lookup.DataSourceLookupFailureException: Failed to look up JNDI DataSource with name 'jdbc/imobiliariaDB'; nested exception is javax.naming.NameNotFoundException: Name [jdbc/imobiliariaDB] is not bound in this Context. Unable to find [jdbc].
at org.springframework.jdbc.datasource.lookup.JndiDataSourceLookup.getDataSource(JndiDataSourceLookup.java:48)
at com.algaworks.cti.imobiliaria.config.AppJPAConfig.dataSource(AppJPAConfig.java:41)
at com.algaworks.cti.imobiliaria.config.AppJPAConfig$$EnhancerBySpringCGLIB$$bf3a5277.CGLIB$dataSource$3(<generated>)
at com.algaworks.cti.imobiliaria.config.AppJPAConfig$$EnhancerBySpringCGLIB$$bf3a5277$$FastClassBySpringCGLIB$$578a378a.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:318)
at com.algaworks.cti.imobiliaria.config.AppJPAConfig$$EnhancerBySpringCGLIB$$bf3a5277.dataSource(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
... 42 more

The context file is configured as follows:

    <Resource name="jdbc/imobiliariaDB" auth="Container" 
        factory="org.apache.naming.factory.BeanFactory"
        type="com.mchange.v2.c3p0.ComboPooledDataSource"
        driverClass="com.mysql.jdbc.Driver"
        jdbcUrl="jdbc:mysql://localhost/imobiliaria?useSSL=false"
        user="root"
        password="root" 
        initialPoolSize="5" 
        minPoolSize="5"
        maxPoolSize="5" 
 />

Some personal tip.

    
asked by anonymous 07.09.2016 / 22:32

0 answers