随笔 - 9  文章 - 4  trackbacks - 0
<2024年11月>
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

常用链接

留言簿

随笔档案

搜索

  •  

最新评论

阅读排行榜

评论排行榜

做一个web项目,启动tomcat时遇到了这样一个错误:

 严重: Exception loading sessions from persistent storage 
java.io.WriteAbortedException: writing aborted,java.io.NotSerializableException: ...

解决:对象要必须实现java.io.Serializable接口;

posted @ 2009-08-12 23:37 田园风光 阅读(418) | 评论 (0)编辑 收藏

信息: Illegal access: this web application instance has been stopped already.  Could not load java.net.BindException.  The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
 at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1244)
 at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
 at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
 at com.mysql.jdbc.CommunicationsException.<init>(CommunicationsException.java:155)
 at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:2723)

解决办法:
将tomcat的server.xml中的Context的reloadable设成false。
比如:<Context path="/expert" docBase="expert" debug="0" reloadable="false">

 

解决办法也容易,只要把tomcat的server.xml 中的reloadable="true" 改成false就行了,不过这样做就失去了热部署的优势了,对于开发不是很方便,干脆还是不改吧。这种错误不用理会.  

报错原理:

 

原因是因为在tomcat重启的时候,因为之前的tomcat中的线程还没有完全关闭,新启动tomcat就会报这个异常,不过这个不影响正常使用,只是跳个异常挺烦人的。使用过hibernate, spring或其他大型组件,当一个WEB应用系统中有很多类时,如果开启了Tomcat的reloadable=true,那么每当相关文件改变时, Tomcat会停止web app并释放内存,然后重新加载web app.这实在是个浩大的工程。所以我们总是在想如果能有只重载某几个类的功能,将极大的满足了我们的调试。


  当response.sendRedirect("xxxx");   时,而客户端关闭了浏览器,就会出这种错.    
  并非程序错误.

 

引自:http://blog.csdn.net/m232341339/archive/2008/11/01/3201104.aspx

posted @ 2009-07-26 01:26 田园风光 阅读(835) | 评论 (0)编辑 收藏

出现了错误异常:
信息: Illegal access: this web application instance has been stopped already.  Could not load java.net.BindException.  The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
 at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1273)
 at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
 at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
 at com.mysql.jdbc.SQLError.createLinkFailureMessageBasedOnHeuristics(SQLError.java:1220)
 at com.mysql.jdbc.CommunicationsException.<init>(CommunicationsException.java:51)
 at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1070)
 at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3270)
 at com.mysql.jdbc.MysqlIO.quit(MysqlIO.java:1659)
 at com.mysql.jdbc.ConnectionImpl.realClose(ConnectionImpl.java:4296)
 at com.mysql.jdbc.ConnectionImpl.cleanup(ConnectionImpl.java:1265)
 at com.mysql.jdbc.ConnectionImpl.finalize(ConnectionImpl.java:2667)
 at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
 at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:83)
 at java.lang.ref.Finalizer.access$100(Finalizer.java:14)
 at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:160)

在启动 tomcat ,并发布应用后没有问题,但是如果重新发布就出现如下异常:

this web application instance has been stopped already. Could not load java.net.BindException

this web application instance has been stopped already. Could not load com.mysql.jdbc

这是由于 MySQL JDBC 驱动放在应用的 WEB-INF\lib 目录下,在重新发布时其加载了两次,故只要将其拷贝到 TOMCAT_HOME%\lib 中即可解决该问题。

解决这两个异常可以将 MySQL 的驱动文件从 WEB-INF\lib 文件夹中移动到 %TOMCAT_HOME%\lib 中。


 

引自:http://www.blogjava.net/cmzy/archive/2009/03/25/261884.html
posted @ 2009-07-26 01:11 田园风光 阅读(951) | 评论 (0)编辑 收藏

出现的错误异常:
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V
Caused by: java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V

原因:spring和hibernate的包不兼容,asm.jar(hibernate)和asm-2.2.3.jar(spring)

解决办法:将asm-2.2.3.jar删除
posted @ 2009-07-26 00:16 田园风光 阅读(427) | 评论 (0)编辑 收藏

今天晚上把三个框架整合在一起出现了一些异常:
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
2009-7-25 0:31:38 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter struts2
[unknown location]
 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:835)
 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:131)
 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:100)
 at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:130)
 at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52)
 at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:395)
 at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:452)
 at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:205)
 at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
 at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
 at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
 at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3709)
 at org.apache.catalina.core.StandardContext.start(StandardContext.java:4363)
 at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
 at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
 at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
 at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926)
 at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889)
 at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
 at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
 at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
 at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
 at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
 at org.apache.catalina.core.StandardService.start(StandardService.java:516)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:585)
 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: Premature end of file. - [unknown location]
 at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:123)
 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:830)
 ... 34 more
Caused by: org.xml.sax.SAXParseException: Premature end of file.
 at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
 at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
 at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
 at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
 at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source)
 at org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown Source)
 at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
 at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
 at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
 at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
 at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
 at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
 at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:121)
 ... 35 more
2009-7-25 0:31:38 org.apache.catalina.core.StandardContext start
严重: Error filterStart
2009-7-25 0:31:38 org.apache.catalina.core.StandardContext start
严重: Context [/ssh] startup failed due to previous errors
2009-7-25 0:31:38 org.apache.catalina.core.ApplicationContext log

