Saravanakumar Selvaraj created CAMEL-26972:
----------------------------------------------

             Summary: camel-alibaba: fc and sms fail with NoSuchFieldError 
because tea-openapi is managed and tea-util is not
                 Key: CAMEL-26972
                 URL: https://issues.apache.org/jira/browse/CAMEL-26972
             Project: Camel
          Issue Type: Bug
            Reporter: Saravanakumar Selvaraj


parent/pom.xml manages com.aliyun:tea-openapi (tea-openapi-version: 0.3.17 in 
4.23.0, 0.3.20 on main) and com.aliyun:tea, but not com.aliyun:tea-util. Where 
this dependencyManagement applies, tea-openapi takes the managed version, while 
tea-util stays at the older version that each Alibaba Cloud SDK declares 
(dependency mediation, nearest definition). tea-openapi 0.3.17 and 0.3.20 
declare tea-util 0.2.28, and they use members that older tea-util versions do 
not have.

Resolved versions (mvn dependency:tree in each module):
- camel-alibaba-fc: tea-util 0.2.23, which fc_open20210406 2.1.0 declares.
- camel-alibaba-sms: tea-util 0.2.26, which dysmsapi20170525 4.6.0 declares.
- camel-alibaba-sls: tea-util 0.2.26, which sls20201230 5.18.1 declares.
- camel-alibaba-kms: tea-util 0.2.26 in 4.23.0, which kms20160120 2.3.0 
declares. On main, kms20160120 2.3.2 declares tea-util 0.2.28.
- camel-alibaba-eventbridge: eventbridge-client 1.3.14 does not depend on 
tea-openapi.

Missing members (javap): com.aliyun.teaopenapi.Client of tea-openapi 0.3.17 and 
0.3.20 reads the fields domain and returnErrorResponse of 
com.aliyun.teautil.models.RuntimeOptions, and calls 
com.aliyun.teautil.Common.getHostName(). tea-util 0.2.23 has none of the three. 
tea-util 0.2.26 lacks returnErrorResponse.
- doRequest, which the Function Compute, Short Message Service and Key 
Management Service clients reach through callApi, reads domain before it sends 
the request, and returnErrorResponse after any response.
- execute, which the Simple Log Service client uses, reads only domain.
- getHostName() is called only when the client Config sets 
enableUsageDataCollection to true, which the components do not do.

Result through the producer, with the SDK client that the endpoint creates from 
its options (dummy AccessKey pair, and the endpoint 127.0.0.1:1 or a local 
HTTPS server that answers 400 or 200):

camel-alibaba-fc (main and 4.23.0): every request fails before it is sent.
{noformat}
java.lang.NoSuchFieldError: Class com.aliyun.teautil.models.RuntimeOptions does 
not have member field 'java.lang.String domain'
    at com.aliyun.teaopenapi.Client.doRequest(Client.java:1002)
    at com.aliyun.teaopenapi.Client.callApi(Client.java:1485)
    at 
com.aliyun.fc_open20210406.Client.invokeFunctionWithOptions(Client.java:2263)
{noformat}

camel-alibaba-sms (main and 4.23.0) and camel-alibaba-kms (4.23.0): every 
request that gets an HTTP response fails, also for status 200. A refused 
connection still gives a connection error.
{noformat}
java.lang.NoSuchFieldError: Class com.aliyun.teautil.models.RuntimeOptions does 
not have member field 'java.lang.Boolean returnErrorResponse'
    at com.aliyun.teaopenapi.Client.doRequest(Client.java:1176)
    at com.aliyun.teaopenapi.Client.callApi(Client.java:1485)
    at com.aliyun.dysmsapi20170525.Client.sendSmsWithOptions(Client.java:5263)
{noformat}

camel-alibaba-sls, and camel-alibaba-kms on main: no NoSuchFieldError.

The line numbers are those of tea-openapi 0.3.20. The tests of these components 
use a mocked SDK client, so they cannot show the defect.

Who gets this combination:
- The Camel build, where the dependencyManagement of camel-parent applies.
- The camel-spring-boot-dependencies BOM has the same entries. In 4.23.0 it 
manages tea-openapi 0.3.17 and tea 1.4.2, and it has no tea-util. An 
application that imports this BOM therefore resolves the same combination (read 
from the BOM, not run).
- An application with Maven 3.9 and no dependencyManagement of its own is not 
affected. It resolves the versions that each SDK declares (for 
camel-alibaba-fc: tea-openapi 0.3.8 with tea-util 0.2.23), and the same 
requests work there, for 4.23.0 and 4.24.0-SNAPSHOT.
- Not checked: Maven 4, Gradle, Camel Quarkus, and Camel JBang at run time.

4.23.0 is the only release that contains these components. The branch 
camel-4.23.x has the same managed versions.

Proposed fix: manage com.aliyun:tea-util in parent/pom.xml next to 
com.aliyun:tea-openapi, at the version that tea-openapi declares (0.2.28), with 
a property tea-util-version and a dependencyManagement entry that uses it. With 
this change, tried locally, camel-alibaba-fc, camel-alibaba-sls and 
camel-alibaba-sms resolve tea-util 0.2.28, no member is missing, and the 
requests above end with a connection error, a com.aliyun.tea.TeaException built 
from the response, or a success.

Found while reviewing the option descriptions of camel-alibaba-fc (CAMEL-23832).

Claude Code on behalf of saravanakumar1987



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to