vendredi 13 mars 2015

HTTP Status 404 - tomcat 7

I am building a spring + hibernate application. I'm getting a 404 error, when I run the project. The compiler does not show any error messages, it indicates that the application server (tomcat 7) loads the servlet, but does not display the root page indicated in the controller class.


Help please......


Config..... `



<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://ift.tt/GArMu6"
xmlns:xsi="http://ift.tt/ra1lAU" xmlns:context="http://ift.tt/GArMu7"
xmlns:tx="http://ift.tt/OGfeU2"
xsi:schemaLocation="
http://ift.tt/GArMu6
http://ift.tt/QEDs1e
http://ift.tt/GArMu7
http://ift.tt/QEDs1k
http://ift.tt/OGfeU2
http://ift.tt/1cQrvTl">

<context:property-placeholder location="classpath:resources/database.properties" />
<context:component-scan base-package="langS.com" />

<tx:annotation-driven transaction-manager="hibernateTransactionManager" />

<bean id="jspViewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/WEB-INF/views/" />
<property name="suffix" value=".jsp" />
</bean>
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${database.driver}" />
<property name="url" value="${database.url}" />
<property name="username" value="${database.user}" />
<property name="password" value="${database.password}" />
</bean>

<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="packagesToScan">
<list>
<value>com.langS.model.Employee</value>
<value>com.langS.EmployeeBean</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
</props>
</property>
</bean>

<bean id="hibernateTransactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
</beans>`


Controller



@Controller
public class NewController {

@Autowired
private EmployeeService employeeService;

@RequestMapping(value = "/index", method = RequestMethod.GET)
public String welcomeHome(){
return "index";
}

@RequestMapping(value = "/addEmployee", method = RequestMethod.GET)
public String addEmployeeRecord(){
return "addEmployee";
}

@RequestMapping(value = "/employeeList", method = RequestMethod.GET)
public String listEmployeesPage(){
return "employeesList";
}
}


web.xml



<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns:xsi="http://ift.tt/ra1lAU"
xmlns="http://ift.tt/nSRXKP"
xsi:schemalocation="http://ift.tt/nSRXKP
http://ift.tt/LU8AHS">

<servlet>
<servlet-name>sdnext</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/config/dispatcher-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>sdnext</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>

<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>

</web-app>

Aucun commentaire:

Enregistrer un commentaire