Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GWT webappcreator creating a Maven project: the source attachment does not contain the source for the file URLClassPath.class

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").

like image 923
PeteUK Avatar asked Nov 30 '10 14:11

PeteUK


1 Answers

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 ;)

like image 57
FuePi Avatar answered Oct 14 '22 12:10

FuePi