web-dev-qa-db-fra.com

Erreur AppEngine [Java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal]

je cherchais une solution à ce problème mais cela semble difficile. J'ai un projet Appengine qui fonctionne avec une servlet qui gère l'enregistrement. Lorsque j'essaie d'appeler ce servlet, j'ai ce rapport de journal:

012-04-19 10:31:06.816 /register 500 90ms 0kb Apache-HttpClient/UNAVAILABLE (Java 1.4)
ip - gecodroidtest [19/Apr/2012:10:31:06 -0700] "POST /register HTTP/1.1" 500 0 - "Apache-HttpClient/UNAVAILABLE (Java 1.4)" "cloudnotifyit.appspot.com" ms=90 cpu_ms=58 api_cpu_ms=0 cpm_usd=0.001738 instance=00c61b117c772731eb45290bfcb07750c0505f
W 2012-04-19 10:31:06.794
com.cloudnotify.server.servlet.RequestInfo processRequest: xxxxxxxxxxxx@xxxx  //just for me
W 2012-04-19 10:31:06.810
Error for /register 
Java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal
    at com.google.appengine.runtime.Request.process-240c2ffe1bf8ddba(Request.Java)
    at Java.lang.ClassLoader.defineClass1(Native Method)
    at Java.lang.ClassLoader.defineClass(ClassLoader.Java:634)
    at Java.security.SecureClassLoader.defineClass(SecureClassLoader.Java:142)
    at Java.net.URLClassLoader.defineClass(URLClassLoader.Java:277)
    at Sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
    at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43)
    at Java.lang.reflect.Method.invoke(Method.Java:616)
    at Java.lang.ClassLoader.loadClass(ClassLoader.Java:266)
    at org.Apache.xerces.parsers.AbstractDOMParser.startDocument(Unknown Source)
    at org.Apache.xerces.impl.dtd.XMLDTDValidator.startDocument(Unknown Source)
    at org.Apache.xerces.impl.XMLDocumentScannerImpl.startEntity(Unknown Source)
    at org.Apache.xerces.impl.XMLVersionDetector.startDocumentParsing(Unknown Source)
    at org.Apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.Apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.Apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.Apache.xerces.parsers.DOMParser.parse(Unknown Source)
    at org.Apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
    at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.Java:121)
    at javax.jdo.JDOHelper.readNamedPMFProperties(JDOHelper.Java:1407)
    at javax.jdo.JDOHelper.getNamedPMFProperties(JDOHelper.Java:1286)
    at javax.jdo.JDOHelper.getPropertiesFromJdoconfig(JDOHelper.Java:1232)
    at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.Java:1079)
    at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.Java:914)
    at com.cloudnotify.server.c2dm.C2DMessaging.getPMF(C2DMessaging.Java:103)
    at com.cloudnotify.server.servlet.RequestInfo.initDevices(RequestInfo.Java:225)
    at com.cloudnotify.server.servlet.RequestInfo.processRequest(RequestInfo.Java:183)
    at com.cloudnotify.server.servlet.RegisterServlet.doPost(RegisterServlet.Java:100)
    at javax.servlet.http.HttpServlet.service(HttpServlet.Java:637)
    at javax.servlet.http.HttpServlet.service(HttpServlet.Java:717)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.Java:511)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.Java:1166)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.Java:1157)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.Java:1157)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.Java:1157)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.Java:388)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.Java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.Java:182)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.Java:765)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.Java:418)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.Java:152)
    at org.mortbay.jetty.Server.handle(Server.Java:326)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.Java:542)
    at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.Java:923)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.Java:404)
    at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.Java:449)
    at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.Java:455)
    at com.google.tracing.TraceContext.runInContext(TraceContext.Java:695)
    at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.Java:333)
    at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.Java:325)
    at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.Java:453)
    at Java.lang.Thread.run(Thread.Java:679)
Caused by: Java.lang.ClassNotFoundException: org.w3c.dom.ElementTraversal
    at com.google.appengine.runtime.Request.process-240c2ffe1bf8ddba(Request.Java)
    ... 44 more
