2010年11月25日

在IBM的JDK环境下进行JVM内存监控的问题

错误信息如下:
java.lang.NoClassDefFoundError: sun.management.ManagementFactory

处理:

sun.management.ManagementFactory替换成java.lang.management.ManagementFactory  

因为ibmjdk没有sun.management.ManagementFactory这个对象

posted @ 2010-11-25 12:01 JGAO编程随笔 阅读(535) | 评论 (0)编辑 收藏

oracel PreparedStatement的setString问题

错误信息如下:

超过最大长度限制

处理:

只能插入666个中文字符。


或者更新到最新的
oracle驱动包

posted @ 2010-11-25 12:00 JGAO编程随笔 阅读(244) | 评论 (0)编辑 收藏

servicemix部署到websphere中,需注意的问题

1derby.jar包可能冲突,需删除项目中的该包

2MBean调用问题

   Websphere的MBean注册路径包括cell,nodeName和processName,具体可以铜鼓jconsole连接来查看MBean注册的全路径。这三个值可以通过Websphere的com.ibm.websphere.management.AdminServiceFactory这个对象来获取,spring中的配置如下:
<!-- 用于获取websphereMBean名称的cell,node,process -->

<bean id="adminService" class="com.ibm.websphere.management.AdminServiceFactory" factory-method="getAdminService"/>

<bean id="adminService.cellName" class="org.springframework.beans.factory.config.PropertyPathFactoryBean"/>

<bean id="adminService.nodeName" class="org.springframework.beans.factory.config.PropertyPathFactoryBean"/>

<bean id="adminService.processName" class="org.springframework.beans.factory.config.PropertyPathFactoryBean"/>

<bean id="websphereNamingStrategy" class="com.des.engine.mbean.WebsphereNamingStrategy">

<property name="cellName" ref="adminService.cellName"/>

<property name="nodeName" ref="adminService.nodeName"/>

<property name="processName" ref="adminService.processName"/>

</bean>

WebsphereNamingStrategy为自己创建的对象就包括那三个属性

3:安全问题

出现如下错误,Caused by: javax.management.JMRuntimeException: ADMN0022E: 由于凭证不足或凭证为空,无法对 org.apache.servicemix:Name=ServiceMgtImpl,cell=dvpbNode02Cell,Type=SystemService,ContainerName=ServiceMix,node=dvpbNode02,process=server1 MBean  retrieveServiceList 操作进行访问。

    该问题是因为设置了安全控制,把控制台的【安全性->安全管理、应用程序和基础结构】里面的所以安全配置都去掉,然后重新启动服务器主机(注意是重启主机,不然安全设置不起作用),再启动websphere服务应该就可以了,还有就是servicemix的应用要跟websphere一起启动,不要等websphere启动后再到控制台启动

posted @ 2010-11-25 11:58 JGAO编程随笔 阅读(872) | 评论 (2)编辑 收藏

2009年6月23日

ResultSet内存溢出OutOfMemory问题

错误信息如下:

jdbc在操作oracle海量数据的时候用ResultSet获取所有的返回数据出现内存溢出

处理:
出错的原因是ResultSet用的是可滚动结果集,正常情况下ResultSet是指针指向数据库的数据,本身是不存储数据库的数据的,默认情况下就算是提交的sql能查询处上亿条的数据也是不消耗内存的,但是如果用的是可滚动结果集的ResultSet情况就不一样了,ORACLE 是不支持可滚动结果集的,那么我们用JDBC得到一个可滚动的结果集就是由JDBC自己支持的,也就是说结果集是要存放在内存中的,所以在海量数据的情况下也就是要消耗大量内存的,因此造成内存溢出也就是正常的了,所以如果是海量数据的话就不要用可滚动结果集就可以了。

posted @ 2009-06-23 21:19 JGAO编程随笔 阅读(2055) | 评论 (0)编辑 收藏

com.ibm.websphere.ce.cm.StaleConnectionException: [ibm][db2][jcc][t4][2030][11211] 检测到了通信错误

错误信息如下:

com.ibm.websphere.ce.cm.StaleConnectionException: [ibm][db2][jcc][t4][2030][11211]

检测到了通信错误。所使用的通信协议:TCP/IP"n所使用的通信 APISOCKETS

检测到错误的位置:Reply.fill()"n用于检测错误的通信功能:InputStream.read()

特定于协议的错误代码数据不足、 0。消息:null"n   

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)"n     

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:67)"n    at

sun.reflect.DelegatingConstructorAccessorImpl.newInstance

(DelegatingConstructorAccessorImpl.java:45)"n

at java.lang.reflect.Constructor.newInstance(Constructor.java:522)"n  

at com.ibm.websphere.rsadapter.GenericDataStoreHelper.mapExceptionHelper

(GenericDataStoreHelper.java:523)"n   

at com.ibm.websphere.rsadapter.GenericDataStoreHelper.mapException(GenericDataStoreHelper.java:578)"n      

at com.ibm.ws.rsadapter.jdbc.WSJdbcUtil.mapException(WSJdbcUtil.java:909)"n 

at com.ibm.ws.rsadapter.jdbc.WSJdbcStatement.executeQuery(WSJdbcStatement.java:898)"n   

at com.newland.bi.util.db.DBUtil.executeQuery(Unknown Source)"n

at com.newland.bi.util.db.DBUtil.executeSql(Unknown Source)"n     

