java

ResultSet prematurely closing

I'm compiling a list of Page variables (which has a list of books in it) from a running MYSQL Database. When attempting the second iteration in the while(rs.next()) loop, I receive an SQL Exception saying that the ResultSet was already closed. I see nowhere that this code closes the rs object. try { stmt = con.createStatement(); ...

Benchmarking Desktop Applications

I have the desire to benchmark a Client/Server application (GUI) written in Java, on a Windows platform. I'm doing this so I can identify where the Application platform will break when scaled to 100s of users. This is not my application, I do not have source code. I know packages like selenium exist for web apps, but I haven't seen ...

Info/Warning messages from SQL procedures to Java through JDBC driver

By seeing the ResultSet.getWarnings() method there must be some way to pass warning/info messages from stored procedures to Java layer but found most of the drivers doesn't implement this method. Are there any way to send info/warning message from stored procedure to Java layer? ...

Dependency Injection failing - hibernate with struts2 using the full-hibernate-plugin

Hi, i'm trying to use hibernate in a struts2 example using the struts2 full hibernate plugin (http://code.google.com/p/full-hibernate-plugin-for-struts2). I've placed all the Jars in my lib folder: antlr-2.7.6.jar commons-collections-3.1.jar commons-fileupload-1.2.1.jar commons-io-1.3.2.jar commons-lang-2.3.jar commons-logging-1.0.4.ja...

Remote deploy Tomcat webapp from Eclipse

For development and testing purposes I'd like to deploy my webapp from within eclipse to a remote tomcat server. Is this possible ? If not, how should I set up my development environment for smooth and easy remote deployment ? ...

Java Date, render with specific daylight mode

I have a Java Date that is from this summer during daylight savings time. For example: Jun 01, 2009 06:00 AM PDT My question is, how do I display this date as my local time zone and current daylight savings mode (in my case Pacific Standard Time)? Jun 01, 2009 05:00 AM PST Java's Date.toString() and SimpleDateFormat displays ...

IllegalMonitorStateException raised with explicit lock/condition

I want to have such kind of work flow using explicit lock/condition variables (It's a course project which mandates this style.): A is the main class, it asks B to do some job from time to time. B has a worker class C which constantly queries B about new jobs to do and do it. After C finishes, it will call A's callback function to notify...

Java Queue Merge, Beginner

I'm trying to write a method that will take in two Queues (pre-sorted Linked Lists) and return the merged, in ascending order, resulting Queue object. I pasted the Queue class, the merge method starts 1/2 way down. I'm having trouble calling merge, this is how I am trying to call it from my main method, can anyone help with this call ...

Convert latex to html in Java or C++?

There are many tools for converting latex into html. I'm looking for a Java or C++ program to do this. It will need to run on multiple operating systems. The solution will be used on academic papers, so it should ideally also be able to interpret things like bibtex. I found htmltolatex which is a "Java program for converting HTML pag...

Some servlet/jetty questions

Having the ServletAPI plus the configurations you can make to jetty or any other web container Do we have a way to limit the request sizes ? (ie to close the connection if posting more that 50 MB) Can we in some way kill the dispatching of a request that is taking too long ? While dispatching a request in your own configured servlet, c...

does throws exception leads the program to a pre written code

( patience requested as i'm new to programming ) when you add the phrase throws ABCexception in method declaration like this public static void main(String[] args) throws ABCException { } does it mean that the you expect the method could generate an ABC exception and by writing throws ABCException ... when this exception occurs .. ...

Java: PrintStream to String?

I have a function that takes an object of a certain type, and a PrintStream to which to print, and outputs a representation of that object. How can I capture this function's output in a String? Specifically, I want to use it as in a toString method. ...

How to convert non-supported character to html entity in Java

Some character not support by certain charset, so below test fail. I would like to use html entity to encode ONLY those not supported character. How, in java? public void testWriter() throws IOException{ String c = "\u00A9"; String encoding = "gb2312"; ByteArrayOutputStream outStream = new ByteArrayOutputStream(); Writer...

invalid AES key length error

this code give invalid AES key length error. how can i correct it ? ( i want 128 bit key AES encryption ) package org.temp2.cod1; import java.security.*; import javax.crypto.*; import javax.crypto.spec.*; import java.io.*; public class Code1 { public static void main(String[] args) throws NoSuchAlgorithmException, NoSuchPaddingEx...

Tomcat parent webapp shared by configurable children webapps

Currently, we support many clients using the same web app, but each client has a different configuration for accessing their database, setting files etc. As the client list grows, updating the web apps is becoming increasingly arduous, and the duplication of resources is a waste of memory, file space, etc.. What we'd like to do is have...

How to patch J2SE so Java Datagram.getAddress() reports sender's port

Sun's j2se implementation of the j2me Datagram appears to be a bit broken: javax.microedition.io.DatagramConnection dc = createDatagramConnection(); javax.microedition.io.Datagram datagram = (javax.microedition.io.Datagram)datagramConnection.newDatagram( 1000 ); datagram.reset(); datagram.setLength( 1000 ); datagramConnection.receive(...

Can I write to the Beanshell console from Java?

I'm using Beanshell as an embedded debugging tool in my app. It means I can telnet to my app and poke around with its internals while it is running (I typically wrap the telnet session with rlwrap). The problem is that the only way I've found to print to the Beanshell console, rather than stdout of the application itself, is the print(...

Pretty Date Text in Flex / Flash / Java / C#

Is there a free library or class for formatting a date in a pretty way such as "5 minutes ago" or "yesterday"? I'd be satisfied with the same code in another language that I could port to Actionscript (like Java or C#) ...

How to parse this output and separate each field/word

Hi Everyone. This is Akshatha. I'm stuck in parsing the following data. I want to fetch each word individually. Can I have a sample code so that I can proceed RTRV-HDR RH01 SIMULATOR 09-11-18 16 13 19 M RH01 COMPLD RTRV-EQPT ALL RE01 SIMULATOR 09-11-18 16 13 20 M RE01 COMPLD SLOT-1-1-1 CMP IS-NR SLOT-1...

Java Problem with the clearselection() method

I have 2 trees in my program. Iam using JTree's clearselection() method to clear the selection in 1 tree when something in the other tree is selected. The main code is something like this:(inside a valueChanged event listener and tree being the one on which the current selection has been triggered) if ( tree == tree1 ){ tree2.cle...