kshpra
kshpra

Reputation: 65

hive-jdbc-standalone.jar not loaded by tomcat 7

I am trying to connect to hive thrift server (hiveserver2) from web application. I created dynamic web project in Eclipse, and added following jars under WEB-INF/lib -

I am using tomcat 7.0.61. When I deploy the application to tomcat server, it gives following message and does not load hive-jdbc-0.14.0-standalone.jar

INFO:     validateJarFile(C:\EclipseWorkspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\HiveWeb\WEB-INF\lib\hive-jdbc-0.14.0-standalone.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class

It seems javax.servlet.Servlet.class in hive-jdbc-0.14.0-standalone.jar and tomcat/lib are conflicting. I need hive-jdbc-0.14.0-standalone.jar for connecting to hiveserver.

I tried to add hive-jdbc-0.14.0-standalone.jar in tomcat/lib directory. But tomcat fail to start due to that.

Is there a way to exclude javax.servlet.Servlet from either hive-jdbc-0.14.0-standalone.jar or tomcat?

Upvotes: 1

Views: 1510

Answers (2)

Tangoo
Tangoo

Reputation: 1449

You guess right.

Tomecat/lib/servlet-api.jar includes javax.servlet conflicts with javax.servlet in hive-jdbc-x.x.x-standlone.jar.

I think it's not recommended to use hive-jdbc-x.x.x-standlone.jar when your app deployed to the production environment, cause hive-jdbc-x.x.x-standlone.jar includes many other resources, it's quite easy to conflict with other *.jar.

So just remove hive-jdbc-x.x.x-standlone.jar, and add the following jar to classpath(HAVE BEEN TESTED).

  1. hadoop-auth-x.x.x.jar
  2. hadoop-common-x.x.x.jar
  3. hadoop-mapreduce-client-core-x.x.x.jar
  4. hive-exec-x.x.x.jar
  5. hive-jdbc-x.x.x.jar
  6. hive-metastore-x.x.x.jar
  7. hive-service-x.x.x.jar

Upvotes: 0

Himanshu
Himanshu

Reputation: 4961

You should try removing hive-jdbc-0.14.0-standalone.jar and use below jars :

hive-common--0.14.0.jar hive-exec-0.14.0.jar hive-metastore-0.14.0.jar hive-serde-0.14.0.jar hive-service-0.14.0.jar

Upvotes: 0

Related Questions