Showing posts with label spring. Show all posts
Showing posts with label spring. Show all posts

Wednesday, October 3, 2012

org.springframework.web.servlet.PageNotFound No mapping found for HTTP request with URI


Problem

I've met the following error on Jboss (7.1.1) with an application using Spring 3.1.1 :
14:35:03,357 WARN  [org.springframework.web.servlet.PageNotFound] (http--127.0.0.1-8080-1) No mapping found for HTTP request with URI [/sandbox-0.0.1-SNAPSHOT/css/design.css] in DispatcherServlet with name 'sandbox'

Solution

You have to add     <mvc:resources mapping="/resources/**" location="/resources/" />


http://stackoverflow.com/questions/1483063/spring-mvc-3-and-handling-static-content-am-i-missing-something

Thursday, September 27, 2012

Spring 3.1.1 and ehcache demo application


I've just commit a new version of demo application on GitHub
This application works on with JBoss 7.It uses Spring and Ehcache.
One important thing is that you could use Crash (a shell to extend the JVM) with it.
I will made a more complete article about Crash.See http://julienviet.com/crash/ for more information.

All source code is available at https://github.com/drieu/sandbox

Spring cache tutorial


Annotation about cache on Spring are properly explained at http://www.dzone.com/links/r/spring_31_caching_and_cacheevict.html

Tuesday, September 18, 2012

java.lang.NoSuchMethodError: org.springframework.core.convert.converter.ConverterRegistry.addConverter(Ljava/lang/Class;Ljava/lang/Class;Lorg/springframework/core/convert/converter/Converter;)V

 Problem :

When I deployed my war, I’ve the following error :


14:11:53,425 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/sandbox-0.0.1-SNAPSHOT]] (MSC service thread 1-1) Exception lors de l'envoi de l'évènement contexte initialisé (context initialized) à l'instance de classe d'écoute (listener) fr.dr.sandbox.listener.CacheListener: java.lang.NoSuchMethodError: org.springframework.core.convert.converter.ConverterRegistry.addConverter(Ljava/lang/Class;Ljava/lang/Class;Lorg/springframework/core/convert/converter/Converter;)V
       at org.springframework.core.convert.support.DefaultConversionService.addScalarConverters(DefaultConversionService.java:62) [spring-core-3.1.1.RELEASE.jar:3.1.1.RELEASE]
       at org.springframework.core.convert.support.DefaultConversionService.addDefaultConverters(DefaultConversionService.java:53) [spring-core-3.1.1.RELEASE.jar:3.1.1.RELEASE]
       at org.springframework.core.convert.support.DefaultConversionService.<init>(DefaultConversionService.java:42) [spring-core-3.1.1.RELEASE.jar:3.1.1.RELEASE]
       at org.springframework.core.env.AbstractPropertyResolver.<init>(AbstractPropertyResolver.java:44) [spring-core-3.1.1.RELEASE.jar:3.1.1.RELEASE]
       at org.springframework.core.env.PropertySourcesPropertyResolver.<init>(PropertySourcesPropertyResolver.java:42) [spring-core-3.1.1.RELEASE.jar:3.1.1.RELEASE]
       at org.springframework.core.env.AbstractEnvironment.<init>(AbstractEnvironment.java:101) [spring-core-3.1.1.RELEASE.jar:3.1.1.RELEASE]
       at org.springframework.core.env.StandardEnvironment.<init>(StandardEnvironment.java:54) [spring-core-3.1.1.RELEASE.jar:3.1.1.RELEASE]
       at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.<init>(AbstractBeanDefinitionReader.java:57) [spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]
       at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.<init>(XmlBeanDefinitionReader.java:135) [spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]
       at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:83) [spring-web-3.1.1.RELEASE.jar:3.1.1.RELEASE]
       at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130) [spring-context-3.0.5.RELEASE.jar:3.0.5.RELEASE]
       at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:467) [spring-context-3.0.5.RELEASE.jar:3.0.5.RELEASE]
       at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:397) [spring-context-3.0.5.RELEASE.jar:3.0.5.RELEASE]
       at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385) [spring-web-3.1.1.RELEASE.jar:3.1.1.RELEASE]
       at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284) [spring-web-3.1.1.RELEASE.jar:3.1.1.RELEASE]
       at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111) [spring-web-3.1.1.RELEASE.jar:3.1.1.RELEASE]
       at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.13.Final.jar:]
       at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.13.Final.jar:]
       at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
       at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
       at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_18]
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_18]
       at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_18]


Solution


If you look carrefully the error log, you will see that there is 2 versions of Spring.(3.0.5.RELEASE et 3.1.1.RELEASE).In fact, I use Spring 3/0.5.RELEASE in my pom.xml and I introduce a library which has a Spring 3.1.1.RELEASE dependency.
To resolve my problem, I update my pom.xml with Spring 3.1.1.RELEASE.