mercredi 29 juillet 2015

Spring MVC +Hibernate 4.0

org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/hibernate/] in DispatcherServlet with name 'appServlet'

enter code here

<!-- DispatcherServlet Context: defines this servlet's request-processing 
    infrastructure -->

<!-- Enables the Spring MVC @Controller programming model -->
<annotation-driven />


<!-- Handles HTTP GET requests for /resources/** by efficiently serving 
    up static resources in the ${webappRoot}/resources directory -->
<resources mapping="/resources/**" location="/resources/" />

<!-- Resolves views selected for rendering by @Controllers to .jsp resources 
    in the /WEB-INF/views directory -->

<context:property-placeholder location="WEB-INF/jdbc.properties" />
<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>

<!-- Declare Datasource bean -->
<beans:bean id="dataSource"
    class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <beans:property name="driverClassName" value="${jdbc.driverClassName}"></beans:property>
    <beans:property name="url" value="${jdbc.url}"></beans:property>
    <beans:property name="username" value="${jdbc.username}"></beans:property>
    <beans:property name="password" value="${jdbc.password}"></beans:property>
</beans:bean>

<!-- Hibernate 4 SessionFactory Bean definition -->
<beans:bean id="sessionFactory"
    class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
    <beans:property name="dataSource" ref="dataSource" />
    <beans:property name="configLocation">
        <beans:value>resources/hibernate.cfg.xml</beans:value>  
        </beans:property>               

    <beans:property name="hibernateProperties">
        <beans:props>
            <beans:prop key="hibernate.dialect">${jdbc.dialect}
            </beans:prop>
            <beans:prop key="hibernate.show_sql">true</beans:prop>
            <!-- <beans:prop key="hibernate.hbm2ddl.auto">create</beans:prop> -->
        </beans:props>

        <!-- </beans:property> <beans:property name = "packagesToScan" value ="com.jcp.hibernateSpring.Model.Icaps"> -->
    </beans:property>
</beans:bean>

<!-- declare beans, Id is just name,but it is important to tell which class 
    is defined beans. -->

<beans:bean id="icapsdao" class="com.jcp.hibernateSpring.DAO.IcapsDAOimpl" />
<beans:bean id="icapsService"
    class="com.jcp.hibernateSpring.Service.IcapsServiceImpl" />


<!-- automatic transaction support for the SessionFactory -->

<tx:annotation-driven transaction-manager="transactionManager" />
<beans:bean id="transactionManager"
    class="org.springframework.orm.hibernate4.HibernateTransactionManager">
    <beans:property name="sessionFactory" ref="sessionFactory"></beans:property>
</beans:bean>

I have been working for this problem from last couple of days. I cannot figure it out by myself. I already have required links. Project build successfully. Any help would be appreciate.

Aucun commentaire:

Enregistrer un commentaire