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

quarkus:dev fails with .m2/repo in path with spaces on all platforms #1402

Closed
tandraschko opened this Issue Mar 11, 2019 · 30 comments

Comments

Projects
None yet
7 participants
@tandraschko
Copy link

tandraschko commented Mar 11, 2019

Download https://github.com/quarkusio/quarkus-quickstarts/tree/master/getting-started
run via
mvn compile quarkus:dev
throws
java.lang.NoClassDefFoundError: org/jboss/logging/Logger

on Windows10 with both Java8 and Java11:
Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-24T20:41:47+02:00)
Maven home: D:\Development\Maven\bin..
Java version: 11.0.2, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk-11.0.2
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

@tandraschko

This comment has been minimized.

Copy link
Author

tandraschko commented Mar 11, 2019

sames happens with the tutorial, which generates the same example

@tandraschko

This comment has been minimized.

Copy link
Author

tandraschko commented Mar 11, 2019

exception:

Listening for transport dt_socket at address: 5005
Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/logging/Logger
at io.quarkus.dev.DevModeMain.(DevModeMain.java:39)
Caused by: java.lang.ClassNotFoundException: org.jboss.logging.Logger
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 1 more
[INFO] ------------------------------------------------------------------------

@tandraschko

This comment has been minimized.

Copy link
Author

tandraschko commented Mar 11, 2019

also weird is that it seems quarkus starts without problems for the unittests

@dmlloyd

This comment has been minimized.

Copy link
Member

dmlloyd commented Mar 11, 2019

Duplicate of #541?

@tandraschko

This comment has been minimized.

Copy link
Author

tandraschko commented Mar 11, 2019

Maybe - but there is still no solution?!
Can you please explain how to integrate #1391 or please fix the example itself.

@dmlloyd

This comment has been minimized.

Copy link
Member

dmlloyd commented Mar 11, 2019

You need to build Quarkus from source, or else wait for next week's release (we're doing them every two weeks for the time being).

@dmlloyd dmlloyd closed this Mar 11, 2019

@tandraschko

This comment has been minimized.

Copy link
Author

tandraschko commented Mar 11, 2019

did it - it's still >not< fixed

@tandraschko

This comment has been minimized.

Copy link
Author

tandraschko commented Mar 11, 2019

[INFO] --- quarkus-maven-plugin:999-SNAPSHOT:dev (default-cli) @ getting-started ---
[INFO] Using servlet resources C:\Users\tandraschko\Downloads\getting-started\src\main\resources\META-INF\resources
Listening for transport dt_socket at address: 5005
Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/logging/Logger
at io.quarkus.dev.DevModeMain.(DevModeMain.java:39)
Caused by: java.lang.ClassNotFoundException: org.jboss.logging.Logger
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 1 more

@dmlloyd

This comment has been minimized.

Copy link
Member

dmlloyd commented Mar 11, 2019

Do you have a reproducer?

@tandraschko

This comment has been minimized.

Copy link
Author

tandraschko commented Mar 11, 2019

Please check my description, i just used the samples in your repo or generated from your guide

@dmlloyd

This comment has been minimized.

Copy link
Member

dmlloyd commented Mar 12, 2019

Is there by any chance a space in the path you're building in? If so, could you see if building in a path with no spaces in it succeeds?

@tandraschko

This comment has been minimized.

Copy link
Author

tandraschko commented Mar 12, 2019

It's without spaces: C:\Users\tandraschko\Downloads\getting-started\

@gsmet gsmet added this to the 0.12.0 milestone Mar 13, 2019

@mmacphail

This comment has been minimized.

Copy link

mmacphail commented Mar 14, 2019

I can confirm the exact same problem, without spaces as well.

@dmlloyd

This comment has been minimized.

Copy link
Member

dmlloyd commented Mar 14, 2019

The fix for #1436 might solve this as well though, because it might be a general URI quoting problem. Have you both tried the latest upstream? Alternatively you could wait for the 0.12.0 release, due next week most likely.

@mmacphail

This comment has been minimized.

Copy link

mmacphail commented Mar 14, 2019

I'm building right now the project from upstream but it might take a long time. Is there any easier technique to get the upstream jar?

@dmlloyd

This comment has been minimized.

Copy link
Member

dmlloyd commented Mar 14, 2019

The easiest trick is: mvn clean install -DskipTests -Dno-native - takes about 2 minutes :)

