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

Java explorer don't show .java files #793

Closed
Raidez opened this issue Oct 17, 2023 · 19 comments
Closed

Java explorer don't show .java files #793

Raidez opened this issue Oct 17, 2023 · 19 comments

Comments

@Raidez
Copy link

Raidez commented Oct 17, 2023

In my folder, I have a subfolder containing my project (pom and java), maven correctly detects the project, however there is no java file in the java explorer.

File explorer and java explorer

file explorer java explorer

Another working projetct
working

@jdneo
Copy link
Member

jdneo commented Oct 18, 2023

Will the java project explorer show correct content if directly open that sub-folder in VS Code?

And btw, would you mind sharing your extension version please.

@Raidez
Copy link
Author

Raidez commented Oct 18, 2023

It doesn't work when opening the subfolder.
I should specify that I am connected to a WSL :

  • WSL -> v0.81.8
  • Extension Pack for Java -> v0.25.14
  • Project Manager for Java -> v0.23.1

@jdneo
Copy link
Member

jdneo commented Oct 25, 2023

Looks like due to some reason, the project is not imported as a Java project.

Does it work if you directly open it in windows instead of WSL?

If still not working, is it possible to share a sample project which can reproduce this issue?

@Raidez
Copy link
Author

Raidez commented Oct 30, 2023

I found a strange point :
demo.zip
On this demo, all you have to do is comment on the maven-resources-plugin and click on "clean workspace" on the Java view and the java files magically disappear.

@jdneo
Copy link
Member

jdneo commented Oct 31, 2023

Tried but working on MacOS. I'll find a Windows machine and try it in WSL later.
image

@jdneo
Copy link
Member

jdneo commented Oct 31, 2023

Still cannot repro using WSL

image

Could you share the server logs? You can get it by command Java: Open Java Language Server log file: https://github.com/redhat-developer/vscode-java/wiki/Troubleshooting#get-the-java-language-servers-workspace-logs

@Raidez
Copy link
Author

Raidez commented Oct 31, 2023

My logs :
NOK.log
OK.log

@jdneo
Copy link
Member

jdneo commented Nov 1, 2023

sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target Looks like your WSL env has some issue to access your private Maven repo?

@Raidez
Copy link
Author

Raidez commented Nov 1, 2023

This don't change the fact when I put maven-resources-plugin, I don't have problem.
I work with IntelliJ too and without any more configuration, it works perfectly.

@jdneo
Copy link
Member

jdneo commented Nov 1, 2023

AFAIK, IntelliJ has some extra work to auto configure the cert: https://www.jetbrains.com/help/idea/ssl-certificates.html

Hi @snjeza, do you know if there is any way to work around the issue sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target? Full log: https://github.com/microsoft/vscode-java-dependency/files/13216546/NOK.log

@snjeza
Copy link

snjeza commented Nov 1, 2023

@Raidez Could you run

$ mvn -version
$ mvn -U clean verify

and attach their output?

do you know if there is any way to work around the issue sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target? Full log: https://github.com/microsoft/vscode-java-dependency/files/13216546/NOK.log

You can try

$ echo -n | openssl s_client -connect my-enterprise-repo-maven:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /tmp/mycert.crt
$ cp <YOUR_JAVA_HOME>/lib/security/cacerts ~/cacerts.backup # optional
$ keytool -import -trustcacerts -keystore <YOUR_JAVA_HOME>/lib/security/cacerts -storepass changeit -noprompt -alias mycert -file /tmp/mycert.crt

@Raidez
Copy link
Author

Raidez commented Nov 2, 2023

> mvn -version
Apache Maven 3.8.6 (Red Hat 3.8.6-4)
Maven home: /usr/share/maven
Java version: 17.0.9, vendor: Eclipse Adoptium, runtime: /usr/lib/jvm/temurin-17-jdk
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "5.15.123.1-microsoft-standard-wsl2", arch: "amd64", family: "unix"

When it's OK/NOK (same result) :

> mvn -U clean verify
[INFO] Scanning for projects...
[INFO] 
[INFO] --------------------------< com.example:demo >--------------------------
[INFO] Building demo 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ demo ---
[INFO] Deleting /my-folder/demo/target
[INFO] 
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ demo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /my-folder/demo/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ demo ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /my-folder/demo/target/classes
[INFO] 
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ demo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /my-folder/demo/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ demo ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ demo ---
[INFO] No tests to run.
[INFO] 
[INFO] --- maven-jar-plugin:3.0.2:jar (default-jar) @ demo ---
[INFO] Building jar: /my-folder/demo/target/demo-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.992 s
[INFO] Finished at: 2023-11-02T08:45:03+01:00
[INFO] ------------------------------------------------------------------------

Openssl don't works :

> openssl s_client -connect my-enterprise-repo-maven
40BC37C6F67F0000:error:10080002:BIO routines:BIO_lookup_ex:system lib:crypto/bio/bio_addr.c:738:Servname not supported for ai_socktype
connect:errno=0

@snjeza
Copy link

snjeza commented Nov 2, 2023

@Raidez could you show your maven repository url? could you try

$ ping my-enterprise-repo-maven

@Raidez
Copy link
Author

Raidez commented Nov 3, 2023

> ping my-enterprise-repo-maven
ping: my-enterprise-repo-maven: Name or service not known

@snjeza
Copy link

snjeza commented Nov 3, 2023

@Raidez could you show your maven repository url?

@Raidez
Copy link
Author

Raidez commented Nov 7, 2023

I can't show my maven url, but I discovered another thing.
Forget the maven-resources-plugin, when I open my project with JAVA_HOME set to jdk17, it works perfectly.
When I switching to jdk8, I got an error (same as NOK.log).
The github said java 11 is required.
My mistake.

@jdneo
Copy link
Member

jdneo commented Nov 7, 2023

@Raidez Is your problem resolved?

@Raidez
Copy link
Author

Raidez commented Nov 7, 2023

YEs

@Raidez Raidez closed this as completed Nov 7, 2023
@jdneo
Copy link
Member

jdneo commented Nov 7, 2023

Ok. Anyway, good to know the problem is fixed. And thank you @snjeza for the help! ❤

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants