Cannot create JDBC driver of class '' for connect URL 'null' oracle XE MVC Spring Mybatis Tomcat 7 -
i created simple web application mvc spring integrated (or @ least trying to) batis. using oracle xe database , tomcat 7. problem not being able connect database, created datasource following apache´s documentation.
every time run application following exception:
severe: el servlet.service() para el servlet [appservlet] en el contexto con ruta [/practicas] lanzó la excepción [request processing failed; nested exception org.mybatis.spring.mybatissystemexception: nested exception org.apache.ibatis.exceptions.persistenceexception: ### error updating database. cause: org.springframework.jdbc.cannotgetjdbcconnectionexception: not jdbc connection; nested exception org.apache.tomcat.dbcp.dbcp.sqlnestedexception: cannot create jdbc driver of class '' connect url 'null' ### error may exist in com/unbosque/practicas/mapper/estudiantemapper.xml ### error may involve com.unbosque.practicas.mapper.estudiantemapper.insertarpersonaestudiante ### error occurred while executing update ### cause: org.springframework.jdbc.cannotgetjdbcconnectionexception: not jdbc connection; nested exception org.apache.tomcat.dbcp.dbcp.sqlnestedexception: cannot create jdbc driver of class '' connect url 'null'] con causa raíz java.lang.nullpointerexception @ sun.jdbc.odbc.jdbcodbcdriver.getprotocol(jdbcodbcdriver.java:524) @ sun.jdbc.odbc.jdbcodbcdriver.knownurl(jdbcodbcdriver.java:493) @ sun.jdbc.odbc.jdbcodbcdriver.acceptsurl(jdbcodbcdriver.java:307) @ java.sql.drivermanager.getdriver(drivermanager.java:273) @ org.apache.tomcat.dbcp.dbcp.basicdatasource.createconnectionfactory(basicdatasource.java:1437) @ org.apache.tomcat.dbcp.dbcp.basicdatasource.createdatasource(basicdatasource.java:1371) @ org.apache.tomcat.dbcp.dbcp.basicdatasource.getconnection(basicdatasource.java:1044) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:601) @ org.springframework.aop.support.aoputils.invokejoinpointusingreflection(aoputils.java:318) @ org.springframework.aop.framework.jdkdynamicaopproxy.invoke(jdkdynamicaopproxy.java:196) @ com.sun.proxy.$proxy10.getconnection(unknown source) @ org.springframework.jdbc.datasource.datasourceutils.dogetconnection(datasourceutils.java:111) @ org.springframework.jdbc.datasource.datasourceutils.getconnection(datasourceutils.java:77) @ org.mybatis.spring.transaction.springmanagedtransaction.openconnection(springmanagedtransaction.java:80) @ org.mybatis.spring.transaction.springmanagedtransaction.getconnection(springmanagedtransaction.java:66) @ org.apache.ibatis.executor.baseexecutor.getconnection(baseexecutor.java:279) @ org.apache.ibatis.executor.simpleexecutor.preparestatement(simpleexecutor.java:69) @ org.apache.ibatis.executor.simpleexecutor.doupdate(simpleexecutor.java:44) @ org.apache.ibatis.executor.baseexecutor.update(baseexecutor.java:108) @ org.apache.ibatis.executor.cachingexecutor.update(cachingexecutor.java:67) @ org.apache.ibatis.session.defaults.defaultsqlsession.update(defaultsqlsession.java:145) @ org.apache.ibatis.session.defaults.defaultsqlsession.insert(defaultsqlsession.java:134) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:601) @ org.mybatis.spring.sqlsessiontemplate$sqlsessioninterceptor.invoke(sqlsessiontemplate.java:355) @ com.sun.proxy.$proxy12.insert(unknown source) @ org.mybatis.spring.sqlsessiontemplate.insert(sqlsessiontemplate.java:237) @ org.apache.ibatis.binding.mappermethod.execute(mappermethod.java:79) @ org.apache.ibatis.binding.mapperproxy.invoke(mapperproxy.java:40) @ com.sun.proxy.$proxy21.insertarpersonaestudiante(unknown source) @ com.unbosque.practicas.service.serviciobasico.insertarestudiante(serviciobasico.java:27) @ com.unbosque.practicas.controladorestudiante.agregarestudiante(controladorestudiante.java:54) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:601) @ org.springframework.web.method.support.invocablehandlermethod.invoke(invocablehandlermethod.java:213) @ org.springframework.web.method.support.invocablehandlermethod.invokeforrequest(invocablehandlermethod.java:126) @ org.springframework.web.servlet.mvc.method.annotation.servletinvocablehandlermethod.invokeandhandle(servletinvocablehandlermethod.java:96) @ org.springframework.web.servlet.mvc.method.annotation.requestmappinghandleradapter.invokehandlermethod(requestmappinghandleradapter.java:617) @ org.springframework.web.servlet.mvc.method.annotation.requestmappinghandleradapter.handleinternal(requestmappinghandleradapter.java:578) @ org.springframework.web.servlet.mvc.method.abstracthandlermethodadapter.handle(abstracthandlermethodadapter.java:80) @ org.springframework.web.servlet.dispatcherservlet.dodispatch(dispatcherservlet.java:923) @ org.springframework.web.servlet.dispatcherservlet.doservice(dispatcherservlet.java:852) @ org.springframework.web.servlet.frameworkservlet.processrequest(frameworkservlet.java:882) @ org.springframework.web.servlet.frameworkservlet.dopost(frameworkservlet.java:789) @ javax.servlet.http.httpservlet.service(httpservlet.java:647) @ javax.servlet.http.httpservlet.service(httpservlet.java:728) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:305) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:210) @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:222) @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:123) @ org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:472) @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:171) @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:99) @ org.apache.catalina.valves.accesslogvalve.invoke(accesslogvalve.java:953) @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:118) @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:408) @ org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1008) @ org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:589) @ org.apache.tomcat.util.net.jioendpoint$socketprocessor.run(jioendpoint.java:312) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615) @ java.lang.thread.run(thread.java:722)
this tomcat 7 context.xml:
<?xml version='1.0' encoding='utf-8'?> <!-- licensed apache software foundation (asf) under 1 or more contributor license agreements. see notice file distributed work additional information regarding copyright ownership. asf licenses file under apache license, version 2.0 (the "license"); may not use file except in compliance license. may obtain copy of license @ http://www.apache.org/licenses/license-2.0 unless required applicable law or agreed in writing, software distributed under license distributed on "as is" basis, without warranties or conditions of kind, either express or implied. see license specific language governing permissions , limitations under license. --> <!-- contents of file loaded each web application --> <context> <resource name="jdbc/practicas" auth="container" type="javax.sql.datasource" driverclassname="oracle.jdbc.oracledriver" url="jdbc:oracle:thin:@localhost:1521:xe" username="practicas" password="1234" maxactive="20" maxidle="10" factory="org.apache.tomcat.jdbc.pool.datasourcefactory" poolpreparedstatements="true" maxwait="-1"/> <!-- default set of monitored resources --> <watchedresource>web-inf/web.xml</watchedresource> <!-- uncomment disable session persistence across tomcat restarts --> <!-- <manager pathname="" /> --> <!-- uncomment enable comet connection tacking (provides events on session expiration webapp lifecycle) --> <!-- <valve classname="org.apache.catalina.valves.cometconnectionmanagervalve" /> --> </context>
this web.xml:
<?xml version="1.0" encoding="utf-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <!-- definición de la referencia de recurso datasource --> <resource-ref> <description>datasource oracle para practicas</description> <res-ref-name>jdbc/practicas</res-ref-name> <res-type>javax.sql.datasource</res-type> <res-auth>container</res-auth> <res-sharing-scope>shareable</res-sharing-scope> </resource-ref> <!-- definition of root spring container shared servlets , filters --> <context-param> <param-name>contextconfiglocation</param-name> <param-value>/web-inf/spring/root-context.xml</param-value> </context-param> <!-- creates spring container shared servlets , filters --> <listener> <listener-class>org.springframework.web.context.contextloaderlistener</listener-class> </listener> <!-- processes application requests --> <servlet> <servlet-name>appservlet</servlet-name> <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class> <init-param> <param-name>contextconfiglocation</param-name> <param-value>/web-inf/spring/appservlet/servlet-context.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>appservlet</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> </web-app>
this root-context.xml
<?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:jee="http://www.springframework.org/schema/jee" xsi:schemalocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd"> <!-- <bean/> definitions here --> <!-- configuracion de datasource --> <jee:jndi-lookup id="datasource" jndi-name="jdbc/practicas" cache="true" resource-ref="true" lookup-on-startup="false" proxy-interface="javax.sql.datasource" /> <bean id="sqlsessionfactory" class="org.mybatis.spring.sqlsessionfactorybean"> <property name="datasource" ref="datasource" /> <property name="typealiasespackage" value="com.unbosque.practicas.dto" /> </bean> <bean class="org.mybatis.spring.mapper.mapperscannerconfigurer"> <property name="basepackage" value="com.unbosque.practicas.mapper" /> </bean> <bean id="transactionmanager" class="org.springframework.jdbc.datasource.datasourcetransactionmanager"> <property name="datasource" ref="datasource" /> </bean> <bean id="estudiante" class="com.unbosque.practicas.dto.estudiante"/> </beans>
and servlet-context.xml:
<?xml version="1.0" encoding="utf-8"?> <beans:beans xmlns="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xsi:schemalocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <!-- dispatcherservlet context: defines servlet's request-processing infrastructure --> <!-- enables spring mvc @controller programming model --> <annotation-driven /> <!-- handles http requests /resources/** efficiently serving static resources in ${webapproot}/resources directory --> <resources mapping="/resources/**" location="/resources/" /> <!-- resolves views selected rendering @controllers .jsp resources in /web-inf/views directory --> <beans:bean class="org.springframework.web.servlet.view.internalresourceviewresolver"> <beans:property name="prefix" value="/web-inf/views/" /> <beans:property name="suffix" value=".jsp" /> </beans:bean> <context:component-scan base-package="com.unbosque.practicas" /> <context:component-scan base-package="com.unbosque.practicas.service" /> <context:component-scan base-package="com.unbosque.practicas.dto" /> <context:annotation-config/> </beans:beans>
i have tried everything, not clear me causing problem, i´d appreciate help, have working possible , have not clue how resolve problema, thank of :) (sorry english xd)
Comments
Post a Comment