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

debugger broke in latest vscode update #308

Closed
clankill3r opened this issue Jun 11, 2018 · 9 comments
Closed

debugger broke in latest vscode update #308

clankill3r opened this issue Jun 11, 2018 · 9 comments
Assignees

Comments

@clankill3r
Copy link

Today I had in a project that I could not run it anymore.
I was getting a ClassNotFoundException.
Since it was only one file and I wanted to get work done I copied the file to another project that still worked. Now later today (while working on a totally unrelated java file) I also get a ClassNotFoundException.

As a test I opened a third project that has always worked fine.
If I run it I get:

screen shot 2018-06-11 at 22 25 56

If I press 'Proceed' everything runs fine. (I guess it runs an old build then?).

All this is since today.

Environment
  • Operating System: OSX 10.12.6
  • JDK version: jdk-10 (that's where $JAVA_HOME points to, I have others installed as well)
  • Visual Studio Code version: 1.24.0
  • Java extension version: 0.3.0 (if you guys mean Java Extension Pack)
  • Java Debugger extension version: 0.9.0
Steps To Reproduce

If I only knew...

Current Result

ClassNotFoundException

Expected Result

A running java program

Additional Informations
{
            "type": "java",
            "name": "IMGUITest",
            "request": "launch",
            "cwd": "${workspaceFolder}",
            "console": "internalConsole",
            "stopOnEntry": false,
            "mainClass": "com.github.imgui.IMGUITest",
            "projectName": "imgui",
            "args": ""
        },

It is a maven project.

@clankill3r clankill3r changed the title debugger broke in latest viscose update debugger broke in latest vscode update Jun 11, 2018
@andxu
Copy link
Contributor

andxu commented Jun 12, 2018

@clankill3r Thank you for trying java debugger, could you please give us a snapshot of error shown ClassNotFoundException, based on your description, it has very high possibility to have a sync problem in project cache, could you please a try after cleaning all the files on the directory : C:\Users<your user name>\AppData\Roaming\Code\User\workspaceStorage (in windows)

@andxu andxu self-assigned this Jun 12, 2018
@andxu
Copy link
Contributor

andxu commented Jun 12, 2018

#302

@clankill3r
Copy link
Author

clankill3r commented Jun 12, 2018

I removed all my workspace storage.

I just figured this out, I only get a ClassNotFoundException when I have Caught Exceptions on!

screen shot 2018-06-12 at 10 38 53

Uncaught Exceptions don't matter, all off is also fine.

I also noticed that since yesterday, the test classes (test/java/...) don't compile to a class file anymore. At least not to this directory:

screen shot 2018-06-12 at 10 39 23

Maybe this has always been the case. I never payed attention to that.
Anyway, maybe this is a problem with the Maven for java extension?

I have no idea, I hope the new info helps.

edit:

I never get a error of ClassNotFoundException in the console. I did had it before but I can not reproduce the error. Meanwhile it keeps throwing them.

@andxu
Copy link
Contributor

andxu commented Jun 13, 2018

@clankill3r Integrated JVM has class loaders which will first throw ClassNotFoundException and then load the class. So if you check Caught Exceptions, you will get a lot of breaks on caught ClassNotFoundException. Your test classes should be generated to output folder defined in .classpath(Java language server will generate this file if it is not here), please let me known the content of your .classpath file, like:

	<classpathentry kind="src" output="target/test-classes" path="src/test/java">
		<attributes>
			<attribute name="optional" value="true"/>
			<attribute name="maven.pomderived" value="true"/>
			<attribute name="test" value="true"/>
		</attributes>
	</classpathentry>
      <classpathentry kind="output" path="target/classes"/>

Meanwhile Maven for java never execute any maven tasks except you execute it manually.

@clankill3r
Copy link
Author

Hi, here it is:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
	<classpathentry kind="src" output="target/classes" path="src/main/java">
		<attributes>
			<attribute name="optional" value="true"/>
			<attribute name="maven.pomderived" value="true"/>
		</attributes>
	</classpathentry>
	<classpathentry kind="src" output="target/test-classes" path="src/test/java">
		<attributes>
			<attribute name="optional" value="true"/>
			<attribute name="maven.pomderived" value="true"/>
			<attribute name="test" value="true"/>
		</attributes>
	</classpathentry>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
		<attributes>
			<attribute name="maven.pomderived" value="true"/>
		</attributes>
	</classpathentry>
	<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
		<attributes>
			<attribute name="maven.pomderived" value="true"/>
		</attributes>
	</classpathentry>
	<classpathentry kind="src" path="target/generated-sources/annotations">
		<attributes>
			<attribute name="optional" value="true"/>
			<attribute name="maven.pomderived" value="true"/>
			<attribute name="ignore_optional_problems" value="true"/>
			<attribute name="m2e-apt" value="true"/>
		</attributes>
	</classpathentry>
	<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
		<attributes>
			<attribute name="optional" value="true"/>
			<attribute name="maven.pomderived" value="true"/>
			<attribute name="ignore_optional_problems" value="true"/>
			<attribute name="m2e-apt" value="true"/>
			<attribute name="test" value="true"/>
		</attributes>
	</classpathentry>
	<classpathentry kind="output" path="target/classes"/>
</classpath>

@andxu
Copy link
Contributor

andxu commented Jun 22, 2018

checked Caught Exceptions will bring a lot of ClassNotFoundException which is by design since the class loader in JVM is try to catch ClassNotFoundException to determine whether a class is loaded or not, your build problem should be related to the java language server at https://github.com/redhat-developer/vscode-java/issues. The output folder for 'src/test/java' is target/test-classes, you should look for .class files here.

@clankill3r
Copy link
Author

They are there.
Just to make sure where on the same page, So it is correct that I get a ClassNotFoundException when Caught Exceptions is on although the class in target/test-classes does exist?

@andxu
Copy link
Contributor

andxu commented Jun 27, 2018

yes, ClassNotFoundException is expected although the class is here.

@no-response no-response bot closed this as completed Aug 7, 2018
@no-response
Copy link

no-response bot commented Aug 7, 2018

This issue has been closed automatically because it needs more information and has not had recent activity. Please reach out if you have or find the answers we need so that we can investigate further.

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

No branches or pull requests

2 participants