Hi,

I have a problem when using Spring MVC in my project. I have one ExampleController class which doesn't want to load into the Spring container. My test URL is: localhost:8180/springTest.do. (I've tried the @Controller annotation and the bean definition as shown below):

web.xml:
HTML Code:
<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>*.do</url-pattern>
    </servlet-mapping>
My dispatcher-servlet.xml:

HTML Code:
<?xml version="1.0" encoding="UTF-8"?>
<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-3.0.xsd
        http://www.springframework.org/schema/mvc
        http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context-3.0.xsd">
        
    <import resource="/application.xml"/>
	
	<bean name="/springTest.do" class="com.projectname.control.ExampleController"/>

</beans>
My Controller:

Code:
package com.projectname.control;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * Spring MVC example controller.
 *
 */

public class ExampleController  {
	
	@RequestMapping("/springTest")
	public ModelAndView process() {
		
		return new ModelAndView("spring.jsp");
	}

	
}
When I start the application server (Tomcat 6) I get the following error:

Code:
 2011-02-10 10:06:19,122 ERROR org.springframework.web.servlet.DispatcherServlet: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name '/springTest.do' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.projectname.control.ExampleController]: Constructor threw exception; nested exception is java.lang.Error: Unresolved compilation problems: 
	Controller cannot be resolved to a type
	Syntax error on tokens, delete these tokens
	Syntax error, insert "enum Identifier" to complete EnumHeaderName
	Syntax error, insert "EnumBody" to complete EnumDeclaration
	Syntax error, insert "}" to complete ClassBody

	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:965)
	
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.Error: Unresolved compilation problems: 
	Controller cannot be resolved to a type
If I use the @Controller annotation in the ExampleController and change the dispatcher-servlet.xml to:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<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-3.0.xsd
        http://www.springframework.org/schema/mvc
        http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context-3.0.xsd">
        
    <import resource="/application.xml"/>
	
	<context:component-scan base-package="com.projectname.control"/>

</beans>
I get:

Code:
2011-02-10 10:48:08,395 DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver: Looking for matching resources in directory tree [D:\source\Project\J2ee\TPW\webApplication\WEB-INF\classes\com\projectname\control]
 2011-02-10 10:48:08,395 DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver: Searching directory [D:\source\projectname\J2ee\TPW\webApplication\WEB-INF\classes\com\projectname\control] for files matching pattern [D:/source/projectname/J2ee/TPW/webApplication/WEB-INF/classes/com/projectname/control/**/*.class]
 2011-02-10 10:48:08,411 DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver: Looking for matching resources in directory tree [D:\localserver\localtpw\tpw\TPW\WEB-INF\classes\com\projectname\control]
 2011-02-10 10:48:08,411 DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver: Searching directory [D:\localserver\localtpw\tpw\TPW\WEB-INF\classes\com\projectname\control] for files matching pattern [D:/localserver/localtpw/tpw/TPW/WEB-INF/classes/com/projectname/control/**/*.class]
 2011-02-10 10:48:08,411 DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver: Resolved location pattern [classpath*:com/projectname/control/**/*.class] to resources [file [D:\source\projectname\J2ee\TPW\webApplication\WEB-INF\classes\com\projectname\control\ExampleController.class], file [D:\localserver\localtpw\tpw\TPW\WEB-INF\classes\com\projectname\control\ExampleController.class]]
 2011-02-10 10:48:08,411 DEBUG org.springframework.context.annotation.ClassPathBeanDefinitionScanner: Scanning file [D:\source\projectname\J2ee\TPW\webApplication\WEB-INF\classes\com\projectname\control\ExampleController.class]
 2011-02-10 10:48:08,426 DEBUG org.springframework.context.annotation.ClassPathBeanDefinitionScanner: Ignored because not matching any filter: file [D:\source\projectname\J2ee\TPW\webApplication\WEB-INF\classes\com\projectname\control\ExampleController.class]
 2011-02-10 10:48:08,426 DEBUG org.springframework.context.annotation.ClassPathBeanDefinitionScanner: Scanning file [D:\localserver\localtpw\tpw\TPW\WEB-INF\classes\com\projectname\control\ExampleController.class]
 2011-02-10 10:48:08,442 DEBUG org.springframework.context.annotation.ClassPathBeanDefinitionScanner: Ignored because not matching any filter: file [D:\localserver\localtpw\tpw\TPW\WEB-INF\classes\com\projectname\control\ExampleController.class]
 2011-02-10 10:48:08,457 DEBUG org.springframework.beans.factory.xml.XmlBeanDefinitionReader: Loaded 5 bean definitions from location pattern [/WEB-INF/dispatcher-servlet.xml]
 2011-02-10 10:48:08,457 DEBUG org.springframework.web.context.support.XmlWebApplicationContext: Bean factory for WebApplicationContext for namespace 'dispatcher-servlet': org.springframework.beans.factory.support.DefaultListableBeanFactory@44b044b: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor]; root of factory hierarchy
When I try the springTest.do in a browser I get:
Code:
17155620 2011-02-10 10:50:00,901 DEBUG org.springframework.web.servlet.DispatcherServlet: Bound request context to thread: org.apache.catalina.connector.RequestFacade@7ba27ba2
17155620 2011-02-10 10:50:00,901 DEBUG org.springframework.web.servlet.DispatcherServlet: DispatcherServlet with name 'dispatcher' processing GET request for [/springTest.do]
17155620 2011-02-10 10:50:00,901 DEBUG org.springframework.web.servlet.DispatcherServlet: Testing handler map [org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping@27a227a2] in DispatcherServlet with name 'dispatcher'
17155620 2011-02-10 10:50:00,901 DEBUG org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping: No handler mapping found for [/springTest.do]
17155620 2011-02-10 10:50:00,901 DEBUG org.springframework.web.servlet.DispatcherServlet: Testing handler map [org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping@7f807f8] in DispatcherServlet with name 'dispatcher'
17155620 2011-02-10 10:50:00,901 DEBUG org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping: No handler mapping found for [/springTest.do]
17155620 2011-02-10 10:50:00,901 WARN  org.springframework.web.servlet.PageNotFound: No mapping found for HTTP request with URI [/springTest.do] in DispatcherServlet with name 'dispatcher'
17155620 2011-02-10 10:50:00,901 DEBUG org.springframework.web.servlet.DispatcherServlet: Cleared thread-bound request context: org.apache.catalina.connector.RequestFacade@7ba27ba2
17155620 2011-02-10 10:50:00,901 DEBUG org.springframework.web.servlet.DispatcherServlet: Successfully completed request
17155620 2011-02-10 10:50:00,901 DEBUG org.springframework.web.context.support.XmlWebApplicationContext: Publishing event in WebApplicationContext for namespace 'dispatcher-servlet': ServletRequestHandledEvent: url=[/springTest.do]; client=[127.0.0.1]; method=[GET]; servlet=[dispatcher]; session=[null]; user=[null]; time=[16ms]; status=[OK]
I'm using Spring 3 and I've put all the Spring jars into my project.

Anybody know what's going on here? Any help would be greatly appreciated.