Adding hive jdbc dependency breaks Glassfish deplo

2019-09-14 00:53发布

问题:

I'm building a Java webapp that needs to access Hive through JDBC, deployed on a Glassfish.

Once the hive jdbc maven dependency

<dependency>
    <groupId>org.apache.hive</groupId>
    <artifactId>hive-jdbc</artifactId>
    <version>2.1.0</version>
</dependency>

is added, deployment breaks and Glassfish gives the following exception:

Error occurred during deployment: Exception while loading the app : CDI deployment failure:WELD-001408: Unsatisfied dependencies for type Injector with qualifiers @Default at injection point [BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedConstructor] @Inject public org.apache.hadoop.yarn.server.resourcemanager.webapp.RMWebAppFilter(Injector) at org.apache.hadoop.yarn.server.resourcemanager.webapp.RMWebAppFilter.(RMWebAppFilter.java:0) . Please see server.log for more details.

回答1:

This seems to be a dependency issue with the libs provived by Glassfish 4.1.1 (1).

It works in Glassfish 4.1 (13). If possible, you should use this version.
You can download it here: https://glassfish.java.net/download-archive.html



回答2:

Solved the issue by

  • Updating from Glassfish 4.1(1) to Glassfish 4.1(13). However this did not on itself solve the issue.
  • On Glassfish's deploy screen in the admin console I disabled Implicit CDI Discovery.


回答3:

Hive-jdbc has some unfortunate dependencies (javax.*, jetty etc). Your error comes from a transitively included YARN webapp.

Try to slim down the Maven dependencies of hive-jdbc, as some dependencies like YARN do not belong in a JDBC driver.,