Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in SQL by (6.1k points)

I am having an oracle database configuration in tomcat's server.xml

<Resource name="jdbc/sgfdb" auth="Container"

          driverClassName="oracle.jdbc.OracleDriver"

          url="jdbc:oracle:thin:@databaseurl:1521:schema"

          username="username" password="password" maxActive="20" maxIdle="10"

          maxWait="-1"

          factory="oracle.jdbc.pool.OracleDataSourceFactory"

          type="oracle.jdbc.pool.OracleDataSource"/>

Then in my web app (spring mvc project), I unclear this in the context.xml file.

<Context>

 <ResourceLink name="jdbc/sgfdb"

        global="jdbc/sgfdb"

        type="javax.sql.DataSource"/>

</Context>

I was able to connect to this database previously. I was not working on it for a week. Now when I am trying to start it, always returns:

SEVERE: Servlet.service() for servlet [action] in context with path [/WebUI] threw exception [Request processing failed; nested exception is javax.persistence.QueryTimeoutException: Could not open connection] with root cause

**java.sql.SQLException: ORA-01017: invalid username/password; logon denied**

at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:440)

at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:389)

at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:382)

at oracle.jdbc.driver.T4CTTIfun.processError(T4CTTIfun.java:573)

at    oracle.jdbc.driver.T4CTTIoauthenticate.processError(T4CTTIoauthenticate.java:431)

at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:445)

at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:191)

at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:366)

at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:752)

at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:366)

at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:536)

at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:228)

at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)

at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)

at oracle.jdbc.pool.OracleDataSource.getPhysicalConnection(OracleDataSource.java:280)

at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:207)

at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:157)

at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:70)

at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:278)

at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:297)

at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.java:169)

at org.hibernate.engine.jdbc.internal.proxy.ConnectionProxyHandler.extractPhysicalConnection(ConnectionProxyHandler.java:82)

at org.hibernate.engine.jdbc.internal.proxy.ConnectionProxyHandler.continueInvocation(ConnectionProxyHandler.java:138)

at org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:81)

at $Proxy36.prepareStatement(Unknown Source)

at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$5.doPrepare(StatementPreparerImpl.java:147)

at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:166)

at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareQueryStatement(StatementPreparerImpl.java:145)

at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1720)

at org.hibernate.loader.Loader.doQuery(Loader.java:828)

at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:289)

at org.hibernate.loader.Loader.doList(Loader.java:2447)

at org.hibernate.loader.Loader.doList(Loader.java:2433)

at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2263)

at org.hibernate.loader.Loader.list(Loader.java:2258)

at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:470)

at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:355)

at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:195)

at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1215)

at org.hibernate.internal.QueryImpl.list(QueryImpl.java:101)

at org.hibernate.ejb.QueryImpl.getSingleResult(QueryImpl.java:284)

at org.hibernate.ejb.criteria.CriteriaQueryCompiler$3.getSingleResult(CriteriaQueryCompiler.java:258)

at mycompany.services.impl.JobServiceImpl.getNumberOfJobs(JobServiceImpl.java:51)

at mycompany.controller.ExecJobController.execJobList(ExecJobController.java:78)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213)

at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)

at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)

at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617)

at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)

at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)

at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)

at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)

at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)

at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)

at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)

at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)

at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)

at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)

at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

at java.lang.Thread.run(Thread.java:662)

I am assured that the username and the password are correct. 

Could anyone help with this?

1 Answer

0 votes
by (12.7k points)

The username and password were perfect. I could able to login using those credentials in the SQLPlus and from the other applications as well. The datasource.url was also perfect.

While examining the errors, I found that the ojdbc6.jar which I was using was trying to connect to Oracle 11.1.0.7 whereas my Oracle was 11.2.0.4. Downloaded the latest ojdbc6.jar and tried to connect and it is done.

Make sure to download the latest version and use it.

Want to be a SQL expert? Come and join this SQL Certification by Intellipaat.

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Dec 6, 2020 in SQL by Appu (6.1k points)
0 votes
1 answer
asked Jan 8 in SQL by Appu (6.1k points)
0 votes
1 answer

Browse Categories

...