8

I have created a Maven2-based GWT application, imported it into Eclipse, and when I Debug As a GWT Web Application, the Eclipse debug session suspends with a FileNotFoundException. It displays a window saying: the source attachment does not contain the source for the file URLClassPath.class.

I have completely wiped out the Eclipse workspace (and .metadata subdirectory), created/imported a blank project and the same thing happens. If I do Run As GWT Web Application it works ok (with a couple of warnings). What do I need to tweak to get this working in debug mode?

Steps to reproduce the problem

1) Create Application

webAppCreator -noant -maven -XnoEclipse -out MyApp com.example.MyApp

2) Import and change settings

  • The application is imported into the Eclipse workspace, in the settings the "Use Google Web Toolkit" checkbox is ticked.

  • "This project has a WAR directory" is checked. The WAR directory is set to src/main/webapp. The "Launch and deploy from this directory" is unchecked.

3) Debug As

Now the debug toolbar button is pressed, choose "GWT Web Application", and select target/www as the WAR directory. You should see the same problem. The call stack in the Debug pane contains the following:

MyApp.html [Web Application]
com.google.gwt.dev.DevMode at localhost:51620 Thread [main] (Suspended (exception FileNotFoundException))
URLClassPath$JarLoader.getJarFile(URL) line: 644
URLClassPath$JarLoader.access$600(URLClassPath$JarLoader, URL) line: 540
URLClassPath$JarLoader$1.run() line: 607
AccessController.doPrivileged(PrivilegedExceptionAction) line: not available [native method]
URLClassPath$JarLoader.ensureOpen() line: 599
URLClassPath$JarLoader.(URL, URLStreamHandler, HashMap) line: 583
URLClassPath$JarLoader$3.run() line: 810
AccessController.doPrivileged(PrivilegedExceptionAction) line: not available [native method]
URLClassPath$JarLoader.getResource(String, boolean, Set) line: 806
URLClassPath$JarLoader.getResource(String, boolean) line: 765
URLClassPath.getResource(String, boolean) line: 169
URLClassLoader$1.run() line: 194
AccessController.doPrivileged(PrivilegedExceptionAction, AccessControlContext) line: not available [native method]
Launcher$AppClassLoader(URLClassLoader).findClass(String) line: 190
Launcher$AppClassLoader(ClassLoader).loadClass(String, boolean) line: 307
Launcher$AppClassLoader.loadClass(String, boolean) line: 301
Launcher$AppClassLoader(ClassLoader).loadClass(String) line: 248 C:\Program Files\Java\jdk1.6.0_21\bin\javaw.exe (28 Nov 2010 15:28:32)

Versions and plugins

GWT: 2.1.

Eclipse: Helios (3.6).

Maven: 2.2.1.

JRE/JDK: JDK 1.6.0.21.

Google Plugin for Eclipse 3.6 version 1.4.0.v201010280102.

Maven Integration for Eclipse (m2eclipse) version 0.10.2.20100623-1649 (this has been configured to point to Maven 2.2.1 environment and NOT to use the embedded Maven3 "instance").

PeteUK
  • 1,062
  • 12
  • 26

1 Answers1

9

In Eclipse go to Window -> Preferences -> Java -> Debug and disable all options for Suspend Execution.

As this error is probably not caused by your app, you don't really need the source for that class (URLClassPath). You can search Oracle's/Sun's Java site for the sources and point Eclipse to them, if you really want to ;)

FuePi
  • 1,958
  • 22
  • 18
  • If I click the "Suspend execution on uncaught exceptions" then it does indeed stop bothering me at debug startup. I'll mark this as the accepted answer. I'd love to know exactly why these exceptions occur, and why they don't appear on a non-Maven GWT project but I'll do that as a separate thing... – PeteUK Dec 01 '10 at 20:27
  • Download the Java sources (e.g. http://www.java.net/download/jdk6/6u23/promoted/b03/jdk-6u23-ea-src-b03-jrl-18_oct_2010.jar), unpack and point Eclipse to them. Have a look at arg0/path which is "/home/fuepi/.m2/repository/com/google/gwt/gwt-servlet/2.1.0/gwt-servlet.jar" for me. Unfourtunately the real filename is "gwt-servlet-2.1.0.jar". So I did "ln -s gwt-servlet-2.1.0.jar gwt-servlet.jar" and now the debugger runs ok :) Solving this by adjusting the pom.xml would be much nicer, but right now this workaround works for me. – FuePi Dec 03 '10 at 13:19
  • 1
    I did as you said as my arg0/path is "/C:/M2Repository/com/google/gwt/gwt-servlet/2.1.0/gwt-servlet.jar". After copying gwt-servlet-2.1.0.jar to gwt-servlet.jar, it works here too. Nice to learn some more about this, thanks! I have to wonder why it's looking for gwt-servlet.jar though? Under the Project Explorer, the Maven Dependencies related to the jars with version numbers. I've removed the link between the project and the GWT SDK. Thanks again for your help. – PeteUK Dec 05 '10 at 18:38
  • I also wonder why even though the JDK source is installed, it is difficult to inspect variables. You can see the arguments to the function but can't see local variables which would be interesting. I'm sorry I've got so many questions and I should probably raise these as distinct questions on StackOverflow. – PeteUK Dec 05 '10 at 18:42
  • 1
    Some extra information for those people having the same problem: There is a GWT issue report about this which explains exactly why this is happening: see http://code.google.com/p/google-web-toolkit/issues/detail?id=4853#makechanges – PeteUK Dec 09 '10 at 16:19