Thiru Sowri

Greenhorn
+ Follow
since Apr 19, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Thiru Sowri

I am learning to develop web applications with Spring MVC. I use eclipse, tomcat-7.0.42, spring-framework-4.0.0.M2 in a Mac OSX 10.6.8

When I am ready to run my first application, I got the following error:
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListe ner

I am able to get rid of it by adding spring-web-4.0.0.M2.jar to the classpath of the tomcat server (through open launch configuration wizard).

Next I got this error: java.lang.NoClassDefFoundError: javax/servlet/ServletContextListener
And I am able to get rid of it by adding servlet-api.jar from tomcat-installation-dir/lib folder, to the tomcat server's class path (through open launch configuration wizard).

Next I got: java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContext
I managed to get rid of this by adding spring-context-4.0.0.M2.jar to the tomcat's classpath

Next I got: java.lang.NoClassDefFoundError: org/springframework/core/env/EnvironmentCapable
which I managed to get rid of by adding spring-core-4.0.0/M2.jar to the tomcat's classpath.

Next I got: java.lang.NoClassDefFoundError: org/springframework/beans/factory/ListableBeanFactory
I got rid of it by adding spring-beans-4.0.0.M2.jar to the tomcat's classpath.

Next I got: java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
I got rid of it by adding commons-logging-1.1.3.jar.

Thats all and I got this headache. I got these errors (please see the stack trace below) which I could not understand and not able to resolve.

Q1. Someone please help me with this. Let me know if additional information is needed
Q2. Do I need to refer the spring libraries both in the class path of my web application and the classpath of my web container?
Q3. What happens in the background when I add libraries to the classpath? does it do any copying of files to any directory?

Stack Trace of the error I get:

INFO: Initializing Spring root WebApplicationContext
Sep 28, 2013 9:49:08 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
Sep 28, 2013 9:49:08 PM org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
INFO: Refreshing Root WebApplicationContext: startup date [Sat Sep 28 21:49:08 GMT+05:30 2013]; root of context hierarchy
Sep 28, 2013 9:49:08 PM org.springframework.web.context.ContextLoader initWebApplicationContext
SEVERE: Context initialization failed
java.lang.ExceptionInInitializerError
    at org.springframework.context.support.AbstractRefreshableApplicationContext.createBeanFactory(AbstractRefreshableApplicationContext.java:201)
    at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:127)
    at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:551)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:465)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.NullPointerException
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.<clinit>(DefaultListableBeanFactory.java:107)
    ... 17 more
Sep 28, 2013 9:49:08 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.ExceptionInInitializerError
    at org.springframework.context.support.AbstractRefreshableApplicationContext.createBeanFactory(AbstractRefreshableApplicationContext.java:201)
    at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:127)
    at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:551)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:465)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.NullPointerException
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.<clinit>(DefaultListableBeanFactory.java:107)
    ... 17 more
Sep 28, 2013 9:49:08 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
Sep 28, 2013 9:49:08 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/SearchFlights] startup failed due to previous errors
Sep 28, 2013 9:49:08 PM org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
Sep 28, 2013 9:49:08 PM org.springframework.web.context.support.XmlWebApplicationContext doClose
INFO: Closing Root WebApplicationContext: startup date [Sat Sep 28 21:49:08 GMT+05:30 2013]; root of context hierarchy
Sep 28, 2013 9:49:08 PM org.springframework.web.context.support.XmlWebApplicationContext doClose
WARNING: Exception thrown from ApplicationListener handling ContextClosedEvent
java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: Root WebApplicationContext: startup date [Sat Sep 28 21:49:08 GMT+05:30 2013]; root of context hierarchy
    at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:357)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:344)
    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1052)
    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1013)
    at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:559)
    at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:115)
    at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4980)
    at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5626)
    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:680)
Sep 28, 2013 9:49:08 PM org.springframework.web.context.support.XmlWebApplicationContext doClose
WARNING: Exception thrown from LifecycleProcessor on context close
java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: Root WebApplicationContext: startup date [Sat Sep 28 21:49:08 GMT+05:30 2013]; root of context hierarchy
    at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:370)
    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1060)
    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1013)
    at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:559)
    at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:115)
    at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4980)
    at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5626)
    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:680)
Sep 28, 2013 9:49:08 PM org.apache.catalina.core.StandardContext listenerStop
SEVERE: Exception sending context destroyed event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
    at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:171)
    at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1093)
    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1067)
    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1013)
    at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:559)
    at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:115)
    at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4980)
    at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5626)
    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:680)
Sep 28, 2013 9:49:08 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Sep 28, 2013 9:49:08 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Sep 28, 2013 9:49:08 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 375 ms
10 years ago
I have a beans.xml file

What is the significance of the following lines?

I tried changing the value of "http://www.springframework.org/schema/beans/spring-beans-3.0.xsd" to spring-beans-4.0.xsd and it is throwing errors like the following:


Why is it running fine when I have spring-beans-3.0.xsd or spring-beans-2.5.xsd. But throwing errors when I have spring-beans-4.0.xsd. Please explain.

thanks,
thiru
10 years ago
Hi there,

Does the namespace URI passed in as a parameter to a Qname constructor represent a network location or is it just a string value?

Why most of the time it adopts the format of a URL say "http://myname.domain/myfolder1/myfolder2" or "urn://myname.domain/myfolder1/myfolder2" ? Why can't it be a variable name or just a simple string value like foo, bar, bigbrother, littlesister etc...?

If in a java web service, the method implementation constructs a Qname with namespaceURI say "http://company.com/objects", does it mean that the web service method, when invoked, will hit the namespaceURI ?

I am in a project that transitions support of an application from vendor1 to another, the web service implementation has methods that construct Qname with namespace URI like "http://vendor1.com/objects". I have to remove the occurrences of vendor1 from all kind of string values, for that I want to understand whether this points to an URL in vendor1's network.

Appreciate your help.
thanks
12 years ago