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

Asked

Viewed 712 times

0

When trying to configure a datasource in spring mvc this gives 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 this way:

    <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" 
 />

Any personal tips.

  • Look how I set up this question and see if it solves: http://answall.com/questions/149614/erro-cannot-create-jdbc-driver-of-class-for-connect-url-null-java-sql-sql

  • Thanks solved yes.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.