I'm working on Liferay 7. I'm new to Liferay and I'm experiencing an issue that I spent too much time on.
I have a portlet that I decided to create a Service Builder (named "Employee"). Here is my service.xml :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 7.0.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_7_0_0.dtd">
<service-builder package-path="com.test">
<author>sachin.singh</author>
<namespace>crud</namespace>
<entity name="Employee" table="user" local-service="true" remote-service="true">
<column name="iduser" type="int" primary="true" id-type="increment"/>
<column name="name" type="String" />
<column name="secret_code" type="String" />
</entity>
</service-builder>
And when i am building using liferay service builder i am getting this error
[copy] Copying 1 file to D:\tools\com.liferay.portal.plugins.sdk-1.0.11\portlets\firstLiferay-portlet\docroot\WEB-INF\classes
[copy] Copied 3 empty directories to 2 empty directories under D:\tools\com.liferay.portal.plugins.sdk-1.0.11\portlets\firstLiferay-portlet\docroot\WEB-INF\classes
[jar] Building MANIFEST-only jar: D:\tools\com.liferay.portal.plugins.sdk-1.0.11\portlets\firstLiferay-portlet\service-builder-classpath.jar
[delete] Deleting: D:\tools\com.liferay.portal.plugins.sdk-1.0.11\portlets\firstLiferay-portlet\service-builder-classpath.jar.manifest
[java] Java Result: 1
[delete] Deleting: D:\tools\com.liferay.portal.plugins.sdk-1.0.11\portlets\firstLiferay-portlet\service-builder-classpath.jar
[echo] java.lang.NoClassDefFoundError: com/thoughtworks/qdox/model/JavaMethod
[echo] at java.lang.Class.getDeclaredMethods0(Native Method)
[echo] at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
[echo] at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
[echo] at java.lang.Class.getMethod0(Class.java:3018)
[echo] at java.lang.Class.getMethod(Class.java:1784)
[echo] at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
[echo] at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
[echo] Caused by: java.lang.ClassNotFoundException: com.thoughtworks.qdox.model.JavaMethod
[echo] at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
[echo] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[echo] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
[echo] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[echo] ... 7 more
[echo] Error: A JNI error has occurred, please check your installation and try again
[echo] Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512m; support was removed in 8.0
[echo] Exception in thread "main"
I checked and cross verify,All jars are there in jar library.
Here is the screenshot of added jar:
Especially when you're new, I'd recommend to try again and use Liferay Workspace instead of the (deprecated) plugins-sdk. All of the samples (here's one for service builder) build on this, and plugins-sdk should largely be used only to migrate existing legacy plugins to the latest release.
I'm not sure what your screenshot shows - if it's all of the bundled jars, then it looks horrible. You should only have tiny plugins in times of OSGi bundles, and it definitely looks like those are way too many dependencies.
Related
My WebSphere 8.5 application has an EAR project containing an MDB project that builds to produce a JAR. That JAR has a class that references classes within a secondary JAR in the EAR that come from a third project.
the manifest for the MDB containing jar (ASyncEJB.jar) is
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.2
Class-Path: ASync.jar
lib\aopalliance\aopalliance-1.0.jar
lib\asm\asm-3.1.jar
etc (more lib references)
the manifest for the containing Enterprise project within EAR looks like
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.2
Created-By: abc
Built-By: xyz
Built-Date: September 18 2014
Implementation-Version: Value_not_provided
It looks like the classpath in the ASyncEJB.jar's manifest should enable it to load the class from the secondary ASync.jar.
The structure of the EAR is
lib
META-INF
ASync.jar
ASyncEJB.jar
The application.xml also withing the META-INF folder with the MANIFEST.MF looks like
<?xml version="1.0" encoding="UTF-8"?>
<application id="Application_ID" version="6" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd">
<display-name>AsyncEnterprise</display-name>
<module id="Module_1381933529290">
<ejb>ASyncEJB.jar</ejb>
</module>
</application>
Why would I get java.lang.ClassNotFoundException on a class in ASync.jar called by a class in ASyncEJB.jar ?
The error is:
[22/09/14 15:10:04:285 EDT] 00000065 SharedEJBRunt I WSVR0057I: EJB jar started: ASyncEJB.jar
[22/09/14 15:10:04:386 EDT] 00000065 BusinessExcep E CNTR0020E: EJB threw an unexpected (non-declared) exception during invocation of method "initialize" on bean "BeanId(AsyncEnterprise#ASyncEJB.jar#ejbContext, null)". Exception data: java.lang.NoClassDefFoundError: corporg.core.context.listener.WebContextListener
at corporg.async.beans.ContextInitilizer.initialize(ContextInitilizer.java:18)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at com.ibm.ejs.container.interceptors.InterceptorProxy.invokeInterceptor(InterceptorProxy.java:232)
at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:559)
at com.ibm.ejs.container.interceptors.InvocationContextImpl.doLifeCycle(InvocationContextImpl.java:273)
at com.ibm.ejs.container.SingletonBeanO.callTransactionalLifecycleInterceptors(SingletonBeanO.java:273)
at com.ibm.ejs.container.SingletonBeanO.initialize(SingletonBeanO.java:404)
at com.ibm.ejs.container.BeanOFactory.create(BeanOFactory.java:130)
at com.ibm.ejs.container.EJSHome.createNewBeanO(EJSHome.java:869)
at com.ibm.ejs.container.EJSHome.createSingletonBeanO(EJSHome.java:3981)
at com.ibm.ejs.csi.EJBApplicationMetaData.createStartupBeans(EJBApplicationMetaData.java:991)
at com.ibm.ejs.csi.EJBApplicationMetaData.startedModule(EJBApplicationMetaData.java:715)
at com.ibm.ws.runtime.component.EJBContainerImpl.stateChanged(EJBContainerImpl.java:4866)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.stateChanged(ApplicationMgrImpl.java:1120)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectEvent(DeployedApplicationImpl.java:1353)
at com.ibm.ws.runtime.component.DeployedModuleImpl.setState(DeployedModuleImpl.java:248)
at com.ibm.ws.runtime.component.DeployedModuleImpl.setState(DeployedModuleImpl.java:244)
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:642)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:968)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:774)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2182)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:445)
at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:388)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$500(CompositionUnitMgrImpl.java:116)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:994)
at com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:502)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1862)
Caused by: java.lang.ClassNotFoundException: corporg.core.context.listener.WebContextListener
at java.net.URLClassLoader.findClass(URLClassLoader.java:434)
at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java:204)
at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:688)
at java.lang.ClassLoader.loadClass(ClassLoader.java:667)
at com.ibm.ws.bootstrap.ExtClassLoader.loadClass(ExtClassLoader.java:119)
at java.lang.ClassLoader.loadClass(ClassLoader.java:650)
at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:62)
at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:58)
at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:584)
at java.lang.ClassLoader.loadClass(ClassLoader.java:650)
at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:584)
at java.lang.ClassLoader.loadClass(ClassLoader.java:650)
... 31 more
I have built my project with maven
All builds successful and eclipse properties generation is also successful
But when I open the project in Eclipse 4, I am getting this error
An internal error occurred during: "Loading descriptor for SALYExplorer.".
org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'taglib' not found. (platform:/resource/SALYExplorer/src/main/webapp/WEB-INF/web.xml, 313, 10)
At that location I have some properties
Though the project runs smoothly and everything is fine, just while exploring the project in Navigation pane, Eclipse always throws this error box (quite annoying).
COde at that location
<taglib>
<taglib-uri>xx.tld</taglib-uri>
<taglib-location>/WEB-INF/tld/xx.tld</taglib-location>
</taglib>
and xx definations int it's file
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
"http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_2.dtd">
<taglib>
<tlib-version>1.0</tlib-version>
<jsp-version>1.2</jsp-version>
.........
</taglib>
The problem is not the taglib at all, it's just a bad error description by Eclipse.
it is the project facet vs. web.xml dtd.. their versions must match!
if the web.xml says:
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
but the project has a
"Dynamic Web Module 2.5"
then this error will occur.. change facet to 2.3 or web.xml to 2.5... in other words: they must match..
I ran into this error while trying to update a maven project in Eclipse (ALT+F5).
web.xml
<web-app xmlns="http://java.sun.com/xml/ns/javaee" version="3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
and project facet
Dynamic Web Modul 3.0
Here is how I could fix it:
Removed all xmls-schema definition from the web-app element
<web-app>
then update the maven project (ALT+F5).
Re-insert the schema definitions and re-update project (ALT+F5).
According to jsp_2_1.xsd included from web-app_2_5.xsd, taglib tag should be in jsp-config tag:
<xsd:complexType name="jsp-configType">
<xsd:annotation>
<xsd:documentation>
The jsp-configType is used to provide global configuration
information for the JSP files in a web application. It has
two subelements, taglib and jsp-property-group.
</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="taglib"
type="javaee:taglibType"
minOccurs="0"
maxOccurs="unbounded"/>
<xsd:element name="jsp-property-group"
type="javaee:jsp-property-groupType"
minOccurs="0"
maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="id" type="xsd:ID"/>
When I wrapped taglib in js-config, the error disappeared.
<jsp-config>
<taglib>
<taglib-uri>http://www.springframework.org/tags/form</taglib-uri>
<taglib-location>/WEB-INF/taglibs/spring-form.tld</taglib-location>
</taglib>
</jsp-config>
Previous parsers were probably more lenient. My config: Eclipse Luna, built-in maven 3.2.1, web.xml 2.5, Dynamic Web Project facet 2.5.
For the time being if it's just the annoying Error Message that you want to fix, then as a short-term fix take a look at disabling validation here : Eclipse 'loading descriptor' takes ages
If the above does not work, an alternative would be to use AHK (Autohotkey) which would take slightly more work at your end. (I have been using an AHK script for a couple of years now to get rid of the Eclipse Error popups that I don't care about)
Eclipse Bug 198630 was raised almost 5 years back and in that there is a comment which has an almost identical error message as the OP. (The bug itself was finally closed as not being reproducible).
I have the following questions for you :
Would it be possible for you to show us the Error log ? (To get at the error log you can either take a look at the Error Log View or by looking at the actual file : WORKSPACE_HOME/.metadata/.log. Please take a look at this for more detailed information. )
Are you using any specific Server Adapters like WebLogic or Glassfish ?
I have the following recommendations :
In the eclipse bug thread, the problem was fixed at least once by updating to a specific JST version. Hence, would it be possible for you to run an Eclipse update and see whether the problem is resolved ? (This can be done by going to Help -> Check for Updates)
Would it be possible to try importing the project in Eclipse Indigo (instead of
Juno, which you currently have) and see whether you can reproduce
the problem ? (Eclipse Indigo downloads are available here and I believe you would need the Java EE version)
I just got the same symptoms, with a web-app project using maven. In my case, was related to struts taglib tags in web.xml, and the project having a struts v1.2.9 dependency. I solved the problem by switching to struts v1.3.10. Don't ask why this solved the problem.
If you are in the same situation and you upgrade your struts dependency from 1.2.9 to 1.3.10, be sure to use at least dtd v2.3 in the DOCTYPE declaration of your web.xml:
!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd"
or you'll get another problem (your webapp won't startup without an internet connection)
Hope this helps
I suspect that the problem is with Eclipse web Tools Platform and Java EMF Model. Here is an image of a list of plugins including Java EMF Model and JEM stuff from Eclipse Web Tools Platform:
https://stackoverflow.com/users/1503535/nitin-gurram, does your stack trace look like this?
!ENTRY org.eclipse.core.jobs 4 2 2012-09-28 12:10:00.554
!MESSAGE An internal error occurred during: "Loading descriptor for grch97.".
!STACK 0
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'taglib' not found. (platform:/resource/grch97/WEB-INF/web.xml, 891, 11)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:319)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:278)
at org.eclipse.jem.internal.util.emf.workbench.ProjectResourceSetImpl.getResource(ProjectResourceSetImpl.java:1003)
at org.eclipse.jst.jee.model.internal.JEE5ModelProvider.getModelResource(JEE5ModelProvider.java:169)
at org.eclipse.jst.jee.model.internal.Web25ModelProvider.getModelObject(Web25ModelProvider.java:44)
at org.eclipse.jst.jee.model.internal.JEE5ModelProvider.getModelObject(JEE5ModelProvider.java:215)
at org.eclipse.jst.jee.model.internal.common.AbstractMergedModelProvider.loadProviders(AbstractMergedModelProvider.java:261)
at org.eclipse.jst.jee.model.internal.common.AbstractMergedModelProvider.access$2(AbstractMergedModelProvider.java:255)
at org.eclipse.jst.jee.model.internal.common.AbstractMergedModelProvider$LoadModelsWorkspaceRunnable.run(AbstractMergedModelProvider.java:278)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
at org.eclipse.jst.jee.model.internal.common.AbstractMergedModelProvider.loadModel(AbstractMergedModelProvider.java:249)
at org.eclipse.jst.jee.model.internal.common.AbstractMergedModelProvider.getMergedModel(AbstractMergedModelProvider.java:219)
at org.eclipse.jst.jee.model.internal.common.AbstractMergedModelProvider.getModelObject(AbstractMergedModelProvider.java:139)
at org.eclipse.jst.jee.ui.internal.navigator.Web25ContentProvider.getNewContentProviderInstance(Web25ContentProvider.java:69)
at org.eclipse.jst.jee.ui.internal.navigator.LoadingJeeDDJob.run(LoadingJeeDDJob.java:50)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'taglib' not found. (platform:/resource/grch97/WEB-INF/web.xml, 891, 11)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeature(XMLHandler.java:1985)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeature(XMLHandler.java:1949)
at org.eclipse.emf.ecore.xmi.impl.XMIHandler.handleUnknownFeature(XMIHandler.java:145)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1893)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:1017)
at org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMIHandler.java:81)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:995)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:706)
at org.eclipse.emf.ecore.xmi.impl.XMIHandler.startElement(XMIHandler.java:163)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:175)
at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:240)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1505)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1284)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:259)
at org.eclipse.jem.internal.util.emf.workbench.ProjectResourceSetImpl.demandLoad(ProjectResourceSetImpl.java:811)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
... 14 more
I managed to fix this by removing the validator out of the .project file for each of the projects that had the issue.
I had a similar error using eclipse 4.3 (Kepler), maven 3.1.0, tomcat 6.0.37 and jdk7 (have also jre6 installed), and found a solution to fix it or at least to get rid of the tedious errors by configuring tomcat in eclipse.
In Preferences->Server-> Runtime Environments, define a new run time environment "Apache Tomcat 6.0" and select the jre6 installation from the installed JREs.
Then review the Targeted Runtimes in the project's properties. Apache Tomcat v6.0 should be associated with Java Runtime Environment v1.6 (if not yet defined press new and check that the selected JRE is a java 1.6 runtime).
Hope it helps
I was able to update the project Java facet to 1.5 and the errors stopped.
In my case, this problem got resolved by using the version
org.eclipse.emf.ecore.xmi_2.10.2.v20150123-0348 and org.eclipse.emf.ecore.xmi.source_2.10.2.v20150123-0348 and
org.eclipse.emf.ecore.xmi_2.10.2.v20150123-0348 and
org.eclipse.emf.ecore.xmi.source_2.10.2.v20150123-0348 and
org.eclipse.emf.common_2.10.1.v20150123-0348
jars in the build path.
Earlier jars of old version were being used inspite of new version present.
Right click on the project in Eclipse -> Build Path -> Configure Build Path -> Project Facets -> Uncheck Dynamic Web Module
Note: This approach is good as long you dont plan to run the web-app from within eclipse thru an embedded app server.
The long awaited Super Dev Mode came and I attempted to use it. After building GWT trunk I created a test app and compiled it successfully. I then added this to the module XML file with the intent to enable Source Maps for Chrome:
<!-- Allows debugging without DevMode -->
<set-property name="compiler.useSourceMaps" value="true">
<when-property-is name="user.agent" value="safari" />
</set-property>
I then tried to compile the application. The output was the following:
Compiling module com.hsi.gwt.test.sdm.Hello_sdm
Compiling 6 permutations
Compiling permutation 0...
Compiling permutation 1...
Compiling permutation 2...
Compiling permutation 3...
Compiling permutation 4...
Compiling permutation 5...
Source Maps Enabled
Compile of permutations succeeded
Linking into /Users/bbrudnoy/Workspaces/indigo-hsi/hello-sdm/war/hello_sdm
Invoking Linker Export CompilationResult symbol maps
[ERROR] Failed to link
java.lang.NoClassDefFoundError: org/json/JSONException
at com.google.gwt.thirdparty.debugging.sourcemap.SourceMapGeneratorV3.mergeMapSection(SourceMapGeneratorV3.java:243)
at com.google.gwt.core.linker.SymbolMapsLinker.link(SymbolMapsLinker.java:299)
at com.google.gwt.core.ext.linker.impl.StandardLinkerContext.invokeLinkForOnePermutation(StandardLinkerContext.java:372)
at com.google.gwt.dev.Link.finishPermutation(Link.java:491)
at com.google.gwt.dev.Link.doSimulatedShardingLink(Link.java:453)
at com.google.gwt.dev.Link.link(Link.java:200)
at com.google.gwt.dev.Compiler.run(Compiler.java:262)
at com.google.gwt.dev.Compiler.run(Compiler.java:198)
at com.google.gwt.dev.Compiler$1.run(Compiler.java:170)
at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:88)
at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:82)
at com.google.gwt.dev.Compiler.main(Compiler.java:177)
Caused by: java.lang.ClassNotFoundException: org.json.JSONException
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 12 more
What am I missing?
If you use Maven then add the following to your pom.xml file. It should help you overcome that problem.
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20090211</version>
</dependency>
EDIT: this is fixed in GWT 2.5
This is a known issue: http://code.google.com/p/google-web-toolkit/issues/detail?id=7397
As a quick workaround, you can add the gwt-servlet-deps.jar to the classpath.
BTW, Super Dev Mode will automatically generate source maps, you don't need to enable them in your module (but for now you have to enable Super Dev Mode and use the xsiframe linker)
I have added the mvp4g jar for project through ivy configuration.It added properly and also mention line in the gwt.xml file for mvp4g.But i am trying to compile the application it gives me following error:
Loading inherited module 'com.mvp4g.Mvp4gModule' [ERROR] Unable to
find 'com/mvp4g/Mvp4gModule.gwt.xml' on your classpath; could be a
typo, or maybe you forgot to include a classpath entry for source?
[ERROR] Line 13: Unexpected exception while processing element
'inherits' com.google.gwt.core.ext.UnableToCompleteException: (see
previous log entries) at
com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:278)
at
com.google.gwt.dev.cfg.ModuleDefSchema$BodySchema.__inherits_begin(ModuleDefSchema.java:495)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597) at
com.google.gwt.dev.util.xml.HandlerMethod.invokeBegin(HandlerMethod.java:230)
at
com.google.gwt.dev.util.xml.ReflectiveParser$Impl.startElement(ReflectiveParser.java:294)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)
at
com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:179)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1343)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2755)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
at
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
at
com.google.gwt.dev.util.xml.ReflectiveParser$Impl.parse(ReflectiveParser.java:347)
at
com.google.gwt.dev.util.xml.ReflectiveParser$Impl.access$200(ReflectiveParser.java:68)
at
com.google.gwt.dev.util.xml.ReflectiveParser.parse(ReflectiveParser.java:418)
at
com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:296)
at
com.google.gwt.dev.cfg.ModuleDefLoader$1.load(ModuleDefLoader.java:198)
at
com.google.gwt.dev.cfg.ModuleDefLoader.doLoadModule(ModuleDefLoader.java:324)
at
com.google.gwt.dev.cfg.ModuleDefLoader.loadFromClassPath(ModuleDefLoader.java:156)
at com.google.gwt.dev.Compiler.run(Compiler.java:196) at
com.google.gwt.dev.Compiler$1.run(Compiler.java:170) at
com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:88)
at
com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:82)
at com.google.gwt.dev.Compiler.main(Compiler.java:177) [ERROR] Failure
while parsing XML com.google.gwt.core.ext.UnableToCompleteException:
(see previous log entries) at
com.google.gwt.dev.util.xml.DefaultSchema.onHandlerException(DefaultSchema.java:58)
at
com.google.gwt.dev.util.xml.Schema.onHandlerException(Schema.java:66)
at
com.google.gwt.dev.util.xml.Schema.onHandlerException(Schema.java:66)
at
com.google.gwt.dev.util.xml.HandlerMethod.invokeBegin(HandlerMethod.java:240)
at
com.google.gwt.dev.util.xml.ReflectiveParser$Impl.startElement(ReflectiveParser.java:294)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)
at
com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:179)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1343)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2755)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
at
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
at
com.google.gwt.dev.util.xml.ReflectiveParser$Impl.parse(ReflectiveParser.java:347)
at
com.google.gwt.dev.util.xml.ReflectiveParser$Impl.access$200(ReflectiveParser.java:68)
at
com.google.gwt.dev.util.xml.ReflectiveParser.parse(ReflectiveParser.java:418)
at
com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:296)
at
com.google.gwt.dev.cfg.ModuleDefLoader$1.load(ModuleDefLoader.java:198)
at
com.google.gwt.dev.cfg.ModuleDefLoader.doLoadModule(ModuleDefLoader.java:324)
at
com.google.gwt.dev.cfg.ModuleDefLoader.loadFromClassPath(ModuleDefLoader.java:156)
at com.google.gwt.dev.Compiler.run(Compiler.java:196) at
com.google.gwt.dev.Compiler$1.run(Compiler.java:170) at
com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:88)
at
com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:82)
at com.google.gwt.dev.Compiler.main(Compiler.java:177) [ERROR]
Unexpected error while processing XML
com.google.gwt.core.ext.UnableToCompleteException: (see previous log
entries) at
com.google.gwt.dev.util.xml.ReflectiveParser$Impl.parse(ReflectiveParser.java:371)
at
com.google.gwt.dev.util.xml.ReflectiveParser$Impl.access$200(ReflectiveParser.java:68)
at
com.google.gwt.dev.util.xml.ReflectiveParser.parse(ReflectiveParser.java:418)
at
com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:296)
at
com.google.gwt.dev.cfg.ModuleDefLoader$1.load(ModuleDefLoader.java:198)
at
com.google.gwt.dev.cfg.ModuleDefLoader.doLoadModule(ModuleDefLoader.java:324)
at
com.google.gwt.dev.cfg.ModuleDefLoader.loadFromClassPath(ModuleDefLoader.java:156)
at com.google.gwt.dev.Compiler.run(Compiler.java:196) at
com.google.gwt.dev.Compiler$1.run(Compiler.java:170) at
com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:88)
at
com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:82)
at com.google.gwt.dev.Compiler.main(Compiler.java:177)
Please help me on this.
Analysis
After digging around the project homepage, I've discovered that the missing XML file is actually located inside the jar file:
unzip -t ./Mvp4g_Layout_Part2/war/WEB-INF/lib/mvp4g-1.4.0.jar | grep xml
testing: com/mvp4g/Mvp4gModule.gwt.xml OK
testing: META-INF/maven/com.googlecode.mvp4g/mvp4g/pom.xml OK
This means while the may have been downloaded by ivy, it is not present on your compile classpath.
Assumption
You haven't specified how you're using the jar, so I must assuming the above error was thrown by the ANT javac task.
Example
ivy.xml
I'd declare the dependency in ivy and associate it with a compile configuration as follows:
<ivy-module version="2.0">
<info organisation="com.myspotontheweb" module="demo"/>
<configurations>
<conf name="compile" description="Required to compile application"/>
</configurations>
<dependencies>
<dependency org="com.googlecode.mvp4g" name="mvp4g" rev="1.4.0" conf="compile->default"/>
</dependencies>
</ivy-module>
build.xml
In the ANT file I'd use the ivy cachepath task to create an ivy managed ANT path.
<target name="init">
<ivy:resolve/>
<ivy:report todir='${ivy.reports.dir}' graph='false' xml='false'/>
<ivy:cachepath pathid="compile.path" conf="compile"/>
</target>
This path is then used as normal in the javac task (or any other ANT task that can accept a classpath reference)
<target name="compile" depends="init">
<javac srcdir="${src.dir}" destdir="${classes.dir}" includeantruntime="false" debug="true" classpathref="compile.path"/>
</target>
I'm following this tutorial to create my ant build file that java compiles, than GWT compiles than perform the correct actions to build my .war file.
I use Eclipse and GWT-compile works, and when I run the development mode it works. I have also successfully deployed on tomcat.
The things is when I run my script, the compiles work but it fails on the gwt-compiler task. My ant build script is as follow :
<project name="vlp" default="gwt.compile" basedir=".">
<tstamp />
<!-- ################# PROPERTIES ################ -->
<!-- directory properties -->
<!-- source -->
<property name="projectName" value="VirtualLabPortal" />
<property name="src.dir" location="src" />
<property name="build.dir" location="bin" />
<property name="src.build.dir" location="${build.dir}/src" />
<property name="gwt.build.dir" location="${build.dir}/gwt" />
<property name="gwt.unitCache.dir" location="gwt-unitCache" />
<!-- libraries -->
<property name="src.lib.dir" location="war/WEB-INF/lib" />
<!-- ___________________________________________________________________
| |
| Configure path source/test |
|___________________________________________________________________|
-->
<path id="compile.path">
<fileset dir="${src.lib.dir}" includes="*.jar" />
<fileset dir="${src.lib.dir}/gwt" includes="*.jar" />
</path>
<!-- ___________________________________________________________________
| |
| Clean old compiled source/test/war |
|___________________________________________________________________|
-->
<target name="clean" description="Clean all the old build files.">
<delete dir="${build.dir}" />
<delete dir="${gwt.unitCache.dir}" />
<delete file="${projectWar}" />
<delete file="${src.lib.dir}/${projectJar}" />
</target>
<!-- ___________________________________________________________________
| |
| Compile the source |
|(should exclude gwtview code which is compiled by the gwt compiler)|
|___________________________________________________________________|
-->
<target name="src.compile" depends="clean" description="Compile the source code when everything has been cleaned.">
<mkdir dir="${src.build.dir}" />
<javac encoding="utf-8" destdir="${src.build.dir}" nowarn="true">
<src path="${src.dir}" />
<classpath refid="compile.path" />
</javac>
</target>
<!-- ___________________________________________________________________
| |
| Invoke the GWT compiler |
|___________________________________________________________________|
-->
<property name="module.gwt.xml" location="${src.dir}/com/banctecmtl/ca/vlp" />
<target name="gwt.compile" depends="src.compile">
<java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler">
<classpath>
<!-- src dir is added to ensure the module.xml file(s) are on the classpath -->
<pathelement location="${module.gwt.xml}" />
<path refid="compile.path" />
</classpath>
<jvmarg value="-Xmx512m" />
<arg line="${projectName} -logLevel ALL -style OBF -war ${build.dir}" />
</java>
</target>
<!-- ___________________________________________________________________
| |
| Copy the config files in the war directory |
|___________________________________________________________________|
-->
<property name="config.dir" location="war/config" />
<target name="copy-resources">
<copy todir="war/config" preservelastmodified="true">
<fileset dir="${config.dir}">
<include name="**.*" />
</fileset>
</copy>
</target>
<!-- ___________________________________________________________________
| |
| Create a Jar to be included in the war |
|___________________________________________________________________|
-->
<property name="projectJar" value="${projectName}.jar" />
<property name="gwt.client.dir" location="com/banctecmtl/ca/vlp/view/webview" />
<target name="jar" depends="src.compile">
<!-- should also depend on gwt.compile -->
<jar jarfile="${src.lib.dir}/${projectJar}" basedir="${src.build.dir}/">
<!-- Don't wrap any of the client only code into the JAR
<exclude name="${gwt.client.dir}/**/*.class"/> -->
<exclude name="${gwt.client.dir}/**/*.class" />
</jar>
</target>
<!-- ___________________________________________________________________
| |
| Create a War from the source |
|___________________________________________________________________|
-->
<property name="projectWar" value="${projectName}.war" />
<target name="war" depends="jar,copy-resources">
<war basedir="war" destfile="${projectWar}" webxml="war/WEB-INF/web.xml">
<exclude name="WEB-INF/**" />
<webinf dir="war/WEB-INF/">
<include name="lib/*.jar" />
<include name="classes/*.properties" />
<exclude name="**/gwt-dev.jar" />
<exclude name="**/gwt-user.jar" />
</webinf>
</war>
</target>
<!-- ___________________________________________________________________
| |
| Deploy to the production server |
|___________________________________________________________________|
-->
<!-- It is possible you can't run this from eclipse,
you need to edit the run configurations and add the
latest jsch library to the classpath -->
<property name="user" value="root" />
<property name="password" value="Banctec01" />
<property name="prodHost" value="vlp" />
<property name="dest" value="/usr/share/tomcat6/webapps/ROOT.war" />
<target name="deploy" depends="war">
<echo message="Copying to : ${user}#${prodHost}:${dest}" />
<scp file="${projectWar}" remoteTofile="${user}#${prodHost}:${dest}" password="${password}" trust="true" />
</target>
</project>
It fails with the following error :
Buildfile: D:\workspace\vlp\build.xml
clean:
[delete] Deleting directory D:\workspace\vlp\war\WEB-INF\classes
src.compile:
[mkdir] Created dir: D:\workspace\vlp\war\WEB-INF\classes
[javac] D:\workspace\vlp\build.xml:42: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 134 source files to D:\workspace\vlp\war\WEB-INF\classes
[javac] Note: D:\workspace\vlp\src\com\banctecmtl\ca\vlp\controller\schedule\ScheduledTaskManager.java uses unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
gwt.compile:
[java] Checking for updates
[java] First launch was 134c3e23387
[java] Last ping was Mon Apr 23 14:42:48 EDT 2012, min wait is 86400000ms
[java] Module location: file:/D:/workspace/vlp/src/com/banctecmtl/ca/vlp/VirtualLabPortal.gwt.xml
[java] Loading inherited module 'com.google.gwt.user.User'
[java] Module location: jar:file:/D:/workspace/vlp/war/WEB-INF/lib/gwt/gwt-user.jar!/com/google/gwt/user/User.gwt.xml
[java] Loading inherited module 'com.google.gwt.animation.Animation'
[java] Module location: jar:file:/D:/workspace/vlp/war/WEB-INF/lib/gwt/gwt-user.jar!/com/google/gwt/animation/Animation.gwt.xml
[java] Loading inherited module 'com.google.gwt.core.Core'
[java] Module location: jar:file:/D:/workspace/vlp/war/WEB-INF/lib/gwt/gwt-user.jar!/com/google/gwt/core/Core.gwt.xml
[java] Loading inherited module 'com.google.gwt.dev.jjs.intrinsic.Intrinsic'
[java] Module location: jar:file:/D:/workspace/vlp/war/WEB-INF/lib/gwt/gwt-dev.jar!/com/google/gwt/dev/jjs/intrinsic/Intrinsic.gwt.xml
[java] Loading inherited module 'com.google.gwt.lang.LongLib'
[java] Module location: jar:file:/D:/workspace/vlp/war/WEB-INF/lib/gwt/gwt-dev.jar!/com/google/gwt/lang/LongLib.gwt.xml
[java] Loading inherited module 'com.google.gwt.emul.Emulation'
[java] Module location: jar:file:/D:/workspace/vlp/war/WEB-INF/lib/gwt/gwt-user.jar!/com/google/gwt/emul/Emulation.gwt.xml
[java] Loading inherited module 'com.google.gwt.logging.LogImpl'
[java] Module location: jar:file:/D:/workspace/vlp/war/WEB-INF/lib/gwt/gwt-user.jar!/com/google/gwt/logging/LogImpl.gwt.xml
[java] Loading inherited module 'com.google.gwt.xhr.XMLHttpRequest'
[java] Module location: jar:file:/D:/workspace/vlp/war/WEB-INF/lib/gwt/gwt-user.jar!/com/google/gwt/xhr/XMLHttpRequest.gwt.xml
[java] Loading inherited module 'com.google.gwt.core.Core'
[java] Module 'com.google.gwt.core.Core' has already been loaded and will be skipped
[java] Loading inherited module 'com.google.gwt.core.CompilerParameters'
[java] Module location: jar:file:/D:/workspace/vlp/war/WEB-INF/lib/gwt/gwt-user.jar!/com/google/gwt/core/CompilerParameters.gwt.xml
[java] [...]
[java] Loading inherited module 'com.google.gwt.user.User'
[java] Module 'com.google.gwt.user.User' has already been loaded and will be skipped
[java] Public resources found in...
[java] Translatable source found in...
[java] Persistent unit cache dir set to: D:\workspace\vlp\war\..\gwt-unitCache
[java] Compiling module VirtualLabPortal
[java] Looking for previously cached Compilation Units in D:\workspace\vlp\war\..\gwt-unitCache
[java] Loaded 0 units from persistent store.
[java] Starting UnitWriteThread.
[java] Found 0 cached units. Used 0 / 2413 units from cache.
[java] [ERROR] Unexpected internal compiler error
[java] java.lang.RuntimeException: Exception processing units
[java] at com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater.compile(CompilationStateBuilder.java:248)
[java] at com.google.gwt.dev.javac.CompilationStateBuilder.doBuildFrom(CompilationStateBuilder.java:447)
[java] at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:370)
[java] at com.google.gwt.dev.cfg.ModuleDef.getCompilationState(ModuleDef.java:360)
[java] at com.google.gwt.dev.Precompile.precompile(Precompile.java:252)
[java] at com.google.gwt.dev.Precompile.precompile(Precompile.java:233)
[java] at com.google.gwt.dev.Precompile.precompile(Precompile.java:145)
[java] at com.google.gwt.dev.Compiler.run(Compiler.java:232)
[java] at com.google.gwt.dev.Compiler.run(Compiler.java:198)
[java] at com.google.gwt.dev.Compiler$1.run(Compiler.java:170)
[java] at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:88)
[java] at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:82)
[java] at com.google.gwt.dev.Compiler.main(Compiler.java:177)
[java] Caused by: java.lang.NoSuchMethodError: com.google.gwt.dev.jjs.ast.JProgram.serializeTypes(Ljava/util/List;Ljava/io/ObjectOutputStream;)V
[java] at com.google.gwt.dev.javac.CompilationUnitImpl.<init>(CompilationUnitImpl.java:68)
[java] at com.google.gwt.dev.javac.SourceFileCompilationUnit.<init>(SourceFileCompilationUnit.java:48)
[java] at com.google.gwt.dev.javac.CompilationUnitBuilder$ResourceCompilationUnitBuilder.makeUnit(CompilationUnitBuilder.java:154)
[java] at com.google.gwt.dev.javac.CompilationUnitBuilder.build(CompilationUnitBuilder.java:266)
[java] at com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater$1.run(CompilationStateBuilder.java:223)
BUILD FAILED
D:\workspace\vlp\build.xml:60: Java returned: 1
Total time: 36 seconds
I found that changing the gwt-compiler class name to the DevMode is building successfully. Using : classname="com.google.gwt.dev.DevMode" instead of classname="com.google.gwt.dev.Compiler".
EDIT : I refactored the XML above.
The build.xml cleans all the bin directory. I also pointer the javacto the bin/src directory and Google Web Toolkit compiler outputs to : bin/gwt. The compiler still doesn't work...
EDIT : I downloaded the latest SDK right away from google developpers site, and overrided the old librairies found in my classpath and in my eclipse plugin. Still won't work with the ant build script.
Anybody sees what could be the problem here?
All I can say is that the method com.google.gwt.dev.jjs.ast.JProgram.serializeTypes(Ljava/util/List;Ljava/io/ObjectOutputStream;)V is introduced only in gwt-dev 2.4.0. It doesn't exist in gwt-dev 2.3.0.
Which implies there are somewhere, in the classpath, two gwt-dev versions. One of them is 2.4.0, which is why com.google.gwt.dev.javac.CompilationUnitImpl is looking for that method. The other is of 2.3.0 or older, which is why that method isn't found (JProgram class was loaded by the compiler using the older version).
Try to look them up thoroughly. Or try to start a fresh environment in which you put a good eye on what's getting in.
tl;dr: this is due to differences in the linkers provided by Compiler versus DevMode in cases of insufficient or incorrect class context
Tracing the issue
I noticed that the repro you have exists in the current GWT trunk. Specifically, it's failing in this block of code:
ArrayList<CompilationUnit> resultUnits = new ArrayList<CompilationUnit>();
do {
// Compile anything that needs to be compiled.
buildQueue = new LinkedBlockingQueue<CompilationUnitBuilder>();
final ArrayList<CompilationUnit> newlyBuiltUnits = new ArrayList<CompilationUnit>();
final CompilationUnitBuilder sentinel = CompilationUnitBuilder.create((GeneratedUnit) null);
final Throwable[] workerException = new Throwable[1];
Thread buildThread = new Thread() {
#Override
public void run() {
try {
do {
CompilationUnitBuilder builder = buildQueue.take();
if (builder == sentinel) {
return;
}
// Expensive, must serialize GWT AST types to bytes.
CompilationUnit unit = builder.build(); // <-- Right here.
newlyBuiltUnits.add(unit);
} while (true);
} catch (Throwable e) {
workerException[0] = e;
}
}
};
Unwinding the stack further than your trace, we bounce through a factory and ten layers of code, until we finally hit UnifyAst.java. And, lo and behold:
...
mapApi(enclosingType);
// Now the method should be there.
method = methodMap.get(sig);
if (method == null) {
// TODO: error logging
throw new NoSuchMethodError(sig);
}
assert !method.isExternal();
return method;
...
This is the only instance of NoSuchMethodError called by the Precompilation stage of GWT.
Differences in Compiler and DevMode linking
Cool. Now that we've taken the deep dive into why this is exploding, let's figure out why DevMode works when Compiler doesn't. We note that both import the same copy of Util.java, so technically, both types are available statically to our Java compiler (just not the GWT compiler).
Inspecting the linkers, we note that Compiler uses Link.link directly:
Link.link(logger.branch(TreeLogger.TRACE, logMessage), module,
generatedArtifacts, allPerms, resultFiles, options.getWarDir(),
options.getDeployDir(), options.getExtraDir(), precompileOptions);
Whereas DevMode uses a much terser static call, with a separate pass filling in an instance of StandardLinkerContext:
link(loadLogger, module);
...
#Override
protected synchronized void produceOutput(TreeLogger logger, StandardLinkerContext linkerStack,
ArtifactSet artifacts, ModuleDef module, boolean isRelink) throws UnableToCompleteException {
...
linkerStack.produceOutput(linkLogger, artifacts, Visibility.Public, outFileSet);
linkerStack.produceOutput(linkLogger, artifacts, Visibility.Deploy, deployFileSet);
linkerStack.produceOutput(linkLogger, artifacts, Visibility.Private, extraFileSet);
...
}
Great! So, how do I fix it?
As accepted in the middle of writing this post, yair provides one such diagnosis for the issue, noting that the precompilation step is non-robust to conflicting class identities in the context of two versions of GWT. Other class visibility problems where precompilation.getGeneratedArtifacts(); pulls in wrong or insufficient objects may also cause this repro.
I will assume the issue has now been resolved, given yair was given accepted answer status. But it is conceivable for other people running across this post that other classpath or visibility issues may cause this exact issue to recur.
java.io.ObjectOutputStream class isn't supported by GWT compiler.
You have to refer to https://developers.google.com/web-toolkit/doc/latest/RefJreEmulation#Package_java_io before using Java classes to be sure GWT supports it.
You fork a JVM to run Gwt Compiler and the bin directory is in ClassPath.
As Eclipse compiles in development mode, a remaining class in bin may prevent the compiler to process properly some source files.
You should make sure the bin directory is empty before you invoke your Ant target. It may pass then.
I recommend you to use two target directories: one for classes compiled from Java sources and another one for GWT generated files. Then the target war will collect both into the WAR.