You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "nzw921rx (via GitHub)" <gi...@apache.org> on 2026/04/08 14:52:27 UTC

[I] [Improve][Zeta] Improve engine-server local IDE startup experience (missing Gson dependency & unconditional Hadoop class loading) [seatunnel]

nzw921rx opened a new issue, #10730:
URL: https://github.com/apache/seatunnel/issues/10730

   ### Search before asking
   
   - [x] I had searched in the [feature](https://github.com/apache/seatunnel/issues?q=is%3Aissue+label%3A%22Feature%22) and found no similar feature requirement.
   
   
   ### Description
   
   ### What are you trying to achieve
   
   Enable developers to **run and debug `SeaTunnelServerStarter` directly from IntelliJ** (using module classpath of `seatunnel-engine-server`) without hitting avoidable `NoClassDefFoundError` failures.
   
   Currently, local IDE startup fails with **two sequential errors** before any job is submitted. These errors do not occur when starting via `seatunnel-cluster.sh`, which uses a full `lib/*` classpath.
   
   ---
   ### Problem 1: Missing `com.google.gson` dependency
   
   After configuring `localfile` checkpoint and adding `-Dseatunnel.config` as VM option, starting `SeaTunnelServerStarter` fails immediately:
   
   ```
   ERROR com.hazelcast.spi.impl.servicemanager.impl.ServiceManagerImpl - Error while initializing service: com/google/gson/GsonBuilder
   java.lang.NoClassDefFoundError: com/google/gson/GsonBuilder
       at org.apache.seatunnel.engine.server.rest.servlet.PendingJobsServlet.<clinit>(PendingJobsServlet.java:60)
       at org.apache.seatunnel.engine.server.JettyService.createJettyServer(JettyService.java:185)
       at org.apache.seatunnel.engine.server.SeaTunnelServer.init(SeaTunnelServer.java:179)
       ...
   Caused by: java.lang.ClassNotFoundException: com.google.gson.GsonBuilder
       at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
   ```
   
   **Root cause:** `seatunnel-engine-server` main code imports `com.google.gson.*` (in `PendingJobsServlet`, `BaseServlet`, `RestHttpGetCommandProcessor`), but `gson` is **not declared as a direct dependency** in `seatunnel-engine-server/pom.xml`. In distribution builds it arrives transitively; in IDE module classpath it is missing.
   
   **Local workaround:** Manually add `com.google.code.gson:gson:2.8.9` to the IDE run configuration classpath.
   
   ---
   
   ### Problem 2: Unconditional Hadoop class loading in `SeaTunnelServer#init`
   
   After resolving Gson, a second startup failure occurs:
   
   ```
   ERROR com.hazelcast.spi.impl.servicemanager.impl.ServiceManagerImpl - Error while initializing service: org/apache/hadoop/fs/FileSystem$Statistics
   java.lang.NoClassDefFoundError: org/apache/hadoop/fs/FileSystem$Statistics
       at org.apache.seatunnel.engine.server.SeaTunnelServer.init(SeaTunnelServer.java:184)
       ...
   Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.fs.FileSystem$Statistics
       at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
   ```
   
   **Root cause:** `SeaTunnelServer.java` line 182-184 unconditionally loads a Hadoop class:
   
   ```java
   // a trick way to fix StatisticsDataReferenceCleaner thread class loader leak.
   // see https://issues.apache.org/jira/browse/HADOOP-19049
   FileSystem.Statistics statistics = new FileSystem.Statistics("SeaTunnel");
   ```
   
   This executes on **every** master init regardless of whether checkpoint storage is `localfile` or `hdfs`. It forces loading `org.apache.hadoop.fs.FileSystem`, which requires Hadoop jars. IDE module classpath typically does not include `seatunnel-hadoop3-3.1.4-uber` (declared as `provided` scope in pom).
   
   **Local workaround:** Comment out this line:
   
   ```java
   // FileSystem.Statistics statistics = new FileSystem.Statistics("SeaTunnel");
   ```
   
   After commenting out, engine-server starts successfully in IDE with `localfile` checkpoint.
   
   ---
   
   ### Proposed fix
   
   #### Fix 1: Add explicit Gson dependency
   
   Add `gson` as a direct compile dependency in `seatunnel-engine-server/pom.xml`:
   
   ```xml
   <dependency>
       <groupId>com.google.code.gson</groupId>
       <artifactId>gson</artifactId>
   </dependency>
   ```
   
   This aligns the pom declaration with actual imports and ensures IDE module classpath is self-contained.
   
   #### Fix 2: Make HADOOP-19049 workaround conditional based on checkpoint storage type
   
   The `SeaTunnelServer#init` method already has access to `seaTunnelConfig`. The checkpoint storage type can be read via:
   
   ```java
   seaTunnelConfig.getEngineConfig().getCheckpointConfig().getStorage().getStorage()
   ```
   
   which returns `"localfile"` or `"hdfs"` (default is `"localfile"`).
   
   The fix should only execute the HADOOP-19049 workaround when the configured storage type actually requires Hadoop:
   
   ```java
   // a trick way to fix StatisticsDataReferenceCleaner thread class loader leak.
   // see https://issues.apache.org/jira/browse/HADOOP-19049
   String storageType = seaTunnelConfig.getEngineConfig()
           .getCheckpointConfig().getStorage().getStorage();
   if (!"localfile".equalsIgnoreCase(storageType)) {
       FileSystem.Statistics statistics = new FileSystem.Statistics("SeaTunnel");
   }
   ```
   
   - When checkpoint storage is `hdfs` (production / distribution): workaround executes as before, no behavior change.
   - When checkpoint storage is `localfile` (local IDE debugging): skips Hadoop class loading, engine-server starts without Hadoop jars.
   
   ---
   
   ### Benefits
   
   - **Fast local startup**: Developers can run and debug `SeaTunnelServerStarter` from IDE without the full distribution classpath or Hadoop uber jars
   - **Correct dependency declaration**: `gson` as direct dependency matches actual imports, eliminates flaky transitive-only resolution
   
   ### Environment
   
   | Item | Value |
   |------|-------|
   | Checkpoint | `type: localfile` |
   
   ### Usage Scenario
   
   _No response_
   
   ### Related issues
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [x] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Improve][Zeta] Improve engine-server local IDE startup experience (missing Gson dependency & unconditional Hadoop class loading) [seatunnel]

Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on issue #10730:
URL: https://github.com/apache/seatunnel/issues/10730#issuecomment-4219671789

   Thanks for the update. I rechecked the current code with your narrowed scope.
   
   I agree with separating the two points now:
   1. `gson` is still a real module-declaration gap for `seatunnel-engine-server`, because the server code directly imports Gson classes while the module POM does not declare it explicitly.
   2. The Hadoop `NoClassDefFoundError` no longer looks like a repository bug from the latest reproduction. With `seatunnel-hadoop3-3.1.4-uber` kept as `provided`, that part is consistent with an IDE classpath setup issue.
   
   So narrowing PR #10742 to Problem 1 only looks right to me.
   
   If you have a moment, please also reflect the final conclusion for Problem 2 in the PR description or issue body, so future contributors do not chase the same path again. Thanks for doing the extra verification here.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Improve][Zeta] Improve engine-server local IDE startup experience (missing Gson dependency) [seatunnel]

Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on issue #10730:
URL: https://github.com/apache/seatunnel/issues/10730#issuecomment-4220824242

   Thanks. Then I think the status is clear now:
   
   1. the real code fix is PR #10742, which addresses the missing Gson declaration on `dev`
   2. the Hadoop part is no longer being treated as a repository bug; it should be documented as an IDE classpath requirement for `provided` dependencies
   
   From the issue side, that means the scope is now stable and the remaining implementation review can continue on #10742.
   
   Once #10742 is merged, this issue should be ready to close.
   
   Thanks for doing the extra verification and narrowing this down for future contributors.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Improve][Zeta] Improve engine-server local IDE startup experience (missing Gson dependency & unconditional Hadoop class loading) [seatunnel]

