Unable to complete the Thymeleaf + Spring 3-tutorial

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Unable to complete the Thymeleaf + Spring 3-tutorial

Rijad
Hi,
I've been keen to check out thymeleaf with Spring 3 MVC, so far with no luck.

Everything i try results in page not found, I've even taken the code char-by-char av one time. The source on the web works tho... Could anyone put some light where I'm going wrong?

My source: ftp://pub@sacirovic.com/seedstartermng.zip

Happy for any help I can get! :)

Error-log:
----
Feb 19, 2013 2:05:25 PM com.springsource.tcserver.security.PropertyDecoder <init>
INFO: tc Runtime property decoder using memory-based key
Feb 19, 2013 2:05:26 PM com.springsource.tcserver.security.PropertyDecoder <init>
INFO: tcServer Runtime property decoder has been initialized in 364 ms
Feb 19, 2013 2:05:26 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Feb 19, 2013 2:05:26 PM com.springsource.tcserver.serviceability.rmi.JmxSocketListener init
INFO: Started up JMX registry on 127.0.0.1:6969 in 169 ms
Feb 19, 2013 2:05:26 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1198 ms
Feb 19, 2013 2:05:27 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Feb 19, 2013 2:05:27 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: VMware vFabric tc Runtime 2.7.2.RELEASE/7.0.30.A.RELEASE
Feb 19, 2013 2:05:27 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor /home/user/springsource/vfabric-tc-server-developer-2.7.2.RELEASE/VMWare/conf/Catalina/localhost/seedstartermng.xml
Feb 19, 2013 2:05:27 PM org.apache.catalina.startup.SetContextPropertiesRule begin
WARNING: [SetContextPropertiesRule]{Context} Setting property 'source' to 'org.eclipse.jst.jee.server:seedstartermng' did not find a matching property.
Feb 19, 2013 2:05:28 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Feb 19, 2013 2:05:28 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
INFO : org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization started
INFO : org.springframework.web.context.support.XmlWebApplicationContext - Refreshing Root WebApplicationContext: startup date [Tue Feb 19 14:05:28 CET 2013]; root of context hierarchy
INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/spring/root-context.xml]
INFO : org.springframework.beans.factory.support.DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@318a9570: defining beans []; root of factory hierarchy
INFO : org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization completed in 350 ms
Feb 19, 2013 2:05:28 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'appServlet'
INFO : org.springframework.web.servlet.DispatcherServlet - FrameworkServlet 'appServlet': initialization started
INFO : org.springframework.web.context.support.XmlWebApplicationContext - Refreshing WebApplicationContext for namespace 'appServlet-servlet': startup date [Tue Feb 19 14:05:28 CET 2013]; parent: Root WebApplicationContext
INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/spring/appServlet/servlet-context.xml]
INFO : org.springframework.context.annotation.ClassPathBeanDefinitionScanner - JSR-330 'javax.inject.Named' annotation found and supported for component scanning
INFO : org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor - JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
INFO : org.springframework.beans.factory.support.DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@7f68f33c: defining beans [org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0,org.springframework.web.servlet.handler.SimpleUrlHandlerMapping#0,org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping,org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter,org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter,org.springframework.web.servlet.resource.ResourceHttpRequestHandler#1,org.springframework.web.servlet.handler.SimpleUrlHandlerMapping#1,org.springframework.web.servlet.resource.ResourceHttpRequestHandler#2,org.springframework.web.servlet.handler.SimpleUrlHandlerMapping#2,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.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,messageSource,templateResolver,templateEngine,org.thymeleaf.spring3.view.ThymeleafViewResolver#0,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@318a9570
INFO : org.springframework.web.servlet.handler.SimpleUrlHandlerMapping - Mapped URL path [/images/**] onto handler 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0'
INFO : org.springframework.web.servlet.handler.SimpleUrlHandlerMapping - Mapped URL path [/css/**] onto handler 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#1'
INFO : org.springframework.web.servlet.handler.SimpleUrlHandlerMapping - Mapped URL path [/resources/**] onto handler 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#2'
INFO : org.springframework.web.servlet.DispatcherServlet - FrameworkServlet 'appServlet': initialization completed in 1083 ms
Feb 19, 2013 2:05:29 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /home/user/springsource/vfabric-tc-server-developer-2.7.2.RELEASE/VMWare/webapps/manager
Feb 19, 2013 2:05:29 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /home/user/springsource/vfabric-tc-server-developer-2.7.2.RELEASE/VMWare/webapps/ROOT
Feb 19, 2013 2:05:30 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Feb 19, 2013 2:05:30 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 3080 ms
WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/seedstartermng/] in DispatcherServlet with name 'appServlet'
----
Reply | Threaded
Open this post in threaded view
|

Re: Unable to complete the Thymeleaf + Spring 3-tutorial

Emanuel
Administrator
I downloaded your code and got the same error.  After playing around with it and comparing to a Thymeleaf + Spring 3 example, I found these suspicious lines in your servlet-context.xml file:

<beans:property name="viewNames" value="index,*th" />
<beans:property name="order" value="1" />

They were part of the ThymeleafViewResolver bean definition.  I have no idea what those properties do, but removing them fixed the project for me.  Can you try remove those lines as well?

If that works, where did you get those lines from?  I was comparing against the thymeleafexamples-sayhello project, which didn't have those lines.
Reply | Threaded
Open this post in threaded view
|

Re: Unable to complete the Thymeleaf + Spring 3-tutorial

Rijad
Emanuel wrote
I downloaded your code and got the same error.  After playing around with it
and comparing to a Thymeleaf + Spring 3 example, I found these suspicious
lines in your servlet-context.xml file:

<beans:property name="viewNames" value="index,*th" />
<beans:property name="order" value="1" />

They were part of the ThymeleafViewResolver bean definition.  I have no idea
what those properties do, but removing them fixed the project for me.  Can
you try remove those lines as well?

If that works, where did you get those lines from?  I was comparing against
the thymeleafexamples-sayhello  project, which didn't have those lines.
That did it.

I got those two lines from following Thymeleaf + Spring 3:

<bean class="org.thymeleaf.spring3.view.ThymeleafViewResolver">
<property name="templateEngine" ref="templateEngine" />
<property name="order" value="1" />
<property name="viewNames" value="*.html,*.xhtml" />
</bean>

I noticed that I had the wrong value for "viewNames", possibly from fiddling around. 
(NOTE: In the ziped-source these lines are missing.)

All working now, thanks!