Ich versuche, etwas sehr ähnlich wie das Gästebuch, das in der App-Engine-Tutorial ist (loszulegen). Ich möchte jedoch die Typen der Felder im Formular ändern. Eclipse zeigt keine Fehler, aber der Server sagt:App-Engine req.getParameter mit Typ Float
Problem accessing /. Reason:
java.lang.NoSuchMethodError: prototipo2.Greeting.getDistance()Ljava/lang/Float;
Caused by:
javax.servlet.ServletException: java.lang.NoSuchMethodError: prototipo2.Greeting.getDistance() Ljava/lang/Float;
at org.apache.jasper.runtime.PageContextImpl.doHandle PageException(PageContextImpl.java:862)
at org.apache.jasper.runtime.PageContextImpl.handlePa geException(PageContextImpl.java:791)
at org.apache.jsp.prototipo2_jsp._jspService(prototip o2_jsp.java:326)
at org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:717)
at org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:377)
at org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:260)
at com.google.appengine.tools.development.PrivilegedJ spServlet.access$101 (PrivilegedJspServlet.java:23)
at com.google.appengine.tools.development.PrivilegedJ spServlet$2.run(PrivilegedJspServlet.java:59)
at java.security.AccessController.doPrivileged(Native Method)
at com.google.appengine.tools.development.PrivilegedJ spServlet.service(PrivilegedJspServlet.java:57)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:717)
at org.mortbay.jetty.servlet.ServletHolder.handle(Ser vletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler$CachedCha in.doFilter(ServletHandler.java:1166)
at com.google.appengine.tools.development.BackendServ ersFilter.doFilter(BackendServersFilter.java:97)
at org.mortbay.jetty.servlet.ServletHandler$CachedCha in.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler.handle(Se rvletHandler.java:388)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(Se ssionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(Co ntextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebA ppContext.java:418)
at com.google.appengine.tools.development.DevAppEngin eWebAppContext.handle(DevAppEngineWebAppContext.ja va:78)
at org.mortbay.jetty.servlet.Dispatcher.forward(Dispa tcher.java:327)
at org.mortbay.jetty.servlet.Dispatcher.forward(Dispa tcher.java:126)
at com.google.appengine.tools.development.StaticFileU tils.serveWelcomeFileAsForward(StaticFileUtils.jav a:80)
at com.google.appengine.tools.development.LocalResour ceFileServlet.maybeServeWelcomeFile(LocalResourceF ileServlet.java:254)
at com.google.appengine.tools.development.LocalResour ceFileServlet.doGet(LocalResourceFileServlet.java: 120)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:717)
at org.mortbay.jetty.servlet.ServletHolder.handle(Ser vletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler$CachedCha in.doFilter(ServletHandler.java:1166)
at com.google.appengine.tools.development.HeaderVerif icationFilter.doFilter(HeaderVerificationFilter.ja va:35)
at org.mortbay.jetty.servlet.ServletHandler$CachedCha in.doFilter(ServletHandler.java:1157)
at com.google.appengine.api.blobstore.dev.ServeBlobFi lter.doFilter(ServeBlobFilter.java:60)
at org.mortbay.jetty.servlet.ServletHandler$CachedCha in.doFilter(ServletHandler.java:1157)
at com.google.apphosting.utils.servlet.TransactionCle anupFilter.doFilter(TransactionCleanupFilter.java: 43)
at org.mortbay.jetty.servlet.ServletHandler$CachedCha in.doFilter(ServletHandler.java:1157)
at com.google.appengine.tools.development.StaticFileF ilter.doFilter(StaticFileFilter.java:122)
at org.mortbay.jetty.servlet.ServletHandler$CachedCha in.doFilter(ServletHandler.java:1157)
at com.google.appengine.tools.development.BackendServ ersFilter.doFilter(BackendServersFilter.java:97)
at org.mortbay.jetty.servlet.ServletHandler$CachedCha in.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler.handle(Se rvletHandler.java:388)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(Se ssionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(Co ntextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebA ppContext.java:418)
at com.google.appengine.tools.development.DevAppEngin eWebAppContext.handle(DevAppEngineWebAppContext.ja va:78)
at org.mortbay.jetty.handler.HandlerWrapper.handle(Ha ndlerWrapper.java:152)
at com.google.appengine.tools.development.JettyContai nerService$ApiProxyHandler.handle(JettyContainerSe rvice.java:363)
at org.mortbay.jetty.handler.HandlerWrapper.handle(Ha ndlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(Htt pConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.he aderComplete(HttpConnection.java:923)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser. java:547)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpPa rser.java:212)
at org.mortbay.jetty.HttpConnection.handle(HttpConnec tion.java:404)
at org.mortbay.io.nio.SelectChannelEndPoint.run(Selec tChannelEndPoint.java:409)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run (QueuedThreadPool.java:582)
Caused by: java.lang.NoSuchMethodError: prototipo2.Greeting.getDistance()Ljava/lang/Float;
at org.apache.jsp.prototipo2_jsp._jspService(prototip o2_jsp.java:187)
... 56 more
Mein Code ist:
@Persistent
private Float distance;
public Greeting (User author, String content, Date date, String distance) {
this.author = author;
this.content = content;
this.date = date;
this.distance = Float.parseFloat(distance); }
}
public Float getDistance() {
return distance;
}
und Eclipse sagt alles in Ordnung ist, wenn ich die app laufen, aber wenn ich öffnen Sie die Datei in Meine localhost-Domain, ich sehe den Fehler, den ich Ihnen zuvor geschrieben habe.
Allerdings, wenn ich den Code in etwa wie folgt zu ändern:
@Persistent
private String distance;
public Greeting (User author, String content, Date date, String distance) {
this.author = author;
this.content = content;
this.date = date;
this.distance = distance;
}
public String getDistance() {
return distance;
}
Vielen Dank!
Ich habe das behoben: float distance = Float.parseFloat (req.getParameter ("distance")); aber der Fehler ist der gleiche! ; ( –