Maybe you need to register the driver before trying to connect: Class. forName($Phoenix_Driver_ClassName);
Refer to this: http://stackoverflow.com/questions/5556664/how-to-fix-no-suitable-driver-found-for-jdbcmysql-localhost-dbname-error-w On Sun, Aug 16, 2015 at 9:14 AM, Ajoy Arimbur Mathew < ajoy_mat...@infosys.com> wrote: > > > We are facing issue in querying HBAse from phoenix Hbase client in web > application environment. > > The web application is deployed in Apache Tomcat 7.047 server.We are using > the Apache Hadoop version 2.4.2 and > > Apache HBase version 1.0.1 , Apache zookeeper version 3.4.6 and we have > the 'phoenix-4.4.0-HBase-1.0-client.jar' in our web application lib. > > Also we have the slf4j-api-1.7.7.jar, > slf4j-nop-1.7.7.jar,slf4j-log4j12-1.7.7.jar in web application lib. > > > > We could successfully connect to the hbase via the sqlline.py command > line (./sqlline.py zookeeper url) > > > > We are getting 'No suitable driver found for jdbc:phoenix:[zookeeper]' > error . > > > > > > We are connecting in our java code in the follwing way > > > > Connection phoenixConnection =null; > > String phoenixConnectionUrl = String.valueOf("jdbc:phoenix:xx.xx.xx.xx"); > > phoenixConnection = DriverManager.getConnection(phoenixConnectionUrl); > > PreparedStatement update = null; > > for(UpdateStatus > entry:entries){ > > > update=phoenixConnection.prepareStatement("UPSERT INTO > MyTABLE(pk,MYDATA.STATUS) values(?, ?)"); > > > update.setString(1,entry.getId()); > > > update.setString(2,entry.getStatus()); > > > update.executeUpdate(); > > } > > > > > > } catch (SQLException e) { > > e.printStackTrace(); > > } > > > > > > > > > > We have tried removing the client jar from application lib and having it > in the tomcat/catalina lib also. > > Also tried appending the zookeper port also, viz. jdbc:phoenix:[zookeeper > url]:2181. > > Still we are getting the same error. > > > > Please find below the complete errorstackrace.Please help what are we > missing here. > > > > ava.sql.SQLException: No suitable driver found for > jdbc:phoenix:10.122.97.176 > > at java.sql.DriverManager.getConnection(DriverManager.java:596) > > at java.sql.DriverManager.getConnection(DriverManager.java:233) > > at > com.gstn.invoice.update.service.InvoiceUpdateHelper.updateInvoiceStatus(InvoiceUpdateHelper.java:18) > > at > com.gstn.invoice.update.service.InvoiceUpdateService.UpdateInvoiceStatus(InvoiceUpdateService.java:24) > > at > com.gstn.filling.rest.UpdateAcceptanceService.updateInvoiceEntries(UpdateAcceptanceService.java:30) > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) > > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > > at java.lang.reflect.Method.invoke(Method.java:606) > > at > com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60) > > at > com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$VoidOutInvoker._dispatch > > > > (AbstractResourceMethodDispatchProvider.java:167) > > at > com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75) > > at > com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302) > > at > com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108) > > at > com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) > > at > com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84) > > at > com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1511) > > at > com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1442) > > at > com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1391) > > at > com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1381) > > at > com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416) > > at > com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538) > > at > com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716) > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) > > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) > > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) > > at > org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) > > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) > > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) > > at > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) > > at > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) > > at > org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) > > at > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) > > at > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100) > > at > org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953) > > at > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) > > at > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) > > at > org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041) > > at > org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603) > > at > org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312) > > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) > > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) > > at java.lang.Thread.run(Thread.java:745) > > > > > > > > **************** CAUTION - Disclaimer ***************** > This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely > for the use of the addressee(s). If you are not the intended recipient, please > notify the sender by e-mail and delete the original message. Further, you are > not > to copy, disclose, or distribute this e-mail or its contents to any other > person and > any such actions are unlawful. This e-mail may contain viruses. Infosys has > taken > every reasonable precaution to minimize this risk, but is not liable for any > damage > you may sustain as a result of any virus in this e-mail. You should carry out > your > own virus checks before opening the e-mail or attachment. Infosys reserves the > right to monitor and review the content of all messages sent to or from this > e-mail > address. Messages sent to or from this e-mail address may be stored on the > Infosys e-mail system. > ***INFOSYS******** End of Disclaimer ********INFOSYS*** > > -- Thanks & Regards, Anil Gupta