Pivotal Knowledge Base

Follow

Error when querying JSON data with PXF: "java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils"

Environment

 Product  Version
 Pivotal HDB  2.0.1, 2.1.x
 HDP  RHEL 2.4/2.5

Symptom

When querying JSON file data through PXF external table, the following error is encountered: 

ERROR:  remote component error (500) from '10.101.170.74:51200':  
type  Exception report   message   java.lang.Exception: java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils    
description   The server encountered an internal error that prevented it from fulfilling this request.    
exception   javax.servlet.ServletException: java.lang.Exception:
java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils (libchurl.c:897)  (seg9 AYCAPSU01TS205:40000 pid=500623)
(dispatcher.c:1801)

Cause 

JsonAccessor needs commons-lang3 and it is not included in pxf-private.classpath. This will be addressed in the next release.

Resolution

As a workaround, include the path /usr/local/lib/commons-lang3-3.1.jar to Advanced pxf-public-classpath through Ambari:

1. Go to Ambari - PXF - Configs-Advanced pxf-public-classpath

2. Paste the path /usr/local/lib/commons-lang3-3.1.jar

3. Save and restart required services

Note: If already using Hive, this might not be needed since the required class is already available.

Comments

Powered by Zendesk