sendev created CXF-8419:
---------------------------
Summary: Graal VM native image run fails
Key: CXF-8419
URL: https://issues.apache.org/jira/browse/CXF-8419
Project: CXF
Issue Type: Bug
Affects Versions: 3.4.2
Reporter: sendev
Hi,
I am trying to follow the guide to create native image for CXF client that was
referenced in the defect that I created earlier #8340 . My example is using
JaxWsProxyFactoryBean to create client.
I tried 3.3.9 version of CXF and I got following error while running native
image
{code:java}
2021-02-09 17:30:11.322 INFO 5013 --- [ main]
com.cxf.client.ClientApplication : Starting ClientApplication using
Java 1.8.0_282 on BGTMNWL-9123HKG with PID 5013
(/home/urajas4/cxf-client/build/client started by urajas4 in
/home/urajas4/cxf-client/build)
2021-02-09 17:30:11.322 INFO 5013 --- [ main]
com.cxf.client.ClientApplication : No active profile set, falling back
to default profiles: default
2021-02-09 17:30:11.385 INFO 5013 --- [ main]
o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s):
8081 (http)
Feb 09, 2021 5:30:11 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8081"]
Feb 09, 2021 5:30:11 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service [Tomcat]
Feb 09, 2021 5:30:11 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet engine: [Apache Tomcat/9.0.41]
Feb 09, 2021 5:30:11 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring embedded WebApplicationContext
2021-02-09 17:30:11.394 INFO 5013 --- [ main]
w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext:
initialization completed in 71 ms
JVM_MaxObjectInspectionAge called: Unimplemented
Aborted (core dumped)
{code}
Then I upgrade to CXF 3.4.2 and getting following error when running native
image. The application runs fine as java application using CXF 3.4.2 or 3.3.9.
{code:java}
2021-02-09 18:15:54.564 ERROR 8528 --- [ main]
o.s.b.web.embedded.tomcat.TomcatStarter : Error starting Tomcat context.
Exception: org.springframework.beans.factory.UnsatisfiedDependencyException.
Message: Error creating bean with name
'org.apache.cxf.spring.boot.autoconfigure.CxfAutoConfiguration': Unsatisfied
dependency expressed through field 'properties'; nested exception is
org.springframework.boot.context.properties.ConfigurationPropertiesBindException:
Error creating bean with name
'cxf-org.apache.cxf.spring.boot.autoconfigure.CxfProperties': Could not bind
properties to 'CxfProperties' : prefix=cxf, ignoreInvalidFields=false,
ignoreUnknownFields=true; nested exception is
org.springframework.boot.context.properties.bind.BindException: Failed to bind
properties under 'cxf' to org.apache.cxf.spring.boot.autoconfigure.CxfProperties
Feb 09, 2021 6:15:54 PM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service [Tomcat]
2021-02-09 18:15:54.566 WARN 8528 --- [ main]
ConfigServletWebServerApplicationContext : Exception encountered during context
initialization - cancelling refresh attempt:
org.springframework.context.ApplicationContextException: Unable to start web
server; nested exception is
org.springframework.boot.web.server.WebServerException: Unable to start
embedded Tomcat
2021-02-09 18:15:54.567 INFO 8528 --- [ main]
ConditionEvaluationReportLoggingListener : Error starting ApplicationContext.
To display the conditions report re-run your application with 'debug' enabled.
2021-02-09 18:15:54.567 ERROR 8528 --- [ main]
o.s.b.d.LoggingFailureAnalysisReporter : ***************************
APPLICATION FAILED TO START
***************************Description:Failed to bind properties under 'cxf' to
org.apache.cxf.spring.boot.autoconfigure.CxfProperties: Reason:
org.hibernate.validator.internal.constraintvalidators.bv.NotNullValidator.<init>()Action:Update
your application's configuration
{code}
The steps I followed.
Placed all the native image configuration from
[https://github.com/apache/cxf/tree/master/distribution/src/main/release/samples/jaxws_graalvm_dynamic/client/src/main/resources/META-INF/native-image/org.apache.cxf.samples/jaxws_graalvm_dynamic_client]
into my sample project and customized the configurations.
# Using CXF 3.3.9/3.4.2 and as per the above confluence document those version
of CXF should work with grail vm.
# Native image build was successful.
# Running native image is failing with above error.
The client project is here [https://github.com/sendev1/cxf-client] -> I am
trying to generate native image for this.
The server project is here [https://github.com/sendev1/cxf-server] -> client
will try to attempt the soap end point present in the server. I am not
compiling native image for server. Just run this as spring boot project so that
client talk to this server.
If native image is running successfully for CXF client, then this REST end
point should work
http://localhost:8081/hello
--
This message was sent by Atlassian Jira
(v8.3.4#803005)