Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!

joe black

Ranch Hand
+ Follow
since Dec 03, 2003
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by joe black

I got rid of it by adding the following to

export JAVA_OPTS="-server -Xms4m -Xmx4m"

Why would I need to set the min/max heap size when shutting down tomcat?
12 years ago
When I run I get the following error below:

[bin]# ./
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/local/java
Error occurred during initialization of VM
Could not reserve enough space for object heap
# An unexpected error has been detected by Java Runtime Environment:
# SIGSEGV (0xb) at pc=0xb7ed041a, pid=17825, tid=3085151120
# Java VM: Java HotSpot(TM) Server VM (10.0-b22 mixed mode linux-x86)
# Problematic frame:
# C [] cfree+0x7a
# An error report file with more information is saved as:
# /usr/local/apache-tomcat-6.0.16/bin/hs_err_pid17825.log
# If you would like to submit a bug report, please visit:

Below is my system info:

--------------- S Y S T E M ---------------

OS:Fedora release 7 (Moonshine)

uname:Linux 2.6.9-023stab044.4-smp #1 SMP Thu May 24 17:20:37 MSD 2007 i686
libc:glibc 2.6 NPTL 2.6
rlimit: STACK 10240k, CORE 0k, NPROC 71680, NOFILE 1024, AS infinity
load average:0.01 0.02 0.00

CPU:total 4 (2 cores per cpu, 1 threads per core) family 6 model 15 stepping 11, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3

Memory: 4k page, physical 8140592k(110360k free), swap 12578884k(9455180k free)

vm_info: Java HotSpot(TM) Server VM (10.0-b22) for linux-x86 JRE (1.6.0_06-b02), built on Mar 25 2008 00:26:44 by "java_re" with gcc 3.2.1-7a (J2SE release)

time: Sat May 10 12:00:37 2008
elapsed time: 0 seconds
[ May 11, 2008: Message edited by: joe black ]
12 years ago

In my dao layer, I have two methods which load and update records in a user table. The user table is mapped one to one, and lazy loading is set to false. In these methods, I am using Spring's HibernateTemplate.

I am calling both these methods from a service layer to retrieve a user by username, modify it, then update the record. Basically, something like this:

First I did not execute these methods inside a transaction, and I saw the following stack trace:

11 Mar 2008 12:42:29,171 [http-8050-Processor25, ] ERROR org.hibernate.event.def.AbstractFlushingEventListener - Could not synchronize database state with session
org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update


Caused by: java.sql.BatchUpdateException: Lock wait timeout exceeded; try restarting transaction
at com.mysql.jdbc.ServerPreparedStatement.executeBatch(
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(
at org.hibernate.jdbc.AbstractBatcher.executeBatch(

Once I put these calls inside a transaction, it works fine. What I would like to know is why I need the transaction for this update to work? I am using mysql 5

I want to implement a zip code search.

The idea is that you enter a zip code to search, and the results contain records where the zipcode is within a certain number of miles from the zip code you entered. I also want to display how many miles the resulting zipcode is from the one you entered.

Is there an api I can use for this?
13 years ago
Let me elaborate.

The following is an example taken from

Which has been modified to show my point. It uses stax, and when an
error is thrown
while writing to the stream, I can recover gracefully and send back well
formed xml with
an error element.

Notice I am throwing an Exception. This would be similar to a
JibxException being thrown during marshalling.
However, I catch this exception, add an error element as the end
element, then call writeEndDocument which
closes all open structures. Can something similar be done with jibx?
instead of sending back xml that is
not well formed? How does any xml to object binding framework handle this use case?

[ July 09, 2007: Message edited by: joe black ]

I am creating a REST style webservice, and I am using jibx xml binding framework to create the response. I configured jibx to use StAX as its parser. I have run into an issue however, and would like to know how other people solve it:

When there is an exception thrown during the binding process, the client could get back an incomplete xml response, since its being streamed.
Something like the following:

What I would really like to do is just have an error response returned, ie catch the exception and modify the response. Currently the way I am solving this issue is by having jibx write to a StringWriter, then I spit that back, and if there is an exception I can clear it out and add my error response:

Is there a better way? The above solution fixes the problem, but now I am creating the entire response in memory. How do other people handle this problem? I'd rather not send back invalid xml...

It seems like a choice between being memory intensive for completeness, or being incomplete for better performance

Also keep in mind that this is not an exception in the business logic, and it should never happen.
[ July 09, 2007: Message edited by: joe black ]
The constructor references this variable as well, and the following did not work:

I'm using a javascript editable combo box, and it did not like the following line:

"undefined has no properties"
[ March 04, 2007: Message edited by: joe black ]
I am using JSF to create a custom component which dumps a lot of javascript.

However, JSF uses colons when generating ID's, and I need these ID's to be variables:

But the colon gives me warnings and does not work.

Is there anyway around this?
[ March 04, 2007: Message edited by: joe black ]
Which version are you using. The bug claims it is fixed in JSF 1.2
13 years ago
I get the same stack trace as you posted above, sometimes. Looks like there is no solution.
13 years ago
So I can rely on the ordering of the components in the jsp?
13 years ago
In what order are the setter methods called by the container?

The reason I ask is because I also have a combo box which is populated dynamically, and I need this to be created first, because before I create it, I lookn in the request for a parameter, which I then set as the value of an instance variable, and then the code which creates the panel would need to grab it.

So if the panel setter was called first, it would not have this value.
[ February 26, 2007: Message edited by: joe black ]
13 years ago
I have a criteria box at the top of my screen which holds various inputs such as text box, combo boxes, etc. The components I need to create for this screen are given to me by a webservice. In the response it tells me which components to add to the criteria box panel. This panel is defined in my jsp.

What I currently do is make a call to my web service in the constructor of my backing bean, then find the criteria box panel by id using findComponent, and then create and add the components. I use findComponent because if I try to bind the panel in the jsp to the backing bean, the reference is always NULL in the constructor. The backing bean is in request scope.

I have this logic in the constructor because these controls need to be in the panel before the page loads. Is there a more clean way of doing this? Anywhere else I can make the call to my web service and add the controls dynamically? I tried adding a phase listener but beforePhase() didn't get called on the first request, I guess because the listener was added, and then was called twice on subsequent requests.

[ February 25, 2007: Message edited by: joe black ]
13 years ago
I have a form with a combo box that contains options which need to be retrieved from the backend. I have a service which gets these options. My question is: where do I call my service to populate a bean which this combo can use to populate itself? Do I need a second controller? Right now I only have a controller which handles the submitted form. I need a way to dynamically populate the form view.