@mmacphail

This comment has been minimized.

Copy link

mmacphail commented Mar 14, 2019

Thanks! I think the build was fine. All the jars were installed in my ~/.m2 folder in 999-SNAPSHOT version so that was taken care of!
I replaced the version in the line <quarkus.version>999-SNAPSHOT</quarkus.version> in the getting-started project pom.
However, when I'm building the project using mvn compile quarkus:dev I get the following error: Error: Could not find or load main class io.quarkus.dev.DevModeMain.
I'm pretty sure it has something to do with my install. I tracked down which jar contains the DevNodeMain class, it's the jar quarkus-development-mode, I checked and it was properly installed in my ~/m2. I don't know why it's not properly linked during the quarkus:dev goal though.
I'ld be happy to check if the fix is working for windows and report it here if I can fix this error! Any help appreciated.

@dmlloyd

This comment has been minimized.

Copy link
Member

dmlloyd commented Mar 18, 2019

I'm going to reopen this until we can get someone with a Windows system to reproduce the problem.

@dmlloyd dmlloyd reopened this Mar 18, 2019

@mmacphail

This comment has been minimized.

Copy link

mmacphail commented Mar 18, 2019

I'm willing to try again; no problem for me; i'm just missing something once I installed the sources from upstream.

@starksm64

This comment has been minimized.

Copy link
Contributor

starksm64 commented Mar 18, 2019

We need more info about which JDK is installed, maven installed, etc. I am running this on a windows 10 machine and I don't see this error.

starksm@DESKTOP-D8936F6 MINGW64 ~/Protean/quarkus-quickstarts/getting-started (master)
$ mvn compile quarkus:dev
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------< org.acme:quarkus-quickstart >---------------------
[INFO] Building quarkus-quickstart 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ quarkus-quickstart ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ quarkus-quickstart ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- quarkus-maven-plugin:0.11.0:dev (default-cli) @ quarkus-quickstart ---
[INFO] Using servlet resources C:\Users\starksm\Protean\quarkus-quickstarts\getting-started\src\main\resources\META-INF\resources
Listening for transport dt_socket at address: 5005
2019-03-18 15:53:39,032 INFO  [io.qua.dep.QuarkusAugmentor] (main) Beginning quarkus augmentation
2019-03-18 15:53:39,657 INFO  [io.qua.dep.QuarkusAugmentor] (main) Quarkus augmentation completed in 625ms
2019-03-18 15:53:40,798 INFO  [io.quarkus] (main) Quarkus 0.11.0 started in 1.923s. Listening on: http://127.0.0.1:8080
2019-03-18 15:53:40,798 INFO  [io.quarkus] (main) Installed features: [cdi, resteasy]

C:\Users\starksm\Protean\quarkus-quickstarts>PATH
PATH=C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Python27;C:\Users\starksm\.dnx\bin;%M2_HOME%\bin;C:\WINDOWS\System32\OpenSSH\;C:\Users\starksm\AppData\Local\Microsoft\WindowsApps;;C:\Users\starksm\apache-maven-3.6.0\bin

C:\Users\starksm\Protean\quarkus-quickstarts>mvn -version
Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-24T11:41:47-07:00)
Maven home: C:\Users\starksm\apache-maven-3.6.0\bin\..
Java version: 1.8.0_144, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk1.8.0_144\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

@starksm64 starksm64 removed this from the 0.12.0 milestone Mar 19, 2019

@mmacphail

This comment has been minimized.

Copy link

mmacphail commented Mar 19, 2019

So,

I pulled the sources from upstream and installed them in the same 999-SNAPSHOT version.
I'm able to compile & run using mvn compile and mvn install.

Unfortunately I still get the same issue:

$ mvn compile quarkus:dev
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------< org.acme:quarkus-quickstart >---------------------
[INFO] Building quarkus-quickstart 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ quarkus-quickstart ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ quarkus-quickstart ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- quarkus-maven-plugin:999-SNAPSHOT:dev (default-cli) @ quarkus-quickstart ---
[INFO] Using javaTool: C:\Program Files\Java\jdk1.8.0_121\jre\bin\java.EXE
[INFO] Using servlet resources C:\project\quarkus-hello-world\quarkus-quickstarts\getting-started\src\main\resources\META-INF\resources
Listening for transport dt_socket at address: 5005
Error: Could not find or load main class io.quarkus.dev.DevModeMain
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  5.365 s
[INFO] Finished at: 2019-03-19T19:48:00+01:00
[INFO] ------------------------------------------------------------------------

