在做mvc自定义框架的时候 出现的异常  技术不过硬 实在是找不到问题所在  希望大家帮忙
javax.naming.NameNotFoundException: Name ssha1 is not bound in this Context
at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
at org.apache.naming.NamingContext.lookup(NamingContext.java:781)

解决方案 »

  1.   

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5" 
    xmlns="http://java.sun.com/xml/ns/javaee" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
      <servlet>
        <description>This is the description of my J2EE component</description>
        <display-name>This is the display name of my J2EE component</display-name>
        <servlet-name>Contorller</servlet-name>
        <servlet-class>com.ssha1.servlet.Contorller</servlet-class>
      </servlet>  <servlet-mapping>
        <servlet-name>Contorller</servlet-name>
        <url-pattern>*.do</url-pattern>
      </servlet-mapping>
      <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
      </welcome-file-list>
       <resource-ref>     <res-ref-name> jdbc/ssha1 </res-ref-name>     <res-type> javax.sql.DataSource </res-type>     <res-auth> Container </res-auth>   </resource-ref>
    </web-app>
      

  2.   

    <!-- The contents of this file will be loaded for each web application -->
     <Context>

       <Resource name="jdbc/ssha1" 
           auth="Container" type="javax.sql.DataSource"  maxActive="100"  
           maxIdle="30" maxWait="10000"   username="sa"   password="123" 
          driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"  
         url="jdbc:mysql://localhost:1433;databaseName=ssha1"/>

    </Context>
      

  3.   

    两个xml的配置  哪里有问题吗?  哎 烦死了