使用log4j.properties 提示错误信息
2009-07-25 01:02:05 [org.springframework.web.context.ContextLoader]-[INFO] Root WebApplicationContext: initialization started
 2009-07-25 01:02:05 [org.springframework.web.context.support.XmlWebApplicationContext]-[INFO] Refreshing org.springframework.web.context.support.XmlWebApplicationContext@19bd735: display name [Root WebApplicationContext]; startup date [Sat Jul 25 01:02:05 CST 2009]; root of context hierarchy
 2009-07-25 01:02:05 [org.springframework.beans.factory.xml.XmlBeanDefinitionReader]-[INFO] Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
 2009-07-25 01:02:06 [org.springframework.web.context.support.XmlWebApplicationContext]-[INFO] Bean factory for application context [org.springframework.web.context.support.XmlWebApplicationContext@19bd735]: org.springframework.beans.factory.support.DefaultListableBeanFactory@146df77
 2009-07-25 01:02:06 [org.springframework.beans.factory.support.DefaultListableBeanFactory]-[INFO] Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@146df77: defining beans []; root of factory hierarchy
 2009-07-25 01:02:06 [org.springframework.web.context.ContextLoader]-[INFO] Root WebApplicationContext: initialization completed in 1469 ms
 2009-07-25 01:02:07 [com.opensymphony.xwork2.config.providers.XmlConfigurationProvider]-[INFO] Parsing configuration file [struts-default.xml]
 2009-07-25 01:02:07 [com.opensymphony.xwork2.config.providers.XmlConfigurationProvider]-[INFO] Parsing configuration file [struts-plugin.xml]
 2009-07-25 01:02:07 [com.opensymphony.xwork2.util.DomHelper]-[FATAL] Premature end of file. at (null:-1:-1)
 org.xml.sax.SAXParseException: Premature end of file.
2009-07-25 01:02:07 [org.springframework.web.context.support.XmlWebApplicationContext]-[INFO] Closing org.springframework.web.context.support.XmlWebApplicationContext@19bd735: display name [Root WebApplicationContext]; startup date [Sat Jul 25 01:02:05 CST 2009]; root of context hierarchy
 2009-07-25 01:02:07 [org.springframework.beans.factory.support.DefaultListableBeanFactory]-[INFO] Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@146df77: defining beans []; root of factory hierarchy
 

因为自己没有把struts.xml的文件配置好,没有引入struts-default.xml的原因。

posted @ 2009-07-25 01:08 田园风光 阅读(1194) | 评论 (3)编辑 收藏
//取fck内容的长度
function GetLength(str)
{
    var oEditor = FCKeditorAPI.GetInstance(str) ;
    var checkContent= oEditor.EditorDocument ;
    var contentLength ;

    if ( document.all )       
    {
        contentLength= checkContent.body.innerText.trim().length ;
    }
    else                   
    {
        var r = checkContent.createRange() ;
        r.selectNodeContents( checkContent.body ) ;
        contentLength= r.toString().trim().length ;
    }
return contentLength
}  

//判断是不是为空
function CheckPost(){
    if(GetLength("content")<=0)    //content为FCKeditor在页面所设的名字
    {
        alert('请输入内容');       
        return false;
    }
}

//取fck内容
function GetContent(str)
{
     var oEditor = FCKeditorAPI.GetInstance(str) ;
     return oEditor.GetXHTML();
}  

//去掉字符串的空格
String.prototype.trim = function()
{
             return this.replace(/(^[\s]*)|([\s]*$)/g, "");
}
posted @ 2009-07-23 19:37 田园风光 阅读(1229) | 评论 (1)编辑 收藏
在使用jstl标签的出现了这样的异常:java.lang.NoSuchFieldError: deferredExpression
原因是:在lib目录下出现了连个不同版本的jstl标签。
解决方法:把就版本的jstl删除就可以了啊!
posted @ 2009-07-18 22:29 田园风光 阅读(440) | 评论 (0)编辑 收藏

一、在项目中的配置:
             .在WebRoot/META-INF下建context.xml文件,注意必须在该目录下:                  
                  <?xml version="1.0" encoding="UTF-8"?>
                            <Context reloadable="true" crossContext="true">
                               <Resource
                                   name="jdbc/项目名" ---------------必须为项目名,否则会有异常
                                   auth="Container"---------------------该项为不变项
                                   type="javax.sql.DataSource"---------该项为不变项
                                  driverClassName="com.mysql.jdbc.Driver"------------数据库驱动名
                                  url="jdbc:mysql://localhost:3306/haotian?autoReconnect=true"---url
                                  username="root"---------------------------------------用户名
                                  password="root"----------------------------------------密码
                                  maxActive="10"   ----------------------------最大连接数
                                  maxIdle="5"     -------------------------------最大空闲连接数
                                  maxWait="-1"/>   ------------------最大等待毫秒数,-1为无限等待
                            </Context>
               在Tomcat6.0以后就不需要在web.xml中配置了:
                                 <resource-ref>
                                            <description>DB Connection</description>
                                             <res-ref-name>jdbc/blog</res-ref-name>
                                             <res-type>javax.sql.DataSource</res-type>
                                             <res-auth>Container</res-auth>
                                   </resource-ref>


二、配置过程中遇到的异常及解决方法:
      (1)org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
        解决方法:连接池的名字是name="jdbc/项目名"
     
      (2)org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver class 'com.mysql.jdbc.Driver'

        解决方法:必须把mysql的驱动包,拷贝到tomcat/lib目录下
   
     (3)javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
         这个异常可能是使用tomcat6版本以下,需要在项目的web.xml配置:
                                        <resource-ref>
                                            <description>DB Connection</description>
                                             <res-ref-name>jdbc/blog</res-ref-name>
                                             <res-type>javax.sql.DataSource</res-type>
                                             <res-auth>Container</res-auth>
                                   </resource-ref>

以上是个人在开发过程中遇到的异常,在参考网友提供解决及个人实践总结所得。

posted @ 2009-07-04 21:24 田园风光 阅读(547) | 评论 (0)编辑 收藏
仅列出标题