My config is the following:

$ echo $PATH
/c/Users/Alexandre Fruchaud/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/Alexandre Fruchaud/bin:/c/ProgramData/DockerDesktop/version-bin:/c/Program Files/Docker/Docker/Resources/bin:/c/Users/Alexandre Fruchaud/Documents/Tools/micronaut-1.0.4/bin:/c/SoftwareAG101/CommandCentral/client/bin:/cmd:/c/Users/Alexandre Fruchaud/AppData/Roaming/npm:/c/Users/Alexandre Fruchaud/Documents/Tools/atlassian-cli-8.0.0:/c/Users/Alexandre Fruchaud/scoop/apps/gradle/4.10.2/bin:/c/Program Files (x86)/Common Files/Oracle/Java/javapath:/c/Users/Alexandre Fruchaud/Documents/Tools/apache-ant-1.10.2/bin:/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/c/Program Files (x86)/Intel/iCLS Client:/c/Users/Alexandre Fruchaud/groovy-2.4.13/bin:/c/Users/Alexandre Fruchaud/Documents/RandD/Clojure/lein:/c/Users/Alexandre Fruchaud/Documents/Tools/apache-maven-3.6.0/bin:/c/ProgramData/Oracle/Java/javapath:/c/Program Files/Intel/iCLS Client:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/Program Files/OpenVPN/bin:/c/Program Files (x86)/Microsoft SQL Server/110/Tools/Binn:/c/Program Files/Microsoft SQL Server/110/Tools/Binn:/c/Program Files/Microsoft SQL Server/110/DTS/Binn:/c/Program Files (x86)/Microsoft SQL Server/Client SDK/ODBC/130/Tools/Binn:/c/Program Files (x86)/Microsoft SQL Server/140/Tools/Binn:/c/Program Files (x86)/Microsoft SQL Server/140/DTS/Binn:/c/Program Files (x86)/Microsoft SQL Server/140/Tools/Binn/ManagementStudio:/c/Program Files/Microsoft SQL Server/Client SDK/ODBC/130/Tools/Binn:/c/Program Files (x86)/Microsoft SQL Server/130/Tools/Binn:/c/Program Files/Microsoft SQL Server/130/Tools/Binn:/c/Program Files/Microsoft SQL Server/130/DTS/Binn:/c/Program Files/MySQL/MySQL Utilities 1.6:/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/DAL:/c/Program Files/Intel/Intel(R) Management Engine Components/DAL:/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/IPT:/c/Program Files/Intel/Intel(R) Management Engine Components/IPT:/c/Program Files/nodejs:/c/WINDOWS/System32/OpenSSH:/c/Program Files/Intel/WiFi/bin:/c/Program Files/Common Files/Intel/WirelessCommon:/c/Program Files/PuTTY:/c/Users/Alexandre Fruchaud/scoop/shims:/c/SoftwareAGCCE/CommandCentral/client/bin:/c/Users/Alexandre Fruchaud/AppData/Local/Google/Cloud SDK/google-cloud-sdk/bin:/c/Users/Alexandre Fruchaud/AppData/Local/Programs/Microsoft VS Code/bin:/c/Users/Alexandre Fruchaud/AppData/Local/hyper/app-2.1.2/resources/bin:/usr/bin/vendor_perl:/usr/bin/core_perl

$ mvn -version
Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-24T20:41:47+02:00)
Maven home: C:\Users\Alexandre Fruchaud\Documents\Tools\apache-maven-3.6.0
Java version: 1.8.0_121, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk1.8.0_121\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

Quickstart project pom.xml:

<properties>
    <quarkus.version>999-SNAPSHOT</quarkus.version>
    <surefire-plugin.version>2.22.0</surefire-plugin.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
</properties>
@starksm64

This comment has been minimized.

Copy link
Contributor

starksm64 commented Mar 19, 2019

Thanks, I'll look at reproducing this setup on my windows 10 box.

@starksm64 starksm64 self-assigned this Mar 19, 2019

@mmacphail

This comment has been minimized.

Copy link

mmacphail commented Mar 19, 2019

Thanks, @starksm64.

OK I did the exact same manipulation on Linux and I don't get the Error: Could not find or load main class io.quarkus.dev.DevModeMain. Everything is working as intended.

