请查看我的代码并指导我为什么抛出此异常 "Name [jdbc/test] is not bound in this Context. Unable to find [jdbc]"

Please have a look at my code and guide me why is it throwing this exception "Name [jdbc/test] is not bound in this Context. Unable to find [jdbc]"

------------APPLICATION_CONTEXT.xml-------------- 我已经阅读了很多文章,但没有找到任何解决方案...

<jee:jndi-lookup jndi-name="jdbc/test" id="dataSource" expected-type="javax.sql.DataSource"/>

    <bean
        class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"
        name="factory">
        <property name="dataSource" ref="dataSource"></property>
        <property name="annotatedClasses">
            <list>
                <value>com.spring.rest.curd.model.Payment</value>
            </list>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
                <prop key="hibernate.show_sql">true</prop>
                <prop key="hibernate.hbm2ddl.auto">update</prop>
            </props>
        </property>
    </bean>
    <bean
        class="org.springframework.orm.hibernate4.HibernateTransactionManager"
        name="transactionManager">
        <property name="sessionFactory" ref="factory"></property>
    </bean>

------------CONTEXT.xml------------

<ResourceLink name="jdbc/test"
global="jdbc/test"
auth="Container"
type="javax.sql.DataSource" />

------------SERVER.xml---------

 <Resource name="jdbc/test"
              global="jdbc/test"
              auth="Container"
              type="javax.sql.DataSource"
              driverClassName="com.mysql.jdbc.Driver"
              url="jdbc:mysql://localhost:3306/test"
              username="root"
              password="root"
              maxActive="100"
              maxIdle="20"
              minIdle="5"
              maxWait="10000"/>

资源的 jndi 名称具有隐式前缀:java:comp/env/

因此,如果您的 context.xml 中的资源名称是 jdbc/test,那么您的 jndi-lookup(在 APPLICATION_CONTEXT.xml 中)的 jndi-name 必须是 java:comp/env/jdbc/test.

<jee:jndi-lookup
     jndi-name="java:comp/env/jdbc/test"
     id="dataSource"
     expected-type="javax.sql.DataSource"/>