0

私はSpring MVCアプリケーションを開発しています。今までは
、login.jspページを表示していたコントローラーを呼び出していました。プロジェクトは正常に実行されていました。

しかし、休止状態でデータベース接続を追加したいときは、web.xml クラスを変更する必要はありませんでした
。dispatcher-servlet.xml に新しいものを追加し、DTO と
サービス クラスに必要な注釈を付けました。

今私がプロジェクトを実行すると、それは言うThe Requested Resource is not available.
休止状態の接続とマッピングに関する新しいものを追加したために、dispatcher-servlet.xml に問題があった場合
、少なくとも <welcome-file> にある私の index.jsp は呼び出されて
いるはずです。

この問題が発生する考えられる理由を誰か教えてください。
これが私のdispatcher-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"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:lang="http://www.springframework.org/schema/lang"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
    http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd
    http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
    http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">

<context:component-scan base-package="com.alw" />

<bean id="viewResolver"
    class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name="prefix">
        <value>/WEB-INF/pages/</value>
    </property>
    <property name="suffix">
        <value>.jsp</value>
    </property>
</bean>

//codes below I added later  

<bean id="propertyConfigurer"
    class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
    p:location="/WEB-INF/jdbc.properties" />

<bean id="dataSource"
    class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"
    p:driverClassName="${jdbc.driverClassName}"
    p:url="${jdbc.databaseurl}" p:username="${jdbc.username}"
    p:password="${jdbc.password}" />

<bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="configLocation">
        <value>classpath:hibernate.cfg.xml</value>
    </property>
    <property name="configurationClass">
        <value>org.hibernate.cfg.AnnotationConfiguration</value>
    </property>
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">${jdbc.dialect}</prop>
            <prop key="hibernate.show_sql">true</prop>
            <prop key="hibernate.current_session_context_class">
                thread
            </prop>
        </props>
    </property>
</bean>

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

4

2 に答える 2

0

これは通常、Web アプリの開始時にアップストリーム エラーが発生し、Web アプリ全体の初期化に失敗したことを意味します。ただし、ログにそのようなものがあることに間違いなく気付くでしょう。

于 2012-05-30T13:17:41.537 に答える
0

この問題は、dispatcher-servlet.xml のビュー リゾルバー コードが原因である可能性があります -

<bean id="viewResolver"     class="org.springframework.web.servlet.view.InternalResourceViewResolver">
  <property name="prefix"><value>/WEB-INF/pages/</value></property>
  <property name="suffix"><value>.jsp</value></property>
</bean> 

変更を行う前に、このコードも存在していましたか?

于 2012-05-30T12:12:01.163 に答える