java 多线程遇到的问题,报java.lang.IllegalMonitorStateException 异常 [问题点数:20分,结帖人rmm0001]

Bbs1
本版专家分:20
结帖率 80%
Bbs1
本版专家分:20
Bbs10
本版专家分:114296
Blank
红花 2011年3月 Java大版内专家分月排行榜第一
2010年4月 Java大版内专家分月排行榜第一
2010年3月 Java大版内专家分月排行榜第一
2007年8月 Java大版内专家分月排行榜第一
Blank
黄花 2011年4月 Java大版内专家分月排行榜第二
2010年8月 Java大版内专家分月排行榜第二
2010年5月 Java大版内专家分月排行榜第二
2008年2月 Java大版内专家分月排行榜第二
2007年7月 Java大版内专家分月排行榜第二
Blank
蓝花 2011年2月 Java大版内专家分月排行榜第三
2010年9月 Java大版内专家分月排行榜第三
2008年9月 Java大版内专家分月排行榜第三
2008年1月 Java大版内专家分月排行榜第三
2007年11月 Java大版内专家分月排行榜第三
2007年9月 Java大版内专家分月排行榜第三
Bbs1
本版专家分:20
java多线程遇到问题
       用线程池开启五个线程处理list数组,每个数组处理20条数据,最终结果是最后一个线程的数据处理了五次,而其他四个线程中的数据自动消失了。查找原因是因为开启线程的时候没有new 一个新的runnable的子类,导致每次五个线程中的数据是共享的,所以前四个线程中的数据都修改为了最后一个线程中的数据。       开启<em>多线程</em>时,每次都要new一个runnable的子类。...
