Adding hive jdbc dependency breaks Glassfish deplo

2019-09-14 00:41发布

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.

3条回答
We Are One
2楼-- · 2019-09-14 01:29

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.,

查看更多
放我归山
3楼-- · 2019-09-14 01:32

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

查看更多
Anthone
4楼-- · 2019-09-14 01:33

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.
查看更多
登录 后发表回答