问题是:Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/context]
Offending resource: ServletContext resource [/WEB-INF/context/applicationContext.xml]这是spring的application。xml:<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:flex="http://www.springframework.org/schema/flex"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/flex
http://www.springframework.org/schema/flex/spring-flex-1.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd">
<context:property-placeholder location="classpath:../properties/loginTest.properties" />
<bean id="userLogin_user"
class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName"
value="com.mysql.jdbc.Driver" />
<property name="url"
value="${db-user.url}" />
<property name="initialSize" value="${db-user.initial-pool-size}"></property>
<property name="username" value="${db-user.username}" />
<property name="password" value="${db-user.password}" />
<property name="poolPreparedStatements" value="true" />
<property name="validationQuery" value="select 1" />
<property name="maxWait" value="10000"/>
<property name="maxActive" value="50" />
<property name="maxIdle" value="-1" />
</bean>
<bean id="userdao" class="UserDao" factory-method="getInstance" >
<property name="dataSourceUser" ref="userLogin_user" />
</bean>
</beans>web.xml是: <?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">
<!--连接池配置 begins -->
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/userinfo</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<!--连接池配置 end -->
<!-- spring begin-->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/context/*.xml;</param-value>
</context-param>
<servlet>
<servlet-name>SpringContextServlet</servlet-name>
<servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- spring end -->
<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>LoginServlet</servlet-name>
<servlet-class>LoginServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>LoginServlet</servlet-name>
<url-pattern>/loginServlet</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
帮帮忙谢谢!
Offending resource: ServletContext resource [/WEB-INF/context/applicationContext.xml]这是spring的application。xml:<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:flex="http://www.springframework.org/schema/flex"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/flex
http://www.springframework.org/schema/flex/spring-flex-1.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd">
<context:property-placeholder location="classpath:../properties/loginTest.properties" />
<bean id="userLogin_user"
class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName"
value="com.mysql.jdbc.Driver" />
<property name="url"
value="${db-user.url}" />
<property name="initialSize" value="${db-user.initial-pool-size}"></property>
<property name="username" value="${db-user.username}" />
<property name="password" value="${db-user.password}" />
<property name="poolPreparedStatements" value="true" />
<property name="validationQuery" value="select 1" />
<property name="maxWait" value="10000"/>
<property name="maxActive" value="50" />
<property name="maxIdle" value="-1" />
</bean>
<bean id="userdao" class="UserDao" factory-method="getInstance" >
<property name="dataSourceUser" ref="userLogin_user" />
</bean>
</beans>web.xml是: <?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">
<!--连接池配置 begins -->
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/userinfo</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<!--连接池配置 end -->
<!-- spring begin-->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/context/*.xml;</param-value>
</context-param>
<servlet>
<servlet-name>SpringContextServlet</servlet-name>
<servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- spring end -->
<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>LoginServlet</servlet-name>
<servlet-class>LoginServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>LoginServlet</servlet-name>
<url-pattern>/loginServlet</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
帮帮忙谢谢!
解决方案 »
- war包中lib下的jar包引用疑问
- 如何在Jsp中取出Session数据
- 客户端通过URL访问服务器上的JAR包
- java正则表达式 数字匹配
- htmlparser分析数据
- J2EE不能启动服务器。大哥帮帮忙啊!
- tomcat不使用80端口,使用别的端口就必须加端口号才能访问吗?
- 『提问』使用Hibernate tools生成代码时,总是报表不存在
- 各位高手能不能发个关于JBUILD+STRUTS环境配置手册给我,谢谢了!
- 我的EJB程序出现javax.naming.linkexception,怎么回事啊?
- struts2怎么实现表单数据保存
- 很急,帮帮忙。spring+servlet+连接池的问题
xmlns:flex="http://www.springframework.org/schema/flex"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/flex
http://www.springframework.org/schema/flex/spring-flex-1.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd">把关于namespace的去掉或者把上面那些换成<beans>试试。