ClassNotFoundException with Spring 3.1 and Tomcat 7 - spring

I have found similar questions on StackOverflow, but not quite the same as mine:
I've configured a Spring bean 'ontologyClient' that is a POJO that I have imported from a library which is added to my Maven dependencies. I have checked and double checked that the produced WAR file contains the org.erasmusmc.ontology.OntologyClient class. However, when Spring wants to instantiate the bean, Tomcat's classloader throws a ClassNotFoundException. I am out of ideas, hopefully somebody can help me out!
applicationContext.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.1.xsd">
<context:component-scan base-package="nl.lumc.conceptrecognizer" />
<context:component-scan base-package="org.nbic.interop.conceptlinker.service.impl" />
<bean class="org.springframework.remoting.jaxws.SimpleJaxWsServiceExporter">
<property name="baseAddress" value="http://localhost:8080/" />
</bean>
<bean id="ontologyClient" class="org.erasmusmc.ontology.OntologyClient">
<constructor-arg index="0" value="localhost" />
<constructor-arg index="1" value="abcde"/>
<constructor-arg index="2" value="abcde" />
<constructor-arg index="3" value="Anni2_1_june2009" />
</bean>
<bean id="conceptRecognizerService"
class="nl.lumc.conceptrecognizer.services.ConceptRecognizerService"
p:ontologyClient-ref="ontologyClient"
/>
</beans>
Tomcat log:
Using CATALINA_BASE: /usr/local/apache-tomcat-7.0.22
Using CATALINA_HOME: /usr/local/apache-tomcat-7.0.22
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-7.0.22/temp
Using JRE_HOME: /usr/java/jdk1.7.0
Using CLASSPATH: /usr/local/apache-tomcat-7.0.22/bin/bootstrap.jar:/usr/local/apache-tomcat-7.0.22/bin/tomcat-juli.jar
feb 20, 2012 7:56:13 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
feb 20, 2012 7:56:13 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-7080"]
feb 20, 2012 7:56:13 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
feb 20, 2012 7:56:13 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 673 ms
feb 20, 2012 7:56:14 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
feb 20, 2012 7:56:14 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.22
feb 20, 2012 7:56:14 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor ROOT.xml from /usr/local/apache-tomcat-7.0.22/conf/Catalina/localhost
feb 20, 2012 7:56:14 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
feb 20, 2012 7:56:14 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing Root WebApplicationContext: startup date [Mon Feb 20 19:56:14 CET 2012]; root of context hierarchy
feb 20, 2012 7:56:14 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
feb 20, 2012 7:56:15 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#7b6d63d5: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,ontologyClient,groundhogManager,conceptProfilesGroundhog,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0]; root of factory hierarchy
feb 20, 2012 7:56:15 PM org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons
INFO: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#7b6d63d5: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,ontologyClient,groundhogManager,conceptProfilesGroundhog,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0]; root of factory hierarchy
feb 20, 2012 7:56:15 PM org.springframework.web.context.ContextLoader initWebApplicationContext
SEVERE: Context initialization failed
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.erasmusmc.ontology.OntologyClient] for bean with name 'ontologyClient' defined in ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: org.erasmusmc.ontology.OntologyClient
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1262)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:576)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1331)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:897)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:566)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:384)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4723)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.ClassNotFoundException: org.erasmusmc.ontology.OntologyClient
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:257)
at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:417)
at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1283)
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1254)
... 17 more
One thing to note is that the ontology dependency is a locally installed Maven artifact. However I don't see how this could be the cause, because the required Jar file is copied to WEB-INF/lib like it should.
UPDATE: It turns out that Tomcat was launching the wrong codebase. I had renamed my webapp because I started a new branch, but context.xml still pointed to the old context.

This is maybe a stupid answer, but did you remove the unzipped war before you copied the new one? Maybe the previous version of your was did not have the OntologyClient class.

I have checked and double checked that the produced WAR file contains the org.erasmusmc.ontology.OntologyClient class
Is the class inside a .jar file? if so, what is the location relative to the WAR.
Are there any other .class or .jar files inside the same directory?

Related

spring mvc with rest webservices using hibernate