多线程使用堆内存报异常
请教下高手们,在<em>多线程</em>时是使用全局内存好还是使用堆内存好。rn因为是安全软件,因此领导要求尽量避免使用全局内存,但是程序频繁操作堆内存是否对稳定性有影响?rn面对这种<em>问题</em>该怎样处理好呢。rnrn<em>问题</em>是这样的,调试发现在线程里用New来一块内存有时失败或者报<em>异常</em>,后来把New加到同步之后也不行。rn实在郁闷的是,这一块是日志审计功能的。rn如果因为<em>异常</em>抛弃这个审计记录动作导致有些记录没审计到的话,用黎叔的话说:领导很生气,后果很严重。rnrn请求大家帮帮忙,传授下<em>多线程</em>经验。
shiro logout 多线程问题 报UnknownSessionException 异常
当用户登录后,页面会执行一个异步请求去请求数据,这个数据请求想对来说需要一定的时间,在返回视图之前,用户如果执行了退出操作,清空了session,等到数据请求完成数据包装返回视图的时候就会出现以下<em>异常</em>(个人分析是这样,毕竟一旦数据视图返回成功后退出就不报错了),请问有什么解决方案,以下是<em>异常</em>的内容rnrnrnrn八月 29, 2016 10:50:10 上午 org.apache.catalina.core.StandardWrapperValve invokern严重: Servlet.service() for servlet [dispatcher] in context with path [] threw exception [org.apache.shiro.session.UnknownSessionException: There is no session with id [93a508af-4f92-45d3-b474-1cabe4f221f7]] with root causernorg.apache.shiro.session.UnknownSessionException: There is no session with id [93a508af-4f92-45d3-b474-1cabe4f221f7]rn at org.apache.shiro.session.mgt.eis.AbstractSessionDAO.readSession(AbstractSessionDAO.<em>java</em>:170)rn at org.apache.shiro.session.mgt.DefaultSessionManager.retrieveSessionFromDataSource(DefaultSessionManager.<em>java</em>:236)rn at org.apache.shiro.session.mgt.DefaultSessionManager.retrieveSession(DefaultSessionManager.<em>java</em>:222)rn at org.apache.shiro.session.mgt.AbstractValidatingSessionManager.doGetSession(AbstractValidatingSessionManager.<em>java</em>:118)rn at org.apache.shiro.session.mgt.AbstractNativeSessionManager.lookupSession(AbstractNativeSessionManager.<em>java</em>:108)rn at org.apache.shiro.session.mgt.AbstractNativeSessionManager.lookupRequiredSession(AbstractNativeSessionManager.<em>java</em>:112)rn at org.apache.shiro.session.mgt.AbstractNativeSessionManager.getAttribute(AbstractNativeSessionManager.<em>java</em>:209)rn at org.apache.shiro.session.mgt.DelegatingSession.getAttribute(DelegatingSession.<em>java</em>:141)rn at org.apache.shiro.session.ProxiedSession.getAttribute(ProxiedSession.<em>java</em>:121)rn at org.apache.shiro.subject.support.DelegatingSubject.getRunAsPrincipalsStack(DelegatingSubject.<em>java</em>:469)rn at org.apache.shiro.subject.support.DelegatingSubject.getPrincipals(DelegatingSubject.<em>java</em>:153)rn at org.apache.shiro.subject.support.DelegatingSubject.getPrincipal(DelegatingSubject.<em>java</em>:149)rn at org.apache.shiro.web.servlet.ShiroHttpServletRequest.getSubjectPrincipal(ShiroHttpServletRequest.<em>java</em>:95)rn at org.apache.shiro.web.servlet.ShiroHttpServletRequest.getUserPrincipal(ShiroHttpServletRequest.<em>java</em>:111)rn at <em>java</em>x.servlet.http.HttpServletRequestWrapper.getUserPrincipal(HttpServletRequestWrapper.<em>java</em>:184)rn at org.springframework.web.servlet.FrameworkServlet.getUsernameForRequest(FrameworkServlet.<em>java</em>:1079)rn at org.springframework.web.servlet.FrameworkServlet.publishRequestHandledEvent(FrameworkServlet.<em>java</em>:1065)rn at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.<em>java</em>:996)rn at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.<em>java</em>:863)rn at <em>java</em>x.servlet.http.HttpServlet.service(HttpServlet.<em>java</em>:647)rn at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.<em>java</em>:837)rn at <em>java</em>x.servlet.http.HttpServlet.service(HttpServlet.<em>java</em>:728)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.<em>java</em>:305)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.<em>java</em>:210)rn at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.<em>java</em>:51)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.<em>java</em>:243)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.<em>java</em>:210)rn at com.hundsun.tzyj.web.filter.XssFilter.doFilter(XssFilter.<em>java</em>:21)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.<em>java</em>:243)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.<em>java</em>:210)rn at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.<em>java</em>:61)rn at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.<em>java</em>:108)rn at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.<em>java</em>:137)rn at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.<em>java</em>:125)rn at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.<em>java</em>:66)rn at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.<em>java</em>:449)rn at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.<em>java</em>:365)rn at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.<em>java</em>:90)rn at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.<em>java</em>:83)rn at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.<em>java</em>:383)rn at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.<em>java</em>:362)rn at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.<em>java</em>:125)rn at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.<em>java</em>:344)rn at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.<em>java</em>:261)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.<em>java</em>:243)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.<em>java</em>:210)rn at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.<em>java</em>:88)rn at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.<em>java</em>:108)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.<em>java</em>:243)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.<em>java</em>:210)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.<em>java</em>:222)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.<em>java</em>:123)rn at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.<em>java</em>:502)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.<em>java</em>:171)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.<em>java</em>:100)rn at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.<em>java</em>:953)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.<em>java</em>:118)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.<em>java</em>:408)rn at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.<em>java</em>:1041)rn at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.<em>java</em>:603)rn at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.<em>java</em>:312)rn at <em>java</em>.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.<em>java</em>:1142)rn at <em>java</em>.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.<em>java</em>:617)rn at <em>java</em>.lang.Thread.run(Thread.<em>java</em>:745)
java.lang.IllegalMonitorStateException错误
<em>java</em>.lang.IllegalMonitorStateExceptionrn违法的监控状态<em>异常</em>。当某个线程试图等待一个自己并不拥有的对象(O)的监控器或者通知其他线程等待该对象(O)的监控器时,抛出该<em>异常</em>。 rn这是网上的解释,我不是很明白,什么叫“自己并不拥有的对象”,我是在一个对象调用wait();在另一个对象调用notifyAll()
java多线程遇到问题总结
1、当有全局性的参数的时候,需要为每个线程单独深度复制一个参数对象,不然在一个线程中对参数的修改可能会影响其他线程中参数的值,而造成间歇性的错误,不容易排查;...
java多线程遇到的回调的问题
今天在用服务器处理excel上传的数据的时候<em>遇到</em>的<em>问题</em>。我的流程是一次读取excel里面900条数据,然后把900条数据保存在数据库中,这个操作完成之后再取下面的900条依次类推。这两步:取数据-存数据是两个线程,其中用一个boolean flag来判断存数据是否完成。rn这里就有<em>问题</em>:当我直接while(!flag);和while(!flag);时这个流程只能走一次,也就是只能取900条。让我在while里面加上打印语句之后就可以完整走完整个流程。rn请问诸位这是什么原因导致的?rn[code=<em>java</em>]rnclass saveDataClass implements Runnable rnrn private String tableName;//表名rn private List columnsTitle;//标题rn private ExcelRead er;//自己写的excel对象rn private boolean flag;rn rn public saveDataClass(String tableName, List columnsTitle, rn ExcelRead er) rn this.tableName = tableName;rn this.columnsTitle = columnsTitle;rn this.er = er;rn this.flag = false;rn rn rn @Overridern public void run() rn int start = 1;rn int size = 900;rn int sheetRowNum = er.getRowNum();//页的行数rn rn int count = sheetRowNum / 900;rn if (sheetRowNum % 900 > 0) rn count++;rn rn for (int i = 0; i < count; i++) rn int end = start + size;rn List list = er.readExcelByRowAndDelete(start, end);//获取一段excel中的数据rn Thread thread = new Thread(new MyThread(columnsTitle, list, tableName));//开始存数据rn thread.start();rn start = end;rn while(!flag) rn //logger.debug("");这里就有<em>问题</em>,加上打印语句就可以,不加就不行rn rn addFlag(false);rn rn rn rn public synchronized void addFlag(boolean flag) rn this.flag = flag;rn rn rn /**rn * 进行数据插入的并发类rn * @implements Runnablern * @author zcxrn *rn */rn class MyThread implements Runnable rnrn List columns;rn List data;rn String tableName;rn rn public MyThread(List columns, List data,rn String tableName) rn this.columns = columns;rn this.data = data;rn this.tableName = tableName;rn rn rn @Overridern public void run() rn /**rn * 数据存入数据库rn **/rn addFlag(true);rn rn rn rn rn rn[/code]
java多线程遇到的奇怪问题
public class TestThread1 rn public static void main(String args[]) rn Runner1 r = new Runner1();rn Thread t =new Thread(r);rn t.start();rn rn for(int i=0; i + i);rn rn rn rn去掉主程序输出中的 + i 线程不再交替执行rn不知道为什么,求解释
java笔记 异常 多线程
各方面搜集的 。有处理<em>异常</em>的,多态<em>问题</em>。。
java多线程异常的捕获
在<em>多线程</em>中,如果子线程抛出了<em>异常</em>,在main中并不能捕获到; 看一个例子 package _Executors; import <em>java</em>.util.concurrent.ExecutorService; import <em>java</em>.util.concurrent.Executors; public class ExceptionRunnable implements Runnable{ ...
Java 多线程异常捕捉
[code=&quot;<em>java</em>&quot;] package org.anicloud.concurrency; import <em>java</em>.util.concurrent.ExecutorService; import <em>java</em>.util.concurrent.Executors; import <em>java</em>.util.concurrent.ThreadFactory; /** * Created ...
java 遇到的各种异常
自己整理的在学习开发过程中<em>遇到</em>的<em>异常</em>及处理办法
java调用asmx报异常
下列是 SOAP 1.1 要求與回應的範例。預留位置顯示之處必須代入實際的值。rnrnPOST /MyGameMemberApp/MemberGetData.asmx HTTP/1.1rnHost: b2b.mygame.com.twrnContent-Type: text/xml; charset=utf-8rnContent-Length: lengthrnSOAPAction: "http://tempuri.org/GetMyCardMemberAuth"rnrnrnrn rn rn stringrn stringrn stringrn stringrn rn rnrnrnHTTP/1.1 200 OKrnContent-Type: text/xml; charset=utf-8rnContent-Length: lengthrnrnrnrn rn rn rn intrn stringrn stringrn rn rn rnrnrn以下是我的测试代码rnpackage hk.egame.port2.util;rnimport <em>java</em>x.xml.namespace.QName;rnimport org.apache.axis.client.Call;rnimport org.apache.axis.client.Service;rnpublic class HttpTest rn /**rn * @param argsrn */rn public static void main(String[] args) throws Exceptionrn // TODO Auto-generated method stubrn String service_url="http://************/MyGameMemberApp/MemberGetData.asmx";rn String method="GetMyCardMemberAuth";rn String factoryReturnUrl="www.baidu.com"; rn Service service = new Service();rn Call call = (Call) service.createCall();rn call.setTargetEndpointAddress(new <em>java</em>.net.URL(service_url));rn // 设置要调用的方法rn //We have to figure our the namespace. The <em>java</em> doesn't know where is the namespace rn call.setOperationName(new QName("http://tempuri.org/",method)); rn rn // 该方法需要的参数rn call.addParameter(new QName("http://tempuri.org/","FactoryId"),org.apache.axis.encoding.XMLType.XSD_STRING,<em>java</em>x.xml.rpc.ParameterMode.IN);rn call.addParameter(new QName("http://tempuri.org/","GameId"),org.apache.axis.encoding.XMLType.XSD_STRING,<em>java</em>x.xml.rpc.ParameterMode.IN);rn call.addParameter(new QName("http://tempuri.org/","FactoryServiceId"),org.apache.axis.encoding.XMLType.XSD_STRING,<em>java</em>x.xml.rpc.ParameterMode.IN);rn call.addParameter(new QName("http://tempuri.org/","FactoryReturnUrl"),org.apache.axis.encoding.XMLType.XSD_STRING,<em>java</em>x.xml.rpc.ParameterMode.IN);rn rn // 方法的返回值类型rn call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);rn call.setUseSOAPAction(true);rn call.setSOAPActionURI("http://tempuri.org/GetMyCardMemberAuth");rn //call.setSOAPActionURI(service_url);rn rn // 调用该方法, new Object[] CustNo, passwd, Jobno为参数列表rn rn String xmlStr = call.invoke(new Object[] "xiaonei", "smzt", "MFSD000310","www.baidu.com").toString();rn rn System.out.println(xmlStr);rn rnrnrnrnrn以下是返回的<em>异常</em>rnhttp://xml.apache.org/axis/stackTrace:org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.rn at org.apache.axis.encoding.ser.SimpleDeserializer.onStartChild(SimpleDeserializer.<em>java</em>:145)rn at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.<em>java</em>:1035)rn at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.<em>java</em>:165)rn at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.<em>java</em>:1141)rn at org.apache.axis.message.RPCElement.deserialize(RPCElement.<em>java</em>:236)rn at org.apache.axis.message.RPCElement.getParams(RPCElement.<em>java</em>:384)rn at org.apache.axis.client.Call.invoke(Call.<em>java</em>:2467)rn at org.apache.axis.client.Call.invoke(Call.<em>java</em>:2366)rn at org.apache.axis.client.Call.invoke(Call.<em>java</em>:1812)rn at hk.egame.port2.util.HttpTest.main(HttpTest.<em>java</em>:56)rnrn http://xml.apache.org/axis/hostname:Srnrn请问谁做过这方面的调用,求帮忙rnrnrnrnrnrnrnrnrnrn
java读取db.properties报异常
db.properties这个文件我想放在src目录下,现在一运行这个Test类在p.load(is);这句就报<em>异常</em>了;rndb.propertiesrn[code="<em>java</em>"]rnDRIVER=com.microsoft.sqlserver.jdbc.SQLServerDriverrnusername=sarnpassword=sasarnurl=jdbc\:sqlserver\://localhost\:1433;DatabaseName\=Wss[/code]rn[code="<em>java</em>"]rnimport <em>java</em>.io.InputStream;rnimport <em>java</em>.sql.Connection;rnimport <em>java</em>.sql.DriverManager;rnimport <em>java</em>.util.Properties;rnrnpublic class Test rn private static Connection conn = null;rn String sDbDriver = null;rn String sConnection = null;rn String sUser = null;rn String sPassword = null;rn rn public void CreateConn()rn tryrn InputStream is = getClass().getResourceAsStream("/db.properties");rn Properties p = new Properties();rn p.load(is);rn sDbDriver = p.getProperty("DBDriver",sDbDriver);rn System.out.println(sDbDriver);rn rn sConnection = p.getProperty("Connection", sConnection);rn sUser = p.getProperty("username",sUser);rn sPassword = p.getProperty("password",sPassword);rn Properties pr = new Properties();rn pr.put("user", sUser);rn pr.put("password", sPassword);rn pr.put("characterEncoding", "GB2312");rn pr.put("userUnicode", "TRUE");rn rn Class.forName(sDbDriver).newInstance();rn conn = DriverManager.getConnection(sConnection,pr);rn System.out.println("数据库连接成功!");rn catch(Exception ex)rn System.out.println("conn bad!");rn ex.printStackTrace();rn rn rn rn public static void main(String[] args)rn Test dbc = new Test();rn tryrn dbc.CreateConn();rn catch(Exception e)rn e.printStackTrace();rn rn rnrn[/code]rn报错信息rn[code="<em>java</em>"]rnconn bad!rn<em>java</em>.lang.NullPointerExceptionrn at <em>java</em>.util.Properties$LineReader.readLine(Properties.<em>java</em>:418)rn at <em>java</em>.util.Properties.load0(Properties.<em>java</em>:337)rn at <em>java</em>.util.Properties.load(Properties.<em>java</em>:325)rn at com.db.Test.CreateConn(Test.<em>java</em>:19)rn at com.db.Test.main(Test.<em>java</em>:44)rn[/code]
java类型转换防止报异常
将字符串转换为整形时: 代码如下(会报错):String count = ""; int result = Integer.parseInt(count); System.out.println("转换结果为"+result);执行结果(错误日志):Exception in thread "main" <em>java</em>.lang.NumberFormatException: For input strin
Java调用Oracle数据库报异常
调用代码如下:rnimport <em>java</em>.sql.*;rnclass MyOracle rnpublic static void main(String args[]) rntry rnDriverManager.registerDriver( new oracle.jdbc.driver.OracleDriver()); rnString url="jdbc: oracle:thin: @127.0.0.1:5500: orcl"; rnConnection conn=DriverManager.getConnection(url,"user1","pass1"); rnCallableStatement c= conn.prepareCall("call sumeng(?,?)");rnc.setString(1,"13");rnc.setString(2, "xiaomao");rnc.execute();rnconn.close(); rncatch(Exception ex)rnSystem.out.println(ex); rnSystem.exit(0); rn rn rn报的<em>异常</em>为<em>java</em>.sql.SQLException: Io <em>异常</em>: Bad packet typern不知道是什么原因,想高手请教~~
异常 Java WEB项目 遇到项目报红色大感叹号
2018/7/4 编写一个<em>java</em> web项目时<em>遇到</em>项目报大红色感叹号,就是这样: 报错原因:jar包报错 本人解决方法: 1.右击项目名 &gt; Build Path &gt; Configure Build Path 2. Java Build Path &gt; Libraries , 找到报错的jar包,选中 &gt; Remove &gt; ok,即可 ...
Java多线程问题--停止线程的方法:异常
本文内容部分引自《Java<em>多线程</em>编程核心技术》,感谢作者!!! 代码地址:https://github.com/xianzhixianzhixian/thread.git 停止线程的方法有以下几种 1、<em>异常</em>法:通过抛出<em>异常</em>来跳出正在运行的线程,在catch块中可以将<em>异常</em>向上层抛出,线程的停止事件得以传播。 2、沉睡法:通过Thread.sleep()一个很长的时间,让线程抛出<em>java</em>.la...
Java 多线程 竞争造成的异常
初始状态, 未使用线程同步机制,造成错误。package com.kunpengku;import <em>java</em>.util.Random; import <em>java</em>.util.Stack;public class Welcome { public static Stack abc = new Stack(); public static void main(String[]
Java学习--异常多线程和输入输出流
深入理解<em>java</em>:<em>异常</em>、<em>多线程</em>和输入流输出1 <em>异常</em>:不断抛出<em>异常</em>,直到有一对try..catch..捕捉到<em>异常</em>清晰区分了业务代码(正常情况下)和<em>异常</em>代码 基本语法 try{ // //之后的代码不在执行 }catch(){ // e.printStackTrace();
Java多线程-捕获线程异常
主线程不能捕获到子线程的运行时<em>异常</em>RuntimeException。import <em>java</em>.util.concurrent.ExecutorService; import <em>java</em>.util.concurrent.Executors;public class ExeceptionThread implements Runnable { @Override public void ru
java多线程——线程组和未处理的异常
<em>java</em>使用ThreadGroup来表示线程组,它可以对一批线程进行分类管理,如果没有显示制定线程所属的线程组,则该线程归属于默认线程组。同时,在默认情况下,子线程与创建它的线程归属于同一线程组,一旦一个线程加入某个线程组后,该线程一直属于这个线程组,运行中不能改变,直至线程死亡。 为线程设置线程组 Thread类提供了几个构造器来设置新创建的线程属于哪个线程组: Thread(Thread...
工作中遇到问题异常
今天在工作中执行项目的时候<em>遇到</em>了一个<em>异常</em> 1.<em>java</em>.lang.StringIndexOutofBoundException:String index out of range:4 <em>异常</em>的原因是:表示越界了,你的字符串没有这么大的长度。 2.在equals中添加参数需要加引号,不加引号 不会报错但是不会之执行这段代码。之前没有注意过这个<em>问题</em>,经过这次<em>遇到</em>这个<em>问题</em>之后,以后会注意这个<em>问题</em>的。
java多线程高并发下的oracle数据库异常
代码的功能是生成一个随机的序列化的订单号,正常的情况下一个一个跑没<em>问题</em>,在进行压力测试的时候,<em>多线程</em>高并发下,oracle的create语句就会报错,说是rn<em>java</em>.lang.RuntimeException: org.springframework.jdbc.BadSqlGrammarException: ConnectionCallback; bad SQL grammar []; nested exception is <em>java</em>.sqlSQLException: ORA-00955: 名称已由现有对象使用rn求大神看下。rn代码如下:rnrnrn```rn package utils.spring;rnrnimport org.springframework.beans.factory.InitializingBean;rnimport org.springframework.beans.factory.annotation.Autowired;rnimport org.springframework.boot.context.properties.ConfigurationProperties;rnimport org.springframework.dao.DataAccessException;rnimport org.springframework.jdbc.core.ConnectionCallback;rnimport org.springframework.jdbc.core.JdbcTemplate;rnimport org.springframework.jdbc.core.PreparedStatementCallback;rnimport org.springframework.stereotype.Component;rnimport org.springframework.transaction.PlatformTransactionManager;rnimport org.springframework.transaction.TransactionStatus;rnimport org.springframework.transaction.support.TransactionCallback;rnimport org.springframework.transaction.support.TransactionTemplate;rnimport utils.Lang;rnrnimport <em>java</em>x.sql.DataSource;rnimport <em>java</em>.sql.*;rnimport <em>java</em>.util.Map;rnimport <em>java</em>.util.concurrent.ConcurrentHashMap;rnrn/**rn * 序列发生器(可用于高并发、可回收等场景)rn *rn * @author lujijiangrn *rn */rn@Componentrn@ConfigurationProperties(prefix = "seqGenerator")rnfinal public class SequenceGenerator implements InitializingBean rnrn interface Atom rn T atom(Connection connection) throws Exception;rn rnrn public static T atom(Connection connection, Atom atom)rn throws Exception rn connection.setAutoCommit(false);rn connectionrn .setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);rn try rn T obj = atom.atom(connection);rn connection.commit();rn return obj;rn catch (Exception e) rn connection.rollback();rn throw e;rn rn rnrn static Map createSqlMap = new ConcurrentHashMap();rn static rn createSqlMaprn .put("h2",rn "CREATE TABLE %s (v$key BIGINT NOT NULL,v$key$ varchar(256),v$seq BIGINT NOT NULL,v$state CHAR(1) NOT NULL, PRIMARY KEY (v$key,v$seq))");rn createSqlMaprn .put("mysql",rn "CREATE TABLE %s (v$key BIGINT NOT NULL,v$key$ varchar(256),v$seq BIGINT NOT NULL,v$state CHAR(1) NOT NULL, PRIMARY KEY (v$key,v$seq))");rn createSqlMaprn .put("informix",rn "CREATE TABLE %s (v$key DECIMAL(16,0) NOT NULL,v$key$ varchar(256),v$seq DECIMAL(16,0) NOT NULL,v$state CHAR(1) NOT NULL, PRIMARY KEY (v$key,v$seq))");rn createSqlMaprn .put("oracle",rn "CREATE TABLE %s (v$key NUMBER(16,0) NOT NULL,v$key$ varchar2(256),v$seq NUMBER(16,0) NOT NULL,v$state CHAR(1) NOT NULL, PRIMARY KEY (v$key,v$seq))");rn rnrn static Map insertSqlMap = new ConcurrentHashMap();rn static rn insertSqlMaprn .put("h2",rn "insert into %s(v$key,v$key$,v$seq,v$state) values(%d,'%s',(select ifnull(max(t.v$seq),%d)+%d from %s t where t.v$key=%d),'1')");rn insertSqlMaprn .put("mysql",rn "insert into %s(v$key,v$key$,v$seq,v$state) values(%d,'%s',(select ifnull(max(t.v$seq),%d)+%d from %s t where t.v$key=%d),'1')");rn insertSqlMaprn .put("informix",rn "insert into %s(v$key,v$key$,v$seq,v$state) values(%d,'%s',(select nvl(max(t.v$seq),%d)+%d from %s t where t.v$key=%d),'1')");rn insertSqlMaprn .put("oracle",rn "insert into %s(v$key,v$key$,v$seq,v$state) values(%d,'%s',(select nvl(max(t.v$seq),%d)+%d from %s t where t.v$key=%d),'1')");rn rn /**rn * 事务模版rn */rn TransactionTemplate transactionTemplate;rn /**rn * 是否使用新事务rn */rn boolean newTransaction = true;rn /**rn * JDBC模版rn */rn JdbcTemplate jdbcTemplate;rnrn /**rn * 尝试次数(默认10次)rn */rn int tryTime = 10;rnrn /**rn * 数据库类型rn */rn String databaseType;rn /**rn * 表名rn */rn private String tableName;rnrn /**rn * 容量rn */rn private int capacity = 25;rnrn /**rn * 步进rn */rn private int step = 1;rn /**rn * 是否可回收序列号rn */rn protected boolean recyclable;rnrn @Autowiredrn public void setTransactionManager(rn PlatformTransactionManager transactionManager) rn if (transactionManager != null) rn transactionTemplate = new TransactionTemplate(transactionManager);rn transactionTemplatern .setIsolationLevel(TransactionTemplate.ISOLATION_READ_COMMITTED);rn transactionTemplatern .setPropagationBehavior(TransactionTemplate.PROPAGATION_REQUIRED);rn rn rnrn public boolean isNewTransaction() rn return newTransaction;rn rnrn public void setNewTransaction(boolean newTransaction) rn this.newTransaction = newTransaction;rn rnrn public TransactionTemplate getTransactionTemplate() rn return transactionTemplate;rn rnrn public void setJdbcTemplate(JdbcTemplate jdbcTemplate) rn this.jdbcTemplate = jdbcTemplate;rn rnrn @Autowiredrn public void setDataSource(DataSource dataSource) rn if (jdbcTemplate == null) rn jdbcTemplate = new JdbcTemplate(dataSource);rn rn rnrn public void setTransactionTemplate(TransactionTemplate transactionTemplate) rn this.transactionTemplate = transactionTemplate;rn rnrn public void setTryTime(int tryTime) rn this.tryTime = tryTime;rn rnrn public void setDatabaseType(String databaseType) rn if (databaseType != null) rn databaseType = databaseType.trim().toLowerCase();rn this.databaseType = databaseType;rn rn rnrn public void setTableName(String tableName) rn this.tableName = tableName == null ? null : tableName.trim();rn rnrn public void setCapacity(int capacity) rn this.capacity = capacity;rn rnrn public void setStep(int step) rn this.step = step < 1 ? 1 : step;rn rnrn public void setRecyclable(boolean recyclable) rn this.recyclable = recyclable;rn rnrn /**rn * 创建序列rn *rn * @param namern * @param lengthrn * @param startrn * @returnrn */rn public String generateSequence(String name, int length, long start) rn final long key = generateKey(name);rn try rn return generateSequence(key, length, start, name);rn catch (Throwable t) rn createSequenceTable();//错误就是定位在这里rn int time = tryTime >= 0 ? tryTime : 10000;rn while (time-- > 0) rn try rn return generateSequence(key, length, start, name);rn catch (Throwable e) rnrn rn rn throw new RuntimeException("Generate sequence failure", t);rn rn rnrn private long generateKey(String name) rn return 10000000000L + name.trim().hashCode();rn rnrn /**rn * 创建序列rn *rn * @param keyrn * @param lengthrn * @returnrn */rn public String generateSequence(String key, int length) rn return generateSequence(key, length, 0);rn rnrn /**rn * 创建序列rn *rn * @param keyrn * @returnrn */rn public String generateSequence(String key) rn return generateSequence(key, 6);rn rnrn private synchronized void createSequenceTable() rn try rn jdbcTemplate.execute(new ConnectionCallback() rnrn public Integer doInConnection(Connection connection)rn throws SQLException, DataAccessException rn ResultSet rs = connection.getMetaData().getTables(null,rn null, tableName, null);rn try rn while (rs.next()) rn return 1;rn rn finally rn rs.close();rn rn String createSql = String.format(rn createSqlMap.get(databaseType), tableName);rn Statement statement = connection.createStatement();rn try rn statement.execute(createSql);//错误就是定位在这里rn finally rn statement.close();rn rn return 0;rn rn );rn catch (Throwable t) rn throw new RuntimeException(t);rn rn rnrn private String generateSequence(final long key, final int length,rn final long start, final String name) rn if (newTransaction) rn try rn Connection connection = jdbcTemplate.getDataSource()rn .getConnection();rn try rn return atom(connection, new Atom() rnrn @Overridern public String atom(Connection connection)rn throws Exception rn if (recyclable) rn String no = getRecoveredSequence(connection,rn key, length);rn if (no != null) rn return no;rn rn rn Statement statement = connection.createStatement();rn try rn String insertSql = String.format(insertSqlMaprn .get(databaseType), tableName, key,rn name.replace("'", "''"), start < 0 ? 0rn : start, step, tableName, key);rn execute(connection, insertSql);rn String querySql = Stringrn .format("select max(v$seq) from %s where v$key=%d and v$state='1'",rn tableName, key);rn ResultSet rs = statement.executeQuery(querySql);rn try rn while (rs.next()) rn Long max = rs.getLong(1);rn if (max < start) // 重新初始化rn String deleteSql = Stringrn .format("delete from %s where v$key=%d and v$state='1'",rn tableName, key);rn execute(connection, deleteSql);rn insertSql = String.format(rn insertSqlMaprn .get(databaseType),rn tableName, key,rn name.replace("'", "''"),rn start < 0 ? 0 : start,rn step, tableName, key);rn execute(connection, insertSql);rn return fillLeftZero(start, length);rn rn if (capacity > 0 && max % capacity == 0) rn String deleteSql = Stringrn .format("delete from %s where v$key=%d and v$seq<>%d and v$state='1'",rn tableName, key, max);rn execute(connection, deleteSql);rn rn return fillLeftZero(max, length);rn rn finally rn rs.close();rn rn finally rn statement.close();rn rn throw new IllegalStateException(rn SequenceGenerator.this.getClass()rn .getSimpleName()rn + "无法获取单号,不可能发生的<em>异常</em>");rn rn );rn finally rn connection.close();rn rn catch (Exception e) rn throw Lang.unchecked(e);rn rn rn return getTransactionTemplate().execute(rn new TransactionCallback() rn public String doInTransaction(TransactionStatus ts) rn try rn if (recyclable) rn String no = jdbcTemplatern .execute(new ConnectionCallback() rn public String doInConnection(rn Connection connection)rn throws SQLException,rn DataAccessException rn return getRecoveredSequence(rn connection, key, length);rn rn );rn if (no != null) rn return no;rn rn rn String insertSql = String.format(insertSqlMaprn .get(databaseType), tableName, key, namern .replace("'", "''"), start < 0 ? 0 : start,rn step, tableName, key);rn execute(insertSql);rn String querySql = Stringrn .format("select max(v$seq) from %s where v$key=%d and v$state='1'",rn tableName, key);rn Long max = jdbcTemplate.queryForObject(querySql,rn Long.class);rn if (max < start) // 重新初始化rn String deleteSql = Stringrn .format("delete from %s where v$key=%d and v$state='1'",rn tableName, key);rn execute(deleteSql);rn insertSql = String.format(insertSqlMaprn .get(databaseType), tableName, key,rn name.replace("'", "''"), start < 0 ? 0rn : start, step, tableName, key);rn execute(insertSql);rn return fillLeftZero(start, length);rn rn if (capacity > 0 && max % capacity == 0) rn String deleteSql = Stringrn .format("delete from %s where v$key=%d and v$seq<>%d and v$state='1'",rn tableName, key, max);rn execute(deleteSql);rn rn return fillLeftZero(max, length);rn catch (Throwable t) rn ts.isRollbackOnly();rn throw new RuntimeException(t);rn rn rn );rn rnrn /**rn * 参数化执行SQLrn *rn * @param sqlrn * @param argsrn * @returnrn */rn protected int execute(String sql, final Object... args) rn return jdbcTemplate.execute(sql,rn new PreparedStatementCallback() rn public Integer doInPreparedStatement(PreparedStatement ps)rn throws SQLException, DataAccessException rn if (args != null) rn for (int i = 0; i < args.length; i++) rn ps.setObject(i + 1, args[i]);rn rn rn return ps.executeUpdate();rn rn );rn rnrn /**rn * 参数化执行SQLrn *rn * @param sqlrn * @param argsrn * @returnrn * @throws SQLExceptionrn */rn protected int execute(Connection conn, String sql, final Object... args)rn throws SQLException rn PreparedStatement ps = conn.prepareStatement(sql);rn try rn if (args != null) rn for (int i = 0; i < args.length; i++) rn ps.setObject(i + 1, args[i]);rn rn rn return ps.executeUpdate();rn finally rn ps.close();rn rn rnrn protected String fillLeftZero(Long max, int length) rn StringBuilder sb = new StringBuilder();rn sb.append(max);rn if (sb.length() >= length) rn return sb.substring(sb.length() - length);rn else rn for (int i = sb.length(); i < length; i++) rn sb.insert(0, '0');rn rn rn return sb.toString();rn rnrn /**rn * 获取已回收的序列rn *rn * @param connectionrn * @param keyrn * @throws SQLExceptionrn */rn protected String getRecoveredSequence(Connection connection, long key,rn int length) throws SQLException rn Statement statement = connection.createStatement(rn ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);rn try rn String querySql = Stringrn .format("select v$key,v$seq,v$state from %s where v$key = %d and v$state<>'1' for update",rn tableName, key);rn statement.executeQuery(querySql);rn querySql = Stringrn .format("select v$key,v$seq,v$state from %s where v$key = %d and v$state<>'1' order by v$seq asc",rn tableName, key);rn ResultSet rs = statement.executeQuery(querySql);rn try rn while (rs.next()) rn try rn Long min = rs.getLong(2);rn rs.updateString(3, "1");rn rs.updateRow();rn return fillLeftZero(min, length);rn catch (Throwable ex) rn rn rn finally rn rs.close();rn rn finally rn statement.close();rn rn return null;rn rnrn /**rn * 回收序列号rn *rn * @param namern * @param sequencern */rn public void recoveredSequence(final String name, final String sequence) rn final long key = generateKey(name);rn final long seq = Long.valueOf(sequence);rn if (newTransaction) rn try rn Connection connection = jdbcTemplate.getDataSource()rn .getConnection();rn try rn atom(connection, new Atom() rn public Object atom(Connection connection)rn throws Exception rn String updateSql = Stringrn .format("update %s set v$state='0' where v$key=%d and v$seq=%d",rn tableName, key, seq);rn int count = execute(connection, updateSql);rn if (count == 0) rn String insertSql = Stringrn .format("insert into %s(v$key,v$key$,v$seq,v$state) values(%d,'%s',%d,'0')",rn tableName, key,rn name.replace("'", "''"), seq);rn execute(connection, insertSql);rn rn return null;rn rn );rn connection.commit();rn finally rn connection.close();rn rn catch (Exception e) rn throw Lang.unchecked(e);rn rn else rn transactionTemplate.execute(new TransactionCallback() rn public Integer doInTransaction(TransactionStatus status) rn try rn String updateSql = Stringrn .format("update %s set v$state='0' where v$key=%d and v$seq=%d",rn tableName, key, seq);rn int count = execute(updateSql);rn if (count == 0) rn String insertSql = Stringrn .format("insert into %s(v$key,v$key$,v$seq,v$state) values(%d,'%s',%d,'0')",rn tableName, key,rn name.replace("'", "''"), seq);rn execute(insertSql);rn rn return null;rn catch (Throwable t) rn status.isRollbackOnly();rn throw new RuntimeException(t);rn rn rn );rn rn rnrn public void afterPropertiesSet() throws Exception rn if (this.databaseType == null) rn throw new IllegalArgumentException(String.format(rn "Property '%s' is required", "databaseType"));rn rn if (databaseType != null) rn if (!createSqlMap.containsKey(databaseType)) rn throw new IllegalStateException(String.format(rn "Unsupported database type:%s", databaseType));rn rn rn if (this.jdbcTemplate == null) rn throw new IllegalArgumentException(String.format(rn "Property '%s' or '%s' is required", "dataSource",rn "jdbcTemplate"));rn rn if (this.tableName == null) rn throw new IllegalArgumentException(String.format(rn "Property '%s' is required", "tableName"));rn rn if (!tableName.matches("[a-zA-Z_][a-zA-Z0-9_]*")rn || tableName.length() > 16) rn throw new IllegalStateException(String.format(rn "Illegal tableName:%s", tableName));rn rn if (!this.newTransaction) rn if (this.transactionTemplate == null) rn throw new IllegalArgumentException(String.format(rn "Property '%s' is required", "transactionManager"));rn rn rn rnrnrn```rn<em>java</em>.lang.RuntimeException: org.springframework.jdbc.BadSqlGrammarException: ConnectionCallback; bad SQL grammar []; nested exception is <em>java</em>.sql.SQLException: ORA-00955: 名称已由现有对象使用rnrn at utils.spring.SequenceGenerator.createSequenceTable(SequenceGenerator.<em>java</em>:272)rn at utils.spring.SequenceGenerator.generateSequence(SequenceGenerator.<em>java</em>:202)rn at utils.spring.SequenceGenerator.generateSequence(SequenceGenerator.<em>java</em>:227)rn at cart.service.service.OrderService.generateOrderNo(OrderService.<em>java</em>:806)rn at cart.service.service.OrderService.saveVirtualGoodsToOrder(OrderService.<em>java</em>:220)rn at cart.service.service.OrderService$$FastClassBySpringCGLIB$$19f99be7.invoke()rn at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.<em>java</em>:204)rn at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.<em>java</em>:720)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.<em>java</em>:157)rn at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.<em>java</em>:99)rn at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.<em>java</em>:281)rn at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.<em>java</em>:96)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.<em>java</em>:179)rn at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.<em>java</em>:655)rn at cart.service.service.OrderService$$EnhancerBySpringCGLIB$$feb8eef.saveVirtualGoodsToOrder()rn at cart.service.apiImpl.OrderMainApiImpl.saveVirtualGoodsToOrder(OrderMainApiImpl.<em>java</em>:223)rn at cart.service.apiImpl.OrderMainApiImpl$$FastClassBySpringCGLIB$$fa3518e.invoke()rn at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.<em>java</em>:204)rn at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.<em>java</em>:651)rn at cart.service.apiImpl.OrderMainApiImpl$$EnhancerBySpringCGLIB$$497f044.saveVirtualGoodsToOrder()rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.<em>java</em>:62)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.<em>java</em>:43)rn at <em>java</em>.lang.reflect.Method.invoke(Method.<em>java</em>:498)rn at com.weibo.api.motan.rpc.DefaultProvider.invoke(DefaultProvider.<em>java</em>:57)rn at com.weibo.api.motan.rpc.AbstractProvider.call(AbstractProvider.<em>java</em>:47)rn at com.weibo.api.motan.filter.AccessLogFilter.filter(AccessLogFilter.<em>java</em>:56)rn at com.weibo.api.motan.protocol.support.ProtocolFilterDecorator$2.call(ProtocolFilterDecorator.<em>java</em>:150)rn at utils.rpc.motan.filter.OpenEntityManagerInMotanFilter.filter(OpenEntityManagerInMotanFilter.<em>java</em>:171)rn at com.weibo.api.motan.protocol.support.ProtocolFilterDecorator$2.call(ProtocolFilterDecorator.<em>java</em>:150)rn at com.weibo.api.motan.transport.ProviderMessageRouter.call(ProviderMessageRouter.<em>java</em>:96)rn at com.weibo.api.motan.transport.ProviderProtectedMessageRouter.call(ProviderProtectedMessageRouter.<em>java</em>:79)rn at com.weibo.api.motan.transport.ProviderMessageRouter.handle(ProviderMessageRouter.<em>java</em>:91)rn at com.weibo.api.motan.transport.support.DefaultRpcHeartbeatFactory$HeartMessageHandleWrapper.handle(DefaultRpcHeartbeatFactory.<em>java</em>:82)rn at com.weibo.api.motan.transport.netty.NettyChannelHandler.processRequest(NettyChannelHandler.<em>java</em>:139)rn at com.weibo.api.motan.transport.netty.NettyChannelHandler.access$000(NettyChannelHandler.<em>java</em>:47)rn at com.weibo.api.motan.transport.netty.NettyChannelHandler$1.run(NettyChannelHandler.<em>java</em>:116)rn at <em>java</em>.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.<em>java</em>:1142)rn at <em>java</em>.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.<em>java</em>:617)rn at <em>java</em>.lang.Thread.run(Thread.<em>java</em>:745)rnCaused by: org.springframework.jdbc.BadSqlGrammarException: ConnectionCallback; bad SQL grammar []; nested exception is <em>java</em>.sql.SQLException: ORA-00955: 名称已由现有对象使用rnrn at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.<em>java</em>:99)rn at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.<em>java</em>:73)rn at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.<em>java</em>:81)rn at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.<em>java</em>:81)rn at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.<em>java</em>:360)rn at utils.spring.SequenceGenerator.createSequenceTable(SequenceGenerator.<em>java</em>:247)rn ... 39 morernCaused by: <em>java</em>.sql.SQLException: ORA-00955: 名称已由现有对象使用rnrn at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.<em>java</em>:112)rn at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.<em>java</em>:331)rn at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.<em>java</em>:288)rn at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.<em>java</em>:745)rn at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.<em>java</em>:210)rn at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.<em>java</em>:961)rn at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.<em>java</em>:1190)rn at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.<em>java</em>:1726)rn at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.<em>java</em>:1696)rn at utils.spring.SequenceGenerator$1.doInConnection(SequenceGenerator.<em>java</em>:264)rn at utils.spring.SequenceGenerator$1.doInConnection(SequenceGenerator.<em>java</em>:247)rn at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.<em>java</em>:353)rn ... 40 morernrnrn
java遇到的一些异常
<em>java</em> <em>异常</em>
JAVA中遇到的一些异常
Exception in thread “main” <em>java</em>.lang.StackOverflowError 栈溢出<em>问题</em>,原因在于我 new 的两个LoginJFrame() 之间相互引用了 Exception in thread “AWT-EventQueue-0” <em>java</em>.lang.NullPointerException 出现了空指针,原因在于我在为了持有整个重写的...
tuxedo服务端报异常问题
tpinit()成功,rn申请缓存成功,缓存区格式为FMLrn客户端调用tpcall()函数返回-1,tperrno=11rnrntuxedo服务端ULOG里的日志为service execute exception...rnrn客户端Tuxedo版本是7.1,服务端版本是8.1rnrn请问这种情况出现是不是因为客户端和服务端版本不一致造成的?
java 动态代理 遇到异常 StackOverflowError
在jdk中<em>遇到</em>了这个StackOverflowError<em>异常</em>。。。不知道你们<em>遇到</em>过没有。。。。rnrnpublic Object invoke(Object proxy, Method method, Object[] args)rn throws Throwable rn rn //System.out.println(proxy);//调用这个会出现StackOverflowError rn //System.out.println(proxy.getClass());//调用class文件的时候怎么又不出<em>异常</em>了rn method.invoke(obj, args);rn return null;rn rn有哪位高人知道为什么吗?讲下原因。谢谢
2-4-Java多线程-多线程异常
<em>多线程</em>的<em>异常</em>代码示例-1class DemoMul1 extends Thread{ private String name; public DemoMul1(String name) { this.name = name; } @Override public void run() { show(); try {
java几种常遇到异常
1.<em>java</em>.sql.SQLException: 索引中丢失  IN 或 OUT 参数     解决方案:核对SQL中属性名字个数和?个数,是否一致,是否跟数据库个数一致 2.<em>java</em>.lang.NoSuchMethodError: <em>java</em>x.servlet.jsp.JspFactory.getJspApplicationContext(L<em>java</em>x/servlet/ServletConte...
JAVA多线程Socket通信时遇到问题???
实验过程中,服务器和客户端都能连接上了,但是服务器就是收不到客户端发来的字符串。n![图片说明](https://img-ask.csdn.net/upload/201512/30/1451482301_784521.png)n再贴一下代码:n//Mult.<em>java</em>npackage t14_chapter;nimport <em>java</em>.io.*;nimport <em>java</em>.net.*;nclass Mult extends Threadn private Socket socket;n private BufferedReader in;n private PrintWriter out;n public Mult(Socket s)throws IOExceptionn socket =s;n in=new BufferedReader(new InputStreamReader(s.getInputStream()));n out=new PrintWriter(new OutputStreamWriter(s.getOutputStream()),true);n start();n n public void run() n tryn while(true)n String str=in.readLine();n //wait(1000);n if(str.equals("END"))n break;n System.out.println("Receiving and echoing:"+str);n out.println(str);n n System.out.println("closing...");n catch(IOException e)n finallyn tryn socket.close();n catch(IOException e)n n nnn//ServerSocketMult.<em>java</em>npackage t14_chapter;nimport <em>java</em>.io.*;nimport <em>java</em>.net.*;npublic class ServerSocketMult n static final int PORT=8080;n public static void main(String[] args)throws IOExceptionn ServerSocket s=new ServerSocket(PORT);n System.out.println("Server Startes");n tryn while(true)n Socket socket=s.accept();n System.out.println("Connection success!");n tryn new Mult(socket);n n catch(IOException e)n finallyn socket.close();n n n n catch(IOException e)n finallyn s.close();n n nnn//ClientSocketMultThread.<em>java</em>npackage t14_chapter;nimport <em>java</em>.io.*;nimport <em>java</em>.net.*;nclass ClientSocketMultThread extends Threadn private Socket socket;n private BufferedReader in;n private PrintWriter out;n private static int counter=0;n private int id=counter++;n private static int threadcount=0;n public static int threadCount()n return threadcount;n n public ClientSocketMultThread(InetAddress addr)n System.out.println("Making client"+id);n threadcount++;n tryn socket =new Socket(addr,ServerSocketMult.PORT);n catch(IOException e)n n n tryn in=new BufferedReader(new InputStreamReader(socket.getInputStream()));n out=new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())),true);n start();n catch(IOException e)n tryn socket.close();n catch(IOException e2)n n n n public void run()n tryn for(int i=0;i);n catch(IOException e)n finallyn tryn socket.close();n catch(IOException e)n threadcount--;n n nnn//ClientSocketMult.<em>java</em>npackage t14_chapter;nimport <em>java</em>.io.*;nimport <em>java</em>.net.*;npublic class ClientSocketMult n static final int MAX_THREADS=40;n public static void main(String[] args)throws IOException,InterruptedExceptionn InetAddress addr=InetAddress.getByName(null);n while(true)n if(ClientSocketMultThread.threadCount()
java笔试中常遇到多线程问题!
试编写一个<em>多线程</em>的程序.rn要求:启动4个线程.两个循环10次,每次将某全局变量加1,另两个循环10次,每次将此变量减1.请输出该变量的变化结果.rnrn各位大大看看怎样写才最好!
生产中遇到的Java多线程问题
1. <em>问题</em>场景:前几天一位同事分享了一段代码,这段代码在线上偶尔会报空指针<em>异常</em>,虽然是一个简单的NullPointerException,却是一个很不容易发现的<em>多线程</em><em>问题</em>导致的,我们一起先来看下代码(这是我复原的测试代码,并非和生产一致,但整体逻辑是一样的): public class TestSingleton {     private static volatile TestSingl...
JAVA中多线程遇到问题
有3个类rn1:MyFrame:rn[code="<em>java</em>"]import <em>java</em>.awt.event.ActionEvent;rnrnpublic class MyFrame extends <em>java</em>x.swing.JFrame rnrn private <em>java</em>.awt.Graphics g;rn private int x, y;rn private <em>java</em>.util.Random rand = new <em>java</em>.util.Random();rn public static MyThread mt;rn public static MyFrame mf = new MyFrame();rn public static int num = 3;rnrn public void init() rnrn this.setTitle("线程的暂停与继续");rn this.setSize(700, 700);rnrn this.setLayout(new <em>java</em>.awt.FlowLayout());rn // 添加开始按钮rn final <em>java</em>x.swing.JButton bu = new <em>java</em>x.swing.JButton("开始");rn this.add(bu);rn final <em>java</em>x.swing.JButton bu2 = new <em>java</em>x.swing.JButton("暂停");rn this.add(bu2);rn // 添加进度条rn final <em>java</em>x.swing.JProgressBar probar = new <em>java</em>x.swing.JProgressBar();rn this.add(probar);rnrn this.setDefaultCloseOperation(3);rn this.setLocationRelativeTo(null);rnrn this.setVisible(true);rn g = this.getGraphics();rn // 按钮1rn bu.addActionListener(new <em>java</em>.awt.event.ActionListener() rnrn public void actionPerformed(ActionEvent e) rn mt = new MyThread(probar);rn String str = new String();rn if ("开始".equals(e.getActionCommand())) rnrn for (int i = 0; i < num; i++) rn x = rand.nextInt(500) + 100;rn y = rand.nextInt(500) + 100;rn BallThread bt = new BallThread(mf, g, x, y);rn bt.start();rn rnrn mt.start();rn bu.setText("停止");rn rn if ("停止".equals(e.getActionCommand())) rn mt.stopThread();rn bu.setText("重新开始");rn bu2.setText("暂停");rn rn if ("重新开始".equals(e.getActionCommand())) rn mt.restart();rn mt.start();rn for (int i = 0; i < num; i++) rn x = rand.nextInt(500) + 100;rn y = rand.nextInt(500) + 100;rn BallThread bt = new BallThread(mf, g, x, y);rn bt.start();rn rn bu.setText("停止");rn rnrn rnrn );rn // 按钮2rn bu2.addActionListener(new <em>java</em>.awt.event.ActionListener() rnrn public void actionPerformed(ActionEvent e) rn String str = new String();rn if ("暂停".equals(e.getActionCommand())) rn mt.pauseThread();rn bu2.setText("继续");rn rn if ("继续".equals(e.getActionCommand())) rn mt.continueThread();rn bu2.setText("暂停");rn rn rn );rn rnrn public static void main(String args[]) rn MyFrame mf = new MyFrame();rn mf.init();rn rnrn[/code]rnrnrnrn2.MyThread:rnrn[code="<em>java</em>"]public class MyThread extends Thread rnrn public static boolean isFinish = false;// 是否停止rn public static boolean isPause = false;// 是否暂停rn private <em>java</em>x.swing.JProgressBar probar;rn private int value = 0;rnrn public MyThread(<em>java</em>x.swing.JProgressBar probar) rn this.probar = probar;rn rnrn public void run() rn this.changeValue();rn rnrn public void changeValue() rnrn while (!isFinish) rn // System.out.println("暂停中");rn while (!isPause) rn // System.out.println("运行中");rn probar.setValue(value);rn value++;rn try rn Thread.sleep(100);rn catch (Exception ef) rn ef.printStackTrace();rn rn rn try rn Thread.sleep(100);rn catch (Exception ef) rn ef.printStackTrace();rn rnrn rn // System.out.println("结束了");rnrn rnrn public void stopThread() rn isPause = true;rn isFinish = true;rn rnrn public void continueThread() rn isPause = false;rn rnrn public void pauseThread() rn isPause = true;rn rnrn public void restart() rn value = 0;rn isPause = false;rn isFinish = false;rn rnrn[/code]rnrn3.BallThread:rnrn[code="<em>java</em>"]public class BallThread extends Thread rnrn private <em>java</em>.awt.Graphics g;rn private int x = 20, y = 20;rn private MyFrame mf = MyFrame.mf;rn private <em>java</em>.util.Random rand = new <em>java</em>.util.Random();rn public static int xx[] = new int[30];rn public static int yy[] = new int[30];rnrn public BallThread(MyFrame mf, <em>java</em>.awt.Graphics g, int x, int y) rn this.mf = MyFrame.mf;rn this.g = g;rn this.x = x;rn this.y = y;rn rn rn public BallThread(int x,int y) rn this.x = x;rn this.y = y;rn rnrn public void run() rn changBall();rn rnrn public synchronized void changBall() rn rn while (!MyThread.isFinish) rn // System.out.println("运行了");rn while (!MyThread.isPause) rn // System.out.println("运行了");rn g.setColor(mf.getBackground());rn g.fillOval(x, y, 20, 20);rnrn x += 20;rn y += 20;rn g.setColor(<em>java</em>.awt.Color.BLUE);rn g.fillOval(x, y, 20, 20);rnrnrn try rn Thread.sleep(100);rn catch (Exception ef) rn ef.printStackTrace();rn rn rnrn rnrn rn if(MyThread.isFinish) rn g.setColor(mf.getBackground());rn g.fillOval(x, y, 20, 20);rn rnrn rn rn public int getX() rn return this.x;rn rn rn public int getY() rn return this.y;rn rn rnrn[/code]rnrnrnrn若将MyFrame中的num设置为3,则重复执行开始、停止、重新开始,可能会出现球擦不干净的情况,若num设置为1,则每次运行球都擦得干净。rn不知道是什么原因,期待高手讲解。
刚开始学习java 多线程遇到问题
今天刚看的<em>多线程</em>教程 结合网上的实例,自己改的简单代码 结果运行一晃眼 jvm就停了rn如图:rn![图片说明](https://img-ask.csdn.net/upload/201504/16/1429172697_673097.png)rn![图片说明](https://img-ask.csdn.net/upload/201504/16/1429172779_809589.png)rnrn控制台:rn![图片说明](https://img-ask.csdn.net/upload/201504/16/1429172804_913970.png)rnrn求友人明示
多线程面试遇到问题
1,怎样是线程安全的?
遇到多线程死循环问题
知乎地址:https://www.zhihu.com/question/276724572/answer/388777540(提问者是本人)1、当时根据需求实现的,循环队列,读写操作不加锁2、状态:0(操作中,不能被读写) 1(可读可写) -1(可写不可读)3、写先行,,读永远读写-1,数据仅仅可以被读一次,没读过的数据是可写的4、读阻塞,必须读到一个 可读数据 才可以返回5、现象 :debug ...
初学多线程遇到问题
package C19;rnrnpublic class ThreadDemo_1 rnrn /**rn * @param argsrn */rn public static void main(String[] args) rn // TODO Auto-generated method stubrn TestThread t = new TestThread();rn new Thread(t).start();rn// new TestThread2().start();rn for(int i = 0; i < 10; i++)rn System.out.println("main 线程在运行");rn rn rnrn rnrnrnrnclass TestThread implements Runnablern public void run()rn for(int i = 0; i < 10; i++)rn System.out.println("TestThread 在运行");rn rn rnrn上面是书上给的例子,但是得不到"main 线程在运行"和"TestThread 在运行"交替出现的结果,请问是例子错了还是跟我的系统有关系
多线程遇到问题
小弟的<em>多线程</em>模块rnunit Unit2;rnrninterfacernrnusesrn Classes,ScktComp;rnrntypern TMyThread = class(TThread)rn privatern Private declarations rn MyServer: TServerSocket;rn Data: string;rn SN: integer;rn protectedrn procedure Execute; override;rn procedure SendText;rn publicrn constructor Create(Sck:TServerSocket;Dat:string);rn end;rnrnvarrn MyThread: TMyThread;rnrnimplementationrnrnconstructor TMyThread.Create(Sck:TServerSocket;Dat:string);rnbeginrn inherited Create(false);rn myserver:=sck; //在主窗体用mysthread:=mythread.Create(Server,text)调用,myserver:=sck;这一句就出错!!!为什么啊,我已经被折磨两天了!!!rn Data:=dat;rn FreeOnTerminate:=true;rnend;rnrnprocedure TMyThread.SendText;rnbeginrn myserver.Socket.Connections[SN].SendText(data);rnend;rnrnprocedure TMyThread.Execute;rnvarrni:integer;rnbeginrn for i:=0 to myserver.Socket.ActiveConnections-1 dorn beginrn SN:=i;rn synchronize(SendText);rn if Terminated then exit;rn end;rnend;rnrnend.
JAVA多线程遇到一个小问题
rn<em>多线程</em>部分的一个小小疑问:rn几个线程同时处理一个参数该如何处理:rn例如:我同时启动2个线程,这两个个线程需要同时对某一个参数进行操作rn两个个线程不是同一个类起来的rn不是下面这种rnnew Thread(t).start();rnnew Thread(t).start();rnrn而是rnnew Thread(t1).start();rnnew Thread(t2).start();rnrn他们同时操作同一个 int num;rnrn有没有哪位朋友能贴一个例子上来的??
java.lang.IllegalMonitorStateException">Exception in thread "notify01" java.lang.IllegalMonitorStateException
package com.xiaonei2shou.test;rnrnpublic class ThreadTest rn private String flag = "true";rnrn class NotifyThread extends Thread rn public NotifyThread(String name) rn super(name);rn rnrn public void run() rn try rn sleep(3000);rn catch (InterruptedException e) rn e.printStackTrace();rn rn synchronized (flag) rn flag = "false";rn flag.notifyAll();rn rn rn ;rnrn class WaitThread extends Thread rn public WaitThread(String name) rn super(name);rn rnrn public void run() rn synchronized (flag) rn while (flag != "false") rn long waitTime = System.currentTimeMillis();rn System.out.println(getName() + " begin waiting!");rn try rn flag.wait();rn catch (InterruptedException e) rn e.printStackTrace();rn rn waitTime = System.currentTimeMillis() - waitTime;rn System.out.println(getName() + " wait time :" + waitTime);rn try rn sleep(1000);rn System.out.println(getName() + " sleep");rn catch (InterruptedException e) rn e.printStackTrace();rn rn rn System.out.println(getName() + " end waiting!");rn rn rn rnrn public static void main(String[] args) throws InterruptedException rn System.out.println("Main Thread Run!");rn ThreadTest test = new ThreadTest();rn NotifyThread notifyThread = test.new NotifyThread("notify01");rn WaitThread waitThread01 = test.new WaitThread("waiter01");rn WaitThread waitThread02 = test.new WaitThread("waiter02");rn WaitThread waitThread03 = test.new WaitThread("waiter03");rn waitThread02.start();rn waitThread01.start();rn waitThread03.start();rn notifyThread.start();rn rnrnrnException in thread "notify01" <em>java</em>.lang.IllegalMonitorStateException 报错了 啥原因
异常多线程
今天看了一天的“<em>异常</em>处理与<em>多线程</em>”这两章好难呀,尤其是"<em>异常</em>处理"都看不懂。请教大家该怎么看?
多线程异常
Thread client_th;rn ParameterizedThreadStart threadStart = new ParameterizedThreadStart( messagepass);rn client_th = new Thread(threadStart);rn 上面我启动了一个<em>异常</em>,可线程中的<em>异常</em>不会被启动线程的程序所捕捉,因为需要,我不想在线种程序中把<em>异常</em>吃掉,这样可能无法通告上层出了什么事,我把这个<em>异常</em>在纯种中捕获后又throw了出来;rn<em>问题</em>:我现在在启动的这个地方如何来捕获这个<em>异常</em>,从面可以让上层来处理我的<em>异常</em>?
多线程异常
如果在一个线程的代码中抛出<em>异常</em>,那么会去哪里?rn还是说一定要在这个线程中处理掉?rn为什么?
遇到异常
response hasbeen ommitted 这个<em>异常</em>出现的场景是:当对来自页面的请求进行处理之后出现了两种的方式 resopnse.sendRidrect(); 主要是在这一步的时候没有返回。 request.getSession().forward(); @AllArgsConstructor 这是lombok中的一个注解,顺带的还有 @Builder @NoArgsConstruct...
java中数据库连接关闭的时候报异常
如:conn.close 抛出<em>java</em>.sql.Exception connection is close 有谁知道怎么解决吗?
java调用oracle存储过程,报连接池异常
没有用什么框架,就是用基本的jdbcrnrn1、rnClass.forName("oracle.jdbc.driver.OracleDriver");rnString url = "";rnconn = DriverManager.getConnection(url, "", "");rn如上面的写法不会出错,调用存储过程正常执行。rnrn2、rnds = (DataSource) ic.lookup(strDataSource);rnconn = ds.getConnection();rn但是用连接池的数据源就会报<em>异常</em>。rnrnrntomcat下<em>异常</em>:rn<em>java</em>.lang.ClassCastException: org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapperrnwebsphere下<em>异常</em>:rncom.ibm.ws.rsadapter.jdbc.WSJdbcConnectionrnrn请指导一下该修改什么地方可以正常的调用连接池中的数据源?
java使用http下载文件报403异常
<em>java</em>中使用http方式下载文件时,有时报<em>异常</em>:rnServer returned HTTP response code: 403 for URL:XXXXrn网上的解决方法都是进行如下设置:rnconn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");rn但是[b]按照这个设置依旧不行[/b]。rn请问有什么解决方法,或者对服务器端进行什么安全配置可以取消这种限制?谢谢!rn
java--hibernate分页报异常
org.hibernate.exception.GenericJDBCException: 只进结果集不支持请求的操作。rnat org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.<em>java</em>:54)rnat org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.<em>java</em>:125)rnat org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.<em>java</em>:110)rnat org.hibernate.engine.jdbc.internal.proxy.AbstractResultSetProxyHandler.continueInvocation(AbstractResultSetProxyHandler.<em>java</em>:108)rnat org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.<em>java</em>:81)rnat $Proxy6.absolute(Unknown Source)rnat org.hibernate.loader.Loader.advance(Loader.<em>java</em>:1640)rnat org.hibernate.loader.Loader.getResultSet(Loader.<em>java</em>:1966)rnat org.hibernate.loader.Loader.doQuery(Loader.<em>java</em>:829)rnat org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.<em>java</em>:289)rnat org.hibernate.loader.Loader.doList(Loader.<em>java</em>:2447)rnat org.hibernate.loader.Loader.doList(Loader.<em>java</em>:2433)rnat org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.<em>java</em>:2263)rnat org.hibernate.loader.Loader.list(Loader.<em>java</em>:2258)rnat org.hibernate.loader.hql.QueryLoader.list(QueryLoader.<em>java</em>:470)rnat org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.<em>java</em>:355)rnat org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.<em>java</em>:196)rnat org.hibernate.internal.SessionImpl.list(SessionImpl.<em>java</em>:1161)rnat org.hibernate.internal.QueryImpl.list(QueryImpl.<em>java</em>:101)rnat com.qingmou.dao.impl.DaoSupeortImpl.paqingBypages(DaoSupeortImpl.<em>java</em>:246)rnat com.qingmou.test.Test.main(Test.<em>java</em>:38)rnCaused by: com.microsoft.sqlserver.jdbc.SQLServerException: 只进结果集不支持请求的操作。rnat com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown Source)rnat com.microsoft.sqlserver.jdbc.SQLServerResultSet.throwNotScrollable(Unknown Source)rnat com.microsoft.sqlserver.jdbc.SQLServerResultSet.verifyResultSetIsScrollable(Unknown Source)rnat com.microsoft.sqlserver.jdbc.SQLServerResultSet.absolute(Unknown Source)rnat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rnat sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rnat sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rnat <em>java</em>.lang.reflect.Method.invoke(Unknown Source)rnat org.hibernate.engine.jdbc.internal.proxy.AbstractResultSetProxyHandler.continueInvocation(AbstractResultSetProxyHandler.<em>java</em>:104)rn... 17 morern说明:rnrnString hql="from TSysGpsData";rnrnList ulist=dao.paqingBypages(hql, null, 2, 10);rnrn传1(hql, null, 1, 10);可以得到结果.2就不行,hibernate 4.1.1
C# IndexOf 报异常
不多说 直接上代码 rn if (!string.IsNullOrEmpty(m_str))rn rn if (GlobleDate.m_databuffUser.TagList.IndexOf(m_str) == -1) rn rn GlobleDate.m_databuffUser.TagList.Add(m_str); rn rn rn m_str = "";rn GlobleDate.userWaitor.Set(); //data资源 告诉界面可以进行更新 rnrnrnrn
开机报异常
十块板子,中间有一块很奇怪:rn开机的时候有时候会报这样一个错误:rnException 'Data Abort' (4): Thread-Id=07b7000e(pth=9b5b9594), Proc-Id=00400002(pprc=88111308) 'NK.EXE', VM-active=065e0002(pprc=9b5cd948) 'explorer.exe'rnPC=80157fd0(kernel.dll+0x00030fd0) RA=801421e0(kernel.dll+0x0001b1e0) SP=d713f468, BVA=00000098rnrn也有的时候是“device.exe”rnrn这样软件会经常运行起来不正常 rn我DEBUG调试的方式跑软件,他又正常rnrnNK都一样的,其它板子都没有这个<em>问题</em>rnrn不知道大家有没有碰到过这种类型的,或提供一个查找的思路也行rnrn个人曾怀疑是不是DDR跟CPU之间有什么有影响或是CPU片子的<em>问题</em>
[异常]报406
1、查看是否Jackson包是否存在。2、如果后缀是html是不能响应json数据的。需要修改后缀名,改成.do或者.action。
SQL连接报异常
package fixedassets;rnrnimport <em>java</em>.sql.*;rnimport <em>java</em>x.swing.tree.DefaultMutableTreeNode;rnrnrnpublic class JDBC rn Statement st=null;rn ResultSet rs2=null;rn ResultSet rs=null;rn public JDBC() rn try rn Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");rn Connection con = DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433;databaseName=AssetsManage","sa","sa");rn st = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);rn catch (Exception ex) rn ex.printStackTrace();rn rn rn public ResultSet yan(String s,String s1) //验证用户名和密码rn ResultSet rsa=null;rn try rn rsa = st.executeQuery("select *from operater where ID='"+s+"'and PassWord='"+s1+"'");rn catch (SQLException ex) rn ex.printStackTrace();rn rn return rsa;rn rn public int chaxun(String s,int i) //查询数据rn try rn if(i==0) //以资产编号查询rn clear();rn rs = st.executeQuery("select *from asset where aId="+s);rn else if(i==1) //以资产名称查询rn clear();rn rs = st.executeQuery("select *from asset where aName='"+s+"'");rn rn if(rs.next()) rn zhi();rn rnrn catch (SQLException ex) rn ex.printStackTrace();rn rn return 0;rn rnrn/*错误就在zhi()这个方法里,上面的chaxun()方法调用本方法来把查询出来的信息显示在文本框内,第一次调用时信息都可以提出来没<em>问题</em>,但是我想做一个导航条,可以通过按钮点击来查看数据,所以我在另外一个类里做了一个按钮事件,当点击时就zhi()这个方法,就在这里就报<em>异常</em>了,<em>异常</em>如下:rn<em>java</em>.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Object has been closed.rn at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)rn at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)rn at com.microsoft.jdbc.base.BaseResultSet.validateClosedState(Unknown Source)rn at com.microsoft.jdbc.base.BaseResultSet.getString(Unknown Source)rn at fixedassets.JDBC.zhi(JDBC.<em>java</em>:68)rn at fixedassets.Frame3.jButton4_actionPerformed(Frame3.<em>java</em>:405)rn at fixedassets.Frame3_jButton4_actionAdapter.actionPerformed(Frame3.<em>java</em>:431)rn at <em>java</em>x.swing.AbstractButton.fireActionPerformed(AbstractButton.<em>java</em>:1786)rn at <em>java</em>x.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.<em>java</em>:1839)rn at <em>java</em>x.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.<em>java</em>:420)rn at <em>java</em>x.swing.DefaultButtonModel.setPressed(DefaultButtonModel.<em>java</em>:258)rn at <em>java</em>x.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.<em>java</em>:245)rn at <em>java</em>.awt.Component.processMouseEvent(Component.<em>java</em>:5100)rn at <em>java</em>.awt.Component.processEvent(Component.<em>java</em>:4897)rn at <em>java</em>.awt.Container.processEvent(Container.<em>java</em>:1569)rn at <em>java</em>.awt.Component.dispatchEventImpl(Component.<em>java</em>:3615)rn at <em>java</em>.awt.Container.dispatchEventImpl(Container.<em>java</em>:1627)rn at <em>java</em>.awt.Component.dispatchEvent(Component.<em>java</em>:3477)rn at <em>java</em>.awt.LightweightDispatcher.retargetMouseEvent(Container.<em>java</em>:3483)rn at <em>java</em>.awt.LightweightDispatcher.processMouseEvent(Container.<em>java</em>:3198)rn at <em>java</em>.awt.LightweightDispatcher.dispatchEvent(Container.<em>java</em>:3128)rn at <em>java</em>.awt.Container.dispatchEventImpl(Container.<em>java</em>:1613)rn at <em>java</em>.awt.Window.dispatchEventImpl(Window.<em>java</em>:1606)rn at <em>java</em>.awt.Component.dispatchEvent(Component.<em>java</em>:3477)rn at <em>java</em>.awt.EventQueue.dispatchEvent(EventQueue.<em>java</em>:456)rn at <em>java</em>.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.<em>java</em>:201)rn at <em>java</em>.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.<em>java</em>:151)rn at <em>java</em>.awt.EventDispatchThread.pumpEvents(EventDispatchThread.<em>java</em>:145)rn at <em>java</em>.awt.EventDispatchThread.pumpEvents(EventDispatchThread.<em>java</em>:137)rn at <em>java</em>.awt.EventDispatchThread.run(EventDispatchThread.<em>java</em>:100)rnrn我在网上查了一下,好像是说连接池被已关闭,但是我所有的连接一个也没关啊,不知道是怎么回事,急~!请各位高手帮忙看一下*/rnrn public void zhi() rn try rn String s3 = rs.getString(1);rn String s10 = rs.getString(2);rn String s11 = rs.getString(3);rn String s5 = rs.getString(4);rn String s6 = rs.getString(8);rn String s7 = rs.getString(9);rn String s8 = rs.getString(7);rn String s12 = rs.getString(5);rn String s13 = rs.getString(6);rn String s14 = rs.getString(10);rn Frame3.jTextField3.setText(s3);rn Frame3.jTextField5.setText(s5);rn Frame3.jTextField6.setText(s6);rn Frame3.jTextField10.setText(s10);rn Frame3.jTextField11.setText(s11);rn Frame3.jTextField12.setText(s12);rn if (s13.equals("0")) rn Frame3.jTextField13.setText("正常");rn else if (s13.equals("1")) rn Frame3.jTextField13.setText("维修");rn else if (s13.equals("2")) rn Frame3.jTextField13.setText("报废");rn rn Frame3.jTextField14.setText(s14);rnrn if (Frame3.i == 1) //通过游标判断是否可以上下翻页rn if (rs.next()) rn Frame3.jButton4.setEnabled(true);rn else rn Frame3.jButton4.setEnabled(false);rn rn else rn if (rs.previous()) rn Frame3.jButton3.setEnabled(true);rn else rn Frame3.jButton3.setEnabled(false);rn rn rnrn ResultSet rls = st.executeQuery(rn "select eName from employee where eId=" +rn s7);rn rls.next();rn Frame3.jTextField7.setText(rls.getString(1));rn ResultSet rs1 = st.executeQuery(rn "select type from cateGory where cateId='" + s11 + "'");rn rs1.next();rn String s4 = rs1.getString(1);rn if (s4.equals("0")) rn Frame3.jTextField4.setText("");rn else rn Frame3.jTextField4.setText(s4);rn rnrn if (!(s8 == null)) rn ResultSet rls1 = st.executeQuery(rn "select eName from employee where eId=" + s8);rn rls1.next();rn Frame3.jTextField8.setText(rls1.getString(1));rn rs2 = st.executeQuery("select *from lend where aId=" +rn s3);rn rs2.last();rn String s9 = rs2.getString(4);rn String s15 = rs2.getString(3);rn String s16 = rs2.getString(5);rn Frame3.jTextField9.setText(s9);rn Frame3.jTextField15.setText(s15);rn if (s16.equals("0")) rn Frame3.jTextField16.setText("否");rn else if (s16.equals("1")) rn Frame3.jTextField16.setText("是");rn rn rnrn catch (Exception a) rn System.out.println("asdfwdfasdf");rn a.printStackTrace();rn rn rnrnrnrnrn public void clear() //清空rn Frame3.jTextField3.setText("");rn Frame3.jTextField4.setText("");rn Frame3.jTextField5.setText("");rn Frame3.jTextField6.setText("");rn Frame3.jTextField7.setText("");rn Frame3.jTextField8.setText("");rn Frame3.jTextField9.setText("");rn Frame3.jTextField10.setText("");rn Frame3.jTextField11.setText("");rn Frame3.jTextField12.setText("");rn Frame3.jTextField13.setText("");rn Frame3.jTextField14.setText("");rn Frame3.jTextField15.setText("");rn Frame3.jTextField16.setText("");rn rnrnrn
Graphics异常,报内存不足
原因:很有可能是因为图片大小导致的,需要通过PS修改一下图片大小 string imageName = sourceImageTb.Substring(sourceImageTb.LastIndexOf('/')); string imageSourcePath = Path.Combine(Config_MCDWX.Instance.Exam_Certifi
tomcat5.5一直报异常
tomcat5.5 一直报<em>java</em>.sql.SQLException: ORA-28000: the account is lockedrn但还是可以用的
crontab执行报异常
<em>异常</em>信息:nohup: failed to run command `<em>java</em>': No such file or directory /data/om-analytics/business/hive_hbase/workwf.sh: line 4: 4: command not found 这就是由于环境变量引起的,这种情况出现时,只需要在你的脚本中,比如XX.sh中加入以下两条语句
日期格式化报异常
今天做自定义标签的时候,写了几个日期格式化的方法,结果在测试将日期格式化为时分秒的时候报了<em>java</em>.text.ParseException: Unparseable date: &quot;13:14:14&quot;<em>异常</em>,由于对这块不熟悉不知道输入的字符串必须与new SimpleDateFormat(&quot;yyyy-MM-dd HH:mm:ss&quot;)保持一致/** * * 格式化日期的自定义标签 * 方法...
mybatis 报空值异常
mybatis 报空值<em>异常</em>及其解决办法
mybatis 报异常
### Cause: <em>java</em>.sql.SQLException: 出现不支持的 SQL92 标记: 288: 0 <em>异常</em>原因:传递参数本来是 #{0},#{1},由于赶时间漏:东西了 写成 {0} 、{1} 解决方法: {0} 、{1} 修改为#{0} #{1} ...
yml文件报异常
Caused by: org.yaml.snakeyaml.scanner.ScannerException: while scanning for the next token found character '@' that cannot start any token. (Do not use @ for indentation)  in 'reader', line 14, column ...
Hive报错,显示已经有一个Derby数据库启动了(spark同)
在系统安装完hive,还未将mysql指定为元数据仓库的时候。运行hive的过程中,易产生一种不稳定的状态。情形一:已经有一个hive连接在访问Derby创建的metastore_db文件夹,由于Derby数据库自身的缺点--仅支持一个链接对其进行访问,所以这时,如果再有一个终端调用hive,就有第二个链接访问Derby数据库了,就会抛出这个<em>异常</em>。解决方法很简单。用mysql作为元数据仓库,mys...
hibernate3+ejb3SessionBean 报异常
程序如下:rnpublic class HibernateBase rn private static SessionFactory sf = null;rn public Session session = null;rn public void Begin()rn //在这里可以根据配置文件来使用,如果是使用JDBC-》openSession(),如果使用JTA使用getCurrentSession();rn if(sf==null) Init();rn session = sf.openSession();rn rn public void Init()rn tryrn InitialContext ctx = new InitialContext();rn Object obj = ctx.lookup("hibernateJNDI");rn System.out.println("hibernateJNDI==============="+obj);rn if(sf==null) sf = (SessionFactory)obj;rn catch(Exception e)rn e.printStackTrace();rn rn rn public void Close()rn if(session!=null&&session.isOpen()) session.close();rn rnrnpublic class ArticleEJB extends HibernateBase implements InfoArticleUtil, ArticleEJBLocal,rn ArticleEJBRemote rnrn public List getAllArticle() rn List list = null;rn tryrn Begin();rn list = session.createQuery("from InfoArticle").list();rn if(list==null) list = new ArrayList();rn session.flush();rn catch(Exception e)rn e.printStackTrace();rn finallyrn Close();rn rn return null;rn rnrnrnpublic class HibernateUtil rn public static SessionFactory sf = null;rn public void Init()rn if(sf == null)rn sf = new Configuration().configure().buildSessionFactory();rn rn rnrnpublic class StartUpListener implements ServletContextListenerrnrn public void contextDestroyed(ServletContextEvent arg0) rnrn rn public void contextInitialized(ServletContextEvent arg0) rn try rn InitialContext ctx = new InitialContext();rn HibernateUtil h = new HibernateUtil();rn h.Init();rn SessionFactory newsf = h.sf;rn SessionFactory oldsf = (SessionFactory)ctx.lookup("hibernateJNDI");rn System.out.println("bind hibernateJNDI~~~~~~~~~~~~~~~~~~~~~~~`");rn if(oldsf!=null) ctx.rebind("hibernateJNDI", newsf);rn else ctx.bind("hibernateJNDI", newsf);rn rn catch (NamingException e) rn e.printStackTrace();rn rn rnrnrn rn rn sysListener.StartUpListenerrn rn
tomcat配置连接池报异常
context里的配置rn[code=XML]rnrn[/code]rnrnweb.xmlrn[code=XML]rn rnDB Connectionrnjdbc/mysqlrn<em>java</em>x.sql.DataSourcernContainerrn[/code]rnrnjsp rnrn[code=Java]rnrn rn rn rn rn rn rn rn rn rn[/code]rnrn为什么报这样的<em>异常</em>,什么意思?rn[color=#FF0000]<em>java</em>x.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: <em>java</em>.naming.factory.initialrn at <em>java</em>x.naming.spi.NamingManager.getInitialContext(NamingManager.<em>java</em>:645)rn at <em>java</em>x.naming.InitialContext.getDefaultInitCtx(InitialContext.<em>java</em>:288)rn at <em>java</em>x.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.<em>java</em>:325)rn at <em>java</em>x.naming.InitialContext.lookup(InitialContext.<em>java</em>:392)rn at Test.main(Test.<em>java</em>:12)[/color]
winform 报异常
有关调用实时(JIT)调试而不是此对话框的详细信息,rn请参见此消息的结尾。rnrn************** <em>异常</em>文本 **************rnSystem.ArgumentException: 参数无效。rn 在 System.Drawing.Image.get_RawFormat()rn 在 System.Drawing.Graphics.DrawImage(Image image, Int32 x, Int32 y, Int32 width, Int32 height)rn 在 System.Drawing.Graphics.DrawImage(Image image, Rectangle rect)rn 在 System.Windows.Forms.PictureBox.OnPaint(PaintEventArgs pe)rn 在 System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)rn 在 System.Windows.Forms.Control.WmPaint(Message& m)rn 在 System.Windows.Forms.Control.WndProc(Message& m)rn 在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)rn 在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)rn 在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)rnrnrn************** 已加载的程序集 **************rnmscorlibrn 程序集版本: 4.0.0.0rn Win32 版本: 4.0.30319.1 (RTMRel.030319-0100)rn 基本代码: file:///C:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/mscorlib.dllrn----------------------------------------rnDaikyoListrn 程序集版本: 1.0.0.0rn Win32 版本: 1.0.0.0rn 基本代码: file:///E:/DaikyoList/DaikyoList/DaikyoList/DaikyoList/bin/Debug/DaikyoList.exern----------------------------------------rnSystem.Windows.Formsrn 程序集版本: 4.0.0.0rn Win32 版本: 4.0.30319.1 built by: RTMRelrn 基本代码: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dllrn----------------------------------------rnSystem.Drawingrn 程序集版本: 4.0.0.0rn Win32 版本: 4.0.30319.1 built by: RTMRelrn 基本代码: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dllrn----------------------------------------rnSystemrn 程序集版本: 4.0.0.0rn Win32 版本: 4.0.30319.1 built by: RTMRelrn 基本代码: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dllrn----------------------------------------rnSystem.Configurationrn 程序集版本: 4.0.0.0rn Win32 版本: 4.0.30319.1 (RTMRel.030319-0100)rn 基本代码: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dllrn----------------------------------------rnSystem.Xmlrn 程序集版本: 4.0.0.0rn Win32 版本: 4.0.30319.1 built by: RTMRelrn 基本代码: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dllrn----------------------------------------rnDaikyoBLLrn 程序集版本: 1.0.0.0rn Win32 版本: 1.0.0.0rn 基本代码: file:///E:/DaikyoList/DaikyoList/DaikyoList/DaikyoList/bin/Debug/DaikyoBLL.DLLrn----------------------------------------rnDaikyoDALrn 程序集版本: 1.0.0.0rn Win32 版本: 1.0.0.0rn 基本代码: file:///E:/DaikyoList/DaikyoList/DaikyoList/DaikyoList/bin/Debug/DaikyoDAL.DLLrn----------------------------------------rnSystem.Datarn 程序集版本: 4.0.0.0rn Win32 版本: 4.0.30319.1 (RTMRel.030319-0100)rn 基本代码: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dllrn----------------------------------------rnSystem.Corern 程序集版本: 4.0.0.0rn Win32 版本: 4.0.30319.1 built by: RTMRelrn 基本代码: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dllrn----------------------------------------rnSystem.Transactionsrn 程序集版本: 4.0.0.0rn Win32 版本: 4.0.30319.1 (RTMRel.030319-0100)rn 基本代码: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_32/System.Transactions/v4.0_4.0.0.0__b77a5c561934e089/System.Transactions.dllrn----------------------------------------rnSystem.EnterpriseServicesrn 程序集版本: 4.0.0.0rn Win32 版本: 4.0.30319.1 (RTMRel.030319-0100)rn 基本代码: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_32/System.EnterpriseServices/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dllrn----------------------------------------rnSystem.Numericsrn 程序集版本: 4.0.0.0rn Win32 版本: 4.0.30319.1 built by: RTMRelrn 基本代码: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Numerics/v4.0_4.0.0.0__b77a5c561934e089/System.Numerics.dllrn----------------------------------------rnmscorlib.resourcesrn 程序集版本: 4.0.0.0rn Win32 版本: 4.0.30319.1 (RTMRel.030319-0100)rn 基本代码: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/mscorlib.resources/v4.0_4.0.0.0_zh-Hans_b77a5c561934e089/mscorlib.resources.dllrn----------------------------------------rnSystem.Drawing.resourcesrn 程序集版本: 4.0.0.0rn Win32 版本: 4.0.30319.1 built by: RTMRelrn 基本代码: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing.resources/v4.0_4.0.0.0_zh-Hans_b03f5f7f11d50a3a/System.Drawing.resources.dllrn----------------------------------------rnSystem.Windows.Forms.resourcesrn 程序集版本: 4.0.0.0rn Win32 版本: 4.0.30319.1 built by: RTMRelrn 基本代码: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms.resources/v4.0_4.0.0.0_zh-Hans_b77a5c561934e089/System.Windows.Forms.resources.dllrn----------------------------------------rnrn************** JIT 调试 **************rn要启用实时(JIT)调试,rn该应用程序或计算机的 .config 文件(machine.config)的 system.windows.forms 节中必须设置rnjitDebugging 值。rn编译应用程序时还必须启用rn调试。rnrn例如: rnrnrn rnrnrn启用 JIT 调试后,任何未经处理的<em>异常</em>rn都将被发送到在此计算机上注册的 JIT 调试器,rn而不是由此对话框处理。rnrnrn请问这是什么错误
hadoop-streaming报异常
执行hadoop-streaming操作:rnhadoop jar hadoop-streaming-2.7.2.jar -file ./mapper.py -file ./reducer.py -input /input/loginservice1.txt -output /output -mapper mapper.py -reducer reducer.pyrnrn报<em>异常</em>:rn<em>java</em>.net.URISyntaxException: Relative path in absolute URI: $PWD:$HADOOP_CONF_DIR:$HADOOP_COMMON_HOME/share/hadoop/common/*:$HADOOP_COMMON_HOME/share/hadoop/common/lib/*:$HADOOP_HDFS_HOME/share/hadoop/hdfs/*:$HADOOP_HDFS_HOME/share/hadoop/hdfs/lib/*:$HADOOP_YARN_HOME/share/hadoop/yarn/*:$HADOOP_YARN_HOME/share/hadoop/yarn/lib/*:$HADOOP_MAPRED_HOME/share/hadoop/mapreduce/*:$HADOOP_MAPRED_HOME/share/hadoop/mapreduce/lib/*:[color=#FF6600]job.jar/job.jar:job.jar/classes/:job.jar/lib/*[/color]:$PWD/*rnFailing this attempt. Failing the application.rnrn如何解决?
java--hibernate分页报异常,
org.hibernate.exception.GenericJDBCException: 只进结果集不支持请求的操作。rn at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.<em>java</em>:54)rn at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.<em>java</em>:125)rn at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.<em>java</em>:110)rn at org.hibernate.engine.jdbc.internal.proxy.AbstractResultSetProxyHandler.continueInvocation(AbstractResultSetProxyHandler.<em>java</em>:108)rn at org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.<em>java</em>:81)rn at $Proxy6.absolute(Unknown Source)rn at org.hibernate.loader.Loader.advance(Loader.<em>java</em>:1640)rn at org.hibernate.loader.Loader.getResultSet(Loader.<em>java</em>:1966)rn at org.hibernate.loader.Loader.doQuery(Loader.<em>java</em>:829)rn at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.<em>java</em>:289)rn at org.hibernate.loader.Loader.doList(Loader.<em>java</em>:2447)rn at org.hibernate.loader.Loader.doList(Loader.<em>java</em>:2433)rn at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.<em>java</em>:2263)rn at org.hibernate.loader.Loader.list(Loader.<em>java</em>:2258)rn at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.<em>java</em>:470)rn at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.<em>java</em>:355)rn at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.<em>java</em>:196)rn at org.hibernate.internal.SessionImpl.list(SessionImpl.<em>java</em>:1161)rn at org.hibernate.internal.QueryImpl.list(QueryImpl.<em>java</em>:101)rn at com.qingmou.dao.impl.DaoSupeortImpl.paqingBypages(DaoSupeortImpl.<em>java</em>:246)rn at com.qingmou.test.Test.main(Test.<em>java</em>:38)rnCaused by: com.microsoft.sqlserver.jdbc.SQLServerException: 只进结果集不支持请求的操作。rn at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown Source)rn at com.microsoft.sqlserver.jdbc.SQLServerResultSet.throwNotScrollable(Unknown Source)rn at com.microsoft.sqlserver.jdbc.SQLServerResultSet.verifyResultSetIsScrollable(Unknown Source)rn at com.microsoft.sqlserver.jdbc.SQLServerResultSet.absolute(Unknown Source)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rn at <em>java</em>.lang.reflect.Method.invoke(Unknown Source)rn at org.hibernate.engine.jdbc.internal.proxy.AbstractResultSetProxyHandler.continueInvocation(AbstractResultSetProxyHandler.<em>java</em>:104)rn ... 17 morern说明:rnrnString hql="from TSysGpsData";rn rnList ulist=dao.paqingBypages(hql, null, 2, 10);rnrn传1(hql, null, 1, 10);可以得到结果.2就不行,hibernate 4.1.1rnrnrnrn
异常求解释!
[code=<em>java</em>]public class CeShirn public static void main(String[] args)rn String a = "<em>java</em>";rn int count = 0;rn int index = -1;rn String str = "sun<em>java</em>hp<em>java</em>ok<em>java</em><em>java</em>and<em>java</em>haha<em>java</em>good<em>java</em>";rn /*String str = "sun<em>java</em>hp<em>java</em>ok<em>java</em><em>java</em>haha<em>java</em>good<em>java</em>";rn 在字符串中多加了一个<em>java</em>and就报<em>异常</em>,如果不加and就不会报错*/rn System.out.println(str.indexOf(a));rn rn while((index = str.indexOf(a))!= -1)rn str = str.substring(index+str.indexOf(a));rn count++;rn rn System.out.println(count);rn rn[/code]rnrn查找了大量资料都没有弄懂,求大神指点一下,本人自学不容易啊!
生成验证码报异常
[code=Java]rn< 4; i++) rn String ranNum = String.valueOf(random.nextInt(10));rn sbRan.append(ranNum);rn g.setColor(new Color(255, 255, 255));rn g.drawString(ranNum, 10 * i, 16);rn rnrn g.dispose();rnrn session.setAttribute("_CODE_", sbRan.toString());rnrn ImageIO.write(image, "PNG", response.getOutputStream());rn //response.getOutputStream().close();rn%>rnrn[/code]rnrn我有这样一个JSP文件,是用来生成验证码的rn运行时会抛出这样的<em>异常</em>:rn[color=#FF0000]<em>java</em>.lang.IllegalStateException: getOutputStream() has already been called for this response[/color]rnrn请问是什么原因呢 ?rn该怎么解决?
导出EXCEL 报异常
[code=C#]rnfor (int i = 0; i < gridView.RowCount; i++)rn rn for (int j = 0; j < gridView.ColumnCount; j++)rn rn excel.Cells[i + 2, j + 1] = gridView[j, i].Value.ToString();rn Range ra2; rn ra2 = sheet.get_Range(excel.Cells[1,1]);rn ra2.Font.Bold = true;rn ra2 = null;rn rnrn[/code]rnrn我想根据条件设置单元格格式rn实验了一下给每个单元格都设置粗体rn结果报<em>异常</em> HRESULT:0x800A03ECrn如果把这段删除就没事了rn[code=C#]rn ra2 = sheet.get_Range(excel.Cells[1,1]);rn ra2.Font.Bold = true;rn[/code]rn单独使用这两行不报错rn[code=C#]rn Range ra2; rn ra2 = null;rn[/code]rn谁帮我看看 那里的<em>问题</em>呀rn不明白
weblogic报antlr.TokenStreamIOException异常
这两天对前段时候针对DB2所做的修改进行较全面的测试.将应用部署到Linux RedHat AS 4.0 + Weblogic81上.rnrn 让Weblogic郁闷了!rnrnweblogic.utils.ParsingException: nested TokenStreamException: antlr.TokenStreamIOExceptionrn at weblogic.servlet.jsp.JspLexer.parse(JspLexer.<em>java</em>:965)rn at weblogic.servlet.jsp.JspParser.doit(JspParser.<em>java</em>:106)rn at weblogic.servlet.jsp.JspParser.parse(JspParser.<em>java</em>:230)rn at weblogic.servlet.jsp.Jsp2Java.outputs(Jsp2Java.<em>java</em>:125)rn at weblogic.utils.compiler.CodeGenerator.generate(CodeGenerator.<em>java</em>:258)rn at weblogic.servlet.jsp.JspStub.compilePage(JspStub.<em>java</em>:367)rn at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.<em>java</em>:223)rn at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.<em>java</em>:172)rn at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.<em>java</em>:518)rnrn.....rn<em>问题</em>并不总是重现.当重启Weblogic的后,可能是工作正常的.出现得亳无规律.rnrnHack 了一下weblogic的代码.代码应该做了较好的混淆处理,相当强悍的jad反编译过来都是东一块西一块的.得不到太多的信息.rnrn不过从<em>异常</em>信息及得到的源码来看,猜测是编码出现<em>问题</em>.因为最终看到的<em>异常</em>是CharStreamIOException的一个包装.rnrnif(charstreamexception instanceof CharStreamIOException)rn throw new TokenStreamIOException(((CharStreamIOException)charstreamexception).io)rnrngoogle了一下,没找到十分可靠明确的原因及解决办法.rnrn存异一下先!rnrn如果有此经验的同学看到,还望不吝赐教.多谢先.rn rn
oracle数据库报死锁异常
1.cd /oracle/admin/DBAXJ/bdump 下 2.tail -1000 alert_dbaxj.log |more 查看到ORA-00060: Deadlock detected. More info in file /oracle/admin/DBaxj/udump/DBAXJ_ora_9809.trc 报<em>异常</em> 3. 切换到/oracle/admin/DBaxj/u
JSONObject.fromObject(obj) 报异常
我的<em>java</em>版本是1.6的。rnjson转化的jar分别是:commons-beanutils-1.7.0.jar,commons-collections-3.2.1.jar,commons-httpclient-3.1.jar,commons-lang-2.3.jar,commons-logging-1.1.1.jar,ezmorph-1.0.3.jar,json-lib-2.2.3-jdk15.jar。rn知道<em>问题</em>帮忙看看了,谢谢。rnrnACTION:rn Map jsonMap = new HashMap(); rn tasks = service.findAll(page, pageSize);rn total = dao.countTotalPage(pageSize);rn jsonMap.put("total", total);rn jsonMap.put("rows", tasks);rn JSONObject result = JSONObject.fromObject(jsonMap);rn错误信息:rnnet.sf.json.JSONException: <em>java</em>.lang.reflect.InvocationTargetExceptionrn at net.sf.json.JSONObject.defaultBeanProcessing(JSONObject.<em>java</em>:818)rn at net.sf.json.JSONObject._fromBean(JSONObject.<em>java</em>:699)rn at net.sf.json.JSONObject.fromObject(JSONObject.<em>java</em>:172)rn at net.sf.json.AbstractJSON._processValue(AbstractJSON.<em>java</em>:274)rn at net.sf.json.JSONObject._processValue(JSONObject.<em>java</em>:2655)rn at net.sf.json.JSONObject.processValue(JSONObject.<em>java</em>:2721)rn at net.sf.json.JSONObject.setInternal(JSONObject.<em>java</em>:2736)rn at net.sf.json.JSONObject.setValue(JSONObject.<em>java</em>:1424)rn at net.sf.json.JSONObject.defaultBeanProcessing(JSONObject.<em>java</em>:765)rn at net.sf.json.JSONObject._fromBean(JSONObject.<em>java</em>:699)rn at net.sf.json.JSONObject.fromObject(JSONObject.<em>java</em>:172)rn at net.sf.json.AbstractJSON._processValue(AbstractJSON.<em>java</em>:274)rn at net.sf.json.JSONArray._processValue(JSONArray.<em>java</em>:2513)rn at net.sf.json.JSONArray.processValue(JSONArray.<em>java</em>:2538)rn at net.sf.json.JSONArray.addValue(JSONArray.<em>java</em>:2525)rn at net.sf.json.JSONArray._fromCollection(JSONArray.<em>java</em>:1056)rn at net.sf.json.JSONArray.fromObject(JSONArray.<em>java</em>:123)rn at net.sf.json.AbstractJSON._processValue(AbstractJSON.<em>java</em>:240)rn at net.sf.json.JSONObject._processValue(JSONObject.<em>java</em>:2655)rn at net.sf.json.JSONObject.processValue(JSONObject.<em>java</em>:2721)rn at net.sf.json.JSONObject.setInternal(JSONObject.<em>java</em>:2736)rn at net.sf.json.JSONObject.setValue(JSONObject.<em>java</em>:1424)rn at net.sf.json.JSONObject._fromMap(JSONObject.<em>java</em>:1168)rn at net.sf.json.JSONObject.fromObject(JSONObject.<em>java</em>:163)rn at net.sf.json.JSONObject.fromObject(JSONObject.<em>java</em>:134)rn at com.test.action.QueryPVTaskAction.showList(QueryPVTaskAction.<em>java</em>:41)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rn at <em>java</em>.lang.reflect.Method.invoke(Unknown Source)rn at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.<em>java</em>:441)rn at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.<em>java</em>:280)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.<em>java</em>:243)rn at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.<em>java</em>:165)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.<em>java</em>:87)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.<em>java</em>:237)rn at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.<em>java</em>:252)rn at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.<em>java</em>:68)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.<em>java</em>:87)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.<em>java</em>:237)rn at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.<em>java</em>:122)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.<em>java</em>:237)rn at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.<em>java</em>:195)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.<em>java</em>:87)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.<em>java</em>:237)rn at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.<em>java</em>:195)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.<em>java</em>:87)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.<em>java</em>:237)rn at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.<em>java</em>:179)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.<em>java</em>:237)rn at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.<em>java</em>:75)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.<em>java</em>:237)rn at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.<em>java</em>:94)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.<em>java</em>:237)rn at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.<em>java</em>:235)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.<em>java</em>:237)rn at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.<em>java</em>:89)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.<em>java</em>:237)rn at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.<em>java</em>:130)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.<em>java</em>:237)rn at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.<em>java</em>:267)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.<em>java</em>:237)rn at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.<em>java</em>:126)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.<em>java</em>:237)rn at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.<em>java</em>:138)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.<em>java</em>:87)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.<em>java</em>:237)rn at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.<em>java</em>:165)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.<em>java</em>:237)rn at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.<em>java</em>:164)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.<em>java</em>:237)rn at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.<em>java</em>:179)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.<em>java</em>:237)rn at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.<em>java</em>:176)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.<em>java</em>:237)rn at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.<em>java</em>:52)rn at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.<em>java</em>:488)rn at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.<em>java</em>:77)rn at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.<em>java</em>:91)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.<em>java</em>:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.<em>java</em>:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.<em>java</em>:233)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.<em>java</em>:191)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.<em>java</em>:127)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.<em>java</em>:102)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.<em>java</em>:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.<em>java</em>:298)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.<em>java</em>:859)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.<em>java</em>:588)rn at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.<em>java</em>:489)rn at <em>java</em>.lang.Thread.run(Unknown Source)rnCaused by: <em>java</em>.lang.reflect.InvocationTargetExceptionrn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rn at <em>java</em>.lang.reflect.Method.invoke(Unknown Source)rn at org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.<em>java</em>:2155)rn at org.apache.commons.beanutils.PropertyUtilsBean.getSimpleProperty(PropertyUtilsBean.<em>java</em>:1323)rn at org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.<em>java</em>:762)rn at org.apache.commons.beanutils.PropertyUtilsBean.getProperty(PropertyUtilsBean.<em>java</em>:837)rn at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.<em>java</em>:426)rn at net.sf.json.JSONObject.defaultBeanProcessing(JSONObject.<em>java</em>:749)rn ... 90 morernCaused by: <em>java</em>.lang.IllegalArgumentExceptionrn at <em>java</em>.sql.Date.getHours(Unknown Source)rn ... 100 morern
j2ee报异常拉.
org.hibernate.exception.GenericJDBCException: could not execute queryrn org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.<em>java</em>:54)rn org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.<em>java</em>:125)rn org.hibernate.loader.Loader.doList(Loader.<em>java</em>:2529)rn org.hibernate.loader.Loader.doList(Loader.<em>java</em>:2512)rn org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.<em>java</em>:2342)rn org.hibernate.loader.Loader.list(Loader.<em>java</em>:2337)rn org.hibernate.loader.custom.CustomLoader.list(CustomLoader.<em>java</em>:338)rn org.hibernate.internal.SessionImpl.listCustomQuery(SessionImpl.<em>java</em>:1833)rn org.hibernate.internal.AbstractSessionImpl.list(AbstractSessionImpl.<em>java</em>:231)rn org.hibernate.internal.SQLQueryImpl.list(SQLQueryImpl.<em>java</em>:157)rn com.icehawk.dao.UserManagerDao.getUsers(UserManagerDao.<em>java</em>:21)rn com.icehawk.service.UserManagerService.getUsers(UserManagerService.<em>java</em>:13)rn com.icehawk.action.UserManagerAction.managerUsers(UserManagerAction.<em>java</em>:28)rn sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.<em>java</em>:39)rn sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.<em>java</em>:25)rn <em>java</em>.lang.reflect.Method.invoke(Method.<em>java</em>:597)rn com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.<em>java</em>:450)rn com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.<em>java</em>:289)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.<em>java</em>:252)rn org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.<em>java</em>:256)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.<em>java</em>:246)rn com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.<em>java</em>:167)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.<em>java</em>:98)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.<em>java</em>:246)rn com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.<em>java</em>:265)rn org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.<em>java</em>:68)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.<em>java</em>:98)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.<em>java</em>:246)rn com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.<em>java</em>:138)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.<em>java</em>:246)rn com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.<em>java</em>:239)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.<em>java</em>:98)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.<em>java</em>:246)rn com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.<em>java</em>:239)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.<em>java</em>:98)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.<em>java</em>:246)rn com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.<em>java</em>:191)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.<em>java</em>:246)rn org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.<em>java</em>:73)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.<em>java</em>:246)rn org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.<em>java</em>:91)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.<em>java</em>:246)rn org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.<em>java</em>:252)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.<em>java</em>:246)rn com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.<em>java</em>:100)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.<em>java</em>:246)rn com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.<em>java</em>:141)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.<em>java</em>:246)rn com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.<em>java</em>:145)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.<em>java</em>:246)rn com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.<em>java</em>:171)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.<em>java</em>:98)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.<em>java</em>:246)rn com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.<em>java</em>:161)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.<em>java</em>:246)rn org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.<em>java</em>:164)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.<em>java</em>:246)rn com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.<em>java</em>:193)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.<em>java</em>:246)rn com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.<em>java</em>:189)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.<em>java</em>:246)rn org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.<em>java</em>:54)rn org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.<em>java</em>:563)rn org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.<em>java</em>:77)rn org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.<em>java</em>:99)rnrnrn我在另一台计算机上运行代码没错 换一台计算机就出现这个错误了.rnrn Session session = sessionFactory.getCurrentSession();rn Transaction ts = session.beginTransaction();rn result = session.createSQLQuery("SELECT * FROM tbl_user").addEntity(User.class).list();rn ts.commit();rnrn
arraycopy 报异常
byte[] cmd = new byte[1024];rn String tt;rntt="";rnSystem.arraycopy(tt,0,cmd,8,tt.length());rnrnrnrnHit uncaught exception <em>java</em>.lang.ArrayStoreException
WCF报System.ServiceModel.Diagnostics.TraceUtility异常
[code=XML]rnrnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrn[/code]rn[code=C#]rn[ServiceContract]rn public interface IWfControlrn rn [OperationContract]rn [WebGet(UriTemplate = "Put/itemcode/wfState/des")]rn bool WfControl(string itemCode, string wfState, string des);rn rnrnpublic class WfControlServices : IWfControlrn rn public bool WfControl(string itemCode, string wfState, string des)rn rn //业务逻辑代码rn rn rn[/code]rn错误堆栈rn[code=C#]rn在 System.ServiceModel.Diagnostics.TraceUtility.SetEtwProviderId()rn 在 System.ServiceModel.ServiceHostBase..ctor()rn 在 System.ServiceModel.ServiceHost..ctor(Type serviceType, Uri[] baseAddresses)rn 在 SOAHost.Program.SOAServiceStart()rn 在 SOAHost.Program.Main(String[] args)rn[/code]rnrn应该是WCF服务的节点配置<em>问题</em>rn因为用application单独调用http://ip:端口/WfControlServicesSoap运行没有<em>问题</em>;rn单独使用http://ip:端口/WfControlServicesRest/put/2103212012004/1/saf运行也没有<em>问题</em>rn但是当两个配置一起用报这个错误;rnWCF初学者,请高手指教rn或者有没有人能给个web和winform都能调用的wcf配置文件rn谢谢
模拟app 报异常
html div class="promptBox">div> css: .promptBox{    position: fixed;    z-index: 990;    left: 50%;    background: white;    bottom: 10%;    transform: translate(-50%, -10%)
eclipse安装报异常!
!SESSION 三月 12, 2007 12:54:31.595 ----------------------------------------------rneclipse.buildId=M200409161125rn<em>java</em>.version=1.5.0_06rn<em>java</em>.vendor=Sun Microsystems Inc.rnBootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=zh_CNrnrn!ENTRY org.eclipse.osgi 三月 12, 2007 12:54:31.595rn!MESSAGE Error installing bundle: reference:file:f:/原D盘/大三(下)课程相关课件/web应用程序设计-张顺淼/软件/eclipse-SDK-3.0.1-win32/eclipse/plugins/org.eclipse.update.configurator_3.0.0/rn!STACK 0rnorg.osgi.framework.BundleException: Error converting plugin at f:\原D盘\大三(下)课程相关课件\web应用程序设计-张顺淼\软件\eclipse-SDK-3.0.1-win32\eclipse\plugins\org.eclipse.update.configurator_3.0.0.rn at org.eclipse.core.runtime.adaptor.EclipseBundleData.generateManifest(EclipseBundleData.<em>java</em>:236)rn at org.eclipse.core.runtime.adaptor.EclipseBundleData.loadManifest(EclipseBundleData.<em>java</em>:191)rn at org.eclipse.core.runtime.adaptor.EclipseBundleData.getManifest(EclipseBundleData.<em>java</em>:159)rn at org.eclipse.core.runtime.adaptor.EclipseBundleData.loadFromManifest(EclipseBundleData.<em>java</em>:280)rn at org.eclipse.osgi.framework.internal.defaultadaptor.DefaultBundleData.initializeNewBundle(DefaultBundleData.<em>java</em>:77)rn at org.eclipse.osgi.framework.internal.defaultadaptor.DefaultAdaptor$1.begin(DefaultAdaptor.<em>java</em>:451)rn at org.eclipse.osgi.framework.internal.core.Framework.installWorkerPrivileged(Framework.<em>java</em>:746)rn at org.eclipse.osgi.framework.internal.core.Framework$2.run(Framework.<em>java</em>:664)rn at <em>java</em>.security.AccessController.doPrivileged(Native Method)rn at org.eclipse.osgi.framework.internal.core.Framework.installWorker(Framework.<em>java</em>:715)rn at org.eclipse.osgi.framework.internal.core.Framework.installBundle(Framework.<em>java</em>:659)rn at org.eclipse.osgi.framework.internal.core.BundleContextImpl.installBundle(BundleContextImpl.<em>java</em>:219)rn at org.eclipse.core.runtime.adaptor.EclipseStarter.installBundles(EclipseStarter.<em>java</em>:800)rn at org.eclipse.core.runtime.adaptor.EclipseStarter.loadBasicBundles(EclipseStarter.<em>java</em>:429)rn at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.<em>java</em>:222)rn at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.<em>java</em>:127)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.<em>java</em>:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.<em>java</em>:25)rn at <em>java</em>.lang.reflect.Method.invoke(Method.<em>java</em>:585)rn at org.eclipse.core.launcher.Main.basicRun(Main.<em>java</em>:185)rn at org.eclipse.core.launcher.Main.run(Main.<em>java</em>:704)rn at org.eclipse.core.launcher.Main.main(Main.<em>java</em>:688)rnCaused by: org.eclipse.osgi.service.pluginconversion.PluginConversionException: Error parsing plugin manifest file f:\原D盘\大三(下)课程相关课件\web应用程序设计-张顺淼\软件\eclipse-SDK-3.0.1-win32\eclipse\plugins\org.eclipse.update.configurator_3.0.0 at .rn at org.eclipse.core.runtime.adaptor.PluginConverterImpl.parsePluginInfo(PluginConverterImpl.<em>java</em>:560)rn at org.eclipse.core.runtime.adaptor.PluginConverterImpl.fillPluginInfo(PluginConverterImpl.<em>java</em>:111)rn at org.eclipse.core.runtime.adaptor.PluginConverterImpl.convertManifest(PluginConverterImpl.<em>java</em>:660)rn at org.eclipse.core.runtime.adaptor.EclipseBundleData.generateManifest(EclipseBundleData.<em>java</em>:233)rn ... 22 morernCaused by: <em>java</em>x.xml.parsers.ParserConfigurationException: Feature: http://xml.org/sax/features/string-interningrn at org.apache.crimson.jaxp.SAXParserFactoryImpl.newSAXParser(SAXParserFactoryImpl.<em>java</em>:119)rn at org.eclipse.core.runtime.adaptor.PluginParser.parsePlugin(PluginParser.<em>java</em>:459)rn at org.eclipse.core.runtime.adaptor.PluginConverterImpl.parsePluginInfo(PluginConverterImpl.<em>java</em>:557)rn ... 25 morernRoot exception:rnorg.eclipse.osgi.service.pluginconversion.PluginConversionException: Error parsing plugin manifest file f:\原D盘\大三(下)课程相关课件\web应用程序设计-张顺淼\软件\eclipse-SDK-3.0.1-win32\eclipse\plugins\org.eclipse.update.configurator_3.0.0 at .rn at org.eclipse.core.runtime.adaptor.PluginConverterImpl.parsePluginInfo(PluginConverterImpl.<em>java</em>:560)rn at org.eclipse.core.runtime.adaptor.PluginConverterImpl.fillPluginInfo(PluginConverterImpl.<em>java</em>:111)rn at org.eclipse.core.runtime.adaptor.PluginConverterImpl.convertManifest(PluginConverterImpl.<em>java</em>:660)rn at org.eclipse.core.runtime.adaptor.EclipseBundleData.generateManifest(EclipseBundleData.<em>java</em>:233)rn at org.eclipse.core.runtime.adaptor.EclipseBundleData.loadManifest(EclipseBundleData.<em>java</em>:191)rn at org.eclipse.core.runtime.adaptor.EclipseBundleData.getManifest(EclipseBundleData.<em>java</em>:159)rn at org.eclipse.core.runtime.adaptor.EclipseBundleData.loadFromManifest(EclipseBundleData.<em>java</em>:280)rn at org.eclipse.osgi.framework.internal.defaultadaptor.DefaultBundleData.initializeNewBundle(DefaultBundleData.<em>java</em>:77)rn at org.eclipse.osgi.framework.internal.defaultadaptor.DefaultAdaptor$1.begin(DefaultAdaptor.<em>java</em>:451)rn at org.eclipse.osgi.framework.internal.core.Framework.installWorkerPrivileged(Framework.<em>java</em>:746)rn at org.eclipse.osgi.framework.internal.core.Framework$2.run(Framework.<em>java</em>:664)rn at <em>java</em>.security.AccessController.doPrivileged(Native Method)rn at org.eclipse.osgi.framework.internal.core.Framework.installWorker(Framework.<em>java</em>:715)rn at org.eclipse.osgi.framework.internal.core.Framework.installBundle(Framework.<em>java</em>:659)rn at org.eclipse.osgi.framework.internal.core.BundleContextImpl.installBundle(BundleContextImpl.<em>java</em>:219)rn at org.eclipse.core.runtime.adaptor.EclipseStarter.installBundles(EclipseStarter.<em>java</em>:800)rn at org.eclipse.core.runtime.adaptor.EclipseStarter.loadBasicBundles(EclipseStarter.<em>java</em>:429)rn at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.<em>java</em>:222)rn
netbeans新建项目报异常
在netbeans6.1中新建项目后出现这个freemarker.core.ParseException:Unexpected end of file reached.Unclosed if directive.rn请问怎么回事?
ignite启动报异常
<em>异常</em>: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getIgnite' defined in class path resource [com/hzy/config/IgniteConfig.class]: Bean instantiation via facto...
[求助]javaBean报异常
org.apache.jasper.JasperException: Unable to compile class for JSPrnrnAn error occurred at line: 65 in the jsp file: /zhuce.jsprnGenerated servlet error:rnUnreachable codernrnrn org.apache.jasper.compiler.DefaultErrorHandler.<em>java</em>cError(DefaultErrorHandler.<em>java</em>:84)rn org.apache.jasper.compiler.ErrorDispatcher.<em>java</em>cError(ErrorDispatcher.<em>java</em>:328)rn org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.<em>java</em>:414)rn org.apache.jasper.compiler.Compiler.compile(Compiler.<em>java</em>:297)rn org.apache.jasper.compiler.Compiler.compile(Compiler.<em>java</em>:276)rn org.apache.jasper.compiler.Compiler.compile(Compiler.<em>java</em>:264)rn org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.<em>java</em>:563)rn org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.<em>java</em>:303)rn org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.<em>java</em>:314)rn org.apache.jasper.servlet.JspServlet.service(JspServlet.<em>java</em>:264)rn <em>java</em>x.servlet.http.HttpServlet.service(HttpServlet.<em>java</em>:802)rn
hiberante报空异常
rn电影rn[code=<em>java</em>]package cn.demo.entity;rnrnimport <em>java</em>.io.Serializable;rnrnimport cn.demo.entity.MovieType;rnrnpublic class Movie implements Serializable rn rn private int Id;rn private String Name;rn private MovieType TypeId;rn private String Actor;rn private String Director;rn private int Price;rn rn public int getId() rn return Id;rn rn public void setId(int id) rn Id = id;rn rn public String getName() rn return Name;rn rn public void setName(String name) rn Name = name;rn rn rn public String getActor() rn return Actor;rn rn public void setActor(String actor) rn Actor = actor;rn rn public String getDirector() rn return Director;rn rn public void setDirector(String director) rn Director = director;rn rn public int getPrice() rn return Price;rn rn public void setPrice(int price) rn Price = price;rn rn public MovieType getTypeId() rn return TypeId;rn rn public void setTypeId(MovieType typeId) rn TypeId = typeId;rn rnrnrn[/code]rn映射文件rn[code=text]rnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn [/code]rn电影类型rn[code=<em>java</em>]package cn.demo.entity;rnrnpublic class MovieType rn private int Type_Id;rn private String Name;rn rn public int getType_Id() rn return Type_Id;rn rn public void setType_Id(int type_Id) rn Type_Id = type_Id;rn rn public String getName() rn return Name;rn rn public void setName(String name) rn Name = name;rn rnrnrn[/code]rn映射文件rn[code=<em>java</em>]rnrn rn rn rn rn rn rn rn rn rn rn rn [/code]rn测试类rn[code=<em>java</em>]package cn.demo.dao;rnrnimport org.hibernate.Session;rnimport org.hibernate.SessionFactory;rnimport org.hibernate.Transaction;rnimport org.hibernate.cfg.Configuration;rnrnimport cn.demo.entity.Movie;rnimport cn.demo.entity.MovieType;rnrnpublic class MovieDao rnrn Configuration conf=null;rn SessionFactory sf=null;rn Session session=null;rn Transaction tx=null;rn public void add()rn tryrn conf=new Configuration().configure();rn sf=conf.buildSessionFactory();rn session=sf.openSession();rn MovieType mt=(MovieType)session.load(MovieType.class, 1);rn Movie m=new Movie();rn m.setId(4);rn m.setName("逃学威龙");rn m.setPrice(60);rn m.setDirector("于晟");rn m.setActor("周星驰");rn m.setTypeId(mt);rn session.save(m);rn tx.commit();rn System.out.println("OK");rn catch(Exception e)rn e.printStackTrace();rn tx.rollback();rn System.out.println("No");rn rn rnrn[/code]rn运行后<em>异常</em>rn[img=https://img-bbs.csdn.net/upload/201407/26/1406357196_87429.png][/img]rnrn问下怎么解决 rn
为什么报classcast异常
String b="wode";rn String c="wodedss";rn set.add(b);set.add(c);rn String [] aa = (String[])set.toArray();rn System.out.println(aa.length+" "+aa[1]);rn我想去的 set 里所有 元素 这样写 为什么报那个错误,请教中
调用WebService报异常
AxisFaultrn faultCode: http://schemas.xmlsoap.org/soap/envelope/Server.userExceptionrn faultSubcode: rn faultString: <em>java</em>.lang.reflect.InvocationTargetExceptionrn faultActor: rn faultNode: rn faultDetail: rn http://xml.apache.org/axis/hostname:server4rnrn<em>java</em>.lang.reflect.InvocationTargetExceptionrn at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.<em>java</em>:222)rn at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.<em>java</em>:129)rn at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.<em>java</em>:1087)rn at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.<em>java</em>:633)rn at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.<em>java</em>:719)rn at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.<em>java</em>:1685)rn at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.<em>java</em>:368)rn at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.<em>java</em>:834)rn at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.<em>java</em>:764)rn at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.<em>java</em>:148)rn at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.<em>java</em>:1242)rn at <em>java</em>x.xml.parsers.SAXParser.parse(SAXParser.<em>java</em>:375)rn at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.<em>java</em>:227)rn at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.<em>java</em>:696)rn at org.apache.axis.Message.getSOAPEnvelope(Message.<em>java</em>:435)rn at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.<em>java</em>:62)rn at org.apache.axis.client.AxisClient.invoke(AxisClient.<em>java</em>:206)rn at org.apache.axis.client.Call.invokeEngine(Call.<em>java</em>:2784)rn at org.apache.axis.client.Call.invoke(Call.<em>java</em>:2767)rn at org.apache.axis.client.Call.invoke(Call.<em>java</em>:2443)rn at org.apache.axis.client.Call.invoke(Call.<em>java</em>:2366)rn at org.apache.axis.client.Call.invoke(Call.<em>java</em>:1812)rn at cn.com.hnisi.viointerface.demo.EPODemo.main(EPODemo.<em>java</em>:105)rn
Socket网络编程报异常
Client类rn[code=Java]package ex30;rnrnimport <em>java</em>.io.*;rnimport <em>java</em>.net.*;rnimport <em>java</em>.awt.*;rnimport <em>java</em>.awt.event.*;rnimport <em>java</em>x.swing.*;rnrnpublic class Client extends JFramern // Text field for receiving radiusrn private JTextField jtf = new JTextField();rn rn // Text area to display contentsrn private JTextArea jta = new JTextArea();rn rn // IO streamsrn private DataOutputStream toServer;rn private DataInputStream fromServer;rn rn public static void main(String[] args) rn // TODO 自动生成方法存根rn new Client();rn rn rn public Client()rn // Panel p to hold the label and text fieldrn JPanel p = new JPanel();rn p.setLayout(new BorderLayout());rn p.add(new JLabel("Enter radius"), BorderLayout.WEST);rn p.add(jtf, BorderLayout.CENTER);rn jtf.setHorizontalAlignment(JTextField.RIGHT);rn rn setLayout(new BorderLayout());rn add(p, BorderLayout.NORTH);rn add(new JScrollPane(jta), BorderLayout.CENTER);rn rn jtf.addActionListener(new TextFieldListener());rn rn setTitle("Client");rn setSize(500, 300);rn setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);rn setVisible(true); // It is necessary to show the frame here!rn rn tryrn // Create a socket to connect to the serverrn Socket socket = new Socket("localhost", 8000);rn // Socket socket = new Socket("130.254.204.36", 8000);rn // Socket socket = new Socket("drake.Armstrong.edu", 8000);rn rn // Create an input stream to receive data from the serverrn toServer =rn new DataOutputStream(socket.getOutputStream());rn rn catch(IOException ex)rn jta.append(ex.toString() + '\n');rn rn rn rn private class TextFieldListener implements ActionListenerrn public void actionPerformed(ActionEvent e)rn tryrn // Get the radius from the text fieldrn double radius = Double.parseDouble(jtf.getText().trim());rn rn // Send the radius to the serverrn toServer.writeDouble(radius);rn toServer.flush();rn rn // Get area from the serverrn double area = fromServer.readDouble(); //这一行为什么会报<em>异常</em>,但程序还能运行rn rn // Display to the text arearn jta.append("Radius is " + radius + "\n");rn jta.append("Area received from the server is "rn + area + '\n');rn rn catch(IOException ex)rn System.err.println(ex);rn rn rn rnrnrn[/code]rnServer类rn[code=Java]package ex30;rnrnimport <em>java</em>.io.*;rnimport <em>java</em>.net.*;rnimport <em>java</em>.awt.*;rnimport <em>java</em>.awt.event.*;rnimport <em>java</em>x.swing.*;rnrnpublic class Client extends JFramern // Text field for receiving radiusrn private JTextField jtf = new JTextField();rn rn // Text area to display contentsrn private JTextArea jta = new JTextArea();rn rn // IO streamsrn private DataOutputStream toServer;rn private DataInputStream fromServer;rn rn public static void main(String[] args) rn // TODO 自动生成方法存根rn new Client();rn rn rn public Client()rn // Panel p to hold the label and text fieldrn JPanel p = new JPanel();rn p.setLayout(new BorderLayout());rn p.add(new JLabel("Enter radius"), BorderLayout.WEST);rn p.add(jtf, BorderLayout.CENTER);rn jtf.setHorizontalAlignment(JTextField.RIGHT);rn rn setLayout(new BorderLayout());rn add(p, BorderLayout.NORTH);rn add(new JScrollPane(jta), BorderLayout.CENTER);rn rn jtf.addActionListener(new TextFieldListener());rn rn setTitle("Client");rn setSize(500, 300);rn setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);rn setVisible(true); // It is necessary to show the frame here!rn rn tryrn // Create a socket to connect to the serverrn Socket socket = new Socket("localhost", 8000);rn // Socket socket = new Socket("130.254.204.36", 8000);rn // Socket socket = new Socket("drake.Armstrong.edu", 8000);rn rn // Create an input stream to receive data from the serverrn toServer =rn new DataOutputStream(socket.getOutputStream());rn rn catch(IOException ex)rn jta.append(ex.toString() + '\n');rn rn rn rn private class TextFieldListener implements ActionListenerrn public void actionPerformed(ActionEvent e)rn tryrn // Get the radius from the text fieldrn double radius = Double.parseDouble(jtf.getText().trim());rn rn // Send the radius to the serverrn toServer.writeDouble(radius);rn toServer.flush();rn rn // Get area from the serverrn double area = fromServer.readDouble(); //这一行为什么会报<em>异常</em>,但程序还能运行rn rn // Display to the text arearn jta.append("Radius is " + radius + "\n");rn jta.append("Area received from the server is "rn + area + '\n');rn rn catch(IOException ex)rn System.err.println(ex);rn rn rn rnrnrn[/code]rn先运行,Server类,再运行client类,在Client中填入数字后,在Server类的第70行就报<em>异常</em>,rn不知道为什么会这样,而且报<em>异常</em>后程序还能运行,就是一直报<em>异常</em>
OpenJpa报异常
[code=Java]<em>java</em>.lang.ClassNotFoundException: org.apache.openjpa.enhance.InstrumentationFactoryrn at <em>java</em>.net.URLClassLoader$1.run(URLClassLoader.<em>java</em>:200)rn at <em>java</em>.security.AccessController.doPrivileged(Native Method)rn at <em>java</em>.net.URLClassLoader.findClass(URLClassLoader.<em>java</em>:188)rn at <em>java</em>.lang.ClassLoader.loadClass(ClassLoader.<em>java</em>:306)rn at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.<em>java</em>:276)rn at <em>java</em>.lang.ClassLoader.loadClass(ClassLoader.<em>java</em>:251)rn at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.<em>java</em>:280)rn at sun.instrument.InstrumentationImpl.loadClassAndCallAgentmain(InstrumentationImpl.<em>java</em>:348)[/code]rn 启动不报错,但是一运行就报这错。。有用过OpenJpa的人帮我看看。。
在序列化的时候报异常
在打开程序的时候 在序列化的时候报的<em>异常</em>。rn崩溃代码如下:rn[code=c]rn // TODO: add loading code herern ar >> m_bAutoFollow;rn int nCount;rn ar >> nCount;rn for (int i = 0; i < nCount; i++)rn m_Archives.AddTail((CWTArchive*)ar.ReadObject(RUNTIME_CLASS(CWTArchive)));rn ar >> nCount;rn for (i = 0; i < nCount; i++)rn m_DelPages.AddTail((CWTArchivePage*)ar.ReadObject(RUNTIME_CLASS(CWTArchivePage)));rn ar >> m_bJudg;rn ar >> m_bSplit;rn[/code]rnrn程序走到 m_Archives.AddTail((CWTArchive*)ar.ReadObject(RUNTIME_CLASS(CWTArchive)));rn的时候 报错:“Unhandled exception in ArchInput.exe(KERNELBASE.DLL):0xe06d7363 Micorsoft C++ Exception”rnrn一直崩溃 不知道 咋回事 rnrn求大神哈
异常求助!!!
<em>异常</em>信息:在选定的数据源上未找到名为“Position.Name”的字段或属性。 rnrn在手动绑定gridview时报这个<em>异常</em>,我数据源是list集合,Position是一个类成员变量,他有name这个属性,但就是找不到!!!
spring+redis 报NullPointerException异常
小弟在使用Spring的spring-data-redis来操作redis缓存时<em>遇到</em>下面这个<em>问题</em>,麻烦各位大侠帮助解惑一下:rnapplication.xml配置文件如下:rn[code=html]rnrnrn rn rn rn rn rn rn rn rn rnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrnrn[/code]rnrnUserServiceImpl类如下:rn[code=<em>java</em>]rnpackage yyuap.redis.spring.service;rnrnimport org.springframework.cache.annotation.CachePut;rnimport org.springframework.cache.annotation.Cacheable;rnimport org.springframework.util.StringUtils;rnrnimport yyuap.redis.spring.model.UserEntity;rnrn/**rn * 业务层接口实现rn * @author leorn *rn */rnpublic class UserServiceImpl rn rn private static final String cacheKey ="userEntity";rn rn /**rn * 新增rn * @param entityrn * @returnrn * @CachePut 这个注释可以确保方法被执行,同时方法的返回值也被记录到缓存中,实现缓存与数据库的同步更新。rn */rn @CachePut(key ="#entity.getUserId()",value ="entity") rn public void addUserEntity(UserEntity entity) rn //非空rn if(entity ==null || StringUtils.isEmpty(entity.getUserId()))rn rn /**rn * 做数据库持久化,这里就无需再申明了rn */rn System.out.println("先插入数据库中,.........");rn rn rnrn[/code]rnrnUserEntiy实体类如下:rn[code=<em>java</em>]rnpackage yyuap.redis.spring.model;rn/**rn * 用户实体类rn * @author leorn *rn */rnpublic class UserEntity rn //用户idrn private String userId;rn //用户账号rn private String EmpCode;rn //用户名称rn private String EmpName;rn //用户角色rn private String role;rn //职位rn private String title;rn public String getUserId() rn return userId;rn rn public void setUserId(String userId) rn this.userId = userId;rn rn public String getEmpCode() rn return EmpCode;rn rn public void setEmpCode(String empCode) rn EmpCode = empCode;rn rn public String getEmpName() rn return EmpName;rn rn public void setEmpName(String empName) rn EmpName = empName;rn rn public String getRole() rn return role;rn rn public void setRole(String role) rn this.role = role;rn rn public String getTitle() rn return title;rn rn public void setTitle(String title) rn this.title = title;rn rnrn[/code]rnrn测试类如下:rn[code=<em>java</em>]rnpackage yyuap.redis.spring;rnimport org.junit.After;rnimport org.junit.Before;rnimport org.junit.Test;rnimport org.junit.runner.RunWith;rnimport org.springframework.beans.factory.annotation.Autowired;rnimport org.springframework.test.context.ContextConfiguration;rnimport org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;rnimport org.springframework.test.context.junit4.SpringJUnit4ClassRunner;rnrnimport yyuap.redis.spring.model.UserEntity;rnimport yyuap.redis.spring.service.UserServiceImpl;rnrnrn@RunWith(SpringJUnit4ClassRunner.class) rn@ContextConfiguration(locations="classpath:applicationContext.xml")rnpublic class TestUserServiceImpl extends AbstractJUnit4SpringContextTestsrn rn @Autowiredrn private UserServiceImpl userServiceImpl;rn rn @Testrn public void testAddUser()rn UserEntity entity = new UserEntity();rn entity.setUserId("000003");rn entity.setEmpCode("130566");rn entity.setEmpName("leonardo-zeng");rn entity.setRole("Java Development Engineer");rn entity.setTitle("PM");rn userServiceImpl.addUserEntity(entity);rn rnrnrn[/code]rnrn但是在运行测试类的testAddUser()方法时总是报如下<em>异常</em>:rn[img=https://img-bbs.csdn.net/upload/201505/29/1432866619_513804.png][/img]rnrn这是什么原因导致的。
c#图片显示报异常
Stream se = response.GetResponseStream();rn rn Bitmap bmp = new Bitmap(se);//这里报<em>异常</em>:在 System.NotSupportedException 中第一次偶然出现的“System.dll”类型的<em>异常</em>rn有没有知道为什么?
TADOQuery.Open()报的异常。。。
Debugger Exception NotificationrnrnProject MTK_W.exe raised exception class EAccessViolation with message ' Access violation at address 00404693 in module 'MTK_W.exe'. Read of address A6C6A74A ' . Process stopped . Use Step or Run to continue.rnrn以上是错误信息,下面程序中,我用断点查看了connStr,sno等相关参数的值也都是正确的。rn我用类似的代码在另外的程序中连接数据库进行存取操作都是正常的,怎么在这里突然报这种错。rnrn[code=C/C++]rn //define varrn TADOConnection *conn=new TADOConnection(NULL);rn TADOQuery *qry=new TADOQuery(NULL);rn TMemoryStream *temp=new TMemoryStream();rn TBlobField *pAddr,*pBlock;rn TADOBlobStream *pmemAddr,*pmemBlock;rnrn //useful strrn AnsiString user="";rn AnsiString snoStr=Edit1->Text;rn AnsiString connStr=GetConfigInfo();rn AnsiString strMacFileName=(AnsiString)GetCurrentDir()+"\\addr.dat";rn AnsiString strKeyFileName=(AnsiString)GetCurrentDir()+"\\block.bin";rn bool bUpgradeResult;rnrn //set ado connection & queryrn conn->ConnectionString=connStr;rn conn->Open();rnrn //get addr & block from db by snorn qry->Connection=conn;rnrn qry->Active=false;rn qry->SQL->Clear();rn qry->SQL->Add("select addr from [mtk_key] where sno='"+snoStr+"'");rn //到这里就报错了rn qry->Open();rn pAddr=(TBlobField *)qry->FieldByName("addr");rn[/code]rnrnrnps:顺便再问下,删除指定路径的文件,用什么类的什么函数,需要引入什么头文件。 3q!
sessionFactory.getCurrentSession().close()报异常
小弟在一个项目中用到了hibernate(4.1.6版本)和spring(3.2.3版本)框架,想关闭session来释放数据库连接(因为测试时,我发现以前不调用close()时,很快服务器就会提示数据库连接已经被占满)时,却<em>遇到</em>了如下<em>异常</em>:rn[code=<em>java</em>]rnorg.springframework.transaction.TransactionSystemException: Could not commit Hibernate transaction;rnnested exception is org.hibernate.TransactionException: commit failedrn at org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransacrnionManager.<em>java</em>:558)rn at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommitrnAbstractPlatformTransactionManager.<em>java</em>:755)rn at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstrarntPlatformTransactionManager.<em>java</em>:724)rn at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfrnerReturning(TransactionAspectSupport.<em>java</em>:475)rn at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransacrnion(TransactionAspectSupport.<em>java</em>:270)rn Truncated. see log file for complete stacktracernCaused By: org.hibernate.TransactionException: commit failedrn at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionIrnpl.<em>java</em>:185)rn at org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransacrnionManager.<em>java</em>:554)rn at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommitrnAbstractPlatformTransactionManager.<em>java</em>:755)rn at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstrarntPlatformTransactionManager.<em>java</em>:724)rn at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfrnerReturning(TransactionAspectSupport.<em>java</em>:475)rn Truncated. see log file for complete stacktracernCaused By: org.hibernate.TransactionException: unable to commit against JDBC connectionrn at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doCommit(JdbcTransaction.rnava:116)rn at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionIrnpl.<em>java</em>:178)rn at org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransacrnionManager.<em>java</em>:554)rn at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommitrnAbstractPlatformTransactionManager.<em>java</em>:755)rn at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstrarntPlatformTransactionManager.<em>java</em>:724)rn Truncated. see log file for complete stacktracernCaused By: <em>java</em>.sql.SQLException: You can't operate on a closed Connection!!!rn at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.<em>java</em>:106)rn at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.<em>java</em>:65)rn at com.mchange.v2.c3p0.impl.NewProxyConnection.commit(NewProxyConnection.<em>java</em>:809)rn at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doCommit(JdbcTransaction.rnava:112)rn at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionIrnpl.<em>java</em>:178)rn Truncated. see log file for complete stacktracernCaused By: <em>java</em>.lang.NullPointerExceptionrn at com.mchange.v2.c3p0.impl.NewProxyConnection.commit(NewProxyConnection.<em>java</em>:803)rn at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doCommit(JdbcTransaction.rnava:112)rn at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionIrnpl.<em>java</em>:178)rn at org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransacrnionManager.<em>java</em>:554)rn at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommitrnAbstractPlatformTransactionManager.<em>java</em>:755)rn Truncated. see log file for complete stacktracern>rn[/code]rnrnrn百度了一下,有人说通过currentSession得到的Session不需要手动关闭,因为会自动关闭,但是我觉得不可信,因为如果自动关闭的话,那就不会<em>遇到</em>数据库连接不足的情况了。rnrn下面是代码:rn[code=<em>java</em>]rn@Repositoryrnpublic class ProjectDaoImpl implements ProjectDao rnrn @Autowiredrn SessionFactory sessionFactory;rn rn public ProjectDaoImpl(SessionFactory sessionFactory) rn this.sessionFactory = sessionFactory;rn rn rn /*rn * This default constructor must exist if you have overwritten it with parametersrn * Otherwise you will can't instantiate it.rn * */rn public ProjectDaoImpl() rn super();rn rn @Overridern public ArrayList findProjectByPage(int startIndex, int pageSize) rn rn Session session = sessionFactory.getCurrentSession();rn rn String hql = "from Project order by num desc";rnrn ArrayList arrayList = (ArrayList)sessionrn .createQuery(hql)rn .setFirstResult(startIndex)rn .setMaxResults(pageSize)rn .list();rn session.close();rn rn rn return arrayList;rn rnrn[/code]rnrn并且通过spring配置了事务,配置文件如下:rn[code=<em>java</em>]rnrnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrn[/code]rnrnrn请大牛出手相助,小弟不胜感激。
hibernate报异常?
执行到Transaction tx = session.beginTransaction();报<em>异常</em>rnrn<em>异常</em>信息:rn<em>java</em>.lang.NullPointerException
大连理工考研数学辅导班资料下载
大连理工大学的高等代数和数学分析,辅导班的资料。 相关下载链接:[url=//download.csdn.net/download/zfx88666/2153989?utm_source=bbsseo]//download.csdn.net/download/zfx88666/2153989?utm_source=bbsseo[/url]
matlab安装手册下载
此文件是matlab2009版的安装文件,希望对大家有用~ 相关下载链接:[url=//download.csdn.net/download/xiaomianyangnj2011/4306853?utm_source=bbsseo]//download.csdn.net/download/xiaomianyangnj2011/4306853?utm_source=bbsseo[/url]
免费asp源码下载
免费asp源码。个人网站,学校网站,政府网站很实用。 相关下载链接:[url=//download.csdn.net/download/free93/5130814?utm_source=bbsseo]//download.csdn.net/download/free93/5130814?utm_source=bbsseo[/url]
相关热词 c#入门推荐书 c# 解码海康数据流 c# xml的遍历循环 c# 取 查看源码没有的 c#解决高并发 委托 c#日期转化为字符串 c# 显示问号 c# 字典对象池 c#5.0 安装程序 c# 分页算法
我们是很有底线的