BertOnline opened a new issue #112:
URL: https://github.com/apache/shardingsphere-elasticjob-ui/issues/112


   ## Bug Report
   
   ### Which version of ElasticJob did you use?
   3.0.0-RC1 
   
   ### Which project did you use? ElasticJob-Lite or ElasticJob-Cloud?
   elasticjob-lite
   
   ### Expected behavior
   
![image](https://user-images.githubusercontent.com/17882970/112114614-39ebca80-8bf3-11eb-86de-d6b9172e2187.png)
   
   ### Actual behavior
   When I click the update button, I get an exception
   ```text
   Failed to specialize base type 
org.apache.shardingsphere.elasticjob.infra.yaml.config.YamlConfiguration<org.apache.shardingsphere.elasticjob.api.JobExtraConfiguration>
 as org.apache.shardingsphere.elasticjob.tracing.yaml.YamlTracingConfiguration, 
problem: Type parameter #1/1 differs; can not specialize 
org.apache.shardingsphere.elasticjob.api.JobExtraConfiguration with 
org.apache.shardingsphere.elasticjob.tracing.api.TracingConfiguration<$1> 
(through reference chain: 
org.apache.shardingsphere.elasticjob.lite.ui.web.response.ResponseResult["model"]->org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJO["jobExtraConfigurations"]->java.util.ArrayList[0])
   ```
   
   ### Reason analyze (If you can)
   Error reason: Job configuration serialization exception, Jackson 
serialization failed
   
   Error location: JobConfigController- > get api/jobs/config/ {jobname}. After 
reading the configuration from ZK, use YamlEngine.unmarshal And then get 
JobConfigurationPOJO, The generic type of jobExtraConfigurations attribute in 
POJO is interface Collection<YamlConfiguration<JobExtraConfiguration>>, while 
the generic class after unmarshal is 
Collection<YamlTracingConfiguration<YamlDataSourceConfiguration>>, However, 
YamlDataSourceConfiguration is not a subclass of JobExtraConfiguration, which 
leads to serialization exception. It is found that jobExtraConfigurations is 
not used in job configuration through debugging at the front and rear ends. 
Therefore, the property is temporarily removed when returning, and then the 
property value before updating is reset.
   
   ### Example codes for reproduce this issue (such as a github link).
   ```java
   // JobConfigController
       
       /**
        * Get job configuration.
        *
        * @param jobName job name
        * @return job configuration
        */
       @GetMapping(value = "/{jobName:.+}")
       public ResponseResult<JobConfigurationPOJO> 
getJobConfig(@PathVariable("jobName") final String jobName) {
           JobConfigurationPOJO data = 
jobAPIService.getJobConfigurationAPI().getJobConfiguration(jobName);
           // fix serialize exception
           data.getJobExtraConfigurations().clear();
           //
           return ResponseResultUtil.build(data);
       }
       
       /**
        * Update job configuration.
        *
        * @param jobConfiguration job configuration
        */
       @PutMapping
       public ResponseResult<Boolean> updateJobConfig(@RequestBody final 
JobConfigurationPOJO jobConfiguration) {
           // for missing jobExtraConfiguration
           JobConfigurationPOJO old = 
jobAPIService.getJobConfigurationAPI().getJobConfiguration(jobConfiguration.getJobName());
           
jobConfiguration.setJobExtraConfigurations(old.getJobExtraConfigurations());
           //
           
jobAPIService.getJobConfigurationAPI().updateJobConfiguration(jobConfiguration);
           return ResponseResultUtil.build(Boolean.TRUE);
       }
    
   // JobConfigurationPOJO
    
   private Collection<YamlConfiguration<JobExtraConfiguration>> 
jobExtraConfigurations = new LinkedList<>();
   ```
   


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

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


Reply via email to