Skip to content

Commit e330d99

Browse files
zakkakcarlesarnal
authored andcommitted
Improve documentation for handling proxies in native-mode
Follow up to quarkusio#45004
1 parent d406d1d commit e330d99

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

docs/src/main/asciidoc/writing-native-applications-tips.adoc

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,23 @@ and in the case of using the Maven configuration instead of `application.propert
320320
----
321321
====
322322

323+
[[managing-proxy-classes-app]]
324+
=== Managing Proxy Classes
325+
326+
While writing native application you'll need to define proxy classes at image build time by specifying the list of interfaces that they implement.
327+
328+
In such a situation, the error you might encounter is:
329+
330+
[source]
331+
----
332+
com.oracle.svm.core.jdk.UnsupportedFeatureError: Proxy class defined by interfaces [interface org.apache.http.conn.HttpClientConnectionManager, interface org.apache.http.pool.ConnPoolControl, interface com.amazonaws.http.conn.Wrapped] not found. Generating proxy classes at runtime is not supported. Proxy classes need to be defined at image build time by specifying the list of interfaces that they implement. To define proxy classes use -H:DynamicProxyConfigurationFiles=<comma-separated-config-files> and -H:DynamicProxyConfigurationResources=<comma-separated-config-resources> options.
333+
----
334+
335+
To solve the issue you can create a `proxy-config.json` file under the `src/main/resources/META-INF/native-image/<group-id>/<artifact-id>` folder.
336+
For more information about the format of the `proxy-config.json`, see the https://www.graalvm.org/{graalvm-docs-version}/reference-manual/native-image/metadata/#dynamic-proxy-metadata-in-json[Dynamic Proxy Metadata in JSON] documentation.
337+
338+
Alternatively, you can create a quarkus extension and register the proxy classes as described in <<managing-proxy-classes-extension>>.
339+
323340
[[modularity-benefits]]
324341
=== Modularity Benefits
325342

@@ -618,18 +635,10 @@ Using such a construct means that a `--initialize-at-run-time` option will autom
618635
For more information about the `--initialize-at-run-time` option, see the link:https://www.graalvm.org/{graalvm-docs-version}/reference-manual/native-image/optimizations-and-performance/ClassInitialization/[GraalVM Class Initialization in Native Image] guide.
619636
====
620637

638+
[[managing-proxy-classes-extension]]
621639
=== Managing Proxy Classes
622640

623-
While writing native application you'll need to define proxy classes at image build time by specifying the list of interfaces that they implement.
624-
625-
In such a situation, the error you might encounter is:
626-
627-
[source]
628-
----
629-
com.oracle.svm.core.jdk.UnsupportedFeatureError: Proxy class defined by interfaces [interface org.apache.http.conn.HttpClientConnectionManager, interface org.apache.http.pool.ConnPoolControl, interface com.amazonaws.http.conn.Wrapped] not found. Generating proxy classes at runtime is not supported. Proxy classes need to be defined at image build time by specifying the list of interfaces that they implement. To define proxy classes use -H:DynamicProxyConfigurationFiles=<comma-separated-config-files> and -H:DynamicProxyConfigurationResources=<comma-separated-config-resources> options.
630-
----
631-
632-
Quarkus allows extensions authors to register a `NativeImageProxyDefinitionBuildItem`. An example of doing so is:
641+
Similarly, Quarkus allows extensions authors to register a `NativeImageProxyDefinitionBuildItem`. An example of doing so is:
633642

634643
[source,java]
635644
----
@@ -645,8 +654,8 @@ public class S3Processor {
645654
----
646655

647656
This will allow Quarkus to generate the necessary configuration for handling the proxy class.
648-
Alternatively, you may create a `proxy-config.json` file under the `src/main/resources/META-INF/native-image/<group-id>/<artifact-id>` folder.
649-
For more information about the format of this file, see the https://www.graalvm.org/{graalvm-docs-version}/reference-manual/native-image/metadata/#dynamic-proxy-metadata-in-json[Dynamic Proxy Metadata in JSON] documentation.
657+
658+
Alternatively, you may create a `proxy-config.json` as described in <<managing-proxy-classes-app>>.
650659

651660
[NOTE]
652661
====

0 commit comments

Comments
 (0)