java

Implementing Synchronous network call in java waiting for an ack message?

How would you go about implementing the equivellent of a wait until complete method call in Java? Basically what I want to do is hava a method that sends a message over the network to a server application and waits till it gets the appropriate Ack message from the server with either an operation completed successfully or operation faile...

Reflection: Effective, Awesome, Necessary uses

Possible Duplicates: What is reflection, and why is it useful? So I've read the Reflection tutorial on Java's website, and I think I generally understand that it allows a class to inspect itself, having access to properties, methods, etc. However, how, if at all, does this relate to mutable or immutable code? Can classes change ...

JDBC Dates Deprecated in Java (java.sql package)

Hello, I am working with JDBC and MySQL. I have a date column that I need included in my result set. Unfortunately, I cannot find a class in Java to retrieve the date. The SQL Date class is deprecated. How do you get Date objects from a result set? ...

Comparing Composer Names, Or How do I find a 'close enough' match between two strings?

After finishing two cs classes, I've started working on a personal project in Java. I am writing a program that will look through a music collection and attempt to set the 'Composer' tag by looking at the filename and meta tags. I am comparing these against a composer list I have created as a simple text file. My question is this: Wh...

Pass events in custom JTable

Hi I have a class called ColorChooser (in the net.java.dev.colorchooser.ColorChooser package) This is a custom component used to select colors. What I want is to display a JTable with ColorChoosers in the second column. So I created my own TableCellRenderer and it works: @SuppressWarnings("serial") class ColorChooserTableRenderer exten...

StackOverflowError on Solaris but not on Linux/Windows

I have a Java application that parses a large xml schema (.xsd) using Xerces that runs fine on Linux and Windows but gives a StackOverflowError on Solaris, with exactly the same inputs and configuration. I know that Xerces uses recursion to validate xml schemas but since it didn't give any problems on Windows and Linux I was pretty confi...

Tips or tools for debugging Spring applications?

I am trying to use Spring for the first time in an application. The general issue that comes up again and again is that I have no idea how to debug Spring. The framework is so configuration heavy that traditional code debugging seems fruitless. Short of turning on the debugging level logs (which are lacking) and scanning through I have n...

Centralized DB connection management in Java

For compliance reasons, my organization is looking to take our database connection settings out of properties/XML config files and into a central registry - ideally federated over multiple physical machines, to avoid a single point of failure. I have been looking at the possibility of using JNDI to achieve this, but haven't really got m...

Merging cells in a JXTreeTable

Hi, I want to merge two cells in a JXTreeTable. Is this possible? I have read the solution for Merging cells in JTable, but this does not work for JXTreeTables. What I mean with merging cells: I want to create a structure like this: node 1    | title for 3 cells | title for 3 cells |   subnode |  c1  | c2  |  c3  |  c1  | c2 ...

How do I convert a String to Double in Java using a specific locale?

I want to convert some numbers which I got as strings into Doubles, but these numbers are not in US standard locale, but in a different one. How can I do that? ...

Unit testing in JEE environment

We're migrating our application into a JEE container, and looking for tools to use for unit testing (and integration testing) our migrated app. Our requirements include: Ad-hoc testing: the ability to run tests manually, on demand (to be used by developers while developing code) Batch testing: the ability to run a large (and growing) s...

Why generate long serialVersionUID instead of a simple 1L?

When class implements Serializable in eclipse i have two options: add default serialVersionUID(1L) or generated serialVersionUID(3567653491060394677L). I think that first one is cooler, but many times i saw people using the second option. is there any reason to generate long serialVersionUID? ...

JGoodies memory leak?? - Out of Memory Exception when Spring tries to display the view

I am getting an Out of Memory exception sometimes during or after the validation of component happens. I was trying to profile a large validation result <= 20000, and it worked, so I went bigger. The exception occurs at values > 20000, does anyone know of any inherent jgoodies memory leaks, with the validation framework, the component ...

How can I use C# to retrieve Java data from a socket?

I want to send BigInteger data in socket and my friend wants to retrieve the data. I am using Java, but my friend uses C#. String str = "Hello"; BigInteger big = new BigInteger(str.getBytes); byteToBeSent[] = big.toByteArray(); I am sending this byte array (byteToBeSent[]) through socket. And my friend wants to retrieve "Hello". How ...

getting started with envers + hibernate (simple and COMPLETE example)

I have Hibernate working and would like to try adding Envers audit/revision functionality but can't seem to figure out what is required. (my example compiles and runs OK and I get the regular Hibernate functionality but no audit tables appear in my database.) Has someone out there done this before? Does it work with H2 database using HSQ...

Weblogic - how to bring server down for maintenance?

I need to bring down a server in Weblogic 10.3 (which will have only one application deployment) and display a "Under Maintenance" page when the user requests the application. Is there a way to use two managed servers or WLST to do this somehow? ...

Fixing Null EntityManger in Spring MVC application?

In the following code I am trouble with my injected EnitityManager, which always shows up as null; public class GenericController extends AbstractController { @PersistenceContext(unitName = "GenericPU") private EntityManager em; protected ModelAndView handleRequestInternal( HttpServletRequest request, ...

Eclipse open console apps in separate window.

Is there a way to configure eclipse to open console apps in a new window rather than it's own console when you run/debug them? I'm debugging a client/server application and I'd like to see the output of both apps at once and not have to switch between the tabs... ...

Hibernate - Same result after update/select

Hi, hibernateSession.createQuery("select foo where id = 1"); // This command return the Item with id 1. // [BREAK POINT STOP] ==> I go in MySQL and I delete this item manualy. // [BREAK POINT CONTINU] hibernateSession.createQuery("select foo where id = 1"); // This command return the Item with id 1 too ! :-( It's the same with hibern...

Any there any circumstances where Java reference equality could be different to equals() equality for a an object of a type which has not overridden equals()?

Is there any magic hanging around anywhere that could mean that (object0 == object1) != (object0.equals(object1)) where object0 and object1 are both of a certain type which hasn't overridden Object.equals()? ...