at com.newland.bi.dao.jdbc.DaoImpl.executeQuery(DaoImpl.java:64)"n   

at com.newland.bi.service.report.exp.dao.ReportExpDao.getExpList(ReportExpDao.java:72)"n 

at com.newland.bi.service.report.exp.manage.ReportExpMgt.runExport(ReportExpMgt.java:91)"n   

at com.newland.bi.service.report.exp.servlet.ReportExp1Servlet$1.run(ReportExp1Servlet.java:97)"n      

at java.util.TimerThread.mainLoop(Timer.java:537)"n       at java.util.TimerThread.run(Timer.java:487)"n

处理:

出错的原因可能是防火墙问题,websphere应用服务器和数据库服务器之间是否存在防火墙

防火墙是否会设置多久没活动的连接就自动断开掉,如果是这样的话就会有问题,因为websphere上面的数据库连接池可能有一段时间没连接而被防火墙断掉了

但对于连接池本身根本就不知道该连接是否还可用,所以web应用从连接池获取的连接可能就是已经断开的了,所以就可能会出现日记中的错误问题


 

posted @ 2009-06-23 21:14 JGAO编程随笔 阅读(7350) | 评论 (1)编辑 收藏

Timer.schedule和Timer.scheduleAtFixedRate的区别

schedulescheduleAtFixedRate的区别在于,如果指定开始执行的时间在当前系统运行时间之前,scheduleAtFixedRate会把已经过去的时间也作为周期执行,而schedule不会把过去的时间算上。

posted @ 2009-06-23 21:13 JGAO编程随笔 阅读(984) | 评论 (0)编辑 收藏

cxf找不到类org.apache.axis.soap.MessageFactoryImpl出错

 

错误信息如下:

Caused by: java.lang.ClassNotFoundException: org.apache.axis.soap.MessageFactoryImpl

    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)

    at java.security.AccessController.doPrivileged(Native Method)

    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)

    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)

    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)

    at javax.xml.soap.MessageFactory.newInstance(MessageFactory.java:50)

    ... 10 more

处理:

原因是调用了axis soap.MessageFactoryImpl,cxf应该用的是sun
     在注册安全拦截器之前执行下面代码就可以了

System.setProperty("javax.xml.soap.MessageFactory", "com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl");

posted @ 2009-06-23 21:10 JGAO编程随笔 阅读(1211) | 评论 (0)编辑 收藏

2008年11月23日

浏览器下载txt文件问题

我们写程序的时候可能会想用open或者<a>来下载一个txt文件,但我们会发现我们用浏览器下载这个txt文件的时候老是在浏览器里面直接打开了,而不是提示下载,这样的话如果txt文件的内容非常多的话肯定是不行的,可能就会导致浏览器挂掉,客户机器死机的问题
现整理了个解决办法,代码如下:

1.下载页面
open(action执行页面,'iframeName','');
2.action执行页面
<id="tempB" style="display:none" href="#" onclick="">&nbsp;</a>
<iframe width=0 height=0 id="hideIframe" name="hideIframe"></iframe>
<script>
    
var n=0;
    
function go(url){
        
        n
==0?new function()
        
{
            frames(
"hideIframe").location=url,n=1
        }
:null;
        
        document.all(
"hideIframe").readyState!="complete"?setTimeout(go,10):so();
        
        
function so()
        
{
            frames(
"hideIframe").document.execCommand("SaveAs"),n=0
        }
;
    }

    
    
var tempB = document.getElementById("tempB");
    
<%
        
if(path.toLowerCase().indexOf(".txt")>=0){
    
%>
    tempB.attachEvent('onclick',
function(){go('<%=request.getContextPath()+"/tempfile/1.txt">');});
    
<%
        }
else{
    
%>
    tempB.attachEvent('onclick',
function(){open('<%=request.getContextPath()+"/tempfile/1.xls">','','');});
    
<%
        }

    
%>
    tempB.click();
</script>


posted @ 2008-11-23 19:28 JGAO编程随笔 阅读(730) | 评论 (0)编辑 收藏

2008年8月23日

websphere部署war应用失败

websphere部署war应用失败正常原因是web.xml的节点定义循序问题,或者一些空格,字符原因造成的
可能先定义完所有的servlet后再定义所有的servlet mapping就没问题了

posted @ 2008-08-23 15:27 JGAO编程随笔 阅读(617) | 评论 (0)编辑 收藏

2008年6月26日

通过jsf事件转向后的页面中文乱码

那个转向后的页面已经有用gb2312的编码了
可能原因是在java类里面调用了((HttpServletResponse)FacesContext.getCurrentInstance().getExternalContext().getResponse()).getWriter().write("");
然后再转向某个页面,这样可能导致编码格式冲突,导致乱码
可以先给resonse设置下编码格式,然后在write
HttpServletResponse httpServletResponse = (HttpServletResponse)FacesContext.getCurrentInstance().getExternalContext().getResponse();
httpServletResponse.setContentType("text/html; charset=gb2312");
httpServletResponse.setCharacterEncoding("gb2312");
httpServletResponse.getWriter().write("");
这样应该就可以解决了

posted @ 2008-06-26 23:46 JGAO编程随笔 阅读(565) | 评论 (0)编辑 收藏

仅列出标题  下一页
<2024年4月>
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

导航

统计

常用链接

留言簿(1)

随笔档案

搜索

最新评论

阅读排行榜

评论排行榜