I am working with Customer application using Spring MVC with REstful webservice using Hibernate. I have created this application as a Dynamic web project in Eclipse because if i am using Maven i am getting few dependencies error.
As i am new to these technologies I don’t know where I have done mistake in configuring these files
I have configured as follows in configuration files.
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>SpringWithRestCaseStudy</display-name>
<context-param>
<param-name>root-context</param-name>
<param-value>\WEB-INF\spring\appServlet\root- context.xml</paramvalue>
</context-param>
<servlet>
<servlet-name>servlet-context</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet- class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>\WEB-INF\spring\appServlet\servlet-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>servlet-context</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.RequestContextListener</listener-class>
</listener>
servlet-context.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:task="http://www.springframework.org/schema/task"
xmlns:context="http://www.springframework.org/schema /context"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->
<!-- Enables the Spring MVC #Controller programming model -->
<annotation-driven />
<resources location="/resources/" mapping="/resources/**"></resources>
<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<beans:property name="prefix" value="/WEB-INF/views/" />
<beans:property name="suffix" value=".jsp" />
</beans:bean>
<context:component-scan base-package="com.crud.rest.controllers" />
</beans:beans>
root-context.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:c="htpp://www.springframework.org/schema/c"
xmlns:p="htpp://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd">
<!-- Root Context: defines shared resources visible to all other web components -->
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver">
</property>
<property name="url" value="jdbc:oracle:thin:#172.16.156.152:1521:orcl">
</property>
<property name="username" value="scott"></property>
<property name="password" value="tiger"></property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
</props>
</property>
<property name="annotatedClasses">
<list>
<value>com.crud.rest.beans.MyCustomer</value>
</list>
</property>
</bean>
<bean id="transactionManager"
class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="customerDao" class="com.crud.rest.dao.CustomerDaoImpl">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="customerService" class="com.crud.rest.dao.CustomerServiceImpl">
<property name="CustomerDao" ref="CustomerDao"></property>
</bean>
</beans>
I am getting the error as follows.
Sep 12, 2017 12:52:55 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:ShoppingDemo' did not find a matching property.
Sep 12, 2017 12:52:55 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:SpringWithRestCaseStudy' did not find a matching property.
Sep 12, 2017 12:52:55 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/8.0.37
Sep 12, 2017 12:52:55 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Sep 1 2016 10:01:52 UTC
Sep 12, 2017 12:52:55 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 8.0.37.0
Sep 12, 2017 12:52:55 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Windows 7
Sep 12, 2017 12:52:55 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 6.1
Sep 12, 2017 12:52:55 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
Sep 12, 2017 12:52:55 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: C:\Program Files\Java\jre1.8.0_66
Sep 12, 2017 12:52:55 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.8.0_66-b18
Sep 12, 2017 12:52:55 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
Sep 12, 2017 12:52:55 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: D:\Narmatha Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp2
Sep 12, 2017 12:52:55 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: D:\apache-tomcat-8.0.37
Sep 12, 2017 12:52:55 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=D:\Narmatha Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp2
Sep 12, 2017 12:52:55 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=D:\apache-tomcat-8.0.37
Sep 12, 2017 12:52:55 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=D:\Narmatha Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp2\wtpwebapps
Sep 12, 2017 12:52:55 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=D:\apache-tomcat-8.0.37\endorsed
Sep 12, 2017 12:52:55 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=Cp1252
Sep 12, 2017 12:52:55 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre1.8.0_66\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre1.8.0_66/bin/server;C:/Program Files/Java/jre1.8.0_66/bin;C:/Program Files/Java/jre1.8.0_66/lib/amd64;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\PROGRA~2\CA\SC\CAM\bin;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\ORACLEXE\app\oracle\product\10.2.0\server\bin;C:\Tcl\bin;C:\Windows\SysWOW64\;C:\Windows\SysWOW64\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\eclipse-jee-luna-SR2-win32-x86_64\eclipse;;.
Sep 12, 2017 12:52:55 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
Sep 12, 2017 12:52:55 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Sep 12, 2017 12:52:55 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-nio-8009"]
Sep 12, 2017 12:52:55 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Sep 12, 2017 12:52:55 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1524 ms
Sep 12, 2017 12:52:55 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Sep 12, 2017 12:52:55 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.0.37
Sep 12, 2017 12:53:00 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Sep 12, 2017 12:53:00 PM org.apache.catalina.core.ApplicationContext log
INFO: Marking servlet dispatcher as unavailable
Sep 12, 2017 12:53:00 PM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet [dispatcher] in web application [/ShoppingDemo] threw load() exception
java.lang.ClassNotFoundException: org.springframework.web.servlet.DisptacherServlet
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderB ase.java:1333)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderB ase.java:1167)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceMana ger.java:518)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(Defa ultInstanceManager.java:499)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceMa nager.java:118)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:109 1)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1027)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5 038)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5 348)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:140 7)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:139 7)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Sep 12, 2017 12:53:00 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderB ase.java:1333)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderB ase.java:1167) at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:518) at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:499)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceMa nager.java:118)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4 775)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5 314)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1407) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:130 9) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Sep 12, 2017 12:53:00 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class org.springframework.web.context.RequestContextListener
java.lang.ClassNotFoundException: org.springframework.web.context.RequestContextListener
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderB ase.java:1333)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderB ase.java:1167)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceMana ger.java:518)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(Defa ultInstanceManager.java:499)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceMa nager.java:118)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4 775)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5 314)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1407)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1397)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Sep 12, 2017 12:53:00 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Skipped installing application listeners due to previous error(s)
Sep 12, 2017 12:53:00 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: One or more listeners failed to start. Full details will be found in the appropriate container log file
Sep 12, 2017 12:53:00 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/SpringWithRestCaseStudy] startup failed due to previous errors
Sep 12, 2017 12:53:01 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
Sep 12, 2017 12:53:01 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-nio-8009"]
Sep 12, 2017 12:53:01 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 5154 ms
Kindly someone help me to solve this issue.
And it would be more helpful if someone can provide a details of how to configure these 3 files.
Might this is solution.
The solution to this problem is very simple. Double click on your tomcat server. It will open the server configuration. Under server options check ‘Publish module contents to separate XML files’ checkbox. Restart your server. This time your page will come without any issues.
enter image description here

