You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

PrestoDb执行关联查询时初始化HttpURLConnection失败求助

Troubleshooting "Could not initialize class sun.net.www.protocol.http.HttpURLConnection" in Presto on EMR 5.2

This error usually ties back to JVM class loading issues or system-level network configuration gaps—especially since you noted the same query runs fine on an identical cluster. Here are targeted steps to diagnose and fix the problem:

1. Check for JVM Environment Discrepancies

Even with matching cluster settings, subtle JDK or JVM parameter differences might be the root cause:

  • Log into the problematic Presto node and run java -version to compare the JDK version with your working cluster. EMR 5.2 defaults to OpenJDK 8, so ensure both clusters run the exact same patch version.
  • Review the Presto JVM config file at /etc/presto/jvm.config for differing -D flags related to networking (like proxy settings or HTTP connection pool parameters). Make sure all JVM arguments match the working cluster.

2. Inspect System Network Configurations

Misconfigured network settings can block the initialization of HttpURLConnection:

  • Compare proxy environment variables across clusters by running echo $http_proxy and echo $https_proxy. Unintended proxy settings can disrupt the JVM's HTTP client setup.
  • Check the /etc/hosts file for abnormal domain mappings that might prevent the JVM from resolving necessary addresses during class initialization.
  • Test basic HTTP connectivity from the node with curl http://example.com to rule out underlying network failures.

3. Audit Presto Plugins and Dependencies

Missing or mismatched plugins can trigger class loading failures:

  • Compare plugin directories (/usr/lib/presto/plugin) between clusters. Ensure all plugins (especially Hive, JDBC, or other connectors) are present and run identical versions.
  • Check the Presto server logs at /var/log/presto/server.log around the error time. The class initialization error might be a symptom of a root cause (like missing dependency classes or permission issues) detailed in the full stack trace.

4. Clear JVM Caches and Restart Services

Stale JVM caches or network state can persist through a simple Presto restart:

  • Clean up JVM temporary files and restart Presto:
    sudo rm -rf /tmp/hsperfdata_presto
    sudo restart presto-server
    
  • Try restarting the node's network service (adjust based on your EMR OS version):
    # For SysVinit-based EMR versions
    sudo service network restart
    # For systemd-based versions
    sudo systemctl restart network
    
    Then restart the Presto server again.

5. Validate File Permissions

Incorrect permissions can block the JVM from accessing required classes or configs:

  • Ensure the presto user has read access to the JDK installation directory. Run ls -ld /usr/lib/jvm/java-1.8.0-openjdk and compare permissions with the working cluster.
  • Verify the presto user can read all files in /etc/presto (the Presto config directory).

If none of these steps resolve the issue, try incrementally syncing configuration files and plugins from your working cluster to the problematic one. This can help isolate the exact setting or dependency causing the discrepancy.

内容的提问来源于stack exchange,提问作者Ashish Kumar

火山引擎 最新活动