Posted by "nzw921rx (via GitHub)" <gi...@apache.org>.
nzw921rx commented on issue #10730:
URL: https://github.com/apache/seatunnel/issues/10730#issuecomment-4207179635

   cc @davidzollo — Looking forward to your input on this. Thanks!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Improve][Zeta] Improve engine-server local IDE startup experience (missing Gson dependency & unconditional Hadoop class loading) [seatunnel]

Posted by "nzw921rx (via GitHub)" <gi...@apache.org>.
nzw921rx commented on issue #10730:
URL: https://github.com/apache/seatunnel/issues/10730#issuecomment-4216114078

   ### Update: Dropping the HADOOP-19049 workaround change (Problem 2)
   
   After further investigation, the Hadoop `NoClassDefFoundError` (Problem 2) is **not a code issue** — it's caused by local IDE classpath configuration.
   
   **Root cause:** `seatunnel-hadoop3-3.1.4-uber` is declared as `provided` scope in `checkpoint-storage-hdfs/pom.xml`. When running `SeaTunnelServerStarter` from IntelliJ, `provided` dependencies are excluded from the classpath by default. The fix is an IDE setting:
   
   - IntelliJ Run Configuration → **Modify options** → check **"Add dependencies with 'provided' scope to classpath"**
   
   With this setting, Hadoop classes are available and the existing HADOOP-19049 workaround (`FileSystem.Statistics`) works as intended — no code change needed.
   
   **The PR (#10742) now only addresses Problem 1** (missing Gson dependency), which is a genuine missing declaration in `pom.xml`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Improve][Zeta] Improve engine-server local IDE startup experience (missing Gson dependency & unconditional Hadoop class loading) [seatunnel]

Posted by "julianbradford19-png (via GitHub)" <gi...@apache.org>.
julianbradford19-png commented on issue #10730:
URL: https://github.com/apache/seatunnel/issues/10730#issuecomment-4208024741

   Thanks for the detailed breakdown of these startup issues. The proposed
   fixes for the missing Gson dependency and the conditional Hadoop class
   loading make sense for improving the local IDE experience.
   
   On Wed, Apr 8, 2026, 9:54 AM zhiwei.niu ***@***.***> wrote:
   
   > *nzw921rx* left a comment (apache/seatunnel#10730)
   > <https://github.com/apache/seatunnel/issues/10730#issuecomment-4207179635>
   >
   > cc @davidzollo <https://github.com/davidzollo> — Looking forward to your
   > input on this. Thanks!
   >
   > —
   > Reply to this email directly, view it on GitHub
   > <https://github.com/apache/seatunnel/issues/10730#issuecomment-4207179635>,
   > or unsubscribe
   > <https://github.com/notifications/unsubscribe-auth/B74KUG5BU5EL575CJSGIYLT4UZR23AVCNFSM6AAAAACXRDRGGOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DEMBXGE3TSNRTGU>
   > .
   > You are receiving this because you are subscribed to this thread.Message
   > ID: ***@***.***>
   >
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Improve][Zeta] Improve engine-server local IDE startup experience (missing Gson dependency) [seatunnel]

Posted by "nzw921rx (via GitHub)" <gi...@apache.org>.
nzw921rx commented on issue #10730:
URL: https://github.com/apache/seatunnel/issues/10730#issuecomment-4219754687

   > Thanks for the update. I rechecked the current code with your narrowed scope.
   > 
   > I agree with separating the two points now:
   > 
   > 1. `gson` is still a real module-declaration gap for `seatunnel-engine-server`, because the server code directly imports Gson classes while the module POM does not declare it explicitly.
   > 2. The Hadoop `NoClassDefFoundError` no longer looks like a repository bug from the latest reproduction. With `seatunnel-hadoop3-3.1.4-uber` kept as `provided`, that part is consistent with an IDE classpath setup issue.
   > 
   > So narrowing PR [#10742](https://github.com/apache/seatunnel/pull/10742) to Problem 1 only looks right to me.
   > 
   > If you have a moment, please also reflect the final conclusion for Problem 2 in the PR description or issue body, so future contributors do not chase the same path again. Thanks for doing the extra verification here.
   
   all right


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Improve][Zeta] Improve engine-server local IDE startup experience (missing Gson dependency) [seatunnel]

Posted by "corgy-w (via GitHub)" <gi...@apache.org>.
corgy-w closed issue #10730: [Improve][Zeta] Improve engine-server local IDE startup experience (missing Gson dependency)
URL: https://github.com/apache/seatunnel/issues/10730


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Improve][Zeta] Improve engine-server local IDE startup experience (missing Gson dependency & unconditional Hadoop class loading) [seatunnel]

Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on issue #10730:
URL: https://github.com/apache/seatunnel/issues/10730#issuecomment-4214309255

   Thanks for the detailed breakdown.
   
   I checked the current `dev` code path and this looks like a real engine-server developer-experience issue, not just an IDE misconfiguration.
   
   Two concrete points match your analysis:
   1. REST classes such as `PendingJobsServlet` / `BaseServlet` use Gson directly, but `seatunnel-engine-server` does not declare Gson as a direct dependency in its own POM.
   2. `SeaTunnelServer.init()` unconditionally touches Hadoop `FileSystem` statistics, which can pull Hadoop classes even when the local startup path does not actually need HDFS-backed storage.
   
   So the direction in this issue is reasonable.
   
   I do not see a dev-branch PR linked here yet. A focused PR that:
   1. adds the direct Gson dependency for the server module, and
   2. guards or defers the Hadoop-specific initialization
   would be a good next step.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org