I may be wrong, but doesn't the ProcessBuilder use the OS interpreter to parse the forked process command line & arguments ? (This may be JRE dependenant) In such case, it may fail on windows with long classpath String as we can have on JEE web applications and maven projects
For my personnal info, why do you fork a JVM and not just use multiple threads using java.util.concurrent ? On Fri, Feb 20, 2009 at 4:16 AM, Scott Blum <[email protected]> wrote: > Nicolas, > I see what the problem is. Check out this code in > ExternalPermutationWorkerFactory<http://code.google.com/p/google-web-toolkit/source/browse/releases/1.6/dev/core/src/com/google/gwt/dev/ExternalPermutationWorkerFactory.java#246> > : > > // Cook up the classpath, main class, and extra args > args.addAll(Arrays.asList("-classpath", > ManagementFactory.getRuntimeMXBean().getClassPath(), > CompilePermsServer.class.getName(), "-host", "localhost", "-port", > String.valueOf(port), "-logLevel", logLevel.toString(), "-cookie", > cookie)); > > This is getting the system-level classpath in order to fork a new process, > which in the Maven case is wrong. I guess the other option would be to check > if (this.getClass().getClassLoader() instanceof URLClassLoader)... if that's > true, we should be able to send over the classpath for the ClassLoader that > contains gwt-dev-*.jar. > > Bob, do you have any thoughts on this? This is your code I think. > > Scott > > On Thu, Feb 19, 2009 at 10:30 AM, nicolas.deloof <[email protected] > > wrote: > >> >> Hi, >> >> I'm trying to upgrade the gwt-maven plugin to support 1.6 release. >> I've applied the shell / compiler changes and now try to launch the >> compiler. I got a strange error : >> >> [INFO] Compiling 15 permutations >> [INFO] Process output >> [INFO] [ERROR] java.lang.NoClassDefFoundError: com/google/gwt/ >> dev/CompilePermsServer >> [INFO] [ERROR] Caused by: java.lang.ClassNotFoundException: >> com.google.gwt.dev.CompilePermsServer >> [INFO] [ERROR] at java.net.URLClassLoader$1.run >> (URLClassLoader.java:200) >> [INFO] [ERROR] at java.security.AccessController.doPrivileged >> (Native Method) >> [INFO] [ERROR] at java.net.URLClassLoader.findClass >> (URLClassLoader.java:188) >> [INFO] [ERROR] at java.lang.ClassLoader.loadClass >> (ClassLoader.java:307) >> [INFO] [ERROR] at sun.misc.Launcher$AppClassLoader.loadClass >> (Launcher.java:301) >> [INFO] [ERROR] at java.lang.ClassLoader.loadClass >> (ClassLoader.java:252) >> [INFO] [ERROR] at java.lang.ClassLoader.loadClassInternal >> (ClassLoader.java:320) >> [INFO] [ERROR] Could not find the main class: >> com.google.gwt.dev.CompilePermsServer. Program will exit. >> [INFO] [ERROR] Exception in thread "main" >> >> The plugin creates a native command script, like this one : >> >> "D:\jdk6\jre\bin\java" -Xmx512M -cp "D:\repository\org\codehaus\mojo >> \gwt-maven-plugin\1.1-SNAPSHOT\gwt-maven-plugin-1.1-SNAPSHOT.jar" >> org.codehaus.mojo.gwt.fork.ForkBooter "D:\projets\webapp\target >> \gwt.classpath" com.google.gwt.dev.Compiler -gen "D:\projets\webapp >> \target\gen" -logLevel INFO -style OBF -war "D:\projets\webapp\target >> \webapp-1.0.0-SNAPSHOT" -localWorkers 2 com.sfr.bios.rc.CADM >> >> The "ForkBooter" class is used to bypass Windows command line length >> limitation. It created a child classloader based on project >> dependencies list. In my case, the gwt.classpath file looks like : >> >> D:\projets\webapp\src\main\java >> D:\projets\webapp\target\generated-sources\gwt >> D:\projets\webapp\src\main\resources >> D:\projets\webapp\target\classes >> D:\repository\com\google\gwt\gwt-user\1.6.0\gwt-user-1.6.0.jar >> D:\repository\com\google\gwt\gwt-dev\1.6.0\gwt-dev-1.6.0-windows.jar >> D:\repository\com\google\gwt\gwt-servlet\1.6.0\gwt-servlet-1.6.0.jar >> ... >> >> As you can notice, the expected gwt-dev jar is present. >> >> I suppose the "Compiling * permutations - Process output" step has >> some Classloader issue that doesn't support our nested ClassLoader. >> Maybe it uses SystemClassloader directly ? >> >> I didn't get further with this issue debugging the compiler to >> understand what's wrong, maybe you've got an idea ? >> >> Nicolas >> >> > > > > --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---