I ran mvn -X quarkus:dev > logs.txt for both the windows getting started project and the linux getting started project (results are here: (logs.txt) (windows),
logs_linux.txt (linux)) and I didn't find anything different that was noticeable besides the java version. I upped the windows java version to match my linux java version (1.8.0_191) but it didn't correct this problem.

I'm not too familiar with maven plugins and I'm not sure how to debug things further. Surely there's a logger I can turn to trace to see why quarkus-development-mode is not included in the classpath during the plugin execution.

@starksm64

This comment has been minimized.

Copy link
Contributor

starksm64 commented Mar 19, 2019

Thanks for the log as it added more info on what your environment is. So the problem was not the jdk version or being in a path with spaces, nor maven being in a path with spaces, but the fact that the .m2/repository for the local artifacts was in a path with spaces is the problem as when I made that change to my environment I see the issuer:

[DEBUG] findJavaTool, selected JVM: C:\Program Files\Java\jdk1.8.0_121\jre\bin\java.EXE
[INFO] Using javaTool: C:\Program Files\Java\jdk1.8.0_121\jre\bin\java.EXE
[INFO] Using servlet resources C:\Users\starksm\Alexandre Fruchaud\quarkus-quickstarts\getting-started\src\main\resources\META-INF\resources
Listening for transport dt_socket at address: 5005
Error: Could not find or load main class io.quarkus.dev.DevModeMain
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  15.847 s
[INFO] Finished at: 2019-03-19T16:07:27-07:00
[INFO] ------------------------------------------------------------------------

starksm@DESKTOP-D8936F6 MINGW64 ~/Alexandre Fruchaud/quarkus-quickstarts/getting-started (master)

So we are not building the classpath correctly for windows in the DevMovo forked vm, and so the io.quarkus.dev.DevModeMain is not found.

A workaround is to move the .m2/repository contents to a location without spaces in the path. You can set the location that maven uses for its local repository using an ~/.m2/settings.xml like the following which is what I used to move my local repo to a path with spaces to test that:

$ cat ~/.m2/settings.xml
<settings>
        <localRepository>C:/Users/starksm/Alexandre Fruchaud/.m2/repository</localRepository>
</settings>

The DevMovo plugin should be reporting more information about the forked vm command when in debug mode as well to help with troubleshooting so I'll add that when I fix the classpath issue.

@mohr023

This comment has been minimized.

Copy link

mohr023 commented Mar 20, 2019

Can confirm this happens in a Win10 environment, also that the settings.xml workaround fixes it for the moment.
The classpath error @starksm64 mentioned also turns out to crash the application if the project folder itself is placed under a path that contains spaces (which is a little bit more annoying, since Quarkus logger was eating up the error messages and showing a nice "build success" without starting anything..).

@johnaohara

This comment has been minimized.

Copy link
Member

johnaohara commented Mar 20, 2019

@mohr23 dev mode logging should now not be swallowed, see #1375. Further improvements are coming in #1393

@mmacphail

This comment has been minimized.

Copy link

mmacphail commented Mar 20, 2019

Alright, I can confirm once I moved the repository to a spaceless path by configuring ~/.m2/settings.xml, everything is working as it should on Windows 10. I'll try again once this is fixed to confirm the fix.
Thanks again @starksm64 for your analysis.

@mohr023

This comment has been minimized.

Copy link

mohr023 commented Mar 20, 2019

Hey @johnaohara , thanks for the heads up, I'll keep an eye out for the fix.

@starksm64 starksm64 changed the title java.lang.NoClassDefFoundError: org/jboss/logging/Logger quarkus:dev fails with .m2/repo in path with spaces on all platforms Mar 20, 2019

@starksm64

This comment has been minimized.

Copy link
Contributor

starksm64 commented Mar 20, 2019

I added a dev discussion on this here:
https://groups.google.com/forum/#!topic/quarkus-dev/R2SkJQ9WtZg

It does apply to all platforms, not just windows.

@gsmet gsmet closed this in fedad8f Mar 21, 2019

gsmet added a commit that referenced this issue Mar 21, 2019

Merge pull request #1607 from starksm64/bugs
Fixes #1402, problems with .m2/repo with spaces in path

@gsmet gsmet added this to the 0.13.0 milestone Mar 21, 2019

@dmlloyd

This comment has been minimized.

Copy link
Member

dmlloyd commented Mar 27, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.