Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Could not initialize class reactor.netty.http.client.HttpClientConfig #23629

Closed
AlejandroBlanco opened this issue Aug 17, 2021 · 3 comments
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. dependency-issue Issue that is caused by dependency conflicts Functions question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@AlejandroBlanco
Copy link

AlejandroBlanco commented Aug 17, 2021

Describe the bug
azure-cosmos jar cannot find at runtime the reactor netty libraries, failing silently when running in local. The bug was discovered running an azure function locally via remote connection:

func host start --port 7071 --useHttps --cert localhost.pfx --password 123 --language-worker -- "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005"

Many attemps have been done to get rid of the issue, like excluding manually the io.reactor netty deps from azure-cosmos and adding them manually to version 1.10 and 1.9 and adding the netty-all and netty-bom jars. Many variations of versions were tested without success (sometimes the method that is not found differs but that doesn't matter as the main issue is the Azure function seems to have problem to build a classpath equivalen to the build path). There are no other jar files which contain apparently different versions of netty or io.projectreactor.netty. The Java version is 8 and the appropriate app setting was added in the local.settings.json doc. Java 11 was tried to but we find further issues with classloaders in the Azure function

{
  "IsEncrypted": false,
  "Values": {
    "FUNCTIONS_WORKER_RUNTIME": "java",
    "CosmosDBAttribute.ConnectionStringSetting": "AccountEndpoint=https://myurl.documents.azure.com:443/; AccountKey=mykey==;",
    "AZ_KEY": "mykey==",
    "AZ_HOST": "https://myurl.documents.azure.com:443/",
    "FUNCTIONS_WORKER_JAVA_LOAD_APP_LIBS": true 
  },  
  "Host": {
    "LocalHttpPort": 7071,
    "CORS": "https://localhost:8080",
    "CORSCredentials": false
  }
}

Exception or Stack Trace
No stacktrace can be recovered for failing silently. In debug mode an "Could not initialize class reactor.netty.http.client.HttpClientConfig" exception can be catched when reactor.netty.http.client.HttpClientConnect(ConnectionProvider provider) constructor is called

To Reproduce
Create an Azure function to call a cosmos DB async client:

Using last core tools :
Azure Functions Core Tools (2.0.3)
Function Runtime Version: 2.0.12115.0

        CosmosAsyncClient asyncClient = new CosmosClientBuilder()
        	    .endpoint(System.getenv("AZ_HOST"))
        	    .key(System.getenv("AZ_KEY"))
        	    .preferredRegions(Collections.singletonList("West Europe"))
        	    .consistencyLevel(ConsistencyLevel.SESSION)
        	    .contentResponseOnWriteEnabled(true)
        	    .buildAsyncClient();
<dependencies>
    <!-- required for the code generated by Swagger Codegen plugin -->
    <dependency>
        <groupId>io.swagger.codegen.v3</groupId>
        <artifactId>swagger-codegen-maven-plugin</artifactId>
        <version>3.0.27</version>
    </dependency>
    <!-- required for the code generated by Swagger Codegen plugin -->
    <dependency>
        <groupId>io.swagger</groupId>
        <artifactId>swagger-annotations</artifactId>
        <version>${swagger-annotations-version}</version>
    </dependency>
    <dependency>
        <groupId>org.openapitools</groupId>
        <artifactId>jackson-databind-nullable</artifactId>
        <version>${jackson-databind-nullable-version}</version>
    </dependency>
    <dependency>
        <groupId>com.github.spotbugs</groupId>
        <artifactId>spotbugs-annotations</artifactId>
        <version>4.2.0</version>
    </dependency>
    <!-- HTTP client: jersey-client -->
    <dependency>
        <groupId>org.glassfish.jersey.core</groupId>
        <artifactId>jersey-client</artifactId>
        <version>${jersey-version}</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.media</groupId>
        <artifactId>jersey-media-json-jackson</artifactId>
        <version>${jersey-version}</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.media</groupId>
        <artifactId>jersey-media-multipart</artifactId>
        <version>${jersey-version}</version>
    </dependency>

    <!-- JSON processing: jackson -->
    <dependency>
        <groupId>com.fasterxml.jackson.jaxrs</groupId>
        <artifactId>jackson-jaxrs-base</artifactId>
        <version>${jackson-version}</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-core</artifactId>
        <version>${jackson-version}</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-annotations</artifactId>
        <version>${jackson-version}</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>${jackson-version}</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.jaxrs</groupId>
        <artifactId>jackson-jaxrs-json-provider</artifactId>
        <version>${jackson-version}</version>
    </dependency>

    <!-- Joda time: if you use it -->
    <dependency>
        <groupId>com.fasterxml.jackson.datatype</groupId>
        <artifactId>jackson-datatype-joda</artifactId>
        <version>${jackson-version}</version>
    </dependency>
    <dependency>
        <groupId>joda-time</groupId>
        <artifactId>joda-time</artifactId>
        <version>${jodatime-version}</version>
    </dependency>

    <!-- Base64 encoding that works in both JVM and Android -->
    <dependency>
        <groupId>com.brsanthu</groupId>
        <artifactId>migbase64</artifactId>
        <version>2.2</version>
    </dependency>

    <!-- Azure dependencies -->

    <dependency>
        <groupId>com.microsoft.azure.functions</groupId>
        <artifactId>azure-functions-java-library</artifactId>
        <version>${azure.functions.java.library.version}</version>
    </dependency>
	<dependency>
		<groupId>com.azure</groupId>
		<artifactId>azure-cosmos</artifactId>
		<version>4.18.0</version>
		<!-- >exclusions>
		    <exclusion>
		         <groupId>io.projectreactor.netty</groupId>
		         <artifactId>reactor-netty</artifactId>
		    </exclusion>
		    			    <exclusion>
		         <groupId>io.projectreactor.netty</groupId>
		         <artifactId>reactor-netty-http</artifactId>
		    </exclusion>
		    			    <exclusion>
		         <groupId>io.projectreactor.netty</groupId>
		         <artifactId>reactor-netty</artifactId>
		    </exclusion>
		</exclusions-->
	</dependency>
	<!-- >dependency>
	    <groupId>io.projectreactor.netty</groupId>
	    <artifactId>reactor-netty</artifactId>
	    <version>1.0.10</version>
	</dependency>
	<dependency>
	    <groupId>io.projectreactor.netty</groupId>
	    <artifactId>reactor-netty-http</artifactId>
	    <version>1.0.10</version>
	</dependency>
	<dependency>
	    <groupId>io.projectreactor.netty</groupId>
	    <artifactId>reactor-netty-core</artifactId>
	    <version>1.0.10</version>
	</dependency>
	<dependency>
	    <groupId>io.netty</groupId>
	    <artifactId>netty-all</artifactId>
	    <version>4.1.66.Final</version>
	</dependency>
	<dependency>
		<groupId>io.netty</groupId>
		<artifactId>netty-bom</artifactId>
		<version>4.1.66.Final</version>
		<type>pom</type>
	</dependency-->		
	
    <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>1.7.1</version>
    </dependency>

    <!-- Test dependencies -->
    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter</artifactId>
        <version>5.4.2</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-core</artifactId>
        <version>2.23.4</version>
        <scope>test</scope>
    </dependency>
</dependencies>


       <plugin>
            <groupId>com.microsoft.azure</groupId>
            <artifactId>azure-functions-maven-plugin</artifactId>
            <version>${azure.functions.maven.plugin.version}</version>
            <configuration>
                <!-- function app name -->
                <appName>${functionAppName}</appName>
                <!-- function app resource group -->
                <resourceGroup>java-functions-group</resourceGroup>
                <!-- function app service plan name -->
                <appServicePlanName>java-functions-app-service-plan</appServicePlanName>
                <functionResourceGroup>java-functions-group</functionResourceGroup>
                <!-- function app region-->
                <!-- refers https://github.com/microsoft/azure-maven-plugins/wiki/Azure-Functions:-Configuration-Details#supported-regions for all valid values -->
                <region>westeurope</region>
                <!-- function pricingTier, default to be consumption if not specified -->
                <!-- refers https://github.com/microsoft/azure-maven-plugins/wiki/Azure-Functions:-Configuration-Details#supported-pricing-tiers for all valid values -->
                <!-- <pricingTier></pricingTier> -->

                <!-- Whether to disable application insights, default is false -->
                <!-- refers https://github.com/microsoft/azure-maven-plugins/wiki/Azure-Functions:-Configuration-Details for all valid configurations for application insights-->
                <!-- <disableAppInsights></disableAppInsights> -->
                <runtime>
                    <!-- runtime os, could be windows, linux or docker-->
                    <os>windows</os>
                    <javaVersion>8</javaVersion>
                    <!-- for docker function, please set the following parameters -->
                    <!-- <image>[hub-user/]repo-name[:tag]</image> -->
                    <!-- <serverId></serverId> -->
                    <!-- <registryUrl></registryUrl>  -->
                </runtime>
                <appSettings>
                    <property>
                        <name>FUNCTIONS_EXTENSION_VERSION</name>
                        <value>~3</value>
                    </property>
                    <property>
                        <name>FUNCTIONS_WORKER_JAVA_LOAD_APP_LIBS</name>
                        <value>1</value>
                    </property>
                </appSettings>
            </configuration>
            <executions>
                <execution>
                    <id>package-functions</id>
                    <goals>
                        <goal>package</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <version>3.1.0</version>
            <executions>
                <execution>
                    <id>copy-resources</id>
                    <phase>package</phase>
                    <goals>
                        <goal>copy-resources</goal>
                    </goals>
                    <configuration>
                        <overwrite>true</overwrite>
                        <outputDirectory>${stagingDirectory}</outputDirectory>
                        <resources>
                            <resource>
                                <directory>${project.basedir}</directory>
                                <includes>
                                    <include>host.json</include>
                                    <include>local.settings.json</include>
                                </includes>
                            </resource>
                        </resources>
                    </configuration>
                </execution>
				<execution>
                    <id>copy-bin</id>
                    <phase>package</phase>
                    <goals>
                        <goal>copy-resources</goal>
                    </goals>
                    <configuration>
                        <overwrite>true</overwrite>
                        <outputDirectory>${stagingDirectory}/bin</outputDirectory>
                        <resources>
                            <resource>
                                <directory>${project.basedir}/bin</directory>
                            </resource>
                        </resources>
                    </configuration>
            	</execution>                    
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>3.1.1</version>
            <executions>
                <execution>
                    <id>copy-dependencies</id>
                    <phase>prepare-package</phase>
                    <goals>
                        <goal>copy-dependencies</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>${stagingDirectory}/lib</outputDirectory>
                        <overWriteReleases>false</overWriteReleases>
                        <overWriteSnapshots>false</overWriteSnapshots>
                        <overWriteIfNewer>true</overWriteIfNewer>
                        <includeScope>runtime</includeScope>
                        <!-- >excludeArtifactIds>azure-functions-java-library</excludeArtifactIds-->
                    </configuration>
                </execution>
            </executions>
        </plugin>

The Cosmos DB that is called is not an emulator but a remote URL if that matters

Code Snippet

        CosmosAsyncClient asyncClient = new CosmosClientBuilder()
        	    .endpoint(System.getenv("AZ_HOST"))
        	    .key(System.getenv("AZ_KEY"))
        	    .preferredRegions(Collections.singletonList("West Europe"))
        	    .consistencyLevel(ConsistencyLevel.SESSION)
        	    .contentResponseOnWriteEnabled(true)
        	    .buildAsyncClient();

Expected behavior
An Async cosmos client is created and we can insert items in the cosmos document in the indicated URL

Screenshots
image

Setup (please complete the following information):

  • OS: Windows 7 with last core tools up to current date (npm i -g azure-functions-core-tools@core)
  • IDE: Irrelevant, caught on an Eclipse
  • Library/Libraries: azure-core:1.18.0, 1.17, 1.16. As seen in the pom there is a cosmos function jar but shouldn't impact on this matter
  • Java version: 1.8
  • App Server/Environment: Azure Function
  • Frameworks: No additional framework to handle the controller

If you suspect a dependency version mismatch (e.g. you see NoClassDefFoundError, NoSuchMethodError or similar), please provide

  • dependency tree (mvn dependency:tree -Dverbose)

[INFO] Verbose not supported since maven-dependency-plugin 3.0
[INFO] com.myapp:jar:1.0-SNAPSHOT
[INFO] +- io.swagger.codegen.v3:swagger-codegen-maven-plugin:jar:3.0.27:compile
[INFO] | +- org.apache.maven:maven-core:jar:3.2.5:compile
[INFO] | | +- org.apache.maven:maven-model:jar:3.2.5:compile
[INFO] | | +- org.apache.maven:maven-settings:jar:3.2.5:compile
[INFO] | | +- org.apache.maven:maven-settings-builder:jar:3.2.5:compile
[INFO] | | +- org.apache.maven:maven-repository-metadata:jar:3.2.5:compile
[INFO] | | +- org.apache.maven:maven-artifact:jar:3.2.5:compile
[INFO] | | +- org.apache.maven:maven-model-builder:jar:3.2.5:compile
[INFO] | | +- org.apache.maven:maven-aether-provider:jar:3.2.5:compile
[INFO] | | | - org.eclipse.aether:aether-spi:jar:1.0.0.v20140518:compile
[INFO] | | +- org.eclipse.aether:aether-impl:jar:1.0.0.v20140518:compile
[INFO] | | +- org.eclipse.aether:aether-api:jar:1.0.0.v20140518:compile
[INFO] | | +- org.eclipse.aether:aether-util:jar:1.0.0.v20140518:compile
[INFO] | | +- org.eclipse.sisu:org.eclipse.sisu.plexus:jar:0.3.0.M1:compile
[INFO] | | | +- javax.enterprise:cdi-api:jar:1.0:compile
[INFO] | | | | - javax.annotation:jsr250-api:jar:1.0:compile
[INFO] | | | - org.eclipse.sisu:org.eclipse.sisu.inject:jar:0.3.0.M1:compile
[INFO] | | +- org.sonatype.sisu:sisu-guice:jar:no_aop:3.2.3:compile
[INFO] | | | +- javax.inject:javax.inject:jar:1:compile
[INFO] | | | - aopalliance:aopalliance:jar:1.0:compile
[INFO] | | +- org.codehaus.plexus:plexus-interpolation:jar:1.21:compile
[INFO] | | +- org.codehaus.plexus:plexus-utils:jar:3.0.20:compile
[INFO] | | +- org.codehaus.plexus:plexus-classworlds:jar:2.5.2:compile
[INFO] | | +- org.codehaus.plexus:plexus-component-annotations:jar:1.5.5:compile
[INFO] | | - org.sonatype.plexus:plexus-sec-dispatcher:jar:1.3:compile
[INFO] | | - org.sonatype.plexus:plexus-cipher:jar:1.4:compile
[INFO] | +- org.apache.maven:maven-compat:jar:3.2.5:compile
[INFO] | | - org.apache.maven.wagon:wagon-provider-api:jar:2.8:compile
[INFO] | +- org.apache.maven:maven-plugin-api:jar:3.2.5:compile
[INFO] | +- org.apache.maven.plugin-tools:maven-plugin-annotations:jar:3.4:compile
[INFO] | +- io.swagger.codegen.v3:swagger-codegen:jar:3.0.27:compile
[INFO] | | +- io.swagger:swagger-parser:jar:1.0.55:compile
[INFO] | | | - io.swagger:swagger-core:jar:1.6.1:compile
[INFO] | | | +- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.10.1:compile
[INFO] | | | | - org.yaml:snakeyaml:jar:1.24:compile
[INFO] | | | +- io.swagger:swagger-models:jar:1.6.1:compile
[INFO] | | | - javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] | | +- io.swagger.parser.v3:swagger-parser:jar:2.0.27:compile
[INFO] | | | +- io.swagger.parser.v3:swagger-parser-v2-converter:jar:2.0.27:compile
[INFO] | | | | +- io.swagger.core.v3:swagger-models:jar:2.1.10:compile
[INFO] | | | | - io.swagger.parser.v3:swagger-parser-core:jar:2.0.27:compile
[INFO] | | | - io.swagger.parser.v3:swagger-parser-v3:jar:2.0.27:compile
[INFO] | | | - io.swagger.core.v3:swagger-core:jar:2.1.10:compile
[INFO] | | | +- io.swagger.core.v3:swagger-annotations:jar:2.1.10:compile
[INFO] | | | - jakarta.validation:jakarta.validation-api:jar:2.0.2:compile
[INFO] | | +- io.swagger:swagger-codegen:jar:2.4.21:compile
[INFO] | | | +- io.swagger:swagger-compat-spec-parser:jar:1.0.55:compile
[INFO] | | | | +- com.github.java-json-tools:json-schema-validator:jar:2.2.14:compile
[INFO] | | | | | +- com.github.java-json-tools:jackson-coreutils-equivalence:jar:1.0:compile
[INFO] | | | | | +- com.github.java-json-tools:json-schema-core:jar:1.2.14:compile
[INFO] | | | | | | +- com.github.java-json-tools:uri-template:jar:0.10:compile
[INFO] | | | | | | - org.mozilla:rhino:jar:1.7.7.2:compile
[INFO] | | | | | +- com.sun.mail:mailapi:jar:1.6.2:compile
[INFO] | | | | | +- com.googlecode.libphonenumber:libphonenumber:jar:8.11.1:compile
[INFO] | | | | | - net.sf.jopt-simple:jopt-simple:jar:5.0.4:compile
[INFO] | | | | +- com.github.java-json-tools:json-patch:jar:1.13:compile
[INFO] | | | | | +- com.github.java-json-tools:msg-simple:jar:1.2:compile
[INFO] | | | | | | - com.github.java-json-tools:btf:jar:1.3:compile
[INFO] | | | | | - com.github.java-json-tools:jackson-coreutils:jar:2.0:compile
[INFO] | | | | - org.apache.httpcomponents:httpclient:jar:4.5.2:compile
[INFO] | | | | +- org.apache.httpcomponents:httpcore:jar:4.4.4:compile
[INFO] | | | | +- commons-logging:commons-logging:jar:1.2:compile
[INFO] | | | | - commons-codec:commons-codec:jar:1.9:compile
[INFO] | | | - org.json:json:jar:20210307:compile
[INFO] | | +- com.samskivert:jmustache:jar:1.12:compile
[INFO] | | +- commons-io:commons-io:jar:2.4:compile
[INFO] | | +- org.slf4j:slf4j-ext:jar:1.7.25:compile
[INFO] | | +- ch.qos.logback:logback-classic:jar:1.2.3:compile
[INFO] | | +- ch.qos.logback:logback-core:jar:1.2.3:compile
[INFO] | | +- org.apache.commons:commons-lang3:jar:3.4:compile
[INFO] | | +- commons-cli:commons-cli:jar:1.2:compile
[INFO] | | +- com.google.guava:guava:jar:23.0:compile
[INFO] | | | +- com.google.errorprone:error_prone_annotations:jar:2.0.18:compile
[INFO] | | | +- com.google.j2objc:j2objc-annotations:jar:1.1:compile
[INFO] | | | - org.codehaus.mojo:animal-sniffer-annotations:jar:1.14:compile
[INFO] | | +- com.github.jknack:handlebars:jar:4.1.2:compile
[INFO] | | - com.atlassian.commonmark:commonmark:jar:0.9.0:compile
[INFO] | - io.swagger.codegen.v3:swagger-codegen-generators:jar:1.0.27:compile
[INFO] +- io.swagger:swagger-annotations:jar:1.5.21:compile
[INFO] +- org.openapitools:jackson-databind-nullable:jar:0.2.1:compile
[INFO] +- com.github.spotbugs:spotbugs-annotations:jar:4.2.0:compile
[INFO] | - com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO] +- org.glassfish.jersey.core:jersey-client:jar:2.34:compile
[INFO] | +- jakarta.ws.rs:jakarta.ws.rs-api:jar:2.1.6:compile
[INFO] | +- org.glassfish.jersey.core:jersey-common:jar:2.34:compile
[INFO] | | +- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile
[INFO] | | - org.glassfish.hk2:osgi-resource-locator:jar:1.0.3:compile
[INFO] | - org.glassfish.hk2.external:jakarta.inject:jar:2.6.1:compile
[INFO] +- org.glassfish.jersey.media:jersey-media-json-jackson:jar:2.34:compile
[INFO] | +- org.glassfish.jersey.ext:jersey-entity-filtering:jar:2.34:compile
[INFO] | - com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.12.2:compile
[INFO] | +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.2:compile
[INFO] | - jakarta.activation:jakarta.activation-api:jar:1.2.1:compile
[INFO] +- org.glassfish.jersey.media:jersey-media-multipart:jar:2.34:compile
[INFO] | - org.jvnet.mimepull:mimepull:jar:1.9.13:compile
[INFO] +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:jar:2.12.4:compile
[INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.12.4:compile
[INFO] +- com.fasterxml.jackson.core:jackson-annotations:jar:2.12.4:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.12.4:compile
[INFO] +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.12.4:compile
[INFO] +- com.fasterxml.jackson.datatype:jackson-datatype-joda:jar:2.12.4:compile
[INFO] +- joda-time:joda-time:jar:2.7:compile
[INFO] +- com.brsanthu:migbase64:jar:2.2:compile
[INFO] +- com.microsoft.azure.functions:azure-functions-java-library:jar:1.4.2:compile
[INFO] +- com.azure:azure-cosmos:jar:4.18.0:compile
[INFO] | +- com.azure:azure-core:jar:1.19.0:compile
[INFO] | | +- com.fasterxml.jackson.dataformat:jackson-dataformat-xml:jar:2.12.4:compile
[INFO] | | | +- org.codehaus.woodstox:stax2-api:jar:4.2.1:compile
[INFO] | | | - com.fasterxml.woodstox:woodstox-core:jar:6.2.4:compile
[INFO] | | +- io.projectreactor:reactor-core:jar:3.4.8:compile
[INFO] | | | - org.reactivestreams:reactive-streams:jar:1.0.3:compile
[INFO] | | - io.netty:netty-tcnative-boringssl-static:jar:2.0.40.Final:compile
[INFO] | +- com.azure:azure-core-http-netty:jar:1.10.2:compile
[INFO] | | +- io.netty:netty-handler:jar:4.1.66.Final:compile
[INFO] | | | +- io.netty:netty-common:jar:4.1.66.Final:compile
[INFO] | | | +- io.netty:netty-resolver:jar:4.1.66.Final:compile
[INFO] | | | +- io.netty:netty-transport:jar:4.1.66.Final:compile
[INFO] | | | - io.netty:netty-codec:jar:4.1.66.Final:compile
[INFO] | | +- io.netty:netty-handler-proxy:jar:4.1.66.Final:compile
[INFO] | | | - io.netty:netty-codec-socks:jar:4.1.66.Final:compile
[INFO] | | +- io.netty:netty-buffer:jar:4.1.66.Final:compile
[INFO] | | +- io.netty:netty-codec-http:jar:4.1.66.Final:compile
[INFO] | | +- io.netty:netty-codec-http2:jar:4.1.66.Final:compile
[INFO] | | +- io.netty:netty-transport-native-unix-common:jar:4.1.66.Final:compile
[INFO] | | +- io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.66.Final:compile
[INFO] | | +- io.netty:netty-transport-native-kqueue:jar:osx-x86_64:4.1.66.Final:compile
[INFO] | | - io.projectreactor.netty:reactor-netty:jar:1.0.9:compile
[INFO] | | +- io.projectreactor.netty:reactor-netty-core:jar:1.0.9:compile
[INFO] | | | +- io.netty:netty-resolver-dns:jar:4.1.65.Final:compile
[INFO] | | | | - io.netty:netty-codec-dns:jar:4.1.65.Final:compile
[INFO] | | | - io.netty:netty-resolver-dns-native-macos:jar:osx-x86_64:4.1.65.Final:compile
[INFO] | | +- io.projectreactor.netty:reactor-netty-http:jar:1.0.9:compile
[INFO] | | - io.projectreactor.netty:reactor-netty-http-brave:jar:1.0.9:runtime
[INFO] | | - io.zipkin.brave:brave-instrumentation-http:jar:5.13.3:runtime
[INFO] | | - io.zipkin.brave:brave:jar:5.13.3:runtime
[INFO] | | - io.zipkin.reporter2:zipkin-reporter-brave:jar:2.16.3:runtime
[INFO] | | - io.zipkin.reporter2:zipkin-reporter:jar:2.16.3:runtime
[INFO] | | - io.zipkin.zipkin2:zipkin:jar:2.23.2:runtime
[INFO] | +- com.fasterxml.jackson.module:jackson-module-afterburner:jar:2.12.2:compile
[INFO] | +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.12.4:compile
[INFO] | +- org.slf4j:slf4j-api:jar:1.7.32:compile
[INFO] | +- org.hdrhistogram:HdrHistogram:jar:2.1.12:compile
[INFO] | +- io.dropwizard.metrics:metrics-core:jar:4.1.0:compile
[INFO] | - io.micrometer:micrometer-core:jar:1.7.2:compile
[INFO] | - org.latencyutils:LatencyUtils:jar:2.0.3:runtime
[INFO] +- com.google.code.gson:gson:jar:1.7.1:compile
[INFO] +- org.junit.jupiter:junit-jupiter:jar:5.4.2:test
[INFO] | +- org.junit.jupiter:junit-jupiter-api:jar:5.4.2:test
[INFO] | | +- org.apiguardian:apiguardian-api:jar:1.0.0:test
[INFO] | | +- org.opentest4j:opentest4j:jar:1.1.1:test
[INFO] | | - org.junit.platform:junit-platform-commons:jar:1.4.2:test
[INFO] | +- org.junit.jupiter:junit-jupiter-params:jar:5.4.2:test
[INFO] | - org.junit.jupiter:junit-jupiter-engine:jar:5.4.2:test
[INFO] | - org.junit.platform:junit-platform-engine:jar:1.4.2:test
[INFO] +- org.mockito:mockito-core:jar:2.23.4:test
[INFO] | +- net.bytebuddy:byte-buddy:jar:1.9.3:test
[INFO] | +- net.bytebuddy:byte-buddy-agent:jar:1.9.3:test
[INFO] | - org.objenesis:objenesis:jar:2.6:test
[INFO] - junit:junit:jar:4.11:test
[INFO] - org.hamcrest:hamcrest-core:jar:1.3:test

Additional context
This issue occurs with 1.18, 1.17, 1.16 and older versions. Without other apparent jar files obscuring the reactor and netty files, everyone should be impacted by this malformed classpath issue, as it seems azure-cosmos cannot find its own reactor netty dependencies. "FUNCTIONS_WORKER_JAVA_LOAD_APP_LIBS": true was added in the local.settings.json and in the pom file under azure-functions-maven-plugin without difference.

Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • [x ] Bug Description Added
  • [x ] Repro Steps Added
  • [x ] Setup information Added
@ghost ghost added needs-triage This is a new issue that needs to be triaged to the appropriate team. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Aug 17, 2021
@alzimmermsft
Copy link
Member

Thank you for submitting this issue @AlejandroBlanco.

Could you let me know if the guidance here resolves the exception you're seeing.

@alzimmermsft alzimmermsft added dependency-issue Issue that is caused by dependency conflicts Functions labels Aug 17, 2021
@ghost ghost removed the needs-triage This is a new issue that needs to be triaged to the appropriate team. label Aug 17, 2021
@AlejandroBlanco
Copy link
Author

Thank you for submitting this issue @AlejandroBlanco.

Could you let me know if the guidance here resolves the exception you're seeing.

Thanks for the very prompt response. As I stated in the bug, the issue occurs despite having this in my local.settings.json

{
"IsEncrypted": false,
"Values": {
"FUNCTIONS_WORKER_RUNTIME": "java",
"CosmosDBAttribute.ConnectionStringSetting": "AccountEndpoint=https://myurl.documents.azure.com:443/; AccountKey=mykey==;",
"AZ_KEY": "mykey==",
"AZ_HOST": "https://myurl.documents.azure.com:443/",
"FUNCTIONS_WORKER_JAVA_LOAD_APP_LIBS": true
},
"Host": {
"LocalHttpPort": 7071,
"CORS": "https://localhost:8080",
"CORSCredentials": false
}
}
and a function plugin like:

   <plugin>
        <groupId>com.microsoft.azure</groupId>
        <artifactId>azure-functions-maven-plugin</artifactId>
        <version>${azure.functions.maven.plugin.version}</version>
        <configuration>
            <!-- function app name -->
            <appName>${functionAppName}</appName>
            <!-- function app resource group -->
            <resourceGroup>java-functions-group</resourceGroup>
            <!-- function app service plan name -->
            <appServicePlanName>java-functions-app-service-plan</appServicePlanName>
            <functionResourceGroup>java-functions-group</functionResourceGroup>
            <!-- function app region-->
            <!-- refers https://github.com/microsoft/azure-maven-plugins/wiki/Azure-Functions:-Configuration-Details#supported-regions for all valid values -->
            <region>westeurope</region>
            <!-- function pricingTier, default to be consumption if not specified -->
            <!-- refers https://github.com/microsoft/azure-maven-plugins/wiki/Azure-Functions:-Configuration-Details#supported-pricing-tiers for all valid values -->
            <!-- <pricingTier></pricingTier> -->

            <!-- Whether to disable application insights, default is false -->
            <!-- refers https://github.com/microsoft/azure-maven-plugins/wiki/Azure-Functions:-Configuration-Details for all valid configurations for application insights-->
            <!-- <disableAppInsights></disableAppInsights> -->
            <runtime>
                <!-- runtime os, could be windows, linux or docker-->
                <os>windows</os>
                <javaVersion>8</javaVersion>
                <!-- for docker function, please set the following parameters -->
                <!-- <image>[hub-user/]repo-name[:tag]</image> -->
                <!-- <serverId></serverId> -->
                <!-- <registryUrl></registryUrl>  -->
            </runtime>
            <appSettings>
                <property>
                    <name>FUNCTIONS_EXTENSION_VERSION</name>
                    <value>~3</value>
                </property>
                <property>
                    <name>FUNCTIONS_WORKER_JAVA_LOAD_APP_LIBS</name>
                    <value>1</value>
                </property>
            </appSettings>
        </configuration>

... etc

Despite the setting was added twice, the classpath seems to be unstable

@AlejandroBlanco
Copy link
Author

AlejandroBlanco commented Aug 18, 2021

Problem goes away upgrading the function core tools form v2.x to v3.x.

npm i -g azure-functions-core-tools@core doesn't install last version as I expected. To move to v3 is necessary to run:

npm i -g azure-functions-core-tools@3 --unsafe-perm true

v2.x is not compatible with Java 11, but v3.x is compatible with both Java 8 and 11.

This problem is solved by updating dependencies below the executable application, therefore no need to keep this open as it is not a problem with current cosmos client versions and no backwards compatibility is broken.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. dependency-issue Issue that is caused by dependency conflicts Functions question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

No branches or pull requests

2 participants