roy_sanu
asked on
Spring application error
Hello,
I was trying to run the sample application. here is the snapshot of it.
I have added all the jars from the spring-framework-3.0.5.REL EASE.
and the set the jars in the web-inf/lib. But it is not working . here is my snapshot with the code.
can somebody tell what is the issue on it. when it runs it tells me something like time out in the tomcat when i set it in the web-inf/lib through deployment assembly of the eclipse
other wise it gives me another error
=============
SEVERE: Error configuring application listener of class org.springframework.web.co ntext.Cont extLoaderL istener
java.lang.ClassNotFoundExc eption: org.springframework.web.co ntext.Cont extLoaderL istener
at org.apache.catalina.loader .WebappCla ssLoader.l oadClass(W ebappClass Loader.jav a:1713)
at org.apache.catalina.loader .WebappCla ssLoader.l oadClass(W ebappClass Loader.jav a:1558)
at org.apache.catalina.core.D efaultInst anceManage r.loadClas s(DefaultI nstanceMan ager.java: 527)
at org.apache.catalina.core.D efaultInst anceManage r.loadClas sMaybePriv ileged(Def aultInstan ceManager. java:509)
at org.apache.catalina.core.D efaultInst anceManage r.newInsta nce(Defaul tInstanceM anager.jav a:137)
at org.apache.catalina.core.S tandardCon text.liste nerStart(S tandardCon text.java: 4823)
at org.apache.catalina.core.S tandardCon text.start Internal(S tandardCon text.java: 5381)
at org.apache.catalina.util.L ifecycleBa se.start(L ifecycleBa se.java:15 0)
at org.apache.catalina.core.C ontainerBa se$StartCh ild.call(C ontainerBa se.java:15 59)
at org.apache.catalina.core.C ontainerBa se$StartCh ild.call(C ontainerBa se.java:15 49)
at java.util.concurrent.Futur eTask$Sync .innerRun( Unknown Source)
at java.util.concurrent.Futur eTask.run( Unknown Source)
at java.util.concurrent.Threa dPoolExecu tor$Worker .runTask(U nknown Source)
at java.util.concurrent.Threa dPoolExecu tor$Worker .run(Unkno wn Source)
at java.lang.Thread.run(Unkno wn Source)
thanks
rosy
spring.docx
I was trying to run the sample application. here is the snapshot of it.
I have added all the jars from the spring-framework-3.0.5.REL
and the set the jars in the web-inf/lib. But it is not working . here is my snapshot with the code.
can somebody tell what is the issue on it. when it runs it tells me something like time out in the tomcat when i set it in the web-inf/lib through deployment assembly of the eclipse
other wise it gives me another error
=============
SEVERE: Error configuring application listener of class org.springframework.web.co
java.lang.ClassNotFoundExc
at org.apache.catalina.loader
at org.apache.catalina.loader
at org.apache.catalina.core.D
at org.apache.catalina.core.D
at org.apache.catalina.core.D
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.util.L
at org.apache.catalina.core.C
at org.apache.catalina.core.C
at java.util.concurrent.Futur
at java.util.concurrent.Futur
at java.util.concurrent.Threa
at java.util.concurrent.Threa
at java.lang.Thread.run(Unkno
thanks
rosy
spring.docx
Solution is on the same site which you referred for your application :)
Refer http://www.mkyong.com/spring/spring-error-classnotfoundexception-org-springframework-web-context-contextloaderlistener/
Refer http://www.mkyong.com/spring/spring-error-classnotfoundexception-org-springframework-web-context-contextloaderlistener/
ASKER
Here is the attachment of the spring libraries, but i get the same error when i run
http://localhost:8080/SpringExample1/welcome
here is the snapshot
is it any of the jar is missing.........
when i try to add the jars to the WEB-INF/lib through deployment assembly of eclipse
it gave me these errors
SEVERE: Context initialization failed
java.lang.NoSuchMethodErro r: org.springframework.web.co ntext.Conf igurableWe bApplicati onContext. setId(Ljav a/lang/Str ing;)V
at org.springframework.web.co ntext.Cont extLoader. createWebA pplication Context(Co ntextLoade r.java:264 )
at org.springframework.web.co ntext.Cont extLoader. initWebApp licationCo ntext(Cont extLoader. java:197)
at org.springframework.web.co ntext.Cont extLoaderL istener.co ntextIniti alized(Con textLoader Listener.j ava:47)
at org.apache.catalina.core.S tandardCon text.liste nerStart(S tandardCon text.java: 4887)
at org.apache.catalina.core.S tandardCon text.start Internal(S tandardCon text.java: 5381)
at org.apache.catalina.util.L ifecycleBa se.start(L ifecycleBa se.java:15 0)
at org.apache.catalina.core.C ontainerBa se$StartCh ild.call(C ontainerBa se.java:15 59)
at org.apache.catalina.core.C ontainerBa se$StartCh ild.call(C ontainerBa se.java:15 49)
at java.util.concurrent.Futur eTask$Sync .innerRun( Unknown Source)
at java.util.concurrent.Futur eTask.run( Unknown Source)
at java.util.concurrent.Threa dPoolExecu tor$Worker .runTask(U nknown Source)
at java.util.concurrent.Threa dPoolExecu tor$Worker .run(Unkno wn Source)
at java.lang.Thread.run(Unkno wn Source)
12 Jun, 2013 10:29:32 AM org.apache.catalina.core.S tandardCon text listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.co ntext.Cont extLoaderL istener
java.lang.NoSuchMethodErro r: org.springframework.web.co ntext.Conf igurableWe bApplicati onContext. setId(Ljav a/lang/Str ing;)V
at org.springframework.web.co ntext.Cont extLoader. createWebA pplication Context(Co ntextLoade r.java:264 )
at org.springframework.web.co ntext.Cont extLoader. initWebApp licationCo ntext(Cont extLoader. java:197)
at org.springframework.web.co ntext.Cont extLoaderL istener.co ntextIniti alized(Con textLoader Listener.j ava:47)
at org.apache.catalina.core.S tandardCon text.liste nerStart(S tandardCon text.java: 4887)
at org.apache.catalina.core.S tandardCon text.start Internal(S tandardCon text.java: 5381)
at org.apache.catalina.util.L ifecycleBa se.start(L ifecycleBa se.java:15 0)
at org.apache.catalina.core.C ontainerBa se$StartCh ild.call(C ontainerBa se.java:15 59)
at org.apache.catalina.core.C ontainerBa se$StartCh ild.call(C ontainerBa se.java:15 49)
at java.util.concurrent.Futur eTask$Sync .innerRun( Unknown Source)
at java.util.concurrent.Futur eTask.run( Unknown Source)
at java.util.concurrent.Threa dPoolExecu tor$Worker .runTask(U nknown Source)
at java.util.concurrent.Threa dPoolExecu tor$Worker .run(Unkno wn Source)
at java.lang.Thread.run(Unkno wn Source)
12 Jun, 2013 10:29:32 AM org.apache.catalina.core.S tandardCon text startInternal
SEVERE: Error listenerStart
12 Jun, 2013 10:29:32 AM org.apache.catalina.core.S tandardCon text startInternal
SEVERE: Context [/SpringExample1] startup failed due to previous errors
12 Jun, 2013 10:29:32 AM org.apache.catalina.core.A pplication Context log
INFO: Closing Spring root WebApplicationContext
12 Jun, 2013 10:29:32 AM org.apache.coyote.Abstract Protocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
12 Jun, 2013 10:29:32 AM org.apache.coyote.Abstract Protocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
12 Jun, 2013 10:29:32 AM org.apache.catalina.startu p.Catalina start
INFO: Server startup in 5921 ms
Thanks
rosy
Spring-library.docx
http://localhost:8080/SpringExample1/welcome
here is the snapshot
is it any of the jar is missing.........
when i try to add the jars to the WEB-INF/lib through deployment assembly of eclipse
it gave me these errors
SEVERE: Context initialization failed
java.lang.NoSuchMethodErro
at org.springframework.web.co
at org.springframework.web.co
at org.springframework.web.co
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.util.L
at org.apache.catalina.core.C
at org.apache.catalina.core.C
at java.util.concurrent.Futur
at java.util.concurrent.Futur
at java.util.concurrent.Threa
at java.util.concurrent.Threa
at java.lang.Thread.run(Unkno
12 Jun, 2013 10:29:32 AM org.apache.catalina.core.S
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.co
java.lang.NoSuchMethodErro
at org.springframework.web.co
at org.springframework.web.co
at org.springframework.web.co
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.util.L
at org.apache.catalina.core.C
at org.apache.catalina.core.C
at java.util.concurrent.Futur
at java.util.concurrent.Futur
at java.util.concurrent.Threa
at java.util.concurrent.Threa
at java.lang.Thread.run(Unkno
12 Jun, 2013 10:29:32 AM org.apache.catalina.core.S
SEVERE: Error listenerStart
12 Jun, 2013 10:29:32 AM org.apache.catalina.core.S
SEVERE: Context [/SpringExample1] startup failed due to previous errors
12 Jun, 2013 10:29:32 AM org.apache.catalina.core.A
INFO: Closing Spring root WebApplicationContext
12 Jun, 2013 10:29:32 AM org.apache.coyote.Abstract
INFO: Starting ProtocolHandler ["http-bio-8080"]
12 Jun, 2013 10:29:32 AM org.apache.coyote.Abstract
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
12 Jun, 2013 10:29:32 AM org.apache.catalina.startu
INFO: Server startup in 5921 ms
Thanks
rosy
Spring-library.docx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks, there is no such above error, removed the spring.2.5.6
I am getting error as
" No mapping found for HTTP request with URI [/SpringExample1/] in DispatcherServlet with name 'mvc-dispatcher' "
I have two xml file such as web.xml and mvc-dispatcher.xml which is in WEB-INF. is it i have to set the mvc-dispatcher.xml in the classpath ?
or i have to add to the src ????
my mvc-dispatcher.xml contains
========================== ========== ========== =======
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
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">
<context:component-scan base-package="com.mkyong.c ommon.cont roller" />
<bean
class="org.springframework .web.servl et.view.In ternalReso urceViewRe solver">
<property name="prefix">
<value>/WEB-INF/pages/</va lue>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
========================== ========== ========== ========== ========== ========
my web.xml contains below
========================== ========== ========== ========== ========== ========
<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Spring Web MVC Application</display-name>
<servlet>
<servlet-name>mvc-dispatch er</servle t-name>
<servlet-class>org.springf ramework.w eb.servlet .Dispatche rServlet</ servlet-cl ass>
<load-on-startup>1</load-o n-startup>
</servlet>
<servlet-mapping>
<servlet-name>mvc-dispatch er</servle t-name>
<url-pattern>/</url-patter n>
</servlet-mapping>
<context-param>
<param-name>contextConfigL ocation</p aram-name>
<param-value>/WEB-INF/mvc- dispatcher -servlet.x ml</param- value>
</context-param>
<listener>
<listener-class>org.spring framework. web.contex t.ContextL oaderListe ner</liste ner-class>
</listener>
</web-app>
========================== ========== ========== ========== ========== ========
</beans>
I am getting error as
" No mapping found for HTTP request with URI [/SpringExample1/] in DispatcherServlet with name 'mvc-dispatcher' "
I have two xml file such as web.xml and mvc-dispatcher.xml which is in WEB-INF. is it i have to set the mvc-dispatcher.xml in the classpath ?
or i have to add to the src ????
my mvc-dispatcher.xml contains
==========================
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
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">
<context:component-scan base-package="com.mkyong.c
<bean
class="org.springframework
<property name="prefix">
<value>/WEB-INF/pages/</va
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
==========================
my web.xml contains below
==========================
<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Spring Web MVC Application</display-name>
<servlet>
<servlet-name>mvc-dispatch
<servlet-class>org.springf
<load-on-startup>1</load-o
</servlet>
<servlet-mapping>
<servlet-name>mvc-dispatch
<url-pattern>/</url-patter
</servlet-mapping>
<context-param>
<param-name>contextConfigL
<param-value>/WEB-INF/mvc-
</context-param>
<listener>
<listener-class>org.spring
</listener>
</web-app>
==========================
</beans>
This is your web.xml file...
...
<context-param>
<param-name>contextConfigL ocation</p aram-name>
<param-value>/WEB-INF/mvc-dispatcher-servlet.xml </param-value>
</context-param>
...
But you are saying that your beans are in mvc-dispatcher.xml ? The value in your web.xml file needs to be exactly what the name of the .xml file is
...
<context-param>
<param-name>contextConfigL
<param-value>/WEB-INF/mvc-dispatcher-servlet.xml
</context-param>
...
But you are saying that your beans are in mvc-dispatcher.xml ? The value in your web.xml file needs to be exactly what the name of the .xml file is
ASKER
i got it copied from the site
http://www.mkyong.com/spring3/spring-3-mvc-hello-world-example/
it have used the same name as it is being specified
but i changed the some thing better name as spring-servlet.xml but as one need to have servlet as an extension to the name as some other spring mvc sites also refer the same...
let me try from some other web site like
http://viralpatel.net/blogs/spring-3-mvc-create-hello-world-application-spring-3-mvc/
let me see if things works on it......
well at present i do not get any error but also i do not get the output. also.. :)
Thanks
http://www.mkyong.com/spring3/spring-3-mvc-hello-world-example/
it have used the same name as it is being specified
but i changed the some thing better name as spring-servlet.xml but as one need to have servlet as an extension to the name as some other spring mvc sites also refer the same...
let me try from some other web site like
http://viralpatel.net/blogs/spring-3-mvc-create-hello-world-application-spring-3-mvc/
let me see if things works on it......
well at present i do not get any error but also i do not get the output. also.. :)
Thanks
ASKER
thanks for the help it is working....
Not a problem, gald to help!
To add them, right-click on your project (the top-level item in that tree for your project, not the 'Libraries' entry itself) and then select "Build Path"->"Configure Build Path..." From here you can add JAR's to the project so that they will be included by Tomcat when running your project.