apache / camel-quarkus

Apache Camel Quarkus
https://camel.apache.org
Apache License 2.0
257 stars 191 forks source link

CamelHotReplacementSetup - Failed to copy resources on windows #5057

Open amoscatelli opened 1 year ago

amoscatelli commented 1 year ago

Bug description

Hi there ! I am the mantainer of Quarkus JNoSQL, I just want to report that on building our arangodb deployments modules (the ones requiring camel-quarkus-arangodb-deployment) we see this non-blocking error during tests :

2023-07-05 11:37:39,408 ERROR [io.qua.dep.dev.RuntimeUpdatesProcessor] (Timer-0) Failed to copy resources [Error Occurred After Shutdown]: java.nio.file.NoSuchFileException: C:\Users\A8ADD~1.MOS\AppData\Local\Temp\quarkus-dev-mode-test3502283492447699497\target\classes
    at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:85)
    at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
    at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
    at java.base/sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:275)
    at java.base/sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:105)
    at java.base/java.nio.file.Files.delete(Files.java:1152)
    at io.quarkus.deployment.dev.RuntimeUpdatesProcessor.checkForFileChange(RuntimeUpdatesProcessor.java:939)
    at io.quarkus.deployment.dev.RuntimeUpdatesProcessor.doScan(RuntimeUpdatesProcessor.java:463)
    at io.quarkus.deployment.dev.RuntimeUpdatesProcessor.doScan(RuntimeUpdatesProcessor.java:441)
    at org.apache.camel.quarkus.core.devmode.CamelHotReplacementSetup$1.run(CamelHotReplacementSetup.java:36)
    at java.base/java.util.TimerThread.mainLoop(Timer.java:566)
    at java.base/java.util.TimerThread.run(Timer.java:516)

As already clarified this only happens when depending on :

        <dependency>
            <groupId>org.apache.camel.quarkus</groupId>
            <artifactId>camel-quarkus-arangodb-deployment</artifactId>
        </dependency>

It may be a problem related on building on windows only but maybe it's worth investigating.

Thank you ! Happy coding

jamesnetherton commented 1 year ago

Thanks for reporting it :+1:

I've seen it before. It actually happens in our dev mode tests on Windows. It does not seem to impact on the reloading of the app though.

If I get time, I can try to dig into it a bit more. It likely needs solving in Quarkus.

jamesnetherton commented 1 year ago

@amoscatelli just curious - do you use camel-quarkus-arangodb because you need the Camel functionality? Or is it just to get the ArangoDB native support?

amoscatelli commented 1 year ago

We need ArangoDB native support to integrate/bridge JNoSQL ArangoDB driver with Quarkus native ! So that ArangoDB can be used with Jakarta NoSQL api.

zbendhiba commented 1 year ago

@amoscatelli if you don't need Camel features. According to the documentation the ArangoDb Java driver is supposed to support native Quarkus by default, no need to add an extension. https://www.arangodb.com/docs/stable/drivers/java.html#graalvm-native-image

amoscatelli commented 1 year ago

I'll give it a try, thanks !

amoscatelli commented 1 year ago

If I remove your deployment module I get this during native compilation :

Caused by: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved method during parsing: com.arangodb.internal.http.HttpConnection.execute(com.arangodb.velocystream.Request). This error is reported at image build time because class com.arangodb.internal.http.HttpCommunication is registered for linking at image build time by command line
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.reportUnresolvedElement(SharedGraphBuilderPhase.java:333)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.handleUnresolvedMethod(SharedGraphBuilderPhase.java:323)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.handleUnresolvedInvoke(SharedGraphBuilderPhase.java:279)
    at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genInvokeVirtual(BytecodeParser.java:1721)
    at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:5286)
    at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3385)
    ... 38 more

Something tells me this is fixed by :

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-support-httpclient</artifactId>
    <version>1.1.0</version>
</dependency>
<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-support-httpclient-deployment</artifactId>
    <version>1.1.0</version>
</dependency>