C 2012-04-19 10:31:06.812
Uncaught exception from servlet
Java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal
    at com.google.appengine.runtime.Request.process-240c2ffe1bf8ddba(Request.Java)
    at Java.lang.ClassLoader.defineClass1(Native Method)
    at Java.lang.ClassLoader.defineClass(ClassLoader.Java:634)
    at Java.security.SecureClassLoader.defineClass(SecureClassLoader.Java:142)
    at Java.net.URLClassLoader.defineClass(URLClassLoader.Java:277)
    at Sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
    at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43)
    at Java.lang.reflect.Method.invoke(Method.Java:616)
    at Java.lang.ClassLoader.loadClass(ClassLoader.Java:266)
    at org.Apache.xerces.parsers.AbstractDOMParser.startDocument(Unknown Source)
    at org.Apache.xerces.impl.dtd.XMLDTDValidator.startDocument(Unknown Source)
    at org.Apache.xerces.impl.XMLDocumentScannerImpl.startEntity(Unknown Source)
    at org.Apache.xerces.impl.XMLVersionDetector.startDocumentParsing(Unknown Source)
    at org.Apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.Apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.Apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.Apache.xerces.parsers.DOMParser.parse(Unknown Source)
    at org.Apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
    at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.Java:121)
    at javax.jdo.JDOHelper.readNamedPMFProperties(JDOHelper.Java:1407)
    at javax.jdo.JDOHelper.getNamedPMFProperties(JDOHelper.Java:1286)
    at javax.jdo.JDOHelper.getPropertiesFromJdoconfig(JDOHelper.Java:1232)
    at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.Java:1079)
    at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.Java:914)
    at com.cloudnotify.server.c2dm.C2DMessaging.getPMF(C2DMessaging.Java:103)
    at com.cloudnotify.server.servlet.RequestInfo.initDevices(RequestInfo.Java:225)
    at com.cloudnotify.server.servlet.RequestInfo.processRequest(RequestInfo.Java:183)
    at com.cloudnotify.server.servlet.RegisterServlet.doPost(RegisterServlet.Java:100)
    at javax.servlet.http.HttpServlet.service(HttpServlet.Java:637)
    at javax.servlet.http.HttpServlet.service(HttpServlet.Java:717)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.Java:511)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.Java:1166)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.Java:1157)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.Java:1157)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.Java:1157)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.Java:388)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.Java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.Java:182)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.Java:765)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.Java:418)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.Java:152)
    at org.mortbay.jetty.Server.handle(Server.Java:326)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.Java:542)
    at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.Java:923)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.Java:404)
    at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.Java:449)
    at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.Java:455)
    at com.google.tracing.TraceContext.runInContext(TraceContext.Java:695)
    at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.Java:333)
    at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.Java:325)
    at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.Java:453)
    at Java.lang.Thread.run(Thread.Java:679)
Caused by: Java.lang.ClassNotFoundException: org.w3c.dom.ElementTraversal
    at com.google.appengine.runtime.Request.process-240c2ffe1bf8ddba(Request.Java)
    ... 44 more


Thanks all 
60
LucasJJ

Il existe peut-être un problème avec l'analyseur Xerces sur GAE. Voir http://code.google.com/p/googleappengine/issues/detail?id=1367

La solution consiste peut-être à vérifier que tous les fichiers Xerces (y compris xml-apis.jar) figurent dans votre répertoire WEB-INF/lib.

23
jeffrey_t_b
  • MAVEN SOLUTION:

Dans pom.xml, définissez la dépendance "xml-apis" sur la version 1.4.01:

<dependency>
    <groupId>xml-apis</groupId>
    <artifactId>xml-apis</artifactId>
    <version>1.4.01</version>
</dependency>
  • SOLUTION POUR TOUT LE MONDE:

Si vous n'utilisez pas maven, vous pouvez ajouter manuellement la bibliothèque xml-apis, version 1.4.01. Vous trouverez les fichiers jar dans le paquet binaire xml-commons, nommé "XML Commons External 1.4.01", que vous pourrez télécharger ici: http://xerces.Apache.org/mirrors.cgi

Enfin, compilez et exécutez votre application/projet Java avec cette version de la bibliothèque.

  • Explication:

La version 1.4.01 de la bibliothèque xml-apis inclut la classe ElementTraversal requise. D'autres versions telles que 2.0.0, 1.0.0, etc. ne l'incluent pas et l'application échoue lors de la compilation.

172
tremendows

Votre problème peut être résolu en mettant à jour la version 2.11.0.SP5 , qui contient déjà la classe ElementTraversal.

1
Javo