| Let thread wait till memory is available |
|
 |
Index ‹ java-programmer
|
- Previous
- 2
- XML Processing Approaches with JavaWhen I want to manipulate and retrieve data from XML file,
I used to use DOM or SAX, and this is JAXP API from Sun.
Some people told me I should use XPath instead, since it's easier for coding.
But we need to use apache's xalan library.
What do u think? please advise. thanks!!
- 3
- What's the point?Here's some thoughts from a Java guy at JavaOne:
http://beust.com/weblog/archives/000388.html
As JavaOne 2006 opens its doors today, the age-old question is bound
to be asked again and again: will Sun open source Java?
I have a fairly straightforward answer: I don't care.
And I suppose that most of the Java developers out there don't care
either.
What exactly is not open source in the Java we use today? I had to
think hard to answer this question because, frankly, everything I need
on a daily
basis is already available in source form, with one exception: the
Java Virtual Machine.
Sun's JVM (and others) is admittedly very good and I'm sure a lot of
developers would be interested in knowing how it works, but let's face
it: the inner workings of a Java Virtual Machine are completely
irrelevant to
most Java developers and not having access to this resource will
probably
never get in the way of writing Java code.
With that in mind, why is the question of open sourcing coming back so
often?
One word: zealotry.
*Posted from the Opera Mini Java browser on my Nokia 9300.
- 3
- JDK 1.5 metadata feature docs?Hi all,
Has anyone come across documentation that thoroughly describes metadata
functionality that will be available in JDK 1.5? I only saw some brief
examples of what it's supposed to do, and I downloaded JDK, but I can't find
any docs. Any pointers?
- 5
- problem with ListIteratorHello,
I've read about the listiterator. It allows me to traverse the list in
either direction and modify the list during iteration.
But I've tried to add list elements during the iteration and got the
error message.
-- java.util.ConcurrentModificationException
at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:444)
at java.util.AbstractList$Itr.next(AbstractList.java:421)
Is it possible to add the new elements at the end of the list??
Thanks
Lucia
- 5
- More on exceptionsHi,
I am looking at the following code. If an UnsupportedEncodingException
is thrown in getDD() how will that be handled by the code. Am I
missing something? what is good practice?
cheers,
//mike
public void myMethod {
try {
incomingDialog.sendStatus(dialog.getDD());
} catch (IOException e) {
logger.severe(e.getMessage());
throw new ScenarioException(Reason.NETWORKERROR, e);
}
}
The code above will call this code:
protected Object getDD() {
if (dd == null) {
try {
this.dd = invite.getContent();
} catch (UnsupportedEncodingException e) {
logger.severe(e.getMessage());
throw new ScenarioException(Reason.MIMEERROR, e);
} catch (IOException e) {
logger.severe(e.getMessage());
throw new ScenarioException(Reason.NETWORKERROR, e);
}
}
return dd;
}
- 6
- 6
- 3D surface plot
timothy ma and constance lee wrote:
> Anyone know anysite teaching 3D mesh plot? Like z = x^2 + y^2
>
<http://www.developer.com/java/other/article.php/3508706>
- 7
- status bar ticking forwardHi,
I am using a servlet application which when I call up a certain page,
the status bar just keeps on ticking forward, you know the progress
bar at the bottom of the screen.
This is happening only on one page. I am doing nothing differnt to
this page that I think would cause this. Any ideas?
Thanks.
TP
- 9
- Third tapestry tutorial availableHi all,
Tapestry is a web app framework (Java) that allows
your web designers to create and edit web pages using
a WYSIWYG editor (DreamWeaver, FrontPage or etc),
while your programmers can still add dynamic contents
to the pages.
I've created my third Tapestry tutorial. You're welcome
to read it
at http://www2.cpttm.org.mo/cyberlab/softdev/tapestry/
Thanks!
- 10
- tomcat error 500...Hello all, i am trying to load a class file into a JSP page and getting
a few errors...what ive got is a simple form, that reads a username,
password, and submits it to a login.jsp file. my login.jsp looks
like:
<%@ page import="IMASOS.UserInterface" %>
<html><head> ... <body>
<%
String uname=request.getParameter("username");
String passw=request.getParameter("password");
UserInterface ui = new UserInterface();
boolean success = ui.login(uname,passw);
if (success) out.println("<h2>User logged in</h2>");
else out.println("<h2>Login Failure</h2>");
%>
</body>
and the error im getting is...
exception
org.apache.jasper.JasperException
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.lang.NullPointerException
IMASOS.UserInterface.login(UserInterface.java:92)
org.apache.jsp.login_jsp._jspService(org.apache.jsp.login_jsp:50)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
- 11
- how change from down to up to up to downHello
sorry for my englisch :-(
Who kan help my.
This is a java bubbles from te bottem tot go's high.
I want to make snow, so the must go from high tot te bottem.
what can i change in the java
thanks for help :-)
<html>
<head>
<meta http-equiv="Content-Language" content="nl">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title></title>
<meta name="Microsoft Theme" content="arcs 111, default">
<meta name="Microsoft Border" content="tl, default">
</head>
<body background= bgcolor="#FFFFCC" text="#000000" link="#3399FF"
vlink="#999933" alink="#FF9900">
<!--mstheme--><font face="Verdana, Arial, Helvetica">
<p>
<script language="JavaScript"><!--
MSFPhover =
(((navigator.appName == "Netscape") &&
(parseInt(navigator.appVersion) >= 3 )) ||
((navigator.appName == "Microsoft Internet Explorer") &&
(parseInt(navigator.appVersion) >= 4 )));
function MSFPpreload(img)
{
var a=new Image(); a.src=img; return a;
}
// --></script><script language="JavaScript">
<!--
if(MSFPhover) { MSFPnav1n=MSFPpreload; MSFPnav1h=MSFPpreload; }
// --></script>
<script language="JavaScript1.2">
<!-- Begin
var no = 12; // image number or falling rate
var speed = 2; // the lower the number the faster the image moves
var snow = new Array();
snow[0] = "bubbel.gif"
snow[1] = "bubbel2.gif"
snow[2] = "bubbel3.gif"
var ns4up = (document.layers) ? 1 : 0; // browser sniffer
var ie4up = (document.all) ? 1 : 0;
var ns6up = (document.getElementById&&!document.all) ? 1 : 0;
var dx, xp, yp; // coordinate and position variables
var am, stx, sty; // amplitude and step variables
var i, doc_width = 800, doc_height = 1800;
if (ns4up||ns6up) {
doc_width = self.innerWidth;
doc_height = self.innerHeight;
} else if (ie4up) {
doc_width = document.body.clientWidth;
doc_height = document.body.clientHeight;
}
dx = new Array();
xp = new Array();
yp = new Array();
am = new Array();
stx = new Array();
sty = new Array();
j = 0;
for (i = 0; i < no; ++ i) {
dx[i] = 0; // set coordinate variables
xp[i] = Math.random()*(doc_width-50); // set position variables
yp[i] = Math.random()*doc_height;
am[i] = Math.random()*20; // set amplitude variables
stx[i] = 0.02 + Math.random()/10; // set step variables
sty[i] = 0.7 + Math.random(); // set step variables
if (ns4up) { // set layers
if (i == 0) {
document.write("<layer name=\"dot"+ i +"\"
left=\"15\" top=\"15\" visibility=\"show\"><img src=\""+ snow[j] + "\"
border=\"0\"></layer>");
} else {
document.write("<layer name=\"dot"+ i +"\"
left=\"15\" top=\"15\" visibility=\"show\"><img src=\""+ snow[j] + "\"
border=\"0\"></layer>");
} } else if (ie4up||ns6up) { if (i ==
0)
{
document.write("<div id=\"dot"+ i +"\"
style=\"POSITION: absolute; Z-INDEX: "+ i +"VISIBILITY: visible; TOP: 15px;
LEFT: 15px; width:1;\"><img src=\"" + snow[j] + "\" border=\"0\"></div>");
} else {
document.write("<div id=\"dot"+ i +"\"
style=\"POSITION: absolute; Z-INDEX: "+ i +"VISIBILITY: visible; TOP: 15px;
LEFT: 15px; width:1;\"><img src=\"" + snow[j] + "\" border=\"0\"></div>");
}
}
if (j == (snow.length-1)) { j = 0; } else { j += 1; }
}
function snowNS() { // Netscape main animation function
for (i = 0; i < no; ++ i) { // iterate for every dot
yp[i] -= sty[i]; if (yp[i] < -50) {
xp[i] = Math.random()*(doc_width-am[i]-30);
yp[i] = doc_height;
stx[i] = 0.02 + Math.random()/10;
sty[i] = 0.7 + Math.random();
doc_width = self.innerWidth;
doc_height = self.innerHeight; }
dx[i] += stx[i];
document.layers["dot"+i].top = yp[i]+pageYOffset;
document.layers["dot"+i].left = xp[i] +
am[i]*Math.sin(dx[i]);
}
setTimeout("snowNS()", speed);
}
function snowIE_NS6() { // IE main animation function
for (i = 0; i < no; ++ i) { // iterate for every dot
yp[i] -= sty[i];
if (yp[i] < -50) {
xp[i] = Math.random()*(doc_width-am[i]-30);
yp[i] = doc_height;
stx[i] = 0.02 + Math.random()/10;
sty[i] = 0.7 + Math.random();
doc_width =
ns6up?window.innerWidth-5:document.body.clientWidth;
doc_height =
ns6up?window.innerHeight-5:document.body.clientHeight;
}
dx[i] += stx[i];
if (ie4up){
document.all["dot"+i].style.pixelTop =
yp[i]+document.body.scrollTop;
document.all["dot"+i].style.pixelLeft = xp[i] +
am[i]*Math.sin(dx[i]);
}
else if (ns6up){
document.getElementById("dot"+i).style.top=yp[i]+pageYOffset;
document.getElementById("dot"+i).style.left=xp[i] +
am[i]*Math.sin(dx[i]);
}
}
setTimeout("snowIE_NS6()", speed);
}
if (ns4up) {
snowNS();
} else if (ie4up||ns6up) {
snowIE_NS6();
}
// End -->
</script>
<!--mstheme--></font>
</html>
- 11
- What to use as HashMap Key?Hi. I'm looking for advice on using keys for a HashMap.
Is it typical to just use a string as a key, e.g., "Item A", "Item B",
etc.? Or are other approaches better? Since the key is just an
Object, I thought there might be some other approach commonly used
that is more efficient/effective.
Thanks for any advice!
Ken
- 11
- Problems to calculate sinI must create a program that use trigonometry function.
I know sin(30)=0.5 but when I use Math.sin() I can't get it
Math.sin(30*Math.PI/180)=0.49999999999999994
What's the problem?
Thank you
Stefano Buscherini
- 14
- jsp page giving error on tomcat 5Hi
i have written a class for database connection. It has two public
functions connect() which return an object of class Connection and
function close which close the connection
I am using that class in a jsp page to connect to database, but I am
getting an error :
Generated servlet error:
[javac] Compiling 1 source file
/usr/tomcat/work/Catalina/localhost/tpr/org/apache/jsp/web/jsp/index_jsp.java:7:
package db does not exist
import db.*;
^
/usr/tomcat/work/Catalina/localhost/tpr/org/apache/jsp/web/jsp/index_jsp.java:51:
cannot resolve symbol
symbol : variable ibDriverTest
location: class org.apache.jsp.web.jsp.index_jsp
Connection con = ibDriverTest.connect();
......
The class is in the package db. Can you please tell why is import db.*
not working.
Thanks is advance
Lalit
- 15
- finding total number of bytes an object takes upGiven an object of a Java class, is there some straightforward way to
find out how many bytes of memory it takes up?
In C there exists a <sizeof()> operator, but even if it had a counter-
part in Java (which doesn't appear to be the case) that wouldn't be
exactly what I want because the objects I want to know the sizes of
contain references to objects of other classes, and I need to know the
_total_ bytes taken up by that object, its components, its components'
components, and so on. Can anybody point me to how I can find this
out? Any information would be greatly appreciated.
---Kevin Simonson
"You'll never get to heaven, or even to LA,
if you don't believe there's a way."
from _Why Not_
|
| Author |
Message |
senges

|
Posted: 2007-5-10 21:40:00 |
Top |
java-programmer, Let thread wait till memory is available
hi all,
a basic question:
i have a memory consuming encoding process which runs in its own
thread.
To preseve OutOfMemory errors when a lot of those treads are running,
i want this thread to check the current memory heap, and maybe wait as
long as there's some available.
Is that possible ?
I think this must be a very common problem in thread programming?
Greets,
chris
|
| |
|
| |
 |
Ingo R. Homann

|
Posted: 2007-5-10 21:45:00 |
Top |
java-programmer >> Let thread wait till memory is available
Hi,
senges wrote:
> hi all,
> a basic question:
>
> i have a memory consuming encoding process which runs in its own
> thread.
>
> To preseve OutOfMemory errors when a lot of those treads are running,
> i want this thread to check the current memory heap, and maybe wait as
> long as there's some available.
>
> Is that possible ?
> I think this must be a very common problem in thread programming?
You may take a look at java.lang.Runtime.free/max/totalMemory.
Hth,
Ingo
|
| |
|
| |
 |
Robert Klemme

|
Posted: 2007-5-10 21:49:00 |
Top |
java-programmer >> Let thread wait till memory is available
On 10.05.2007 15:44, Ingo R. Homann wrote:
> Hi,
>
> senges wrote:
>> hi all,
>> a basic question:
>>
>> i have a memory consuming encoding process which runs in its own
>> thread.
>>
>> To preseve OutOfMemory errors when a lot of those treads are running,
>> i want this thread to check the current memory heap, and maybe wait as
>> long as there's some available.
>>
>> Is that possible ?
>> I think this must be a very common problem in thread programming?
>
> You may take a look at java.lang.Runtime.free/max/totalMemory.
Other options are to start and catch any OOM errors. Or use a thread
pool with limited size to limit concurrent processing.
Kind regards
robert
|
| |
|
| |
 |
Ingo R. Homann

|
Posted: 2007-5-10 21:59:00 |
Top |
java-programmer >> Let thread wait till memory is available
Hi,
Robert Klemme wrote:
>>> hi all,
>>> a basic question:
>>>
>>> i have a memory consuming encoding process which runs in its own
>>> thread.
>>>
>>> To preseve OutOfMemory errors when a lot of those treads are running,
>>> i want this thread to check the current memory heap, and maybe wait as
>>> long as there's some available.
>>>
>>> Is that possible ?
>>> I think this must be a very common problem in thread programming?
>>
>> You may take a look at java.lang.Runtime.free/max/totalMemory.
>
> Other options are to start and catch any OOM errors.
But that might crash other threads (with low mem usage) with an OOME as
well!
> Or use a thread
> pool with limited size to limit concurrent processing.
OK.
Ciao,
Ingo
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- problem while regenerating jpg file from swing image.Hi,
I am trying to regenerate the jpg file with the image that is
generated by java swings. But the x,y positions are not matching from
swing generated image to jpg file generated.Any body worked on the
similar problem please suggest.
Thanks in advance.
- 2
- How to display the texts into 2 line in JButton?hi, I am newbies here.
I want to display 2 words in jbutton but if I use setText("Add Record");
When display, it show Add record (in a line)
I want it display as
Add
Record
(2lines)
in jbutton?
How to do that?
- 3
- can anybody please check this code out?Hi all,
I'm rather inexperienced in Java but I'm in need of defining a
JTable(N,N) with non-editable underdiagonal elements. I do not know if
it's better to do it by using TableModel or directly JTable, but I used
the latter because it looked easier to me.
The following code gives no errors in NetBeans, but using the newborne
UD_JTable class in MATLAB I get a very nasty error which pretty much
looks like some sort of memory allocation fault.
Here is the code:
import javax.swing.*;
import javax.swing.table.*;
public class UD_JTable extends JTable
{
public UD_JTable(int rows, int cols)
{
super();
}
public boolean isCellEditable( int rowIndex , int columnIndex)
{
if(rowIndex > columnIndex)
{
return false;
}
else
{
return true;
}
}
public static void main(String[] args)
{
}
}
And here is the error
??? Java exception occurred:
java.lang.ArrayIndexOutOfBoundsException: 0 >= 0
at java.util.Vector.elementAt(Unknown Source)
at javax.swing.table.DefaultTableColumnModel.getColumn(Unknown Source)
at javax.swing.JTable.convertColumnIndexToModel(Unknown Source)
at javax.swing.JTable.setValueAt(Unknown Source)
.
Does anybody have a clue of what's happening???
Thank you ahead
lor
- 4
- Unusual Error Message
I have some Java classes that accept parameters, perform login then
update MYSQL tables. The code runs fine when executed from IDE
(JBuilder). When I try to run it from a JSP I get the following
message. Can't make heads or tails out of it. Does anyone see the
problem? What does the first line mean?
Thanks
javax.servlet.ServletException: Name index 59136 in LocalVariableTable
has bad constant type in class file
com_xyz_practice/CrunchBracketSchedule
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
org.apache.jsp.brackets20B.bracket_005fauto_005fsch_005fbrks_jsp._jspService(org.apache.jsp.brackets20B.bracket_005fauto_005fsch_005fbrks_jsp:118)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.lang.ClassFormatError: Name index 59136 in LocalVariableTable has
bad constant type in class file com_xyz_practice/CrunchBracketSchedule
java.lang.ClassLoader.defineClass1(Native Method)
java.lang.ClassLoader.defineClass(ClassLoader.java:620)
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1629)
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:850)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1299)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1181)
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
com_xyz_practice.ScheduleBrackets.Schedule(ScheduleBrackets.java:59)
org.apache.jsp.brackets20B.bracket_005fauto_005fsch_005fbrks_jsp._jspService(org.apache.jsp.brackets20B.bracket_005fauto_005fsch_005fbrks_jsp:92)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
- 5
- Servlet: "action" failed to preload on startup in Web application: "xxxx".<Mar 15, 2005 10:10:38 PM EST> <Error> <HTTP> <BEA-101216> <Servlet:
"action" failed to preload on startup in Web application: "xxxx".
javax.servlet.ServletException: org/apache/log4j/Logger
at
weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubIm
pl.java:909)
at
weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStub
Impl.java:873)
at
weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubI
mpl.java:812)
at
weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppS
ervletContext.java:3281)
at
weblogic.servlet.internal.WebAppServletContext.preloadServlets(WebApp
ServletContext.java:3238)
at
weblogic.servlet.internal.WebAppServletContext.preloadServlets(WebApp
ServletContext.java:3224)
at
weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAp
pServletContext.java:3207)
at
weblogic.servlet.internal.WebAppServletContext.setStarted(WebAppServl
etContext.java:5737)
at
weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:874)
at
weblogic.j2ee.J2EEApplicationContainer.start(J2EEApplicationContainer
.java:2106)
at
weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContai
ner.java:2147)
at
weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.
activateContainer(SlaveDeployer.java:2434)
at
weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.doCommit(
SlaveDeployer.java:2352)
at
weblogic.management.deploy.slave.SlaveDeployer$Task.commit(SlaveDeplo
yer.java:2136)
at
weblogic.management.deploy.slave.SlaveDeployer$Task.checkAutoCommit(S
laveDeployer.java:2235)
at
weblogic.management.deploy.slave.SlaveDeployer$Task.prepare(SlaveDepl
oyer.java:2130)
at
weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(S
laveDeployer.java:2315)
at
weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(Sla
veDeployer.java:866)
at
weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDepl
oyer.java:594)
at
weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDep
loyer.java:508)
at
weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHan
dler.java:25)
at
weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
>
<Mar 15, 2005 10:26:13 PM EST> <Error> <HTTP> <BEA-101216> <Servlet:
"action" fa
iled to preload on startup in Web application: "WRAP".
javax.servlet.ServletException: org/apache/log4j/Logger
at
weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubIm
pl.java:909)
at
weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStub
Impl.java:873)
at
weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubI
mpl.java:812)
at
weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppS
ervletContext.java:3281)
at
weblogic.servlet.internal.WebAppServletContext.preloadServlets(WebApp
ServletContext.java:3238)
at
weblogic.servlet.internal.WebAppServletContext.preloadServlets(WebApp
ServletContext.java:3224)
at
weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAp
pServletContext.java:3207)
at
weblogic.servlet.internal.WebAppServletContext.setStarted(WebAppServl
etContext.java:5737)
at
weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:874)
at
weblogic.j2ee.J2EEApplicationContainer.start(J2EEApplicationContainer
.java:2106)
at
weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContai
ner.java:2147)
at
weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.
activateContainer(SlaveDeployer.java:2434)
at
weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.doCommit(
SlaveDeployer.java:2352)
at
weblogic.management.deploy.slave.SlaveDeployer$Task.commit(SlaveDeplo
yer.java:2136)
at
weblogic.management.deploy.slave.SlaveDeployer$Task.checkAutoCommit(S
laveDeployer.java:2235)
at
weblogic.management.deploy.slave.SlaveDeployer$Task.prepare(SlaveDepl
oyer.java:2130)
at
weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(S
laveDeployer.java:2315)
at
weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(Sla
veDeployer.java:866)
at
weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDepl
oyer.java:594)
at
weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDep
loyer.java:508)
at
weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHan
dler.java:25)
at
weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
>
======================================
Does anybody knows what to do?
upgrading app from WL7.0, struts 1.1 to WL8.1 SP3, struts 1.2.4
Did not updrade log4j-1.2.6.jar( which is working with WL7.0)
[log4j-1.2.9.jar gave too many compilation error when tried to upgrade
to with new env.]
Thanks
-Hemant
- 6
- Converting Java batch file from windows to unix formatMy java application includes source files in packages, and jar
library's in a lib directory.
I have created a windows batch file that compiles all and then runs the
application.
It is in the form of "javac classpath[jar files] [all package folders]
java classpath[jarfiles] [MainClass]"
The batch file is as so:
___________________________________________________________________
javac -classpath
"lib\jdom.jar;lib\ant.jar;lib\ant-launcher.jar;lib\liquidlnf.jar;lib\tools.jar"
antigen\builders\*.java antigen\config\*.java
antigen\datastructure\*.java antigen\gui\*.java antigen\io\*.java
antigen\listeners\*.java antigen\wizard\*.java
java -classpath
".;lib\jdom.jar;lib\ant.jar;lib\ant-launcher.jar;lib\liquidlnf.jar;lib\tools.jar"
antigen.config.Antigen
____________________________________________________________________
I have attempted to create a unix version of this (well i have tried to
make it work in mac os 10).
I have created a script that will run when i call "source BatchFile"
from the command prompt.
The script is as follows:
______________________________________________________________________
javac -classpath
/lib/jdom.jar:/lib/ant.jar:/lib/ant-launcher.jar:/lib/liquidlnf.jar:/lib/tools.jar
antigen/builders/*.java antigen/config/*.java
antigen/datastructure/*.java antigen/gui/*.java antigen/io/*.java
antigen/listeners/*.java antigen/wizard/*.java
java -classpath
".;/lib/jdom.jar;/lib/ant.jar;/lib/ant-launcher.jar;/lib/liquidlnf.jar;/lib/tools.jar"
antigen.config.Antigen
______________________________________________________________________
Java attempts to compile the source, but it doesnt include the jar
files in the classpath. Therefore i get a lot of library specific
errors.
Does anyone know why? Does unix work with the classpath differently?
Can someone help me create a batch file for a unix system.
Thanks
PS I do not want to use a build tool, as the whole point of the
application is to allow use of ant without installing it.
- 7
- 8
- Capital PunishmentIn the past I had made posts on these programming forums with
references to my website. I have stopped doing that since it is
labelled spamming.
The other day, on one of these forums, an individual threatend to wipe
out my site from the internet because he did't find use for the post.
Which one is a bigger offence. To post a message or to terminate
someone's site.
Asad
- 9
- JSTL - Following MVCHi, I've got a J2EE application (trying) to follow the MVC paradigm.
So far, there is a data model, which is sent to the view. The view
then calls java functions to html formate Strings from this model,
using inline java code, which I don't like very much. Would you:
a) leave it as it is
for: No work to do
against:Mixes JSTL tags with java inline code - ugly
b) add an additional "view-model" attribute for each attribute to be
displayed on the view, that already contains the necessary html style
informations
for: No more logic (java inline code) in the jsps
against: each attribute exists in 2 varieties in one hugh model
c) Add another view-model, and map from data-model to view model in a
huge loop before displaying the view model on the view?
pro: Data-model and view-model are totally separated, no more logic in
the jsps
against: lots of programming to do, and mapping all attributes from
one model to the other model would cost a lot of performance.
d) Simply add new getter methods for each attribute to the current
data-model.
So e.g. there would be a getName() method to get the data
representation of the name, and getFormatedName() which would first
call getName and then manipulate the name attribute to get a view
representation of it.
pro No more logic in the jsps, beans will not be "flooded" by
"duplicate attributes"
contra: Data model would still contain view-model getter methods.
Thanks for your advice,
Christine
- 10
- [Advanced Java/Gurus] JNI/Win32 hWnd JDK 1.4.2_05 freeze on Javascript CallbackDear Colleagues,
An advanced Java (i.e.: SUN Java Plugin 1.4.2_05) issue would require
your expertise. Inside a "JRE/1.4.2_05" environment (i.e.: version
prior to that latest installment are performing with an adequate
satisfaction) the execution of an "Applet", acquiring native methods
through a "JNI/Win32" interface and returning data using the
"jaws.jar", (i.e.: JSObject callback to "Javascript") hangs on the
"callback" invocation. (i.e.: it is happening in a "single threaded"
environment)
Please note that the invoked "Java" routine is not returning (i.e.:
the "JavaScript/Jdirect" call happens just before), as well as the
"JavaScript" callback is not being entered.
As remarkable as it could be, to unblock the "Java" runtime main
thread, one would right click on the "Internet Explorer" window (i.e.:
right in the task bar). Consequently the execution of the process
continues.
I have explored numerous options including "Thread" notifications,
garbage collections and method finalizations without success. Finally,
the option of duplication the "hWnd"
based "Win32" messaging flow stood as my ultimate option. I have
finally managed to retrieve the top level "hWnd" handle from my
"JDK1.4.2_05/Win32" environment, not to say easily? and declared
method such as "SendMessage", "SetFocus", "SetEnabled" (i.e.: and so
on) to replicate the behavior of my "right click". Through the "Spy++"
delivered messaged I, unfortunately, had no chance to discover the
message (i.e.: or the sequence) that had unblocked my process.
Please note that these "JNI/Win32" calls are executed inside a
separate thread, which is not blocked by the "main/thread" freeze.
Finally, I am relying on your wisdom and experience to win that quite
complicated case, unless an upcoming release of the "SUN/JRE" would
correct that damned state of things.
Thank you for your time; and please do not hesitate to come back for
details.
- 11
- WaitForMultipleObject feature in JavaCurrent, I have a method, which will perform lock on
void MyWait()
{
CountDownLatch.aWait
// We can have access to the Stop lock.
}
void MyStop()
{
// Signal Stop lock.
}
This works fine until we need to stop the thread from keep waiting on
CountDownLatch, when there is a stop signal. (The method who send stop
signal doesn't have access to CountDownLatch, else, the stop method
can just directly signal the CountDownLatch)
We would like to have something, "if either CountDownLatch is signaled
or Stop lock is signaled", unblock the thread.
Perhaps something like
WaitForMultipleObject(CountDownLatch, StopLock) in method void
MyWait()
either one of the object being signaled, the thread will continue
execution.
May I know how can I do that in Java?
One of the solution is that I can interrupt the Thread which is halted
at line CountDownLatch.aWait. However, I have no access to the Thread
which halted at line CountDownLatch.aWait
- 12
- Java Program error need helpI am working on this program for class and I can't figure out why I am
getting class or interface expected on the last two { symbols. Please
help, I am not trying to cheat, just need a point in the write
direction. Thank you
/*
Author: Kevin Rosier
Course: POS 407
Assignment: Week 3 Mortgage Calculator
Written: Oct 16, 2006
Creates a sales tax calculator with a GUI.
*/
// class names
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.text.*;
import java.text.*;
import java.util.*;
import javax.*;
public class MortgageCalculatorGUIwk3 extends JFrame implements
ActionListener
{
JFrame mortgageFrame;
JPanel mortgagePanel;
JButton mortgageButton;
JButton clearButton;
JButton exitButton;
JLabel mortgageLabel;
JLabel interestrateLabel;
JLabel yearLabel;
JLabel paymentLabel;
JTextField mortgageField;
JTextField interestrateField;
JTextField yearField;
JTextField paymentField;
public MortgageCalculatorGUIwk3() //constructor
{
{
// defining JFrame
mortgageFrame = new JFrame("Calculate Your Mortgage Payment");
mortgageFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
mortgageFrame.setSize(500,500);
//public static void main(String args[]){
ActionListener actionListener = new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
AstractionButton aButton = (AbstractButton)
actionEvent.getSource();
boolean selected = abutton.getmodel().isSelected();
System.out.println(actionEvent.getActionCommand()
+ " - selected? " + selected);
}
};
//constructs Radio buttons
JMenuBar menuBar = new JMenuBar();
JMenu menu = new JMenu("Menu");
ButtonGroup buttonGroup = new ButtonGroup();
menu.setMnemonic(KeyEvent.VK_M);
JRaidoButtonMenuItem emptyMenuItem = new
JRadioButtonMenuItem();
empyMenuItem.setActionCommand("Empty");
emptyMenuItem.addActionListener(actionListener);
buttonGroup.add(emptyMenuItem);
menu.add(empyMenuItem);
JRadioButtonMenuItem oneMenuItem = new JRadioButtonMenuItem("7
years at 5.35%");
oneMenuItem.addActionListener(actionListener);
buttonGroup.add(oneMenuItem);
menu.add(oneMenuItem);
JRadioButtonMenuItem twoMenuItem = new JRadioButtonMenuItem("15
years at 5.5%");
twoMenuItem.addActionListener(actionListener);
buttonGroup.add(twoMenuItem);
menu.add(twoMenuItem);
JRadioButtonMenuItem threeMenuItem = new
JRadioButtonMenuItem("30 years 5.75%");
threeMenuItem.addActionListener(actionListener);
buttonGroup.add(threeMenuItem);
menu.add(threeMenuItem);
menuBar.add(menu);
frame.setJMenuBar(menuBar);
frame.setSize(350, 250);
frame.setVisible(true);
// defining JPanel
JPanel mortgagePanel = new JPanel(new GridLayout(7,2,10,30));
// defining contents on the panel
mortgageLabel = new JLabel("Mortgage Amount Desired");
interestrateLabel = new JLabel("Interest Rate Desired");
yearLabel = new JLabel("Years of Mortgage");
paymentLabel = new JLabel("Payment");
mortgageButton = new JButton("Your Monthly Payment Is");
clearButton = new JButton("Reset");
exitButton = new JButton("Exit");
// data for calculations
mortgageField = new JTextField("");
interestrateField = new JTextField("");
yearField = new JTextField("");
paymentField = new JTextField("");
paymentField.setEditable(false);
// Adding components to the GUI
mortgagePanel.add(mortgageLabel);
mortgagePanel.add(mortgageField);
mortgagePanel.add(interestrateLabel);
mortgagePanel.add(interestrateField);
mortgagePanel.add(yearLabel);
mortgagePanel.add(yearField);
mortgagePanel.add(mortgageButton);
mortgagePanel.add(clearButton);
mortgagePanel.add(exitButton);
mortgagePanel.add(paymentLabel);
mortgagePanel.add(paymentField);
mortgageFrame.add(mortgagePanel);
mortgageFrame.setVisible(true);
// action buttons
mortgageButton.addActionListener(this);
clearButton.addActionListener(this);
exitButton.addActionListener(this);
}
} //end constructor
// What action is to be performed
public void actionPerformed(ActionEvent e)
{
Object source = e.getSource();
if(source == mortgageButton) {
String sMortgage = mortgageField.getText();
String sInterestrate = interestrateField.getText();
String sYear = yearField.getText();
double mortgage = Double.parseDouble(sMortgage);
double interestrate = Double.parseDouble(sInterestrate);
double year = Double.parseDouble(sYear);
double numberOfPayments = year * 12;
double monthlyInterest = interestrate / 100 / 12;
double x = Math.pow(1+monthlyInterest, numberOfPayments);
double monthlyPayment = (mortgage * x * monthlyInterest)/(x-1);
DecimalFormat df = new DecimalFormat("$0,000.00");
paymentField.setText(df.format(monthlyPayment));
}
else if(source == clearButton)
{
mortgageField.setText("");
interestrateField.setText("");
yearField.setText("");
}
else if(source == exitButton)
{
System.exit(0);
}
} // end actionPerformed
public static void main(String [] args) {
MortgageCalculatorGUIwk3 thisCalc = new MortgageCalculatorGUIwk3();
}; //end main
};
} //end class
}
- 13
- [OT] Linux Flaw DiscoveredKernel Flaw Makes Linux Crash Easily
A flaw in the Linux kernel allows a 20-line C program to crash most
distributions of the operating system using the 2.4 and 2.6 kernels
running on x86 and x86-64 architectures, according to security
researchers.
http://www.computerworld.com/newsletter/0,4902,93833,00.html?nlid=OS
l8r, Mike N. Christoff
- 14
- Setter method in form bean corresponding to text field in JSPhi all,
In my JSP, I am having a text field like this
<input type="text" name="data(id)" />
Please note, that I am not using <html:text> tag. Can you tell me what
should be the corresponding setter nethod signature in the bean.
I have tried
public void setData(String key, String value) and
public void setData(String key, Object value)
but both of them are not working.
I have also noted that if I use <html:text> tag in the same mannar,
then my {Object value} setter method gets called.
Thanks for any help,
- 15
- va_list in JNICan anyone tell me if it is possible to call a C function which
contains a va_list parameter from java code. I have a existing library
that I wish to use by creating a Java wrapper around the code.
|
|
|