SPRING MVC getting 404 error in when you hits the submit button

IN SPRING MVC
in spring mvc. i am unable to get required page,it is not showing error in console also, but it is giving 404 error in browser..
CONSOLE-->Aug 01, 2016 10:26:09 AM
org.apache.catalina.core.AprLifecycleListener init INFO: The APR based
Apache Tomcat Native library which allows optimal performance in
production environments was not found on the java.library.path:
C:\Program
Files\Java\jre1.8.0_101\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\ProgramData\Oracle\Java\javapath;C:\Program
Files\Dell\DW WLAN Card;;;C:\PROGRAM FILES (X86)\INTEL\ICLS
CLIENT\;C:\PROGRAM FILES\INTEL\ICLS
CLIENT\;C:\Windows\SYSTEM32;C:\Windows;C:\Windows\SYSTEM32\WBEM;C:\Windows\SYSTEM32\WINDOWSPOWERSHELL\V1.0\;C:\PROGRAM
FILES (X86)\INTEL\OPENCL SDK\2.0\BIN\X86;C:\PROGRAM FILES
(X86)\INTEL\OPENCL SDK\2.0\BIN\X64;C:\PROGRAM FILES\INTEL\INTEL(R)
MANAGEMENT ENGINE COMPONENTS\DAL;C:\PROGRAM FILES\INTEL\INTEL(R)
MANAGEMENT ENGINE COMPONENTS\IPT;C:\PROGRAM FILES (X86)\INTEL\INTEL(R)
MANAGEMENT ENGINE COMPONENTS\DAL;C:\PROGRAM FILES (X86)\INTEL\INTEL(R)
MANAGEMENT ENGINE COMPONENTS\IPT;C:\Program Files\WIDCOMM\Bluetooth
Software\;C:\Program Files\WIDCOMM\Bluetooth
Software\syswow64;C:\Program Files (x86)\Brackets\command;C:\Program
Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program
Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files
(x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files
(x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files
(x86)\MySQL\MySQL Fabric 1.5 & MySQL Utilities 1.5\;C:\Program Files
(x86)\MySQL\MySQL Fabric 1.5 & MySQL Utilities 1.5\Doctrine extensions
for PHP\;C:\Program Files\Java\jdk1.8.0_101\bin;. Aug 01, 2016
10:26:09 AM org.apache.coyote.AbstractProtocol init INFO: Initializing
ProtocolHandler ["http-bio-8080"] Aug 01, 2016 10:26:09 AM
org.apache.coyote.AbstractProtocol init INFO: Initializing
ProtocolHandler ["ajp-bio-8009"] Aug 01, 2016 10:26:09 AM
org.apache.catalina.startup.Catalina load INFO: Initialization
processed in 838 ms Aug 01, 2016 10:26:09 AM
org.apache.catalina.core.StandardService startInternal INFO: Starting
service Catalina Aug 01, 2016 10:26:09 AM
org.apache.catalina.core.StandardEngine startInternal INFO: Starting
Servlet Engine: Apache Tomcat/7.0.47 Aug 01, 2016 10:26:10 AM
org.apache.catalina.startup.HostConfig deployDescriptor INFO:
Deploying configuration descriptor
D:\Springs\WORK_SPACE.metadata.plugins\org.eclipse.wst.server.core\tmp0\conf\Catalina\localhost\demoMVC.xml
Aug 01, 2016 10:26:10 AM
org.apache.catalina.startup.SetContextPropertiesRule begin WARNING:
[SetContextPropertiesRule]{Context} Setting property 'source' to
'org.eclipse.jst.j2ee.server:demoMVC' did not find a matching
property. Aug 01, 2016 10:26:11 AM
org.apache.catalina.core.ApplicationContext log INFO: No Spring
WebApplicationInitializer types detected on classpath Aug 01, 2016
10:26:12 AM org.apache.catalina.core.ApplicationContext log INFO:
Initializing Spring FrameworkServlet 'dispatcher' Aug 01, 2016
10:26:12 AM org.springframework.web.servlet.DispatcherServlet
initServletBean INFO: FrameworkServlet 'dispatcher': initialization
started Aug 01, 2016 10:26:12 AM
org.springframework.web.context.support.XmlWebApplicationContext
prepareRefresh INFO: Refreshing WebApplicationContext for namespace
'dispatcher-servlet': startup date [Mon Aug 01 10:26:12 IST 2016];
root of context hierarchy Aug 01, 2016 10:26:12 AM
org.springframework.beans.factory.xml.XmlBeanDefinitionReader
loadBeanDefinitions INFO: Loading XML bean definitions from
ServletContext resource [/WEB-INF/kool-servlet.xml] Aug 01, 2016
10:26:13 AM
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter
initControllerAdviceCache INFO: Looking for #ControllerAdvice:
WebApplicationContext for namespace 'dispatcher-servlet': startup date
[Mon Aug 01 10:26:12 IST 2016]; root of context hierarchy Aug 01, 2016
10:26:13 AM
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter
initControllerAdviceCache INFO: Looking for #ControllerAdvice:
WebApplicationContext for namespace 'dispatcher-servlet': startup date
[Mon Aug 01 10:26:12 IST 2016]; root of context hierarchy Aug 01, 2016
10:26:13 AM org.springframework.web.servlet.DispatcherServlet
initServletBean INFO: FrameworkServlet 'dispatcher': initialization
completed in 1599 ms Aug 01, 2016 10:26:13 AM
org.apache.coyote.AbstractProtocol start INFO: Starting
ProtocolHandler ["http-bio-8080"] Aug 01, 2016 10:26:13 AM
org.apache.coyote.AbstractProtocol start INFO: Starting
ProtocolHandler ["ajp-bio-8009"] Aug 01, 2016 10:26:13 AM
org.apache.catalina.startup.Catalina start INFO: Server startup in
4303 ms
index.jsp
<html>
<body>
<form action="add" method="post">
<input type="text" name="t1">
<input type="text" name="t2">
<input type="submit">
</form>
</body>
</html>
controller.java
package com.test;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
#Controller
public class addController {
#RequestMapping("/add")
#ResponseBody
public String add()
{
return "display.jsp";
}
}
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- webapp/WEB-INF/web.xml -->
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<display-name>Archetype Created Web Application</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class> org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/kool-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
test-servlet.xml
<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-4.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd">
<context:component-scan base-package="com.test" />
<mvc:annotation-driven />
</beans>
Looks like you are calling a page display.jsp which does not exists. change display.jsp to index.jsp in your controller and it should work, or change the view name index.jsp to display.jsp.

Securing SOAP Web-Services using WSS4J Library (Spring WITHOUT MVC)

I am new to spring web services.I am doing an interceptor on the sage.xml (otherwse, known as spring-ws-servlet.xml) in my project by using eclipse.
Without the interceptors and it's handler. The web services work fine, but once added the interceptor the error was prompt.
I have no idea why it is prompting errors.I suspected the libraries problem. I can't figure it out can anyone help me with this?
The following is the error message.
Apr 30, 2014 2:27:47 PM org.apache.catalina.core.AprLifecycleListener init
INFO: Loaded APR based Apache Tomcat Native library 1.1.29 using APR version 1.4.8.
Apr 30, 2014 2:27:47 PM org.apache.catalina.core.AprLifecycleListener init
INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
Apr 30, 2014 2:27:48 PM org.apache.catalina.core.AprLifecycleListener initializeSSL
INFO: OpenSSL successfully initialized (OpenSSL 1.0.1e 11 Feb 2013)
Apr 30, 2014 2:27:48 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-apr-8080"]
Apr 30, 2014 2:27:48 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-apr-8009"]
Apr 30, 2014 2:27:48 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1173 ms
Apr 30, 2014 2:27:48 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Apr 30, 2014 2:27:48 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.52
Apr 30, 2014 2:27:48 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor C:\Java\apache-tomcat-7.0.52\conf\Catalina\localhost\task4.xml
Apr 30, 2014 2:27:51 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
Apr 30, 2014 2:27:51 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing Root WebApplicationContext: startup date [Wed Apr 30 14:27:51 SGT 2014]; root of context hierarchy
Apr 30, 2014 2:27:51 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/config/sage.xml]
Apr 30, 2014 2:27:51 PM org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider registerDefaultFilters
INFO: JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning
Apr 30, 2014 2:27:51 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#1655d7e: defining beans [govUserEndpoint,govUserInterfaceImplementation,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,final,org.springframework.ws.soap.server.endpoint.interceptor.DelegatingSmartSoapEndpointInterceptor#0,org.springframework.ws.soap.server.endpoint.interceptor.DelegatingSmartSoapEndpointInterceptor#1,callbackHandler,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0]; root of factory hierarchy
Apr 30, 2014 2:27:52 PM org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons
INFO: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#1655d7e: defining beans [govUserEndpoint,govUserInterfaceImplementation,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,final,org.springframework.ws.soap.server.endpoint.interceptor.DelegatingSmartSoapEndpointInterceptor#0,org.springframework.ws.soap.server.endpoint.interceptor.DelegatingSmartSoapEndpointInterceptor#1,callbackHandler,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0]; root of factory hierarchy
Apr 30, 2014 2:27:52 PM org.springframework.web.context.ContextLoader initWebApplicationContext
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.ws.soap.server.endpoint.interceptor.DelegatingSmartSoapEndpointInterceptor#1': Cannot create inner bean 'wss4jSecurityInterceptor' of type [org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'wss4jSecurityInterceptor' defined in ServletContext resource [/WEB-INF/config/sage.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/apache/xml/security/Init
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:281)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:120)
at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:616)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:148)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1035)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:939)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:670)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1839)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'wss4jSecurityInterceptor' defined in ServletContext resource [/WEB-INF/config/sage.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/apache/xml/security/Init
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:270)
... 30 more
Caused by: java.lang.NoClassDefFoundError: org/apache/xml/security/Init
at org.apache.ws.security.WSSConfig.setXmlSecIgnoreLineBreak(WSSConfig.java:400)
at org.apache.ws.security.WSSConfig.init(WSSConfig.java:420)
at org.apache.ws.security.WSSConfig.getNewInstance(WSSConfig.java:455)
at org.apache.ws.security.WSSecurityEngine.getWssConfig(WSSecurityEngine.java:142)
at org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor.afterPropertiesSet(Wss4jSecurityInterceptor.java:496)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
... 33 more
Caused by: java.lang.ClassNotFoundException: org.apache.xml.security.Init
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1718)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1569)
... 40 more
Apr 30, 2014 2:27:52 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
Apr 30, 2014 2:27:52 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/task4] startup failed due to previous errors
Apr 30, 2014 2:27:52 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Java\apache-tomcat-7.0.52\webapps\docs
Apr 30, 2014 2:27:52 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Java\apache-tomcat-7.0.52\webapps\examples
Apr 30, 2014 2:27:54 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Java\apache-tomcat-7.0.52\webapps\host-manager
Apr 30, 2014 2:27:55 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Java\apache-tomcat-7.0.52\webapps\manager
Apr 30, 2014 2:27:56 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Java\apache-tomcat-7.0.52\webapps\ROOT
Apr 30, 2014 2:27:56 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-apr-8080"]
Apr 30, 2014 2:27:56 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-apr-8009"]
Apr 30, 2014 2:27:56 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 8494 ms
Apr 30, 2014 2:39:57 PM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-apr-8080"]
Apr 30, 2014 2:39:57 PM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["ajp-apr-8009"]
Apr 30, 2014 2:39:57 PM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Catalina
Apr 30, 2014 2:39:57 PM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["http-apr-8080"]
Apr 30, 2014 2:39:57 PM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["ajp-apr-8009"]
Apr 30, 2014 2:39:57 PM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-apr-8080"]
Apr 30, 2014 2:39:57 PM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["ajp-apr-8009"]
The libraries I have are,
aopalliance-1.0.jar
commons-collections-3.2.jar
commons-lang-2.5.jar
commons-logging-1.1.1.jar
spring-aop-3.1.1.RELEASE.jar
spring-asm-3.1.1.RELEASE.jar
spring-aspects-3.1.1.RELEASE.jar
spring-beans-3.1.1.RELEASE.jar
spring-context-3.1.1.RELEASE.jar
spring-context-support-3.1.1.RELEASE.jar
spring-core-3.1.1.RELEASE.jar
spring-expression-3.1.1.RELEASE.jar
spring-oxm-3.1.1.RELEASE.jar
spring-web-3.0.5.RELEASE.jar
spring-webmvc-3.0.5.RELEASE.jar
spring-ws-core-2.0.0.RELEASE.jar
spring-ws-security-2.1.4.RELEASE .jar
spring-xml-2.0.0.RELEASE.jar
stax-api-1.0-2.jar
wsdl4j-1.6.1.jar
wss4j-1.6.13.jar
XmlSchema-1.4.3.jar
My web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID"
version="2.5">
<!--
Spring-ws-configuraion file.
-->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/config/sage.xml
</param-value>
</context-param>
<!--
Loads the Spring web application context, using the files defined above.
-->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!--
Define the Spring WS Servlet. The 'transformWsldLocations' param means
that any WSDLs generated are context-aware and contain the correct
path to their exposed port types. The 'contextConfigLocation' param
with an empty value means that the Spring context won't try to load
a file called webservices-servlet.xml
-->
<servlet>
<servlet-name>webservices</servlet-name>
<servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
<init-param>
<param-name>transformWsdlLocations</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value></param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>webservices</servlet-name>
<url-pattern>*.wsdl</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>webservices</servlet-name>
<url-pattern>/endpoints/*</url-pattern>
</servlet-mapping>
</web-app>
My sage.xml (spring-ws-servlet.xml)
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:sws="http://www.springframework.org/schema/web-services"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/web-services
http://www.springframework.org/schema/web-services/web-services-2.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd ">
<!-- Here point to your interface and implementation package -->
<context:component-scan base-package="org.example.service" />
<!-- Here is the name for the web address -->
<bean id="final"
class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition"
lazy-init="true">
<property name="schemaCollection">
<bean
class="org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection">
<property name="inline" value="true" />
<property name="xsds">
<list>
<!-- Here point to schemas folder of the operation service XSD!! -->
<value>schema/GovUserOperationService.xsd</value>
</list>
</property>
</bean>
</property>
<property name="portTypeName" value="GovUserServices" />
<property name="serviceName" value="GovUserService" />
<property name="locationUri" value="/endpoints" />
</bean>
<sws:interceptors>
<bean
class="org.springframework.ws.soap.server.endpoint.interceptor.SoapEnvelopeLoggingInterceptor" />
<bean id="wss4jSecurityInterceptor"
class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor">
<property name="validationCallbackHandler" ref="callbackHandler" />
<property name="validationActions" value="UsernameToken" />
</bean>
</sws:interceptors>
<bean id="callbackHandler"
class="org.springframework.ws.soap.security.wss4j.callback.SimplePasswordValidationCallbackHandler">
<property name="users">
<props>
<prop key="admin">password</prop>
</props>
</property>
</bean>
</beans>

The requested resource is not available. Spring MVC

I have 5 hello world projects that have the same error:
"description: The requested resource is not available."
I'm using jdk7, tomcat7, maven3.1.1. I always use mvn clean/package.
Here is one of this projects
/WEB-INF/dispatcher-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
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">
<!-- the package is right( checked it twice) -->
<context:component-scan base-package="ua.abond.tutor.controller" />
<!-- without this tag I get "No mapping found for HTTP request with URI [/SecondSite/hello.htm] in DispatcherServlet with name 'dispatcher'" -->
<mvc:default-servlet-handler />
<!-- also tried mvc:annotation-driven and context:annotation-config tags
didnt help too-->
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver"
p:prefix="/WEB-INF/pages/" p:suffix=".jsp">
</bean>
<!-- prefix is right, if I had permission, I would have shared my root screenshot -->
</beans>
/WEB-INF/web.xml
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<display-name>SecondSite</display-name>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>*.htm</url-pattern>
<!-- also tried /*, *, /dispatcher/*, /dispatcher/*.htm and / -->
</servlet-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/dispatcher-servlet.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
</web-app>
controller
#Controller
public class Home {
String message = "Welcome to your 1st Maven Spring project !";
#RequestMapping(value = "/hello")//also tried: hello, /hello.htm ... no result
public ModelAndView showMessage() {
System.out.println("from controller");
return new ModelAndView("hello", "message", message);
}
}
and my pages
1)index.jsp
<html>
<head>
<title>Tutorial | Spring</title>
</head>
<body>
<h4>
Click Here
</h4>
</body>
</html>
2)WEB-INF/pages/hello.jsp ------ The page I cant reach
<html>
<head>
<title>Tutorial | Spring</title>
</head>
<body>
<h4>${message}</h4>
</body>
</html>
console
Jan 28, 2014 8:57:15 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\Programmes\JRE7\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files (x86)\iis express\PHP\v5.4;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft SQL ;;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files\MySQL\MySQL Server 5.1\bin;C:\Program Files (x86)\nodejs\ ;C:\Program Files\Apache Software Foundation\apache-maven-3.1.1\bin;C:\Program Files (x86)\Java\jre7\bin;C:\Users\Alex\AppData\Roaming\npm\;.
Jan 28, 2014 8:57:15 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:SecondSite' did not find a matching property.
Jan 28, 2014 8:57:15 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jan 28, 2014 8:57:15 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Jan 28, 2014 8:57:15 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 475 ms
Jan 28, 2014 8:57:15 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jan 28, 2014 8:57:15 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.47
Jan 28, 2014 8:57:16 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Jan 28, 2014 8:57:16 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Jan 28, 2014 8:57:16 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
Jan 28, 2014 8:57:16 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing Root WebApplicationContext: startup date [Tue Jan 28 20:57:16 EET 2014]; root of context hierarchy
Jan 28, 2014 8:57:16 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/dispatcher-servlet.xml]
Jan 28, 2014 8:57:17 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/**] onto handler 'org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler#0'
Jan 28, 2014 8:57:17 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization completed in 692 ms
Jan 28, 2014 8:57:17 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'dispatcher'
Jan 28, 2014 8:57:17 PM org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: FrameworkServlet 'dispatcher': initialization started
Jan 28, 2014 8:57:17 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing WebApplicationContext for namespace 'dispatcher-servlet': startup date [Tue Jan 28 20:57:17 EET 2014]; parent: Root WebApplicationContext
Jan 28, 2014 8:57:17 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/dispatcher-servlet.xml]
Jan 28, 2014 8:57:17 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/**] onto handler 'org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler#0'
Jan 28, 2014 8:57:17 PM org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: FrameworkServlet 'dispatcher': initialization completed in 178 ms
Jan 28, 2014 8:57:17 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Jan 28, 2014 8:57:17 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Jan 28, 2014 8:57:17 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 2025 ms
The dispatcher servlet is only configured to handle *.htm files, so when accessing /hello it won't work.
Try this:
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
Try with this,
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
Put the <mvc:annotation-driven /> in spring configuration.

TomcatInstrumentableClassLoader Servlet ClassNotFoundException

I using Tomcat 6 as the App Server for my web application which uses the AOP to inject DAO into servlet.
Dec 31, 2012 5:21:01 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files (x86)\Java\jre6\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files (x86)/Java/jre7/bin/client;C:/Program Files (x86)/Java/jre7/bin;C:/Program Files (x86)/Java/jre7/lib/i386;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Common Files\Acronis\SnapAPI\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\MySQL\MySQL Server 5.5\bin;C:\Program Files (x86)\Java\jdk1.6.0_26\bin;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\eclipse-jee-indigo-SR2-win32\eclipse;;.
Dec 31, 2012 5:21:02 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:BISDAO' did not find a matching property.
Dec 31, 2012 5:21:02 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context/Loader} Setting property 'useSystemClassLoaderAsParent' to 'false' did not find a matching property.
Dec 31, 2012 5:21:02 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Dec 31, 2012 5:21:02 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 288 ms
Dec 31, 2012 5:21:02 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Dec 31, 2012 5:21:02 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.35
Dec 31, 2012 5:21:02 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
17:21:02,477 INFO ContextLoader:272 - Root WebApplicationContext: initialization started
17:21:02,571 INFO XmlWebApplicationContext:510 - Refreshing Root WebApplicationContext: startup date [Mon Dec 31 17:21:02 SGT 2012]; root of context hierarchy
17:21:02,635 INFO XmlBeanDefinitionReader:315 - Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
17:21:02,967 INFO DefaultContextLoadTimeWeaver:89 - Using a reflective load-time weaver for class loader: org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader
17:21:03,614 INFO DefaultListableBeanFactory:577 - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#188c838: defining beans [org.springframework.context.config.internalBeanConfigurerAspect,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,genericDAOImpl,org.springframework.context.weaving.AspectJWeavingEnabler#0,loadTimeWeaver,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,org.springframework.cache.annotation.AnnotationCacheOperationSource#0,org.springframework.cache.interceptor.CacheInterceptor#0,org.springframework.cache.config.internalCacheAdvisor,org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor#0,dataSource,jdbcTemplate,genericDaoImpl,transactionManager,ehcache,cacheManager,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor]; root of factory hierarchy
17:21:03,944 INFO EhCacheManagerFactoryBean:100 - Initializing EHCache CacheManager
17:21:04,263 INFO MLog:80 - MLog clients using log4j logging.
17:21:04,330 INFO C3P0Registry:204 - Initializing c3p0-0.9.1.2 [built 21-May-2007 15:04:56; debug? true; trace: 10]
17:21:04,471 INFO ContextLoader:301 - Root WebApplicationContext: initialization completed in 1993 ms
Dec 31, 2012 5:21:04 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Dec 31, 2012 5:21:04 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Dec 31, 2012 5:21:04 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/11 config=null
Dec 31, 2012 5:21:04 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 2354 ms
Dec 31, 2012 5:21:08 PM org.apache.catalina.core.ApplicationContext log
INFO: Marking servlet GenericServlet as unavailable
Dec 31, 2012 5:21:08 PM org.apache.catalina.core.ApplicationContext log
SEVERE: Error loading org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader
WebappClassLoader
context: /BISDAO
delegate: false
repositories:
/WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader#3c0007
GenericServlet
java.lang.ClassNotFoundException: GenericServlet
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1128)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:827)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)
Dec 31, 2012 5:21:08 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Allocate exception for servlet GenericServlet
java.lang.ClassNotFoundException: GenericServlet
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1128)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:827)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)
Below is my configuration:
I have put spring-instrument-tomcat-3.1.2.RELEASE.jar into $CATALINA_HOME\lib and have context.xml inside my META-INF folder.
<?xml version='1.0' encoding='utf-8'?>
<Context path="/BISDAO">
<Loader loaderClass="org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader" />
</Context>
applicationContext.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<!-- Enable #Required #Autowired #PreDestroy #PostConstruct #Resource -->
<context:annotation-config />
<!-- Scan class file in class path for annotated component -> #Component, #Repository, #Service, and #Controller -->
<context:component-scan base-package="com.breeze.bis.core.service.jdbcTemplate" />
<!-- Enable load time weaving for #Configurable -->
<context:load-time-weaver aspectj-weaving="autodetect" />
<!-- -->
<tx:annotation-driven proxy-target-class="false" transaction-manager="transactionManager"/>
<!-- ==================================================================================================== -->
<!-- Alternate method to enable #Autowired -->
<bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"/>
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="jdbcUrl" value="jdbc:mysql://localhost:3306/vbossdb" />
<property name="driverClass" value="com.mysql.jdbc.Driver" />
<property name="user" value="root" />
<property name="password" value="root" />
</bean>
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<constructor-arg type="javax.sql.DataSource" ref="dataSource"></constructor-arg>
</bean>
<bean id="genericDaoImpl" class="com.breeze.bis.core.service.jdbcTemplate.GenericDAOImpl">
<property name="jdbcDao" ref="jdbcTemplate"></property>
</bean>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"></property>
</bean>
</beans>
Servlet.java
#Configurable
public class GenericServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
#Autowired
GenericDAO dao;
}
Please help.
Thanks.
Your servlet shouldn't be in the default package. Move it into a proper package, and it'll probably work.
Define servlet class using custom package in web.xml

Resources