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

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/seatunnel/issues?q=is%3Aissue+label%3A%22bug%22)
 and found no similar issues.
   
   
   ### What happened
   
   I am try to use `seatunnel-config-shade` library to generate config file out 
of seatunnel. But find some issue.
   
   
   ## Sample Code
   ```
   Config config = ConfigFactory.parseFile(new File(configFilePath));
    // resolve with global properties
   return config.root().render(CONFIG_RENDER_OPTIONS);
   ```
   Then I use this result submit to SeaTunnel via RestAPI.
   
   ## error message
   ```
   java.util.LinkedHashMap cannot be cast to java.util.ArrayList
   ```
   
   The submitted config to SeaTunnel is:
   ```
   {
       "sink" : {
           "Console" : {}
       },
       "source" : {
           "FakeSource" : {
               "schema" : {
                   "fields" : {
                       "name" : "string",
                       "age" : "int"
                   }
               },
               "row.num" : 16,
               "parallelism" : 2,
               "result_table_name" : "fake"
           }
       },
       "env" : {
           "job.mode" : "BATCH",
           "parallelism" : 2,
           "checkpoint.interval" : 10000
       }
   }
   ```
   
   ## Issue
   The generated config format is not right, the right format should be:
   ```
   "source" : [ {xxxxx} ]
   ```
   But error format is : 
   ```
   "source" : {xxxxx}
   ```
   
   
   
   ## Related code
   In `config-shade`, we rewrite the `ConfigParser`, when key is `source`, 
`transform`, `sink`, we will cast it as `SimpleConfigList`
   
https://github.com/apache/seatunnel/blob/132278c06a6f2af12934b948f65f8baf4b69db79/seatunnel-config/seatunnel-config-shade/src/main/java/org/apache/seatunnel/shade/com/typesafe/config/impl/ConfigParser.java#L131
   
https://github.com/apache/seatunnel/blob/132278c06a6f2af12934b948f65f8baf4b69db79/seatunnel-config/seatunnel-config-shade/src/main/java/org/apache/seatunnel/shade/com/typesafe/config/impl/ConfigParser.java#L253
   
   
   And when parse config file, we has a type cast the `source` to 
`List<Map<String, Object>>`
   
https://github.com/apache/seatunnel/blob/132278c06a6f2af12934b948f65f8baf4b69db79/seatunnel-core/seatunnel-core-starter/src/main/java/org/apache/seatunnel/core/starter/utils/ConfigShadeUtils.java#L142
   
   
   But If using origin `typesafe-config`  to parse Config File, It will read 
`source` as   `SimpleConfigObject`. So when cast to `List`
   we will got exception.
   
   
   ## What did I do
   1. Delete `seatunnel-config-base`  library, find it will get 
`NoClassDefFoundError` error
   2. using arthas to check check the class,
   I find the overwrite class under this folder 
https://github.com/apache/seatunnel/tree/dev/seatunnel-config/seatunnel-config-shade/src/main/java/org/apache/seatunnel/shade/com/typesafe/config
 all will load from `seatunnel-config-shade`
   the not overwrite class will load from `seatunnel-config-base`
   
   
   
   ## About Env
   This also rediculous, In my local desktop, mac/windows it can work well.
   But In sometime on special env, it will got this issue.
   Now I am using `Centos7`, it will got issue.
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   ### SeaTunnel Version
   
   2.3.8
   
   ### SeaTunnel Config
   
   ```conf
   demo batch config file
   ```
   
   
   ### Running Command
   
   ```shell
   out of seatunnel, using `seatunnel-config-shade` library to generate config
   ```
   
   
   ### Error Exception
   
   ```log
   java.util.LinkedHashMap cannot be cast to java.util.ArrayList
   ```
   
   
   ### Zeta or Flink or Spark Version
   
   _No response_
   
   ### Java or Scala Version
   
   _No response_
   
   ### Screenshots
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to