Avatar of iharmony24
iharmony24
 asked on

I think it is not reading the dispatch-servlet.xml file.

I have created a simple webapp that works fine when deployed locally. But when uploaded to the host, it is not finding the pages. It does load the welcome page, but it does not load any of the pages that need to be resolved in the servlet with internalresourceviewresolver. The webapp is located on our sub-domain called clientportal. The directory listing is as follows:
clientportal
    index.jsp
    WEB-INF
          classes
                   GsrPkg
                   view
                    util
           lib
           web.xml
           dispatch-servlet.xml
view is where the jsps are located, util has the utility class and GsrPkg has the rest of the classes.
Why does it work locally and not on the host. It seems as if the dispatch-servlet.xml file is not being read. Both are using TomCat 5.x.
         
webxml file:::
<?xml version="1.0" encoding="ISO-8859-1"?>
 
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
                        http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
	version="2.4">
 
	<display-name>GSR's WebApp</display-name>
	<description>GSR's WebApp for Client Login</description>
 
	<welcome-file-list>
		<welcome-file>index.jsp</welcome-file>
	</welcome-file-list>
	<servlet>
		<servlet-name>dispatch</servlet-name>
		<servlet-class>
			org.springframework.web.servlet.DispatcherServlet
		</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>
 	<servlet-mapping>
		<servlet-name>dispatch</servlet-name>
		<url-pattern>*.htm</url-pattern>
	</servlet-mapping>
	<servlet-mapping>
		<servlet-name>dispatch</servlet-name>
		<url-pattern>*.html</url-pattern>
	</servlet-mapping>
</web-app>
 
Servlet dispatch-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"
	xsi:schemaLocation="http://www.springframework.org/schema/beans 
         http://www.springframework.org/schema/beans/spring-beans.xsd">
         
	<bean id="urlMapping"
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
		<property name="mappings">
			<props>
			<prop key="/login.htm">loginController</prop>
			<prop key="/loginSuccess.htm">
			loginSuccessController</prop>
			</props>
		</property>
	</bean>
			<!-- Utility classes -->
	<bean id="applicationSecurityManager"
		class="GsrPkg.ApplicationSecurityManager"/>
		
	<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
		<property name="configLocation"
			value="classpath:hibernate.cfg.xml" />
	</bean>
	<bean id="urlFilenameController"
		class="org.springframework.web.servlet.mvc.UrlFilenameViewController" />
 
	<bean id="LoginDAO" class="GsrPkg.LoginDAO">
		<property name="sessionFactory">
			<ref bean="sessionFactory" />
		</property>
	</bean>
	<bean id="ActdocsDAO" class="GsrPkg.ActdocsDAO">
		<property name="sessionFactory">
			<ref bean="sessionFactory" />
		</property>
	</bean>
	<bean id="persistenceLayer" class="GsrPkg.PersistenceLayer"
		abstract="false" lazy-init="default" autowire="default"
		dependency-check="default">
		<property name="actdocsDAO">
			<ref bean="ActdocsDAO" />
		</property>
		<property name="loginDAO">
			<ref bean="LoginDAO" />
		</property>
	</bean>
 
	<bean name="loginController" class="GsrPkg.LoginController">
		<property name="sessionForm">
			<value>true</value>
		</property>
		<property name="formView">
			<value>login</value>
		</property>
		<property name="successView">
			<value>redirect:loginSuccess.htm</value>
		</property>
		<property name="commandClass">
			<value>GsrPkg.Login</value>
		</property>
		<property name="validator">
			<ref bean="loginValidator" />
		</property>
		<property name="loginDAO">
			<ref bean="LoginDAO" />
		</property>
		<property name="applicationSecurityManager">
			<ref bean="applicationSecurityManager" />
		</property>
		<property name="persistenceLayer">
			<ref bean="persistenceLayer" />
		</property>
	</bean>
	<bean name="loginSuccessController"
		class="GsrPkg.LoginSuccessController">
		<property name="loginDAO">
			<ref bean="LoginDAO" />
		</property>
		<property name="applicationSecurityManager">
			<ref bean="applicationSecurityManager" />
		</property>
		<property name="successView">
			<value>loginSuccess</value>
		</property>
	</bean>
 
	<bean id="loginValidator" class="GsrPkg.LoginValidator" />
 
	<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
		<property name="viewClass"			value="org.springframework.web.servlet.view.JstlView" />
	<property name="prefix" value="WEB-INF/classes/view/" />
		<property name="suffix" value=".jsp" />
	</bean>
</beans>

Open in new window

Java App ServersJava EEJSP

Avatar of undefined
Last Comment
iharmony24

8/22/2022 - Mon
Mick Barry

what does your tomcat log show?

ASKER CERTIFIED SOLUTION
iharmony24

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes