Newbee help iterator ????
Hi
I have an assignement I have to make in java. My problem is that I cannot understand why the following code won't compile, the compiler sais that iterator method is wrong???? I use the iterator package from the libraries...i have a homogenous list of items, only String...I really can't figure it out...anybody can help me??? :-|
public void searchName(String searchname)
boolean gotit = false;
Iterator it = varer.iterator();
while (it.hasNext()) {
Varer searchname = (Varer) it.next();
if (searchname.equals(searchvare.getName())) {
System.out.println("Vare: " + searchvare.getName());
gotit = true;
}
Gosh...I am so stupid, of course...now it will compile, I repaced "varer" with another instance....I used so much time on this!! :-o
Thanks a lot!!!!
:D
Similar Messages
-
Please help a newbee to get things going. I've just installed 10g Xe on my home pc with windows XP. I can start and stop the database but cannot locate the environment files. Also new to oracle installation on windows, therefore not familiar with the file structure. Is there a location with this info? Also cannot locate the user scott on the db. Has the schema been removed from 10g?
Scott's fired. The schema you can use is HR but you probably need to unlock it first. What environment files are you talking about?
MHE -
Newbee help: applet sends itself to sock server!!!
hi all,
im a c# developer 'n new to java applets,
my client have a server and a web java applet that connects to server using socket
i've got a task to create a c# windows application to do same as the applet.
im just confused, when i saw the applet code, it connects to server, and sends itself to the server!!!
here's the code, can anyone plz help me what's actually happening...
try
to_server = new Socket(getCodeBase().getHost(), port_of_server);
_OOS = new ObjectOutputStream(to_server.getOutputStream());
is = new DataInputStream(new BufferedInputStream(to_server.getInputStream()));
os = new PrintStream(new BufferedOutputStream(to_server.getOutputStream(), 1024), false);
txtAreaMessages.setText("");
txtMessage.setEnabled(true);
txtMessage.setText("");
catch(Exception exception)
_logout();
txtAreaMessages.appendText("Could not Connect...");
return;
// THIS IS THE CODE WHERE IM CONFUSED!!!
_OOS.writeObject(this);
_OOS.flush();
os.print(1);
os.flush();
ClientNew clientnew = new ClientNew(is, os, txtAreaMessages);
clientnew.start();
btnLogin.setEnabled(false);
txtLoginName.setEnabled(false);
btnSend.setEnabled(true);
btnMobMessage.setEnabled(true);
ch_thread = new Thread(this, "abc");
ch_thread.start();alll is well, but what's with ObjectOutputStream, and why its sending (this) to server??
im asking this question here because i wanna learn it as well :D
it'll be really great help if someone can tell me same to do in c#
// chall3ng3r //the decompiled source code should tell you what you need to rewrite the client-server communications, which you will unfortunately have to do.
is it some kind of trick to allow only connection from the applet not from c# or vb??no, its an easy, java-specific method of communication.
if it is, how to do same in c#, (just gimme a hint, not the full solution)yes, you would have to do work to allow any other language to emulate this.
no, its not impossible to do.
i know nothing about c# -
I have been trying to populate a combo box from a HTTPservice
bound to an .asp file, it works great for a list box, this has
given me a bad beating! I will purchase Flex as soon as this is
resolved. Here is some code starting with the .asp. Thanks in
advance for the help.....
Note: I can make it work with a .xml file!
[email protected]
***ASP File
<%
On Error Resume Next
Set objDO_Prod = CreateObject("myTools.PopArray")
objDO_Prod.Return_Records = True
objDO_Prod.Max_Allowable_Records = 1000
objDO_Prod.Include_Field_Names = False
objDO_Prod.Conn_String = "Driver={SYBASE
SYSTEM11};Srvr=mlndb02;Uid=wu;Pwd=web_user;Database=warehouse"
sql = " SELECT *"
sql = sql & " FROM t_employee"
sql = sql & " ORDER BY f_last"
objDO_Prod.SQL_Statment = sql
SqlArray = objDO_Prod.ExecuteSQL
If objDO_Prod.Status = True Then
'build xml
mxmlStr = "<users>"
For i = 1 to UBound(SqlArray, 2)
mxmlStr = mxmlStr & "<user><userid>" &
SqlArray(1,i) & "</userid><username>" &
SqlArray(3,i) & "</username><emailaddress>" &
SqlArray(23,i) & "</emailaddress></user>" &
vbcrlf
Next
mxmlStr = mxmlStr & "</users>"
Response.Write(mxmlStr)
End If
%>
***MX File
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
xmlns="*"
initialize="simpleHTS.send()"
creationComplete="createEmplist()">
<mx:HTTPService
id="simpleHTS"
url="List_Emp6.asp"
useProxy="false"
method="POST"
resultFormat="object">
</mx:HTTPService>
<mx:HBox>
<mx:ComboBox id="country" dataProvider="{emps}"/>
</mx:HBox>
<mx:Script>
<![CDATA[
import mx.utils.ArrayUtil;
import mx.collections.ArrayCollection;
[Bindable]
var emps:ArrayCollection;
function createEmplist()
emps =
ArrayCollection(simpleHTS.lastResult.users.user.userid);
]]>
</mx:Script>
</mx:Application><******************** .asp output
10005935Aguilar
[email protected]
10004844Albertson 10004671Aldrup
[email protected]
[email protected] 10003279Anderson
10003487Anderson 10011747Anderson 10005575Anderson 10003520Appling
10043232Augustin
[email protected] 10004718Bailey
10002092Baker 10003121Balderson 10002787Barney 10003684Bartek
[email protected]
[email protected] 10001799Bergmeier
10002818Bietz 10001823Blecha 10001747Bloebaum 10041828Bloomquist
10005553Bogle 10001489Boller 10004619Borgmann 10002757Borgmann
[email protected]
[email protected]
[email protected]
10004731Branting
[email protected]
10001486Brethouwer 10004026Brethouwer 10004252Brethouwer
10004085Bristol 10005522Brooks 10001462Brown 10004702Brown
[email protected]
[email protected] 10004040Buhr
10001905Burbach [email protected]
<******** asp source
<users><user><userid>10005935</userid><username>Aguilar</username><emailaddress>
</emailaddress></user>
<user><userid>10002493</userid><username>Ainslie</username><emailaddress>Wayne.Ainslie@us. schneider-electric.com</emailaddress></user>
<user><userid>10004844</userid><username>Albertson</username><emailaddress>
</emailaddress></user>
<user><userid>10004671</userid><username>Aldrup</username><emailaddress>
</emailaddress></user>
<user><userid>10001691</userid><username>Alles</username><emailaddress>[email protected] neider-electric.com</emailaddress></user>
<user><userid>10002049</userid><username>Alles</username><emailaddress>[email protected] ider-electric.com</emailaddress></user>
<user><userid>10003279</userid><username>Anderson</username><emailaddress>
</emailaddress></user>
<user><userid>10003487</userid><username>Anderson</username><emailaddress>
</emailaddress></user>
<user><userid>10011747</userid><username>Anderson</username><emailaddress>
</emailaddress></user>
</users> -
i am new to java, this is the first time I upload my web application using jsp tech. Can anyone help me solve this problem:
develop environment: mysql 4, tomcat 4, jconnector 5.0.3 driver
Apache Tomcat/4.0.6 - HTTP Status 500 - Internal Server Error
type Exception report
message Internal Server Error
description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Communications link failure due to underlying exception:
** BEGIN NESTED EXCEPTION **
java.net.SocketException
MESSAGE: Broken pipe
STACKTRACE:
java.net.SocketException: Broken pipe
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:66)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124)
at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:2637)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1554)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3124)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1149)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1262)
at org.apache.jsp.products$jsp._jspService(products$jsp.java:216)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:98)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:176)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:172)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.ajp.tomcat4.Ajp13Processor.process(Ajp13Processor.java:458)
at org.apache.ajp.tomcat4.Ajp13Processor.run(Ajp13Processor.java:551)
at java.lang.Thread.run(Thread.java:534)
** END NESTED EXCEPTION **
Last packet sent to the server was 1 ms ago.
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:471)
at org.apache.jsp.products$jsp._jspService(products$jsp.java:441)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:98)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:176)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:172)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.ajp.tomcat4.Ajp13Processor.process(Ajp13Processor.java:458)
at org.apache.ajp.tomcat4.Ajp13Processor.run(Ajp13Processor.java:551)
at java.lang.Thread.run(Thread.java:534)
root cause
com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:
** BEGIN NESTED EXCEPTION **
java.net.SocketException
MESSAGE: Broken pipe
STACKTRACE:
java.net.SocketException: Broken pipe
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:66)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124)
at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:2637)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1554)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3124)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1149)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1262)
at org.apache.jsp.products$jsp._jspService(products$jsp.java:216)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:98)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:176)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:172)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.ajp.tomcat4.Ajp13Processor.process(Ajp13Processor.java:458)
at org.apache.ajp.tomcat4.Ajp13Processor.run(Ajp13Processor.java:551)
at java.lang.Thread.run(Thread.java:534)
** END NESTED EXCEPTION **
Last packet sent to the server was 1 ms ago.
at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:2652)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1554)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3124)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1149)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1262)
at org.apache.jsp.products$jsp._jspService(products$jsp.java:216)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:98)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:176)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:172)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.ajp.tomcat4.Ajp13Processor.process(Ajp13Processor.java:458)
at org.apache.ajp.tomcat4.Ajp13Processor.run(Ajp13Processor.java:551)
at java.lang.Thread.run(Thread.java:534)I have used this connecting code:
String host = "localhost";
String db = "mydb";
String username = "myname";
String password = "admin";
MYBean.ConnectionPool pool = (MYBean.ConnectionPool)application.getAttribute("mycons");
if(pool==null) {
try{
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
} catch(Exception ex){
out.println("<br>- Problem with Driver -<br>");
out.println(ex.getMessage());
pool = new MYBean.ConnectionPool(host,db,username,password);
application.setAttribute("mycons",pool);
I wrote this code in common.jsp file, then in any jsp page If I want to get data from DB, i use :
<%@ include file="common.jsp"%>
<%
java.sql.Connection con = null;
java.sql.PreparedStatement ps = null;
java.sql.ResultSet rs = null;
con = pool.getCon();
rs = con.createStatement().executeQuery("...")
pool.releaseCon(con);
Following is my simple ConnectionPool.java
package MYBean;
import java.sql.*;
import java.util.*;
public class ConnectionPool {
protected Stack CONS; // store connectionS
protected String host;
protected String db;
protected String username;
protected String password;
public ConnectionPool(String host, String db, String username, String password) {
this.host = host;
this.db = db;
this.username = username;
this.password = password;
CONS = new Stack();
public int total() throws Exception {
return CONS.size();
public synchronized Connection getCon() throws Exception{
if (!CONS.empty())
return (java.sql.Connection)CONS.pop();
else {
String st = "jdbc:mysql://"+host+"/"+db+"?user="+username+"&password="+password;
return DriverManager.getConnection(st);
public synchronized void releaseCon(java.sql.Connection con) throws Exception {
// max store = 20
if (CONS.size()<20)
CONS.push(con);
%> -
Newbee help for dicom image window center/width manipultation
We have a flash based dicom viewer and i have the folowing code in action script which i want to replace with pixel bender code. is it possible ?
var img_bmp:BitmapData = new BitmapData(Cols, Rows,false,0);
for (var y:Number = 0; y <Rows; y++) {
for (var x:Number = 0; x <Cols; x++) {
gray = byteArray.readUnsignedShort()*Slope + Intercept;
gray = 255 * gray/WindowWidth - Min * 255 / WindowWidth;
gray = uint(gray);
var r:int = gray;
var g:int = gray;
var blue:int = gray;
var c:uint = (r << 16) | (g << 8) | blue;
img_bmp.setPixel(x, y, c);
Where byteArray is a unsignedshort sequnce. Slope, intercept, WindowWidth and Min are constants.
From the little i understood of the kernel programming the expected input channel cannot be 2 channel or single channel input.
can any one suggest how i can proceed or give me pointers or for this kind of image manipulation pixel bender is not suitable.
Thanks in advance
Sastradhari wrote the below kernel code and compiled using pbutil and it did compile i am having trouble determining the shader width and height. can some one help me out.
<languageVersion: 1.0;>
kernel pixel
< namespace : "TMP";
vendor : "TMP";
version : 1;
>
input image1 src;
output pixel3 dst;
parameter float Intercept;
parameter float Slope;
parameter float WindowWidth;
parameter float Min;
void
evaluatePixel()
float gray = sample(src, outCoord())*Slope + Intercept ;
gray = 255.0 * gray/WindowWidth - Min * 255.0 / WindowWidth;
dst = pixel3(gray,gray,gray);
can some one tell me how to get the shader width and height so so that pixel bender can only act on 16 bits or did i get the whole thing wrong.
shader.data.src.input = byteArray;
shader.data.Slope = Slope;
shader.data.Intercept = Intercept;
shader.data.Min = Min;
shader.data.WindowWidth = WindowWidth;
shader.data.src.width = Cols >> 1;
shader.data.src.height = Rows ;
var myJob:ShaderJob = new ShaderJob(shader, img_bmp,Cols, Rows);
myJob.addEventListener(ShaderEvent.COMPLETE, pixelComplete);
myJob.start();
Thanks in advance -
Newbee help, how to make a outlook styled bar.
Hi all,
I'm a beginner in Java and i want to make a toolbar that's like the outlook bar feature in the left hand corner of the screen, where you have a series of buttons ( or button like components). By clicking on any of these buttons, the screen is split up and displays a menu of components according to the button that was clicked. The position of the buttons also changes when it is clicked.
What i want to do is to open a frame (or something) when you click on one of the components in the menu.
I want to implement such a functionality in java. Can some one out there give an idea as to which swing components could be used to implement the above, because i realy don't know how to do this. Or if any one has done a similar thing, your code sample would be of much use.
Thanks in advance,
fifnux.some one out there give an idea as to which swing
components could be used to implement the above,
because i realy don't know how to do this. Or if any
one has done a similar thing, your code sample would
be of much use.Use a JMenuBar or a JToolBar for the outlook style buttons. Use a JSplitPane for your divisions in your UI. Search the tutorials (see left) for details and app notes on each. -
Reposting: Question regarding iteration over synchronized list
[added proper markup]
I've got an A-Life program I work on for fun. I thought I understood (sorta) synchronized collections, but this puzzles me. The method body is as follows:
* Create new animals from existing animals
* @return The cohort of newborn animals
public List<IAnimal> regenerate() {
List<IAnimal> children = new ArrayList<IAnimal>();
synchronized (animalList) {
Iterator<IAnimal> it = animalList.iterator(); // must be in synchro block according to JDK notes
while (it.hasNext()) {
IAnimal a = it.next();
if (a.isPregnant() && ((GeneModel.getInstance().getTicks() % getEnvironment().getAnimal().getReproCycle()) == 0)) {
IAnimal child = a.reproduce();
children.add(child); // newborns
// animalList.add(child); // the whole population //THROWS CME!
animalList.addAll(children); // does not throw CME
return children;
}Animal list is a synchronized list (backed by and ArrayList). Note that I've synchronized on the list, yet adding children individually throws a ConcurrentModificationException (I did overwrite the add() method on the backing list, but I wouldn't think that would be a problem; it might be in that it iterates over itself... but synchronizing that doesn't help, either).
Anyhow, doing an addAll outside of the synchronization block works fine (also works if I loop through the children and add them at this point).
Is it my override of the add() method? From what I can see, the synchronized wrapper just adds a mutex to each access method in the backing list. Here's the method override:
List<IAnimal> backingList =
new LinkedList<IAnimal>() {
* Checks that we're not putting one animal on top of another. If we are, we generate a new animal and
* try again.
* @param animal The animal to be added
* @return true
public boolean add(IAnimal animal) {
boolean added = false;
outer:
do {
// synchronized (this) { // DIDN'T HELP
Iterator<IAnimal> iAnimals = iterator();
while (iAnimals.hasNext()) {
//FIXME: this algorithm assumes square animals
Point existingAnimalLocation = iAnimals.next().getLocation();
double distance = existingAnimalLocation.distance(animal.getLocation());
if (distance < animal.getSize().getWidth()) {
animal = new Animal();
continue outer;
//} //end unhelpful synchro block
super.add(animal);
added = true;
while (!added);
return added;
} // end method add
};Jefferino wrote:
spoon_ wrote:
By the way that Iterators in Java are designed, you are not allowed to modify a list as you iterate over it.
Not true: Iterator.remove().
Edited by: Jefferino on Mar 20, 2008 2:24 AMOh yeah, you can modify it using the iterator's methods; but not using any of the collection's methods, like add(). -
Question regarding iteration over synchronized list
I've got an A-Life program I work on for fun. I thought I understood (sorta) synchronized collections, but this puzzles me. The method body is as follows:
* Create new animals from existing animals
* @return The cohort of newborn animals
public List<IAnimal> regenerate() {
List<IAnimal> children = new ArrayList<IAnimal>();
synchronized (animalList) {
Iterator<IAnimal> it = animalList.iterator(); // must be in synchro block according to JDK notes
while (it.hasNext()) {
IAnimal a = it.next();
if (a.isPregnant() && ((GeneModel.getInstance().getTicks() % getEnvironment().getAnimal().getReproCycle()) == 0)) {
IAnimal child = a.reproduce();
children.add(child); // newborns
// animalList.add(child); // the whole population //THROWS CME!
animalList.addAll(children); // does not throw CME
return children;
Animal list is a synchronized list (backed by and ArrayList). Note that I've synchronized on the list, yet adding children individually throws a ConcurrentModificationException (I did overwrite the add() method on the backing list, but I wouldn't think that would be a problem; it might be in that it iterates over itself... but synchronizing that doesn't help, either).
Anyhow, doing an addAll outside of the synchronization block works fine (also works if I loop through the children and add them at this point).
Is it my override of the add() method? From what I can see, the synchronized wrapper just adds a mutex to each access method in the backing list. Here's the method override:
List<IAnimal> backingList =
new LinkedList<IAnimal>() {
* Checks that we're not putting one animal on top of another. If we are, we generate a new animal and
* try again.
* @param animal The animal to be added
* @return true
public boolean add(IAnimal animal) {
boolean added = false;
outer:
do {
// synchronized (this) { // DIDN'T HELP
Iterator<IAnimal> iAnimals = iterator();
while (iAnimals.hasNext()) {
//FIXME: this algorithm assumes square animals
Point existingAnimalLocation = iAnimals.next().getLocation();
double distance = existingAnimalLocation.distance(animal.getLocation());
if (distance < animal.getSize().getWidth()) {
animal = new Animal();
continue outer;
//} //end unhelpful synchro block
super.add(animal);
added = true;
while (!added);
return added;
} // end method add
};Your code is not formatted (use code tags for this) but it seems to me that you add elements to the list while you iterate over it, hence a ConcurrentModificationException is thrown. Use a ListIterator if you want to add to the list while iterating.
-
Pro*c multithreaded application has memory leak
Hi there,
I posted this message a week ago in OCI section, nobody answer me.
I am really curious if my application has a bug or the pro*c has a bug.
Anyone can compile the sample code and test it easily.
I made multithreaded application which queries dynamic SQL, it works.
But the memory leaks when i query the SQL statement.
The more memory leaks, the more i query the SQL statement, even same SQL
statement.
I check it with top, shell command.
My machine is SUN E450, Solaris 8. Oracle 9.2.0.1
Compiler : gcc (GCC) 3.2.2
I changed source code which is from
$(ORACLE_HOME)/precomp/demo/proc/sample10.pc
the sample10 doesn't need to be multithreaded. But i think it has to work
correctly if i changed it to multithreaded application.
the make file and source code will be placed below.
I have to figure out the problem.
Please help
Thanks in advance,
the make file is below
HOME = /user/jkku
ORA = $(ORACLE_HOME)
CC = gcc
PROC = proc
LC_INCL = -I$(HOME)/work/dbmss/libs/include
lc_incl = include=$(HOME)/work/dbmss/libs/include
SYS_INCL =
sys_incl =
ORA_INCL = -I. \
-I$(ORA)/precomp/public \
-I$(ORA)/rdbms/public \
-I$(ORA)/rdbms/demo \
-I$(ORA)/rdbms/pbsql/public \
-I$(ORA)/network/public \
-DSLMXMX_ENABLE -DSLTS_ENABLE -D_SVID_GETTOD
INCLUDES = $(LC_INCL) $(SYS_INCL) $(ORA_INCL)
includes = $(lc_incl) $(sys_incl)
LC_LIBS =
SYS_LIBS = -lpthread -lsocket -lnsl -lrt
ORA_LIBS = -L$(ORA)/lib/ -lclntsh
LIBS = $(LC_LIBS) $(SYS_LIBS) $(ORA_LIBS)
# Define C Compiler flags
CFLAGS += -D_Solaris64_ -m64
CFLAGS += -g -D_REENTRANT
# Define pro*c Compiler flags
PROCFLAGS += THREADS=YES
PROCFLAGS += CPOOL=YES
# Our object files
PRECOMPS = sample10.c
OBJS = sample10.o
.SUFFIXES: .o .c .pc
.c.o:
$(CC) -c $(CFLAGS) $(INCLUDES) $*.c
.pc.c:
$(PROC) $(PROCFLAGS) $(includes) $*.pc $*.c
all: sample10
sample10: $(PRECOMPS) $(OBJS)
$(CC) $(CFLAGS) -o sample10 $(OBJS) $(LIBS)
clean:
rm -rf *.o sample10 sample10.c
the source code is below which i changed the oracle sample10.pc to
multithreaded application.
Sample Program 10: Dynamic SQL Method 4
This program connects you to ORACLE using your username and
password, then prompts you for a SQL statement. You can enter
any legal SQL statement. Use regular SQL syntax, not embedded SQL.
Your statement will be processed. If it is a query, the rows
fetched are displayed.
You can enter multi-line statements. The limit is 1023 characters.
This sample program only processes up to MAX_ITEMS bind variables and
MAX_ITEMS select-list items. MAX_ITEMS is #defined to be 40.
#include <stdio.h>
#include <string.h>
#include <setjmp.h>
#include <sqlda.h>
#include <stdlib.h>
#include <sqlcpr.h>
/* Maximum number of select-list items or bind variables. */
#define MAX_ITEMS 40
/* Maximum lengths of the names of the
select-list items or indicator variables. */
#define MAX_VNAME_LEN 30
#define MAX_INAME_LEN 30
#ifndef NULL
#define NULL 0
#endif
/* Prototypes */
#if defined(__STDC__)
void sql_error(void);
int oracle_connect(void);
int alloc_descriptors(int, int, int);
int get_dyn_statement(void);
void set_bind_variables(void);
void process_select_list(void);
void help(void);
#else
void sql_error(/*_ void _*/);
int oracle_connect(/*_ void _*/);
int alloc_descriptors(/*_ int, int, int _*/);
int get_dyn_statement(/* void _*/);
void set_bind_variables(/*_ void -*/);
void process_select_list(/*_ void _*/);
void help(/*_ void _*/);
#endif
char *dml_commands[] = {"SELECT", "select", "INSERT", "insert",
"UPDATE", "update", "DELETE", "delete"};
EXEC SQL INCLUDE sqlda;
EXEC SQL INCLUDE sqlca;
EXEC SQL BEGIN DECLARE SECTION;
char dyn_statement[1024];
EXEC SQL VAR dyn_statement IS STRING(1024);
EXEC SQL END DECLARE SECTION;
EXEC ORACLE OPTION (ORACA=YES);
EXEC ORACLE OPTION (RELEASE_CURSOR=YES);
SQLDA *bind_dp;
SQLDA *select_dp;
/* Define a buffer to hold longjmp state info. */
jmp_buf jmp_continue;
char *db_uid="dbmuser/dbmuser@dbmdb";
sql_context ctx;
int err_sql;
enum{
SQL_SUCC=0,
SQL_ERR,
SQL_NOTFOUND,
SQL_UNIQUE,
SQL_DISCONNECT,
SQL_NOTNULL
int main()
int i;
EXEC SQL ENABLE THREADS;
EXEC SQL WHENEVER SQLERROR DO sql_error();
EXEC SQL WHENEVER NOT FOUND DO sql_not_found();
/* Connect to the database. */
if (connect_database() < 0)
exit(1);
EXEC SQL CONTEXT USE :ctx;
/* Process SQL statements. */
for (;;)
/* Allocate memory for the select and bind descriptors. */
if (alloc_descriptors(MAX_ITEMS, MAX_VNAME_LEN, NAME_LEN) != 0)
exit(1);
(void) setjmp(jmp_continue);
/* Get the statement. Break on "exit". */
if (get_dyn_statement() != 0)
break;
EXEC SQL PREPARE S FROM :dyn_statement;
EXEC SQL DECLARE C CURSOR FOR S;
/* Set the bind variables for any placeholders in the
SQL statement. */
set_bind_variables();
/* Open the cursor and execute the statement.
* If the statement is not a query (SELECT), the
* statement processing is completed after the
* OPEN.
EXEC SQL OPEN C USING DESCRIPTOR bind_dp;
/* Call the function that processes the select-list.
* If the statement is not a query, this function
* just returns, doing nothing.
process_select_list();
/* Tell user how many rows processed. */
for (i = 0; i < 8; i++)
if (strncmp(dyn_statement, dml_commands, 6) == 0)
printf("\n\n%d row%c processed.\n", sqlca.sqlerrd[2], sqlca.sqlerrd[2] == 1 ? '\0' : 's');
break;
/* Close the cursor. */
EXEC SQL CLOSE C;
/* When done, free the memory allocated for pointers in the bind and
select descriptors. */
for (i = 0; i < MAX_ITEMS; i++)
if (bind_dp->V != (char *) 0)
free(bind_dp->V);
free(bind_dp->I); /* MAX_ITEMS were allocated. */
if (select_dp->V != (char *) 0)
free(select_dp->V);
free(select_dp->I); /* MAX_ITEMS were allocated. */
/* Free space used by the descriptors themselves. */
SQLSQLDAFree(ctx, bind_dp);
SQLSQLDAFree(ctx, select_dp);
} /* end of for(;;) statement-processing loop */
disconnect_database();
EXEC SQL WHENEVER SQLERROR CONTINUE;
EXEC SQL COMMIT WORK RELEASE;
puts("\nHave a good day!\n");
return;
* Allocate the BIND and SELECT descriptors using sqlald().
* Also allocate the pointers to indicator variables
* in each descriptor. The pointers to the actual bind
* variables and the select-list items are realloc'ed in
* the set_bind_variables() or process_select_list()
* routines. This routine allocates 1 byte for select_dp->V
* and bind_dp->V, so the realloc will work correctly.
alloc_descriptors(size, max_vname_len, max_iname_len)
int size;
int max_vname_len;
int max_iname_len;
int i;
* The first sqlald parameter determines the maximum number of
* array elements in each variable in the descriptor. In
* other words, it determines the maximum number of bind
* variables or select-list items in the SQL statement.
* The second parameter determines the maximum length of
* strings used to hold the names of select-list items
* or placeholders. The maximum length of column
* names in ORACLE is 30, but you can allocate more or less
* as needed.
* The third parameter determines the maximum length of
* strings used to hold the names of any indicator
* variables. To follow ORACLE standards, the maximum
* length of these should be 30. But, you can allocate
* more or less as needed.
if ((bind_dp =
SQLSQLDAAlloc(ctx, size, max_vname_len, max_iname_len)) ==
(SQLDA *) 0)
fprintf(stderr,
"Cannot allocate memory for bind descriptor.");
return -1; /* Have to exit in this case. */
if ((select_dp =
SQLSQLDAAlloc(ctx, size, max_vname_len, max_iname_len)) == (SQLDA *)
0)
fprintf(stderr,
"Cannot allocate memory for select descriptor.");
return -1;
select_dp->N = MAX_ITEMS;
/* Allocate the pointers to the indicator variables, and the
actual data. */
for (i = 0; i < MAX_ITEMS; i++) {
bind_dp->I = (short *) malloc(sizeof (short));
select_dp->I = (short *) malloc(sizeof(short));
bind_dp->V = (char *) malloc(1);
select_dp->V = (char *) malloc(1);
return 0;
int get_dyn_statement()
char *cp, linebuf[256];
int iter, plsql;
for (plsql = 0, iter = 1; ;)
if (iter == 1)
printf("\nSQL> ");
dyn_statement[0] = '\0';
fgets(linebuf, sizeof linebuf, stdin);
cp = strrchr(linebuf, '\n');
if (cp && cp != linebuf)
*cp = ' ';
else if (cp == linebuf)
continue;
if ((strncmp(linebuf, "EXIT", 4) == 0) ||
(strncmp(linebuf, "exit", 4) == 0))
return -1;
else if (linebuf[0] == '?' ||
(strncmp(linebuf, "HELP", 4) == 0) ||
(strncmp(linebuf, "help", 4) == 0))
help();
iter = 1;
continue;
if (strstr(linebuf, "BEGIN") ||
(strstr(linebuf, "begin")))
plsql = 1;
strcat(dyn_statement, linebuf);
if ((plsql && (cp = strrchr(dyn_statement, '/'))) ||
(!plsql && (cp = strrchr(dyn_statement, ';'))))
*cp = '\0';
break;
else
iter++;
printf("%3d ", iter);
return 0;
void set_bind_variables()
int i, n;
char bind_var[64];
/* Describe any bind variables (input host variables) */
EXEC SQL WHENEVER SQLERROR DO sql_error();
bind_dp->N = MAX_ITEMS; /* Initialize count of array elements. */
EXEC SQL DESCRIBE BIND VARIABLES FOR S INTO bind_dp;
/* If F is negative, there were more bind variables
than originally allocated by sqlald(). */
if (bind_dp->F < 0)
printf ("\nToo many bind variables (%d), maximum is %d\n.",
-bind_dp->F, MAX_ITEMS);
return;
/* Set the maximum number of array elements in the
descriptor to the number found. */
bind_dp->N = bind_dp->F;
/* Get the value of each bind variable as a
* character string.
* C contains the length of the bind variable
* name used in the SQL statement.
* S contains the actual name of the bind variable
* used in the SQL statement.
* L will contain the length of the data value
* entered.
* V will contain the address of the data value
* entered.
* T is always set to 1 because in this sample program
* data values for all bind variables are entered
* as character strings.
* ORACLE converts to the table value from CHAR.
* I will point to the indicator value, which is
* set to -1 when the bind variable value is "null".
for (i = 0; i < bind_dp->F; i++)
printf ("\nEnter value for bind variable %.*s: ",
(int)bind_dp->C, bind_dp->S);
fgets(bind_var, sizeof bind_var, stdin);
/* Get length and remove the new line character. */
n = strlen(bind_var) - 1;
/* Set it in the descriptor. */
bind_dp->L = n;
/* (re-)allocate the buffer for the value.
sqlald() reserves a pointer location for
V but does not allocate the full space for
the pointer. */
bind_dp->V = (char *) realloc(bind_dp->V, (bind_dp->L + 1));
/* And copy it in. */
strncpy(bind_dp->V, bind_var, n);
/* Set the indicator variable's value. */
if ((strncmp(bind_dp->V, "NULL", 4) == 0) ||
(strncmp(bind_dp->V, "null", 4) == 0))
*bind_dp->I = -1;
else
*bind_dp->I = 0;
/* Set the bind datatype to 1 for CHAR. */
bind_dp->T = 1;
return;
void process_select_list()
int i, null_ok, precision, scale;
if ((strncmp(dyn_statement, "SELECT", 6) != 0) &&
(strncmp(dyn_statement, "select", 6) != 0))
select_dp->F = 0;
return;
/* If the SQL statement is a SELECT, describe the
select-list items. The DESCRIBE function returns
their names, datatypes, lengths (including precision
and scale), and NULL/NOT NULL statuses. */
select_dp->N = MAX_ITEMS;
EXEC SQL DESCRIBE SELECT LIST FOR S INTO select_dp;
/* If F is negative, there were more select-list
items than originally allocated by sqlald(). */
if (select_dp->F < 0)
printf ("\nToo many select-list items (%d), maximum is %d\n",
-(select_dp->F), MAX_ITEMS);
return;
/* Set the maximum number of array elements in the
descriptor to the number found. */
select_dp->N = select_dp->F;
/* Allocate storage for each select-list item.
sqlprc() is used to extract precision and scale
from the length (select_dp->L).
sqlnul() is used to reset the high-order bit of
the datatype and to check whether the column
is NOT NULL.
CHAR datatypes have length, but zero precision and
scale. The length is defined at CREATE time.
NUMBER datatypes have precision and scale only if
defined at CREATE time. If the column
definition was just NUMBER, the precision
and scale are zero, and you must allocate
the required maximum length.
DATE datatypes return a length of 7 if the default
format is used. This should be increased to
9 to store the actual date character string.
If you use the TO_CHAR function, the maximum
length could be 75, but will probably be less
(you can see the effects of this in SQL*Plus).
ROWID datatype always returns a fixed length of 18 if
coerced to CHAR.
LONG and
LONG RAW datatypes return a length of 0 (zero),
so you need to set a maximum. In this example,
it is 240 characters.
printf ("\n");
for (i = 0; i < select_dp->F; i++)
char title[MAX_VNAME_LEN];
/* Turn off high-order bit of datatype (in this example,
it does not matter if the column is NOT NULL). */
sqlnul ((unsigned short *)&(select_dp->T), (unsigned short
*)&(select_dp->T), &null_ok);
switch (select_dp->T)
case 1 : /* CHAR datatype: no change in length
needed, except possibly for TO_CHAR
conversions (not handled here). */
break;
case 2 : /* NUMBER datatype: use sqlprc() to
extract precision and scale. */
sqlprc ((unsigned int *)&(select_dp->L), &precision,
&scale);
/* Allow for maximum size of NUMBER. */
if (precision == 0) precision = 40;
/* Also allow for decimal point and
possible sign. */
/* convert NUMBER datatype to FLOAT if scale > 0,
INT otherwise. */
if (scale > 0)
select_dp->L = sizeof(float);
else
select_dp->L = sizeof(int);
break;
case 8 : /* LONG datatype */
select_dp->L = 240;
break;
case 11 : /* ROWID datatype */
case 104 : /* Universal ROWID datatype */
select_dp->L = 18;
break;
case 12 : /* DATE datatype */
select_dp->L = 9;
break;
case 23 : /* RAW datatype */
break;
case 24 : /* LONG RAW datatype */
select_dp->L = 240;
break;
/* Allocate space for the select-list data values.
sqlald() reserves a pointer location for
V but does not allocate the full space for
the pointer. */
if (select_dp->T != 2)
select_dp->V = (char *) realloc(select_dp->V,
select_dp->L + 1);
else
select_dp->V = (char *) realloc(select_dp->V,
select_dp->L);
/* Print column headings, right-justifying number
column headings. */
/* Copy to temporary buffer in case name is null-terminated */
memset(title, ' ', MAX_VNAME_LEN);
strncpy(title, select_dp->S, select_dp->C);
if (select_dp->T == 2)
if (scale > 0)
printf ("%.*s ", select_dp->L+3, title);
else
printf ("%.*s ", select_dp->L, title);
else
printf("%-.*s ", select_dp->L, title);
/* Coerce ALL datatypes except for LONG RAW and NUMBER to
character. */
if (select_dp->T != 24 && select_dp->T != 2)
select_dp->T = 1;
/* Coerce the datatypes of NUMBERs to float or int depending on
the scale. */
if (select_dp->T == 2)
if (scale > 0)
select_dp->T = 4; /* float */
else
select_dp->T = 3; /* int */
printf ("\n\n");
/* FETCH each row selected and print the column values. */
EXEC SQL WHENEVER NOT FOUND GOTO end_select_loop;
for (;;)
EXEC SQL FETCH C USING DESCRIPTOR select_dp;
/* Since each variable returned has been coerced to a
character string, int, or float very little processing
is required here. This routine just prints out the
values on the terminal. */
for (i = 0; i < select_dp->F; i++)
if (*select_dp->I < 0)
if (select_dp->T == 4)
printf ("%-*c ",(int)select_dp->L+3, ' ');
else
printf ("%-*c ",(int)select_dp->L, ' ');
else
if (select_dp->T == 3) /* int datatype */
printf ("%*d ", (int)select_dp->L,
*(int *)select_dp->V);
else if (select_dp->T == 4) /* float datatype */
printf ("%*.2f ", (int)select_dp->L,
*(float *)select_dp->V);
else /* character string */
printf ("%-*.*s ", (int)select_dp->L,
(int)select_dp->L, select_dp->V);
printf ("\n");
end_select_loop:
return;
void help()
puts("\n\nEnter a SQL statement or a PL/SQL block at the SQL> prompt.");
puts("Statements can be continued over several lines, except");
puts("within string literals.");
puts("Terminate a SQL statement with a semicolon.");
puts("Terminate a PL/SQL block (which can contain embedded
semicolons)");
puts("with a slash (/).");
puts("Typing \"exit\" (no semicolon needed) exits the program.");
puts("You typed \"?\" or \"help\" to get this message.\n\n");
int connect_database()
err_sql = SQL_SUCC;
EXEC SQL WHENEVER SQLERROR DO sql_error();
EXEC SQL WHENEVER NOT FOUND DO sql_not_found();
EXEC SQL CONTEXT ALLOCATE :ctx;
EXEC SQL CONTEXT USE :ctx;
EXEC SQL CONNECT :db_uid;
if(err_sql != SQL_SUCC){
printf("err => connect database(ctx:%ld, uid:%s) failed!\n", ctx, db_uid);
return -1;
return 1;
int disconnect_database()
err_sql = SQL_SUCC;
EXEC SQL WHENEVER SQLERROR DO sql_error();
EXEC SQL WHENEVER NOT FOUND DO sql_not_found();
EXEC SQL CONTEXT USE :ctx;
EXEC SQL COMMIT WORK RELEASE;
EXEC SQL CONTEXT FREE:ctx;
return 1;
void sql_error()
printf("err => %.*s", sqlca.sqlerrm.sqlerrml, sqlca.sqlerrm.sqlerrmc);
printf("in \"%.*s...\'\n", oraca.orastxt.orastxtl, oraca.orastxt.orastxtc);
printf("on line %d of %.*s.\n\n", oraca.oraslnr, oraca.orasfnm.orasfnml,
oraca.orasfnm.orasfnmc);
switch(sqlca.sqlcode) {
case -1: /* unique constraint violated */
err_sql = SQL_UNIQUE;
break;
case -1012: /* not logged on */
case -1089:
case -3133:
case -1041:
case -3114:
case -3113:
/* �6�Ŭ�� shutdown�ǰų� �α��� ���°� �ƴҶ� ��b�� �õ� */
/* immediate shutdown in progress - no operations are permitted */
/* end-of-file on communication channel */
/* internal error. hostdef extension doesn't exist */
err_sql = SQL_DISCONNECT;
break;
case -1400:
err_sql = SQL_NOTNULL;
break;
default:
err_sql = SQL_ERR;
break;
EXEC SQL CONTEXT USE :ctx;
EXEC SQL WHENEVER SQLERROR CONTINUE;
EXEC SQL ROLLBACK WORK;
void sql_not_found()
err_sql = SQL_NOTFOUND;Hi Jane,
What version of Berkeley DB XML are you using?
What is your operating system and your hardware platform?
For how long have been the application running?
What is your current container size?
What's set for EnvironmentConfig.setThreaded?
Do you know if containers have previously not been closed correctly?
Can you please post the entire error output?
What's the JDK version, 1.4 or 1.5?
Thanks,
Bogdan -
JRockit JVM crash using RHEL 4
Hi,
I am using BEA JRockit(R) R27.5.0-110-94909-1.5.0_14-20080204-1558-linux-x86_64 on RHEL 4 (update 5) running 64 bit AMD Athlon processor. I got a JVM crash from an application which has been running stable all this time. The crash occured 1 hour after the application was started. The error message is "Illegal memory access". From the older discussion forums in BEA I found that this crash is possibly due to a bug in JIT optimization. Below is the complete dump from the crash. It would be great if someone can confirm that this crash is due to the same bug or something else.
Thanks,
Rakesh
===== BEGIN DUMP =============================================================
JRockit dump produced after 0 days, 01:06:20 on Tue Jan 20 10:23:21 2009
* If you see this dump, please go to *
* http://edocs.bea.com/jrockit/go2troubleshooting.html *
* for troubleshooting information. *
Additional information is available in:
/ha/apps/bin/jrockit.2041.dump
No snapshot file (core dump) will be created because core dumps have been
disabled. To enable core dumping, try "ulimit -c unlimited"
before starting JRockit again.
Error Message: Illegal memory access. 54
Signal info : si_signo=11, si_code=128 si_addr=(nil)
Version : BEA JRockit(R) R27.5.0-110-94909-1.5.0_14-20080204-1558-linux-x86_64
GC Strategy : Mode: static, with strategy: singleconcon
GC Status : OC currently running, in phase: marking. This is OC#746.
Heap : 0x2d00000 - 0x22d00000 (Size: 512 MB)
Compaction : 0xdd00000 - 0xe100000 (Current compaction type: internal)
CompRefs : References are compressed, with heap base 0x0.
CPU : AMD Opteron/Athlon64 SSE SSE2 SSE3 EM64T
Number CPUs : 8
Tot Phys Mem : 67561517056 (64431 MB)
OS version : Red Hat Enterprise Linux AS release 4 (Nahant Update 4)
Linux version 2.6.9-42.0.8.ELsmp ([email protected]) (gcc version 3.4.6 20060404 (Red Hat 3.4.6-3)) #1 SMP Tue Jan 23 12:49:51 EST 2007 (x86_64)
Thread System: NPTL
Java locking : Normal
State : JVM is running
Command Line : -Xms512M -Xmx1024M -Xss128M -Xgc:singlecon -XXcompactratio:1 -Djava.ext.dirs=/cms/lib/:/cms/ext/:/ha/apps/lib/:/ha/OracleJar/:/ha/dbwrapper/:.: -DserverID=prod -DSystemProperties=/ha/hi/properties/HITcpBootstrap.prp -Dpid=2041 -Dsun.java.launcher=SUN_STANDARD com.ups.coii.tos.server.TOSServer
java.home : /opt/bea/jrockit-R27.5.0-jdk1.5.0_14/jre
j.class.path : .
j.lib.path : /opt/bea/jrockit-R27.5.0-jdk1.5.0_14/jre/lib/amd64/jrockit:/opt/bea/jrockit-R27.5.0-jdk1.5.0_14/jre/lib/amd64:/opt/bea/jrockit-R27.5.0-jdk1.5.0_14/jre/../lib/amd64::/opt/mqm/java/lib64/:/opt/mqm/java/lib/
JAVA_HOME : <not set>
JAVAOPTIONS: <not set>
LD_LIBRARY_PATH: /opt/bea/jrockit-R27.5.0-jdk1.5.0_14/jre/lib/amd64/jrockit:/opt/bea/jrockit-R27.5.0-jdk1.5.0_14/jre/lib/amd64:/opt/bea/jrockit-R27.5.0-jdk1.5.0_14/jre/../lib/amd64::/opt/mqm/java/lib64/:/opt/mqm/java/lib/
LD_ASSUME_KERNEL: <not set>
C Heap : Good; no memory allocations have failed
StackOverFlow: 0 StackOverFlowErrors have occured
OutOfMemory : 0 OutOfMemoryErrors have occured
Registers (from ThreadContext: 0x42d82960 / OS context: 0x42d82a20):
rax = 040000000174c008 rcx = 0000000000000000
rdx = 0000002a95fe6b70 rbx = 0000000000000002
rsp = 0000000042d82e60 rbp = 0000000042d82fc0
rsi = 000000001450000c rdi = 0000000042d82ec0
r8 = 0000000000000001 r9 = 0000002a96002dac
r10 = 0000002c7a72c140 r11 = 0000000000000021
r12 = 0000000000000002 r13 = 0000000042d82ec0
r14 = 0000002ad6893ff0 r15 = 0000000014500000
cs = 000000000000ab30 fs = 0000000000000000
gs = 0000000000000000
rip = 0000002a95df7d2d flags = 0000000000000246
Stack:
(* marks the word pointed to by the stack pointer)
0000000042d82e60: 0000002ad6893ff0* 0000002ad6893ff0 0000000042d82ec0 0000000042d82f60
0000000042d82e80: 0000002a961222c0 0000002ad6893ff0 0000000014500008 0000002d00000000
0000000042d82ea0: 0000000014500008 0000002d00000000 0000000014500008 0000002d00000000
0000000042d82ec0: 0000000000000000 0000002d00000000 0000000014500008 0000002a00000000
0000000042d82ee0: 0000000014500000 0000000000000000 00000000004ce628 0000000000000001
0000000042d82f00: 0000002a00000000 000000001450000c 00000000059165d8 00000000059167d8
Code:
(* marks the word pointed to by the instruction pointer)
0000002a95df7cc8: bd831ceb028b4821 48097503fffffed8 0aebfffffed0858b 48fffffed0858b48
0000002a95df7ce8: c08548c38948008b 8b4c00000102840f c48949fffffea8b5 48002c1a69058b48
0000002a95df7d08: e9c148082b48d989 06e8c148c8894803 00000008c5048d48 48002c12b9158b48
0000002a95df7d28: 008b483fe1830203* 485a7501a8e8d348 8948002c1a32058b 03e9c148082b48d9
0000002a95df7d48: 8306e8c148c88948 4800000001ba3fe1 048d48d18948e2d3 158b4800000008c5
0000002a95df7d68: 48020348002c1274 2c1837058b480809 8948087400388300 894cfff7ffa2e8df
Loaded modules:
(* denotes the module causing the exception)
0000000000400000-000000000041196b /opt/bea/jrockit-R27.5.0-jdk1.5.0_14/jre/bin/java
0000002a9566c000-0000002a9567aff9 /lib64/tls/libpthread.so.0
0000002a95782000-0000002a9580659b /lib64/tls/libm.so.6
0000002a95908000-0000002a95909c73 /lib64/libdl.so.2
0000002a95a0b000-0000002a95b35df9 /lib64/tls/libc.so.6
0000002a95556000-0000002a9556a34f /lib64/ld-linux-x86-64.so.2
0000002a95c41000-0000002a95ee448f */opt/bea/jrockit-R27.5.0-jdk1.5.0_14/jre/lib/amd64/jrockit/libjvm.so
0000002a96137000-0000002a9613f95a /lib64/tls/librt.so.1
0000002a96251000-0000002a9625497b /usr/lib64/libnuma.so
0000002a96356000-0000002a9635ff13 /lib64/libnss_files.so.2
0000002a964c1000-0000002a964cd467 /opt/bea/jrockit-R27.5.0-jdk1.5.0_14/jre/lib/amd64/libverify.so
0000002a965d0000-0000002a965f321b /opt/bea/jrockit-R27.5.0-jdk1.5.0_14/jre/lib/amd64/libjava.so
0000002a96707000-0000002a9671a503 /lib64/libnsl.so.1
0000002ad69ae000-0000002ad69b463f /opt/bea/jrockit-R27.5.0-jdk1.5.0_14/jre/lib/amd64/native_threads/libhpi.so
0000002ad9a30000-0000002ad9a3dd93 /opt/bea/jrockit-R27.5.0-jdk1.5.0_14/jre/lib/amd64/libzip.so
0000002ad9db4000-0000002ad9dc55cf /opt/bea/jrockit-R27.5.0-jdk1.5.0_14/jre/lib/amd64/libnet.so
Scan Dump Helper:
Iterating in objIter over object at address 0x14500000 (seems to be real).
The reference that caused the crash is a normal field.
Scanned object [0000000014500000 0000000014500018) of class java/lang/ThreadLocal$ThreadLocalMap
0x14500000 : 0x004ce580 classblock
0x14500004 : 0x00000000 flags
===> 0x14500008 : 0x00000002 .table [Ljava/lang/ThreadLocal$ThreadLocalMap$Entry; (java/lang/ThreadLocal$ThreadLocalMap)
0x1450000c : 0x00000002
0x14500010 : 0x0000000a
0x14500014 : 0x00000000
The field that caused the crash is marked with "===>"
The reference is bogus and pointing outside the heap.
Only reference to this object from another object is
object [00000000059191e8 0000000005919278) of class com/ups/coii/thread/util/ThreadPool$PooledThread
0x59191e8 : 0x017b55f0 classblock
0x59191ec : 0x80000000 flags
0x59191f0 : 0x05919280 .name [C (java/lang/Thread)
0x59191f4 : 0x00000000 .threadQ Ljava/lang/Thread; (java/lang/Thread)
0x59191f8 : 0x00000000 .target Ljava/lang/Runnable; (java/lang/Thread)
0x59191fc : 0x02d02ae8 .group Ljava/lang/ThreadGroup; (java/lang/Thread)
0x5919200 : 0x05d50b48 .contextClassLoader Ljava/lang/ClassLoader; (java/lang/Thread)
0x5919204 : 0x059192c0 .inheritedAccessControlContext Ljava/security/AccessControlContext; (java/lang/Thread)
===> 0x5919208 : 0x14500000 .threadLocals Ljava/lang/ThreadLocal$ThreadLocalMap; (java/lang/Thread)
0x591920c : 0x059192d8 .inheritableThreadLocals Ljava/lang/ThreadLocal$ThreadLocalMap; (java/lang/Thread)
0x5919210 : 0x00000000 .blocker Lsun/nio/ch/Interruptible; (java/lang/Thread)
0x5919214 : 0x05919278 .blockerLock Ljava/lang/Object; (java/lang/Thread)
0x5919218 : 0x00000000 .uncaughtExceptionHandler Ljava/lang/Thread$UncaughtExceptionHandler; (java/lang/Thread)
0x591921c : 0x05916d38 .cwObj Ljava/lang/Object; (java/lang/Thread)
0x5919220 : 0x00000000 .blockObj Ljava/lang/Object; (java/lang/Thread)
0x5919224 : 0x04102cf0 .waitNext Ljava/lang/Thread; (java/lang/Thread)
0x5919228 : 0x00000000 .lockNext Ljava/lang/Thread; (java/lang/Thread)
0x591922c : 0x059191e8 .blockThreadStop Ljava/lang/Object; (java/lang/Thread)
0x5919230 : 0x00000000 .accessControlContext Ljava/security/AccessControlContext; (java/lang/Thread)
0x5919234 : 0x00000005
0x5919238 : 0x00000000
0x591923c : 0x00000000
0x5919240 : 0x00000000
0x5919244 : 0x00000000
0x5919248 : 0x00000026
0x591924c : 0x00000000
0x5919250 : 0xda213db0
0x5919254 : 0x0000002a
0x5919258 : 0x00000000
0x591925c : 0x00000000
0x5919260 : 0x000001a1
0x5919264 : 0x00000000
0x5919268 : 0x00000001
0x591926c : 0x05916150 .this$0 Lcom/ups/coii/thread/util/ThreadPool; (com/ups/coii/thread/util/ThreadPool$PooledThread)
0x5919270 : 0x00000000
0x5919274 : 0x00000000
"(GC Main Thread)" id=3 idx=0xc tid=2058 lastJavaFrame=0xfffffffffffffffc
Stack 0: start=0x42d42000, end=0x42d84000, guards=0x42d47000 (ok), forbidden=0x42d45000
Thread Stack Trace:
at mmSingleConFollowReferences+481()@0x2a95df7d2d
at mmSingleConMark+220()@0x2a95df87ab
at mmMark+82()@0x2a95cab846
at mmGCMainLoop+101()@0x2a95cab8eb
at mmGCMainThread+51()@0x2a95ce826e
at tsiCallStartFunction+67()@0x2a95d62bfb
at tsiThreadStub+308()@0x2a95d63e05
at ptiThreadStub+14()@0x2a95dcb277
at start_thread+138()@0x2a9567210a
-- Java stack --
Extended, platform specific info:
libc release: 2.3.4-stable
Elf headers:
libc ehdrs: EI: 7f454c46020101000000000000000000 ET: 3 EM: 62 V: 1 ENTRY: 000000000001c4a0 PHOFF: 0000000000000040 SHOFF: 000000000013c290 EF: 0x0 HS: 64 PS: 56 PHN; 10 SS: 64 SHN: 66 STIDX: 63
libpthread ehdrs: EI: 7f454c46020101000000000000000000 ET: 3 EM: 62 V: 1 ENTRY: 0000000000005620 PHOFF: 0000000000000040 SHOFF: 0000000000011e48 EF: 0x0 HS: 64 PS: 56 PHN; 9 SS: 64 SHN: 35 STIDX: 32
libjvm ehdrs: EI: 7f454c46020101000000000000000000 ET: 3 EM: 62 V: 1 ENTRY: 000000000003f820 PHOFF: 0000000000000040 SHOFF: 000000000037bd90 EF: 0x0 HS: 64 PS: 56 PHN; 3 SS: 64 SHN: 22 STIDX: 19
* If you see this dump, please go to *
* http://edocs.bea.com/jrockit/go2troubleshooting.html *
* for troubleshooting information. *
===== END DUMP ===============================================================Hello Rakesh,
The crash is in GC code, possiibly caused by an incorrect reference on the heap. This could have been caused by an earlier JIT optimization issue or by a bug in GC or something else - we would need to analyze the full core to know for sure. If you want to pursue this, contact Oracle Support and provide us with the core.
Another tip is to upgrade to the latest JRockit version. The latest version available bundled with Oracle products is R27.6.0, I believe R27.6.1 is on its way out with a WLS 10 service pack but don't know the exact date.
Regards,
Henrik -
JRockit JVM crash using RHEL 4 (update 5)
Hi,
I am using BEA JRockit(R) R27.5.0-110-94909-1.5.0_14-20080204-1558-linux-x86_64 on RHEL 4 (update 5) running 64 bit AMD Athlon processor. I got a JVM crash from an application which has been running stable all this time. The crash occured 1 hour after the application was started. The error message is "Illegal memory access". From the older discussion forums in BEA I found that this crash is possibly due to a bug in JIT optimization. Below is the complete dump from the crash. It would be great if someone can confirm that this crash is due to the same bug or something else.
Thanks,
Rakesh
===== BEGIN DUMP =============================================================
JRockit dump produced after 0 days, 01:06:20 on Tue Jan 20 10:23:21 2009
* If you see this dump, please go to *
* http://edocs.bea.com/jrockit/go2troubleshooting.html *
* for troubleshooting information. *
Additional information is available in:
/ha/apps/bin/jrockit.2041.dump
No snapshot file (core dump) will be created because core dumps have been
disabled. To enable core dumping, try "ulimit -c unlimited"
before starting JRockit again.
Error Message: Illegal memory access. [54]
Signal info : si_signo=11, si_code=128 si_addr=(nil)
Version : BEA JRockit(R) R27.5.0-110-94909-1.5.0_14-20080204-1558-linux-x86_64
GC Strategy : Mode: static, with strategy: singleconcon
GC Status : OC currently running, in phase: marking. This is OC#746.
Heap : 0x2d00000 - 0x22d00000 (Size: 512 MB)
Compaction : 0xdd00000 - 0xe100000 (Current compaction type: internal)
CompRefs : References are compressed, with heap base 0x0.
CPU : AMD Opteron/Athlon64 SSE SSE2 SSE3 EM64T
Number CPUs : 8
Tot Phys Mem : 67561517056 (64431 MB)
OS version : Red Hat Enterprise Linux AS release 4 (Nahant Update 4)
Linux version 2.6.9-42.0.8.ELsmp ([email protected]) (gcc version 3.4.6 20060404 (Red Hat 3.4.6-3)) #1 SMP Tue Jan 23 12:49:51 EST 2007 (x86_64)
Thread System: NPTL
Java locking : Normal
State : JVM is running
Command Line : -Xms512M -Xmx1024M -Xss128M -Xgc:singlecon -XXcompactratio:1 -Djava.ext.dirs=/cms/lib/:/cms/ext/:/ha/apps/lib/:/ha/OracleJar/:/ha/dbwrapper/:.: -DserverID=prod -DSystemProperties=/ha/hi/properties/HITcpBootstrap.prp -Dpid=2041 -Dsun.java.launcher=SUN_STANDARD com.ups.coii.tos.server.TOSServer
java.home : /opt/bea/jrockit-R27.5.0-jdk1.5.0_14/jre
j.class.path : .
j.lib.path : /opt/bea/jrockit-R27.5.0-jdk1.5.0_14/jre/lib/amd64/jrockit:/opt/bea/jrockit-R27.5.0-jdk1.5.0_14/jre/lib/amd64:/opt/bea/jrockit-R27.5.0-jdk1.5.0_14/jre/../lib/amd64::/opt/mqm/java/lib64/:/opt/mqm/java/lib/
JAVA_HOME : <not set>
JAVAOPTIONS: <not set>
LD_LIBRARY_PATH: /opt/bea/jrockit-R27.5.0-jdk1.5.0_14/jre/lib/amd64/jrockit:/opt/bea/jrockit-R27.5.0-jdk1.5.0_14/jre/lib/amd64:/opt/bea/jrockit-R27.5.0-jdk1.5.0_14/jre/../lib/amd64::/opt/mqm/java/lib64/:/opt/mqm/java/lib/
LD_ASSUME_KERNEL: <not set>
C Heap : Good; no memory allocations have failed
StackOverFlow: 0 StackOverFlowErrors have occured
OutOfMemory : 0 OutOfMemoryErrors have occured
Registers (from ThreadContext: 0x42d82960 / OS context: 0x42d82a20):
rax = 040000000174c008 rcx = 0000000000000000
rdx = 0000002a95fe6b70 rbx = 0000000000000002
rsp = 0000000042d82e60 rbp = 0000000042d82fc0
rsi = 000000001450000c rdi = 0000000042d82ec0
r8 = 0000000000000001 r9 = 0000002a96002dac
r10 = 0000002c7a72c140 r11 = 0000000000000021
r12 = 0000000000000002 r13 = 0000000042d82ec0
r14 = 0000002ad6893ff0 r15 = 0000000014500000
cs = 000000000000ab30 fs = 0000000000000000
gs = 0000000000000000
rip = 0000002a95df7d2d flags = 0000000000000246
Stack:
(* marks the word pointed to by the stack pointer)
0000000042d82e60: 0000002ad6893ff0* 0000002ad6893ff0 0000000042d82ec0 0000000042d82f60
0000000042d82e80: 0000002a961222c0 0000002ad6893ff0 0000000014500008 0000002d00000000
0000000042d82ea0: 0000000014500008 0000002d00000000 0000000014500008 0000002d00000000
0000000042d82ec0: 0000000000000000 0000002d00000000 0000000014500008 0000002a00000000
0000000042d82ee0: 0000000014500000 0000000000000000 00000000004ce628 0000000000000001
0000000042d82f00: 0000002a00000000 000000001450000c 00000000059165d8 00000000059167d8
Code:
(* marks the word pointed to by the instruction pointer)
0000002a95df7cc8: bd831ceb028b4821 48097503fffffed8 0aebfffffed0858b 48fffffed0858b48
0000002a95df7ce8: c08548c38948008b 8b4c00000102840f c48949fffffea8b5 48002c1a69058b48
0000002a95df7d08: e9c148082b48d989 06e8c148c8894803 00000008c5048d48 48002c12b9158b48
0000002a95df7d28: 008b483fe1830203* 485a7501a8e8d348 8948002c1a32058b 03e9c148082b48d9
0000002a95df7d48: 8306e8c148c88948 4800000001ba3fe1 048d48d18948e2d3 158b4800000008c5
0000002a95df7d68: 48020348002c1274 2c1837058b480809 8948087400388300 894cfff7ffa2e8df
Loaded modules:
(* denotes the module causing the exception)
0000000000400000-000000000041196b /opt/bea/jrockit-R27.5.0-jdk1.5.0_14/jre/bin/java
0000002a9566c000-0000002a9567aff9 /lib64/tls/libpthread.so.0
0000002a95782000-0000002a9580659b /lib64/tls/libm.so.6
0000002a95908000-0000002a95909c73 /lib64/libdl.so.2
0000002a95a0b000-0000002a95b35df9 /lib64/tls/libc.so.6
0000002a95556000-0000002a9556a34f /lib64/ld-linux-x86-64.so.2
0000002a95c41000-0000002a95ee448f */opt/bea/jrockit-R27.5.0-jdk1.5.0_14/jre/lib/amd64/jrockit/libjvm.so
0000002a96137000-0000002a9613f95a /lib64/tls/librt.so.1
0000002a96251000-0000002a9625497b /usr/lib64/libnuma.so
0000002a96356000-0000002a9635ff13 /lib64/libnss_files.so.2
0000002a964c1000-0000002a964cd467 /opt/bea/jrockit-R27.5.0-jdk1.5.0_14/jre/lib/amd64/libverify.so
0000002a965d0000-0000002a965f321b /opt/bea/jrockit-R27.5.0-jdk1.5.0_14/jre/lib/amd64/libjava.so
0000002a96707000-0000002a9671a503 /lib64/libnsl.so.1
0000002ad69ae000-0000002ad69b463f /opt/bea/jrockit-R27.5.0-jdk1.5.0_14/jre/lib/amd64/native_threads/libhpi.so
0000002ad9a30000-0000002ad9a3dd93 /opt/bea/jrockit-R27.5.0-jdk1.5.0_14/jre/lib/amd64/libzip.so
0000002ad9db4000-0000002ad9dc55cf /opt/bea/jrockit-R27.5.0-jdk1.5.0_14/jre/lib/amd64/libnet.so
Scan Dump Helper:
Iterating in objIter over object at address 0x14500000 (seems to be real).
The reference that caused the crash is a normal field.
Scanned object [0000000014500000 0000000014500018) of class java/lang/ThreadLocal$ThreadLocalMap
0x14500000 : 0x004ce580 [classblock]
0x14500004 : 0x00000000 [flags]
===> 0x14500008 : 0x00000002 .table [Ljava/lang/ThreadLocal$ThreadLocalMap$Entry; (java/lang/ThreadLocal$ThreadLocalMap)
0x1450000c : 0x00000002
0x14500010 : 0x0000000a
0x14500014 : 0x00000000
The field that caused the crash is marked with "===>"
The reference is bogus and pointing outside the heap.
Only reference to this object from another object is
object [00000000059191e8 0000000005919278) of class com/ups/coii/thread/util/ThreadPool$PooledThread
0x59191e8 : 0x017b55f0 [classblock]
0x59191ec : 0x80000000 [flags]
0x59191f0 : 0x05919280 .name [C (java/lang/Thread)
0x59191f4 : 0x00000000 .threadQ Ljava/lang/Thread; (java/lang/Thread)
0x59191f8 : 0x00000000 .target Ljava/lang/Runnable; (java/lang/Thread)
0x59191fc : 0x02d02ae8 .group Ljava/lang/ThreadGroup; (java/lang/Thread)
0x5919200 : 0x05d50b48 .contextClassLoader Ljava/lang/ClassLoader; (java/lang/Thread)
0x5919204 : 0x059192c0 .inheritedAccessControlContext Ljava/security/AccessControlContext; (java/lang/Thread)
===> 0x5919208 : 0x14500000 .threadLocals Ljava/lang/ThreadLocal$ThreadLocalMap; (java/lang/Thread)
0x591920c : 0x059192d8 .inheritableThreadLocals Ljava/lang/ThreadLocal$ThreadLocalMap; (java/lang/Thread)
0x5919210 : 0x00000000 .blocker Lsun/nio/ch/Interruptible; (java/lang/Thread)
0x5919214 : 0x05919278 .blockerLock Ljava/lang/Object; (java/lang/Thread)
0x5919218 : 0x00000000 .uncaughtExceptionHandler Ljava/lang/Thread$UncaughtExceptionHandler; (java/lang/Thread)
0x591921c : 0x05916d38 .cwObj Ljava/lang/Object; (java/lang/Thread)
0x5919220 : 0x00000000 .blockObj Ljava/lang/Object; (java/lang/Thread)
0x5919224 : 0x04102cf0 .waitNext Ljava/lang/Thread; (java/lang/Thread)
0x5919228 : 0x00000000 .lockNext Ljava/lang/Thread; (java/lang/Thread)
0x591922c : 0x059191e8 .blockThreadStop Ljava/lang/Object; (java/lang/Thread)
0x5919230 : 0x00000000 .accessControlContext Ljava/security/AccessControlContext; (java/lang/Thread)
0x5919234 : 0x00000005
0x5919238 : 0x00000000
0x591923c : 0x00000000
0x5919240 : 0x00000000
0x5919244 : 0x00000000
0x5919248 : 0x00000026
0x591924c : 0x00000000
0x5919250 : 0xda213db0
0x5919254 : 0x0000002a
0x5919258 : 0x00000000
0x591925c : 0x00000000
0x5919260 : 0x000001a1
0x5919264 : 0x00000000
0x5919268 : 0x00000001
0x591926c : 0x05916150 .this$0 Lcom/ups/coii/thread/util/ThreadPool; (com/ups/coii/thread/util/ThreadPool$PooledThread)
0x5919270 : 0x00000000
0x5919274 : 0x00000000
"(GC Main Thread)" id=3 idx=0xc tid=2058 lastJavaFrame=0xfffffffffffffffc
Stack 0: start=0x42d42000, end=0x42d84000, guards=0x42d47000 (ok), forbidden=0x42d45000
Thread Stack Trace:
at mmSingleConFollowReferences+481()@0x2a95df7d2d
at mmSingleConMark+220()@0x2a95df87ab
at mmMark+82()@0x2a95cab846
at mmGCMainLoop+101()@0x2a95cab8eb
at mmGCMainThread+51()@0x2a95ce826e
at tsiCallStartFunction+67()@0x2a95d62bfb
at tsiThreadStub+308()@0x2a95d63e05
at ptiThreadStub+14()@0x2a95dcb277
at start_thread+138()@0x2a9567210a
-- Java stack --
Extended, platform specific info:
libc release: 2.3.4-stable
Elf headers:
libc ehdrs: EI: 7f454c46020101000000000000000000 ET: 3 EM: 62 V: 1 ENTRY: 000000000001c4a0 PHOFF: 0000000000000040 SHOFF: 000000000013c290 EF: 0x0 HS: 64 PS: 56 PHN; 10 SS: 64 SHN: 66 STIDX: 63
libpthread ehdrs: EI: 7f454c46020101000000000000000000 ET: 3 EM: 62 V: 1 ENTRY: 0000000000005620 PHOFF: 0000000000000040 SHOFF: 0000000000011e48 EF: 0x0 HS: 64 PS: 56 PHN; 9 SS: 64 SHN: 35 STIDX: 32
libjvm ehdrs: EI: 7f454c46020101000000000000000000 ET: 3 EM: 62 V: 1 ENTRY: 000000000003f820 PHOFF: 0000000000000040 SHOFF: 000000000037bd90 EF: 0x0 HS: 64 PS: 56 PHN; 3 SS: 64 SHN: 22 STIDX: 19
* If you see this dump, please go to *
* http://edocs.bea.com/jrockit/go2troubleshooting.html *
* for troubleshooting information. *
===== END DUMP ===============================================================You should open a tar with support (http://metalink.oracle.com ; I am not sure if that is the correct support site for jrockit)
Because the information is all about jrockit and not linux, you probably are not going to get much help here.
You could try the jrockit forum: JRockit -
Please help with combining two java packages into one iteration
Hello, I work for a pharmaceutical company and run reports for credits that we have received. Currently the packages are reported seperately from the credit reports and my job is to combine them. There are two models that handle these and I need to link the second to the first with some common entities. Please help me figure out what I need to do in order to add a credit column to the report. I have a sample of the code below and would appreciate any help you can offer.
First, the info pulled about the boxes:
rm = (ReportManager) ManagerFactory.getManager(ManagerFactory.REPORTS);
items = rm.getRVSSearchResults(hvstoresid,
hvstoregroupsid,
String.valueOf(request.getParameter("price_type")).trim(),
String.valueOf(report_by).trim(),
vendor_type,
String.valueOf(request.getParameter("vendor")).trim(),
from_date,
until_date,
debitNum,
processing_type,
sort_field,
sort_direction,
includeAll222s).iterator();
Second, the page that has the data i need to transpose to the first:
PackoutModel pm = null;
int iter = searchpageposition*resultPageSize;
while (iter < packouts.size() && iter<(searchpageposition*resultPageSize)+resultPageSize)
{ pm = (PackoutModel) packouts.get(iter);
BigDecimal invoiceAmt = DataConverter.parseBigDecimalWithAlternateWhenNull(pm.getInvoiceAmt(),"0.00");
BigDecimal creditRec = DataConverter.parseBigDecimalWithAlternateWhenNull(pm.getAmtReceived(),"0.00");
BigDecimal processingFee = DataConverter.parseBigDecimalWithAlternateWhenNull(pm.getProcessFeeTotal(),"0.00");
BigDecimal shippingFee = DataConverter.parseBigDecimalWithAlternateWhenNull(pm.getShippingHandlingFeeTotal(),"0.00");
BigDecimal balanceDue =(invoiceAmt.add(processingFee.add(shippingFee))).subtract(creditRec);
All that I need from the second page is to get a value for:
DataConverter.parseBigDecimalWithAlternateWhenNull(pm.getAmtReceived(),"0.00");
which I believe must first have the store id, etc equal to the first model. So there is the existing rvs.FOO and the needed pm.BAR but since it is in an iter loop, I can't seem to figure out how to join the two.
Any ideas?could you explain your problem with a simplified schema or a more
understandable code.
(don't bother to write the details of your project plz) -
Please help convering recursion to iteration
Hello all, I am relatively new with Java. I am implementing a Region Growing algorithm, and it works fine for small regions. For large regions, I get the usual stack overflow problem. I was never able to increase my stack size and didn't really want that approach. I have posted the method that does the region growing. It is messy, and I know there is stuff in there that will not make sense but, the region growing section is there. I have given up and need some help...
Thanks everyone who can help!!
private void growRegion(int x, int y) {
double red = 0;
double green = 0;
double blue = 0;
double alpha = 0;
pixelArray2 = new double[5];
wraster.getPixel(x,y,pixelArray2);
red = pixelArray2[0];
green = pixelArray2[1];
blue = pixelArray2[2];
alpha = pixelArray2[3];
pixelChange2[0] = 195;
pixelChange2[1] = 195;
pixelChange2[2] = 195;
pixelChange2[3] = alpha;
if (x < 0 || y < 0) return;
if (x >= wraster.getWidth()) return;
if (y >= wraster.getHeight()) return;
// the pixel has been assigned a threshold but has not been associated
// with a region.
if (assigned[x][y]==true && associated[x][y]==false){
wraster.setPixel(x,y,pixelChange2);
associated[x][y] = true;
// the recursive calls that are driving me nuts
growRegion(x+1,y);
growRegion(x-1,y);
growRegion(x,y+1);
growRegion(x,y-1);
}else{
// do something else...anything but recursion
}You should use some recursion but this looks like an over-use. Method growRegion starts (after some initializations) with a termination statement,
if (x < 0 || y < 0) return;
if (x >= wraster.getWidth()) return;
if (y >= wraster.getHeight()) return; This means you could probably remove this and instead use for-loops to drive the recursion,
if (d != 0)
for (int i=x+1, l=wraster.getWidth(); i<l; i++)
growRegion(i,y,0);
if (d != 1)
for (int i=x-1; i>=0; i--)
growRegion(i,y,1);
if (d != 2)
for (int i=y+1, l=wraster.getHeight(); i<l; i++)
growRegion(x,i,2);
if (d != 3)
for (int i=y-1; i>=0; i--)
growRegion(x,i,3); The signature of growRegion is now,
growRegion(int x, int y, int d)And in the very first call d (direction) must be -1. I think this will replace lots of (unnecessary) recursion with iteration but I'm not sure. It an easy change so it could be worth a try -:) -
Need help in iteration problem
i have a question that requires to use iteration ("for" repetition ) and it inquires to enter each day's cost for a whole week and then calculate and display the total week's cost.
can anyone help me with this? cause i've tried everything i know.dunno, i dont think it is cause the total is unknown
and it is what i want to getof course the total is unknown. that's what your program does, finds it out. forget computers for a minute. how would you do this with a pen and paper? you'd start off not knowing the total, and ask questions until you had it, right? like
"what were mondays takings?" "oh, 50"
"ok,what were tuesdays?" "um, 102"
"and wednesdays?" "200"
and you'd add the latest answer to your running total. same thing here
Maybe you are looking for
-
Family sharing - how to create a separate account?
My son (4) has his own ipad, but I've always used my Apple ID to purchase apps for him. I'm trying to set up family sharing. Recently I read on Apple's website: Kids under 13 can have an account too. Now kids under 13 can have their own Apple IDs. As
-
Hi, I am a new user to InDesign and have created a document - I want all the text to be set to K100%, but for some reason when I change the colour percentages, click ok, and check again, it has reset the colour persentage to eg: C35%, M87% etc and ha
-
Hi I have a problem with unmarshalling. when my XML document is valide ,there is no probem but when the document is not valid(for exemple i put a String value in an element of type xs:decimal) i get a strange result:I thought that i will get a java.l
-
I have created a desktop Estimating program written in Java. One feature (measuring off drawings onscreen) requires a transparent window sitting over the drawing on which the user clicks the start and end points of the item to measure. I make the win
-
How to create a empty table when user a oracle bpm ADF 11g auto created form?
Hi, I'm new to ADF/BPM development. I created a bpm process and generated adf forms. I want to customize those created forms. I want to use a table to show payload content and insert rows from my EJB to BPM payload datacontrol programatically. Everyt