`
gstarwd
  • 浏览: 1527007 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

在使用SSH添加 <listener> <listener-class>org.springframework.web.context.C

阅读更多

在使用SSH添加

  <listener>
     <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
   </listener>

 

tomcat在启动的时候发生如下错误: 

2008-9-28 11:13:01 org.apache.catalina.core.StandardContext start
严重: Error listenerStart
2008-9-28 11:13:01 org.apache.catalina.core.StandardContext start
严重: Context [/xxfire] startup failed due to previous errors

 

 

错误分析:

 

      错误触发在web.xml中定义

Xml代码 复制代码
  1. < context-param >   
  2.          < param-name > contextConfigLocation </ param-name >   
  3.          < param-value > /WEB-INF/context/ApplicationContext-*.xml </ param-value >   
  4. </ context-param >   
  5. < SPAN   style = "COLOR: #000000" > < listener >   
  6.          < listener-class > < SPAN   style = "BACKGROUND-COLOR: #ff6600" > org.springframework.web.context.ContextLoaderListener </ SPAN > </ listener-class >   
  7. </ listener > </ SPAN >   
Xml代码 <embed type="application/x-shockwave-flash" width="14" height="15" src="http://pavel.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf" flashvars="clipboard=%3Ccontext-param%3E%0A%20%20%20%20%20%20%20%20%3Cparam-name%3EcontextConfigLocation%3C%2Fparam-name%3E%0A%20%20%20%20%20%20%20%20%3Cparam-value%3E%2FWEB-INF%2Fcontext%2FApplicationContext-*.xml%3C%2Fparam-value%3E%0A%3C%2Fcontext-param%3E%0A%3Cspan%20style%3D%22color%3A%20rgb(0%2C%200%2C%200)%3B%22%3E%3Clistener%3E%0A%20%20%20%20%20%20%20%20%3Clistener-class%3E%3Cspan%20style%3D%22background-color%3A%20rgb(255%2C%20102%2C%200)%3B%22%3Eorg.springframework.web.context.ContextLoaderListener%3C%2Fspan%3E%3C%2Flistener-class%3E%0A%3C%2Flistener%3E%3C%2Fspan%3E%0A" quality="high" allowscriptaccess="always" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>
  1. < context-param >   
  2.         < param-name > contextConfigLocation </ param-name >   
  3.         < param-value > /WEB-INF/context/ApplicationContext-*.xml </ param-value >   
  4. </ context-param >   
  5. < span   style = "color: rgb(0, 0, 0);" > < listener >   
  6.         < listener-class > < span   style = "background-color: rgb(255, 102, 0);" > org.springframework.web.context.ContextLoaderListener </ span > </ listener-class >   
  7. </ listener > </ span >   
<context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/context/ApplicationContext-*.xml</param-value>
</context-param>
<listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>

   检查spring配置管理xml文件。发现错误产生在:

 

Xml代码 复制代码
  1. < bean   id = "dataSource"   class =" < SPAN  style=" COLOR : #000000; BACKGROUND-COLOR: #ff6600" > org.apache.commons.dbcp.BasicDataSource </ SPAN > " >   
  2.      < property   name = "driverClassName"   value = "oracle.jdbc.driver.OracleDriver" > </ property >   
  3.      < property   name = "url"   value = "jdbc:oracle:thin:@localhost:1521:orcl" > </ property >   
  4.      < property   name = "username"   value = "sys8" > </ property >   
  5.      < property   name = "password"   value = "sys8" > </ property >   
  6. </ bean >   
Xml代码 <embed type="application/x-shockwave-flash" width="14" height="15" src="http://pavel.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf" flashvars="clipboard=%3Cbean%20id%3D%22dataSource%22%20class%3D%22%3Cspan%20style%3D%22color%3A%20rgb(0%2C%200%2C%200)%3B%20background-color%3A%20rgb(255%2C%20102%2C%200)%3B%22%3Eorg.apache.commons.dbcp.BasicDataSource%3C%2Fspan%3E%22%3E%0A%09%3Cproperty%20name%3D%22driverClassName%22%20value%3D%22oracle.jdbc.driver.OracleDriver%22%3E%3C%2Fproperty%3E%0A%09%3Cproperty%20name%3D%22url%22%20value%3D%22jdbc%3Aoracle%3Athin%3A%40localhost%3A1521%3Aorcl%22%3E%3C%2Fproperty%3E%0A%09%3Cproperty%20name%3D%22username%22%20value%3D%22sys8%22%3E%3C%2Fproperty%3E%0A%09%3Cproperty%20name%3D%22password%22%20value%3D%22sys8%22%3E%3C%2Fproperty%3E%0A%3C%2Fbean%3E" quality="high" allowscriptaccess="always" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>
  1. < bean   id = "dataSource"   class =" < span  style=" color : rgb(0, 0, 0); background-color: rgb(255, 102, 0);" > org.apache.commons.dbcp.BasicDataSource </ span > " >   
  2.     < property   name = "driverClassName"   value = "oracle.jdbc.driver.OracleDriver" > </ property >   
  3.     < property   name = "url"   value = "jdbc:oracle:thin:@localhost:1521:orcl" > </ property >   
  4.     < property   name = "username"   value = "sys8" > </ property >   
  5.     < property   name = "password"   value = "sys8" > </ property >   
  6. </ bean >   
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource
">
	<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"></property>
	<property name="url" value="jdbc:oracle:thin:@localhost:1521:orcl"></property>
	<property name="username" value="sys8"></property>
	<property name="password" value="sys8"></property>
</bean>

   上面所示的代码中,红色代码是产生错误的根源,在spring管理Hibernate的dataSource是用的是:

Java代码 复制代码
  1. <SPAN style= "COLOR: #000000" >org.springframework.jdbc.datasource.DriverManagerDataSource</SPAN>  
Java代码 <embed type="application/x-shockwave-flash" width="14" height="15" src="http://pavel.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf" flashvars="clipboard=%3Cspan%20style%3D%22color%3A%20rgb(0%2C%200%2C%200)%3B%22%3Eorg.springframework.jdbc.datasource.DriverManagerDataSource%3C%2Fspan%3E" quality="high" allowscriptaccess="always" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>
  1. <span style= "color: rgb(0, 0, 0);" >org.springframework.jdbc.datasource.DriverManagerDataSource</span>  
org.springframework.jdbc.datasource.DriverManagerDataSource

 

解决:

Xml代码 复制代码
  1. < bean   id = "dataSource"   class =" < SPAN  style=" BACKGROUND -COLOR: #ff6600" > org.springframework.jdbc.datasource.DriverManagerDataSource </ SPAN > " >   
  2.      < property   name = "driverClassName"   value = "oracle.jdbc.driver.OracleDriver" > </ property >   
  3.      < property   name = "url"   value = "jdbc:oracle:thin:@localhost:1521:orcl" > </ property >   
  4.      < property   name = "username"   value = "sys8" > </ property >   
  5.      < property   name = "password"   value = "sys8" > </ property >   
  6. </ bean >   

<script type="text/javascript">&lt;!-- google_ad_client = &quot;pub-4348265167276910&quot;; /* 468x60, 个人博客 */ google_ad_slot = &quot;2046406163&quot;; google_ad_width = 468; google_ad_height = 60; //--&gt; </script><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"> </script><script src="http://pagead2.googlesyndication.com/pagead/expansion_embed.js"></script><script src="http://googleads.g.doubleclick.net/pagead/test_domain.js"></script><script>google_protectAndRun(&quot;ads_core.google_render_ad&quot;, google_handleError, google_render_ad);</script>

分享到:
评论

相关推荐

    ssh框架的搭建

    &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt; &lt;/listener&gt; &lt;!-- Listener log4jConfigLocation --&gt; &lt;listener&gt; &lt;listener-class&gt;org.springframework.web....

    ssh整合word教程

    -- 配置Hibernate的SessionFactory,用于在Servlet容器启动时初始化SessionFactory对象 --&gt; &lt;listener&gt; &lt;listener-class&gt;org.springframework.orm.hibernate3.HibernateContextListener&lt;/listener-class&gt; &lt;/listener...

    生活轨迹SSH服务端

    &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt; &lt;!-- 默认找的文件名 --&gt; &lt;/listener&gt; &lt;!-- Context Configuration locations for Spring XML files --&gt; &lt;context...

    spring_MVC源码

    09. &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt; 10. &lt;/listener&gt; 11. 12. &lt;servlet&gt; 13. &lt;servlet-name&gt;spring&lt;/servlet-name&gt; 14. &lt;servlet-class&gt;org.spring...

    基于全注解方式的SSH基础框架

    &lt;listener-class&gt;org.springframework.web.util.Log4jConfigListener&lt;/listener-class&gt; &lt;/listener&gt; &lt;!-- Proxool 数据库连接池监听器 --&gt; &lt;listener&gt; &lt;listener-class&gt;org.chinasb.framework.core.db....

    java SSH 框架学习

    org.springframework.web.context.ContextLoaderListener &lt;/listener-class&gt; &lt;/listener&gt; &lt;!-- Struts2 ActionContext清理过滤器 --&gt; &lt;filter&gt; &lt;filter-name&gt;struts-cleanup&lt;/filter-name&gt; &lt;filter-class&gt; ...

    SSH整合配置.doc

    &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt; &lt;/listener&gt; ``` 3. **Hibernate配置**: - `hibernate.cfg.xml`:Hibernate的配置文件,包含数据库连接信息、实体类...

    java中SSH框架主要说明SSH各部分的作用

    &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt; &lt;/listener&gt; &lt;!-- 配置编码过滤器 --&gt; &lt;filter&gt; &lt;filter-name&gt;Spring character encoding filter&lt;/filter-name&gt; ...

    javaSSH框架搭建配置

    &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt; &lt;/listener&gt; &lt;context-param&gt; &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt; &lt;param-value&gt;classpath:...

    SSH框架整合

    &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt; &lt;/listener&gt; ``` 接着,集成Struts2。在项目中添加Struts2的库,包括struts2-core、struts2-spring-plugin等,以支持与...

    SSH与DWR框架整合

    &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt; &lt;/listener&gt; &lt;servlet&gt; &lt;servlet-name&gt;action&lt;/servlet-name&gt; &lt;servlet-class&gt;org.apache.struts.action.Action...

    ssh2+cxf搭建webservice实例

    &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt; &lt;/listener&gt; ... &lt;context-param&gt; &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt; &lt;param-value&gt;classpath:META-...

    SSH和SSI等框架常用基础配置web.xml

    &lt;filter-class&gt;org.springframework.web.filter.CharacterEncodingFilter&lt;/filter-class&gt; &lt;init-param&gt; &lt;param-name&gt;encoding&lt;/param-name&gt; &lt;param-value&gt;utf-8&lt;/param-value&gt; &lt;/init-param&gt; &lt;/filter&gt; &lt;filter...

    ssh基本配置过程,是struts2的

    &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt; &lt;/listener&gt; &lt;filter&gt; &lt;filter-name&gt;openSessionInViewFilter&lt;/filter-name&gt; &lt;filter-class&gt;org.springframework....

    SSH第7章上机.zip ACCP8.0

    &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt; &lt;/listener&gt; 在struts.xml中配置对象创建工具为spring &lt;constant name="struts.objectFactory" value="spring" /&gt;

    ssh配置文件

    &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt; &lt;/listener&gt; ``` - **字符集过滤器**:为了正确处理中文等非英文字符,需配置字符编码过滤器: ```xml &lt;filter&gt; ...

    ssh中struts2,spring,各配置说明

    &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt; &lt;/listener&gt; ``` 3. **字符编码过滤器**:确保请求和响应的字符编码一致,避免乱码问题。 ```xml &lt;filter&gt; &lt;filter-...

    SSH全注解环境搭建

    &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt; &lt;/listener&gt; ``` - 设置Spring上下文配置文件的位置: ```xml &lt;context-param&gt; &lt;param-name&gt;...

    ssh框架整合步骤

    org.springframework.web.context.ContextLoaderListener &lt;/listener-class&gt; &lt;/listener&gt; &lt;!-- Struts2 Filter Dispatcher --&gt; &lt;filter&gt; &lt;filter-name&gt;struts2&lt;/filter-name&gt; &lt;filter-class&gt; org.apache....

Global site tag (gtag.js) - Google Analytics