Menu

JSF Spring Hibernate Integration

Users
dufeng
2006-11-20
2013-04-08
  • dufeng

    dufeng - 2006-11-20

    I am using Tomcat 5.0 and Eclipse 3.2, MyEclipse 5.0
    first,i integrat jsf with spring,and the login.jsp display correctly.
    when i add hibernate,i am getting following errors

    type Status report
    message /test/login.jsf
    description The requested resource (/test/login.jsf) is not available.

    Here are the snippets from web.xml
    <context-param>
    <param-name>javax.faces.CONFIG_FILES</param-name>
    <param-value>/WEB-INF/faces-config.xml</param-value>
    </context-param>
    <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
    <listener>
    <listener-class>
      org.springframework.web.context.ContextLoaderListener
    </listener-class>
    </listener>
    <listener>
    <listener-class>
      de.mindmatters.faces.spring.context.ContextLoaderListener
    </listener-class>
    </listener>

    faces-config.xml :
    <navigation-rule>
    <from-view-id>/login.jsp</from-view-id>
    <navigation-case>
    <from-outcome>success</from-outcome>
    <to-view-id>/ok.jsp</to-view-id>
    </navigation-case>
    </navigation-rule>
    <navigation-rule>
    <from-view-id>/ok.jsp</from-view-id>
    </navigation-rule>
    <managed-bean>
    <managed-bean-name>user</managed-bean-name>
    <managed-bean-class>com.backbean.UserBean</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    <managed-property>
    <property-name>userValidator</property-name>
    <value>#{userValidator}</value>
    </managed-property>
    </managed-bean>

    applicationContext.xml :

    <bean name="userValidator" class="com.validator.UserValidator"
            id="userValidator">
    <property name="userDAO">
    <ref bean="userDAO" />
    </property>
    </bean>
    <bean id="dataSource"
        class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName">
    <value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
    </property>
    <property name="url">
    <value>jdbc:microsoft:sqlserver://localhost:1433</value>
    </property>
    <property name="username">
    <value>sa</value>
    </property>
    <property name="password">
    <value>sa</value>
    </property>
    </bean>
    <bean id="sessionFactory"
          class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource">
    <ref bean="dataSource" />
    </property>
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">
    org.hibernate.dialect.SQLServerDialect
    </prop>
    <prop key="hibernate.show_sql">true</prop>
    </props>
    </property>
    <property name="mappingResources">
    <list>
    <value>com/hibernate/User.hbm.xml</value>
    </list>
    </property>
    </bean>
    <bean id="transactionManager"
        class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    <property name="sessionFactory">
    <ref local="sessionFactory" />
    </property>
    </bean>
    <bean id="userDAO" class="com.hibernate.UserDAO">
    <property name="sessionFactory">
    <ref bean="sessionFactory" />
    </property>
    </bean>

    I have been looking forsolution to this problem since more than a week and posted it on all the Forums. Hoping to get some help from this forum 

    Regards
    dufeng

     
    • Thomas Jachmann

      Thomas Jachmann - 2006-11-29

      Hi dufeng,

      you should always include stack traces when posting errors. The "resource not available" error looks like the application didn't start properly at all. Maybe you haven't included all of hibernate's dependencies into WEB-INF/lib? Please consult the hibernate docs if this is the case.

      HTH, Thomas

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.