java

Find potential SQL inject problems in Java/JSP code.

I'm working for a customer with a huge legacy codebase consisting of various Java en JSP based applications. Most querying is done using the home-build 'orm' system. Some applications use Plain Old JDBC. Some applications are based on Hibernate (yes HQL build with plus signs is a potential problem as well). Some of the older application...

Best Resources for Learning JavaFX?

For those of us learning JavaFX, what are the best resources you've found so far? (One of the difficulties in finding good JavaFX resources is that things written before July 2008 are often no longer valid because of changes made to beta version of the language) I've found: James Weaver's JavaFX Blog JavaFX in Action by Manning Pres...

Denormalize an XML schema programmatically

I need to take any given valid XML schema (XSD) and denormalize it to a simple form containing no refs, no includes, etc. All simple type definitions should be inline, such that when looking at any given element, all declarations are visible without performing another lookup. I've found some tools that have this built-in, but I need to...

java get file size efficiently

While googling, I see that using java.io.File.length() can be slow. FileChannel has a size() method that is available as well. Is there an efficient way in java to get the file size? ...

Opening more than one of the same Mac Application at once.

Hi there. I'm developing a Mac App in Java that logs into any one of our client's databases. My users want to have several copies of this program running so they can log into a couple clients at the same time, rather than logging out and logging back in. How can I allow a user to open several copies of my App at once? I'm using Eclip...

Determining the extended interfaces of a Class

I need to determine if a Class object representing an interface extends another interface, ie: package a.b.c.d; public Interface IMyInterface extends a.b.d.c.ISomeOtherInterface{ } according to the spec Class.getSuperClass() will return null for an Interface. If this Class represents either the Object class, an interf...

What's the best setup for working with WSO2 WSAS

What version of java, eclipse and WPT should I be using? ...

Drools project idea needed

I was asked to make some drools traning for my teammates. Just to show them how it can be used and how usefull it may be. To do this training I first have to learn Drools, and I figured that the best way to learn it will be small project centered around drools. Any interesting ideas? My idea for this project was to do some webMethods...

"SocketException: Unconnected sockets not implemented" with self-signed SSL certificate

(I've asked the same question of the jmeter-user mailing list, but I wanted to try here as well - so at the least I can update this with the answer once I find it). I'm having trouble using JMeter to test a Tomcat webapp using a self-signed SSL cert. JMeter throws a SocketException with message Unconnected sockets not implemented. Accor...

Low Java single process thread limit in Red Hat Linux

I'm experiencing an issue on a test machine running Red Hat Linux (kernel version is 2.4.21-37.ELsmp) using Java 1.6 (1.6.0_02 or 1.6.0_04). The problem is, once a certain number of threads are created in a single thread group, the operating system is unwilling or unable to create any more. This seems to be specific to Java creating thr...

cURL equivalent in JAVA

I am tasked with writing an authentication component for an open source JAVA app. We have an in-house authentication widget that uses https. I have some example php code that accesses the widget which uses cURL to handle the transfer. My question is whether or not there is a port of cURL to JAVA, or better yet, what base package wil...

What’s the current state of closures in Java?

Does anybody know, if closures will be in Java 7? ...

Which Layout Manager do you use?

What java GUI layout manager does everyone use? Lately, I have been using MigLayout, which has some powerful component controls. Just wanted to see what other developers are using other than the standard JDK ones. ...

Can anyone recommend a simple Java web-app framework?

I'm trying to get started on what I'm hoping will be a relatively quick web application in Java, yet most of the frameworks I've tried (Apache Wicket, Liftweb) require so much set-up, configuration, and trying to wrap my head around Maven while getting the whole thing to play nice with Eclipse, that I spent the whole weekend just trying ...

What is the best way for a Java program to monitor system health?

I would like to be able to monitor my major system health indicators from inside our Java-based system. Major points of interest include CPU temperature, motherboard temperature, fan speed, etc. Is there a package available that: Makes this sort of data available to Java? Works on Windows or Linux or both? Is open / free / cheap? ...

Seam/JSF form submit firing button onclick event

I have a search form with a query builder. The builder is activated by a button. Something like this <h:form id="search_form"> <h:outputLabel for="expression" value="Expression"/> <h:inputText id="expression" required="true" value="#{searcher.expression}"/> <button onclick="openBuilder(); return false;">Open Builder</button> <h:...

Can I use Terracotta to scale a RAM-intensive application?

I'm evaluating Terracotta to help me scale up an application which is currently RAM-bounded. It is a collaborative filter and stores about 2 kilobytes of data per-user. I want to use Amazon's EC2, which means I'm limited to 14GB of RAM, which gives me an effective per-server upper-bound of around 7 million users. I need to be able to sca...

Wait until any of Future<T> is done

I have few asynchronous tasks running and I need to wait until at least one of them is finished (in the future probably I'll need to wait util M out of N tasks are finished). Currently they are presented as Future, so I need something like /** * Blocks current thread until one of specified futures is done and returns it. */ public st...

Spring JTA TransactionManager config: Supporting both Tomcat and JBoss

I have a web application using JPA and JTA with Spring. I would like to support both JBoss and Tomcat. When running on JBoss, I'd like to use JBoss' own TransactionManager, and when running on Tomcat, I'd like to use JOTM. I have both scenarios working, but I now find that I seem to need two separate Spring configurations for the two ca...

How do you resolve a circular dependency with an inner class?

(Java question) If I reference a field in an inner class, does this cause a circular dependency between the enclosing class and the inner class? How can I avoid this? Here is an example: public class Outer { private Other o; private Inner i; public Outer() { o = new Other(); i = new Inner() { public void d...