[jira] [Commented] (CAMEL-20664) camel-mapstruct - MapStruct mappers not found in Spring Boot
[ https://issues.apache.org/jira/browse/CAMEL-20664?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17837370#comment-17837370 ] Josh Reagan commented on CAMEL-20664: - Thanks Claus! Confirmed working in 4.4.0 and higher without the need for the custom `MapStructFinder`. > camel-mapstruct - MapStruct mappers not found in Spring Boot > > > Key: CAMEL-20664 > URL: https://issues.apache.org/jira/browse/CAMEL-20664 > Project: Camel > Issue Type: Bug > Components: camel-mapstruct >Affects Versions: 4.0.0 > Environment: $ java -version > openjdk version "17.0.7" 2023-04-18 > OpenJDK Runtime Environment Temurin-17.0.7+7 (build 17.0.7+7) > OpenJDK 64-Bit Server VM Temurin-17.0.7+7 (build 17.0.7+7, mixed mode, > sharing) >Reporter: Josh Reagan >Priority: Minor > Fix For: 4.4.0 > > Attachments: camel-mapstruct-demo.zip > > > The `DefaultMapStructFinder` is unable to locate the `Mapper` classes when > running in Spring Boot. Seems to throw an exception calling > `PluginHelper.getPackageScanClassResolver(ecc).findByFilter(f -> > f.getName().endsWith("Mapper"), names);` inside the `doInit()` method. > You can work around this by creating your own `MapStructFinder`, extending > `DefaultMapStructFinder`, overriding the `doInit()` function, and calling > `discoverMappings(...)` with each of your `Mapper` classes. That way it > doesn't try to scan the classpath to find the `Mapper` classes automatically. > I've attached a working example to illustrate. > *Note: It has no issue locating them when running `mvn spring-boot:run`. Only > when running from the packaged uber jar with `java -jar ...`. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (CAMEL-20664) camel-mapstruct - MapStruct mappers not found in Spring Boot
[ https://issues.apache.org/jira/browse/CAMEL-20664?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17836810#comment-17836810 ] Claus Ibsen commented on CAMEL-20664: - Okay removing that custom resolver so its plain OOTB then it works for 4.4.1, 4.5.0, 4.6-SNAPSHOT And it fails for 4.0.x You can upgrade to Camel 4.4.x > camel-mapstruct - MapStruct mappers not found in Spring Boot > > > Key: CAMEL-20664 > URL: https://issues.apache.org/jira/browse/CAMEL-20664 > Project: Camel > Issue Type: Bug > Components: camel-mapstruct >Affects Versions: 4.0.0 > Environment: $ java -version > openjdk version "17.0.7" 2023-04-18 > OpenJDK Runtime Environment Temurin-17.0.7+7 (build 17.0.7+7) > OpenJDK 64-Bit Server VM Temurin-17.0.7+7 (build 17.0.7+7, mixed mode, > sharing) >Reporter: Josh Reagan >Priority: Minor > Fix For: 4.6.0 > > Attachments: camel-mapstruct-demo.zip > > > The `DefaultMapStructFinder` is unable to locate the `Mapper` classes when > running in Spring Boot. Seems to throw an exception calling > `PluginHelper.getPackageScanClassResolver(ecc).findByFilter(f -> > f.getName().endsWith("Mapper"), names);` inside the `doInit()` method. > You can work around this by creating your own `MapStructFinder`, extending > `DefaultMapStructFinder`, overriding the `doInit()` function, and calling > `discoverMappings(...)` with each of your `Mapper` classes. That way it > doesn't try to scan the classpath to find the `Mapper` classes automatically. > I've attached a working example to illustrate. > *Note: It has no issue locating them when running `mvn spring-boot:run`. Only > when running from the packaged uber jar with `java -jar ...`. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (CAMEL-20664) camel-mapstruct - MapStruct mappers not found in Spring Boot
[ https://issues.apache.org/jira/browse/CAMEL-20664?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17836807#comment-17836807 ] Claus Ibsen commented on CAMEL-20664: - What is your example supposed to output in the logs to make it work. I see this 12:47:23.937 [Camel (camel-1) thread #1 - timer://kickstartmyroute] INFO c.redhat.examples.CamelConfiguration - Processed order: [{"id":null,"customer":"1","item":"1","description":null,"quantity":4}] > camel-mapstruct - MapStruct mappers not found in Spring Boot > > > Key: CAMEL-20664 > URL: https://issues.apache.org/jira/browse/CAMEL-20664 > Project: Camel > Issue Type: Bug > Components: camel-mapstruct >Affects Versions: 4.0.0 > Environment: $ java -version > openjdk version "17.0.7" 2023-04-18 > OpenJDK Runtime Environment Temurin-17.0.7+7 (build 17.0.7+7) > OpenJDK 64-Bit Server VM Temurin-17.0.7+7 (build 17.0.7+7, mixed mode, > sharing) >Reporter: Josh Reagan >Priority: Minor > Fix For: 4.6.0 > > Attachments: camel-mapstruct-demo.zip > > > The `DefaultMapStructFinder` is unable to locate the `Mapper` classes when > running in Spring Boot. Seems to throw an exception calling > `PluginHelper.getPackageScanClassResolver(ecc).findByFilter(f -> > f.getName().endsWith("Mapper"), names);` inside the `doInit()` method. > You can work around this by creating your own `MapStructFinder`, extending > `DefaultMapStructFinder`, overriding the `doInit()` function, and calling > `discoverMappings(...)` with each of your `Mapper` classes. That way it > doesn't try to scan the classpath to find the `Mapper` classes automatically. > I've attached a working example to illustrate. > *Note: It has no issue locating them when running `mvn spring-boot:run`. Only > when running from the packaged uber jar with `java -jar ...`. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (CAMEL-20664) camel-mapstruct - MapStruct mappers not found in Spring Boot
[ https://issues.apache.org/jira/browse/CAMEL-20664?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17836806#comment-17836806 ] Claus Ibsen commented on CAMEL-20664: - Can you try with a newer camel version. This works for me for 4.6 {code} ~/Downloads/camel-mapstruct-demo ❯ java -jar target/order-processor-1.0.0-SNAPSHOT.jar . ___ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' || .__|_| |_|_| |_\__, | / / / / =|_|==|___/=/_/_/_/ :: Spring Boot ::(v3.2.4) 12:47:20.773 [main] INFO com.redhat.examples.Application - Starting Application using Java 17.0.5 with PID 20269 (/Users/davsclaus/Downloads/camel-mapstruct-demo/target/order-processor-1.0.0-SNAPSHOT.jar started by davsclaus in /Users/davsclaus/Downloads/camel-mapstruct-demo) 12:47:20.775 [main] INFO com.redhat.examples.Application - No active profile set, falling back to 1 default profile: "default" 12:47:21.691 [main] WARN io.undertow.websockets.jsr - UT026010: Buffer pool was not set on WebSocketDeploymentInfo, the default pool will be used 12:47:21.704 [main] INFO io.undertow.servlet - Initializing Spring embedded WebApplicationContext 12:47:21.704 [main] INFO o.s.b.w.s.c.ServletWebServerApplicationContext - Root WebApplicationContext: initialization completed in 877 ms 12:47:22.304 [main] INFO o.s.b.a.e.web.EndpointLinksResolver - Exposing 3 endpoint(s) beneath base path '/actuator' 12:47:22.374 [main] INFO io.undertow - starting server: Undertow - 2.3.12.Final 12:47:22.381 [main] INFO org.xnio - XNIO version 3.8.8.Final 12:47:22.387 [main] INFO org.xnio.nio - XNIO NIO Implementation Version 3.8.8.Final 12:47:22.434 [main] INFO org.jboss.threads - JBoss Threads version 3.5.0.Final 12:47:22.463 [main] INFO o.s.b.w.e.undertow.UndertowWebServer - Undertow started on port 8080 (http) 12:47:22.725 [main] INFO o.a.c.i.engine.AbstractCamelContext - Apache Camel 4.6.0-SNAPSHOT (camel-processor) is starting 12:47:22.727 [main] WARN o.a.c.c.mapstruct.MapstructComponent - Cannot find MapStruct Mapper classes because mapperPackageName has not been configured 12:47:22.853 [main] INFO o.a.c.i.engine.AbstractCamelContext - Routes startup (total:1) 12:47:22.853 [main] INFO o.a.c.i.engine.AbstractCamelContext - Started route1 (timer://kickstartmyroute) 12:47:22.853 [main] INFO o.a.c.i.engine.AbstractCamelContext - Apache Camel 4.6.0-SNAPSHOT (camel-processor) started in 127ms (build:0ms init:0ms start:127ms) 12:47:22.855 [main] INFO com.redhat.examples.Application - Started Application in 2.365 seconds (process running for 2.717) 12:47:23.878 [Camel (camel-1) thread #1 - timer://kickstartmyroute] INFO c.redhat.examples.CamelConfiguration - Raw order: [114] 12:47:23.882 [Camel (camel-1) thread #1 - timer://kickstartmyroute] INFO o.a.c.converter.jaxp.StaxConverter - Created XMLInputFactory: com.sun.xml.internal.stream.XMLInputFactoryImpl@55ae2ff4. DOMSource/DOMResult may have issues with com.sun.xml.internal.stream.XMLInputFactoryImpl@55ae2ff4. We suggest using Woodstox. 12:47:23.937 [Camel (camel-1) thread #1 - timer://kickstartmyroute] INFO c.redhat.examples.CamelConfiguration - Processed order: [{"id":null,"customer":"1","item":"1","description":null,"quantity":4}] ^C12:47:26.606 [SpringApplicationShutdownHook] INFO io.undertow - stopping server: Undertow - 2.3.12.Final 12:47:26.613 [SpringApplicationShutdownHook] INFO o.a.c.i.engine.AbstractCamelContext - Apache Camel 4.6.0-SNAPSHOT (camel-processor) is shutting down (timeout:45s) 12:47:26.619 [SpringApplicationShutdownHook] INFO o.a.c.i.engine.AbstractCamelContext - Routes stopped (total:1) 12:47:26.620 [SpringApplicationShutdownHook] INFO o.a.c.i.engine.AbstractCamelContext - Stopped route1 (timer://kickstartmyroute) 12:47:26.622 [SpringApplicationShutdownHook] INFO o.a.c.i.engine.AbstractCamelContext - Apache Camel 4.6.0-SNAPSHOT (camel-processor) shutdown in 8ms (uptime:3s) {code} > camel-mapstruct - MapStruct mappers not found in Spring Boot > > > Key: CAMEL-20664 > URL: https://issues.apache.org/jira/browse/CAMEL-20664 > Project: Camel > Issue Type: Bug > Components: camel-mapstruct >Affects Versions: 4.0.0 > Environment: $ java -version > openjdk version "17.0.7" 2023-04-18 > OpenJDK Runtime Environment Temurin-17.0.7+7 (build 17.0.7+7) > OpenJDK 64-Bit Server VM Temurin-17.0.7+7 (build 17.0.7+7, mixed mode, > sharing) >Reporter: Josh Reagan >Priority: Minor > Fix For: 4.6.0 > > Attachments: camel-mapstruct-demo.zip > > > The `DefaultMapStructFinder` is unable to locate the `Mapper` classes when > running in Spring Boo