Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing Spring with App Engine
    primarykey
    data
    text
    <p>I am struggeling using the basic crud methods with app engine:</p> <p>My code looks like that:</p> <p>My CustomerController:</p> <pre><code>@Controller public class CustomerController { @RequestMapping(value = "/add", method = RequestMethod.GET) public String getAddCustomerPage(ModelMap model) { return "command"; } @RequestMapping(value = "/list", method = RequestMethod.POST) public ModelAndView add(HttpServletRequest request, ModelMap model) { String email = request.getParameter("email"); String password = request.getParameter("password"); Customer c = new Customer(); c.setEmail(email); c.setPassword(password); c.setDate(new Date()); PersistenceManager pm = PMF.get().getPersistenceManager(); try { pm.makePersistent(c); } finally { pm.close(); } return new ModelAndView("redirect:command"); } // get all customers @RequestMapping(value = "/list", method = RequestMethod.GET) public String listCustomer(ModelMap model) { PersistenceManager pm = PMF.get().getPersistenceManager(); Query q = pm.newQuery(Customer.class); q.setOrdering("date desc"); List&lt;Customer&gt; results = null; try { results = (List&lt;Customer&gt;) q.execute(); if (results.isEmpty()) { model.addAttribute("customerList", null); } else { model.addAttribute("customerList", results); } } finally { q.closeAll(); pm.close(); } return "list"; } </code></pre> <p>my mvc-dispatcher-servlet:</p> <pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"&gt; &lt;context:component-scan base-package="com.Trium.controller" /&gt; &lt;mvc:annotation-driven /&gt; &lt;bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt; &lt;property name="suffix"&gt; &lt;value&gt;.jsp&lt;/value&gt; &lt;/property&gt; &lt;/bean&gt; </code></pre> <p></p> <p>and the form I want to proceede in command.jsp:</p> <pre><code>&lt;form id="myForm" class="form-horizontal" action="add" method="post"&gt; &lt;fieldset&gt; &lt;div class="control-group"&gt; &lt;!-- Text input--&gt; &lt;label class="control-label" for="input01"&gt;Email:&lt;/label&gt; &lt;div class="controls"&gt; &lt;input name="email" placeholder="email" class="input-xlarge" type="text" value="&lt;%=request.getParameter("email")%&gt;"&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="control-group"&gt; &lt;!-- Text input--&gt; &lt;label class="control-label" for="input01"&gt;Password:&lt;/label&gt; &lt;div class="controls"&gt; &lt;input name="password" placeholder="password" class="input-xlarge" type="text" value="&lt;%=request.getParameter("password")%&gt;"&gt; &lt;/div&gt; &lt;/div&gt; &lt;/fieldset&gt; &lt;/form&gt; </code></pre> <p>When I want to proceede the form from <code>http://127.0.0.1:8888/command.jsp</code>. I get:</p> <p><code>http://127.0.0.1:8888/add</code> <strong>Error 404</strong></p> <p>In GAE I get:</p> <blockquote> <p>WARNING: No mapping found for HTTP request with URI [/add] in DispatcherServlet with name 'mvc-dispatcher'</p> </blockquote> <p>Please help me to find what is wrongly mapped in my application.</p> <p><strong>UPDATE</strong></p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;&lt;web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"&gt; &lt;!-- Servlets --&gt; &lt;servlet&gt; &lt;servlet-name&gt;mvc-dispatcher&lt;/servlet-name&gt; &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt; &lt;load-on-startup&gt;1&lt;/load-on-startup&gt; &lt;/servlet&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;mvc-dispatcher&lt;/servlet-name&gt; &lt;url-pattern&gt;/&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; &lt;context-param&gt; &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt; &lt;param-value&gt;/WEB-INF/mvc-dispatcher-servlet.xml&lt;/param-value&gt; &lt;/context-param&gt; &lt;listener&gt; &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt; &lt;/listener&gt; &lt;!-- Default page to serve --&gt; &lt;welcome-file-list&gt; &lt;welcome-file&gt;login.jsp&lt;/welcome-file&gt; &lt;/welcome-file-list&gt; &lt;servlet&gt; &lt;servlet-name&gt;SystemServiceServlet&lt;/servlet-name&gt; &lt;servlet-class&gt;com.google.api.server.spi.SystemServiceServlet&lt;/servlet-class&gt; &lt;init-param&gt; &lt;param-name&gt;services&lt;/param-name&gt; &lt;param-value/&gt; &lt;/init-param&gt; &lt;/servlet&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;SystemServiceServlet&lt;/servlet-name&gt; &lt;url-pattern&gt;/_ah/spi/*&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; &lt;/web-app&gt; </code></pre> <p><strong>UPDATE - 2</strong></p> <pre><code> Mär 26, 2013 4:59:11 PM com.google.appengine.tools.development.ApiProxyLocalImpl log INFO: javax.servlet.ServletContext log: Initializing Spring root WebApplicationContext Mär 26, 2013 4:59:11 PM org.springframework.web.context.ContextLoader initWebApplicationContext INFO: Root WebApplicationContext: initialization started Mär 26, 2013 4:59:17 PM org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh INFO: Refreshing Root WebApplicationContext: startup date [Tue Mar 26 16:59:17 UTC 2013]; root of context hierarchy Mär 26, 2013 4:59:19 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/mvc-dispatcher-servlet.xml] Mär 26, 2013 4:59:21 PM org.springframework.context.annotation.ClassPathBeanDefinitionScanner registerDefaultFilters INFO: JSR-330 'javax.inject.Named' annotation found and supported for component scanning Mär 26, 2013 4:59:25 PM org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor &lt;init&gt; INFO: JSR-330 'javax.inject.Inject' annotation found and supported for autowiring Mär 26, 2013 4:59:25 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@7f5fde46: defining beans [customerController,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,mvcContentNegotiationManager,org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0,org.springframework.format.support.FormattingConversionServiceFactoryBean#0,org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter#0,org.springframework.web.servlet.handler.MappedInterceptor#0,org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver#0,org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver#0,org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver#0,org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping,org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter,org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter,org.springframework.web.servlet.view.InternalResourceViewResolver#0,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor]; root of factory hierarchy Mär 26, 2013 4:59:27 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod INFO: Mapped "{[/list],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.web.servlet.ModelAndView com.Trium.controller.CustomerController.add(javax.servlet.http.HttpServletRequest,org.springframework.ui.ModelMap) Mär 26, 2013 4:59:27 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod INFO: Mapped "{[/delete/{key}],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.web.servlet.ModelAndView com.Trium.controller.CustomerController.delete(java.lang.String,javax.servlet.http.HttpServletRequest,org.springframework.ui.ModelMap) Mär 26, 2013 4:59:27 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod INFO: Mapped "{[/update],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.web.servlet.ModelAndView com.Trium.controller.CustomerController.update(javax.servlet.http.HttpServletRequest,org.springframework.ui.ModelMap) Mär 26, 2013 4:59:27 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod INFO: Mapped "{[/add],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.Trium.controller.CustomerController.getAddCustomerPage(org.springframework.ui.ModelMap) Mär 26, 2013 4:59:27 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod INFO: Mapped "{[/update/{name}],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.Trium.controller.CustomerController.getUpdateCustomerPage(java.lang.String,javax.servlet.http.HttpServletRequest,org.springframework.ui.ModelMap) Mär 26, 2013 4:59:27 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod INFO: Mapped "{[/list],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.Trium.controller.CustomerController.listCustomer(org.springframework.ui.ModelMap) Mär 26, 2013 4:59:27 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod INFO: Mapped "{[/login],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.web.servlet.ModelAndView com.Trium.controller.CustomerController.login(javax.servlet.http.HttpServletRequest,org.springframework.ui.ModelMap) Mär 26, 2013 4:59:30 PM org.springframework.web.context.ContextLoader initWebApplicationContext INFO: Root WebApplicationContext: initialization completed in 18804 ms Mär 26, 2013 4:59:37 PM com.google.appengine.tools.development.ApiProxyLocalImpl log INFO: javax.servlet.ServletContext log: Initializing Spring FrameworkServlet 'mvc-dispatcher' Mär 26, 2013 4:59:37 PM org.springframework.web.servlet.DispatcherServlet initServletBean INFO: FrameworkServlet 'mvc-dispatcher': initialization started Mär 26, 2013 4:59:37 PM org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh INFO: Refreshing WebApplicationContext for namespace 'mvc-dispatcher-servlet': startup date [Tue Mar 26 16:59:37 UTC 2013]; parent: Root WebApplicationContext Mär 26, 2013 4:59:37 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/mvc-dispatcher-servlet.xml] Mär 26, 2013 4:59:37 PM org.springframework.context.annotation.ClassPathBeanDefinitionScanner registerDefaultFilters INFO: JSR-330 'javax.inject.Named' annotation found and supported for component scanning Mär 26, 2013 4:59:37 PM org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor &lt;init&gt; INFO: JSR-330 'javax.inject.Inject' annotation found and supported for autowiring Mär 26, 2013 4:59:37 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@3c050a95: defining beans [customerController,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,mvcContentNegotiationManager,org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0,org.springframework.format.support.FormattingConversionServiceFactoryBean#0,org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter#0,org.springframework.web.servlet.handler.MappedInterceptor#0,org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver#0,org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver#0,org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver#0,org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping,org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter,org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter,org.springframework.web.servlet.view.InternalResourceViewResolver#0,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@7f5fde46 Mär 26, 2013 4:59:37 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod INFO: Mapped "{[/list],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.web.servlet.ModelAndView com.Trium.controller.CustomerController.add(javax.servlet.http.HttpServletRequest,org.springframework.ui.ModelMap) Mär 26, 2013 4:59:37 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod INFO: Mapped "{[/delete/{key}],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.web.servlet.ModelAndView com.Trium.controller.CustomerController.delete(java.lang.String,javax.servlet.http.HttpServletRequest,org.springframework.ui.ModelMap) Mär 26, 2013 4:59:37 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod INFO: Mapped "{[/update],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.web.servlet.ModelAndView com.Trium.controller.CustomerController.update(javax.servlet.http.HttpServletRequest,org.springframework.ui.ModelMap) Mär 26, 2013 4:59:37 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod INFO: Mapped "{[/add],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.Trium.controller.CustomerController.getAddCustomerPage(org.springframework.ui.ModelMap) Mär 26, 2013 4:59:37 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod INFO: Mapped "{[/update/{name}],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.Trium.controller.CustomerController.getUpdateCustomerPage(java.lang.String,javax.servlet.http.HttpServletRequest,org.springframework.ui.ModelMap) Mär 26, 2013 4:59:37 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod INFO: Mapped "{[/list],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.Trium.controller.CustomerController.listCustomer(org.springframework.ui.ModelMap) Mär 26, 2013 4:59:37 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod INFO: Mapped "{[/login],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.web.servlet.ModelAndView com.Trium.controller.CustomerController.login(javax.servlet.http.HttpServletRequest,org.springframework.ui.ModelMap) Mär 26, 2013 4:59:38 PM org.springframework.web.servlet.DispatcherServlet initServletBean INFO: FrameworkServlet 'mvc-dispatcher': initialization completed in 657 ms Mär 26, 2013 4:59:38 PM com.google.apphosting.utils.jetty.JettyLogger info INFO: Started SelectChannelConnector@0.0.0.0:8888 Mär 26, 2013 4:59:38 PM com.google.appengine.tools.development.AbstractServer startup INFO: Server default is running at http://localhost:8888/ Mär 26, 2013 4:59:38 PM com.google.appengine.tools.development.AbstractServer startup INFO: The admin console is running at http://localhost:8888/_ah/admin Mär 26, 2013 5:59:38 PM com.google.appengine.tools.development.DevAppServerImpl start INFO: Dev App Server is now running Mär 26, 2013 6:00:11 PM org.springframework.web.servlet.PageNotFound handleHttpRequestMethodNotSupported WARNING: Request method 'POST' not supported </code></pre> <p>Now i am getting a different exception. However, I changed nothing from before;P</p> <pre><code>**WARNING: Request method 'POST' not supported** </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload