java

Problems with use of "ExecutorCompletionService" with Callbable vs. Runnable

I have been working with the example code from the ExecutorCompletionService and put together the following example code. The code in solve() works as expected and prints 1 2 3 4 5 The code in solve2() doesn't print anything and in fact never exits. It doesn't matter whether ecs is constructed before or after submitting the jobs to th...

Secure connection between client and server

Hi, I'm developing a server component that will serve requests for a embedded client, which is also under my control. Right now everything is beta and the security works like this: client sends username / password over https. server returns access token. client makes further requests over http with the access token in a custom header...

Fire mouse event on underlying components

I'm looking for a way to pass mouse events to components covered by other components. To illustrate what I mean, here's a sample code. It contains two JLabels, one is twice smaller and entirely covered with a bigger label. If you mouse over the labels, only the bigger one fires mouseEntered event however. import java.awt.Color; import j...

Why is "java.lang.OutOfMemoryError: Java heap space" not caught?

I have a thread in a Java web application that causes a java.lang.OutOfMemoryError: Java heap space exception, but the try/catch block does not catch the error. Sample code: private void doSomeWork() { try { processData(); //Causes OutOfMemoryError System.out.println("This line does not execute"); } ...

schedule jobs dynamically in quartz

I would like to create a generic job class which takes some arguments instead of creating job class before hand? All the settings are stored in a db so we could just call "refresh" which drops all the jobs and re-registers them from the database. ...

Java: Enerjy - Unchecked Exception?

Enerjy has a problem with this line of code: private static List<ParseTree> getTestTrees(Xml test) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { This is the warning: (Baseline) JAVA0126 Method 'getTestTrees' declares unchecked exception 'IllegalArgumentException' in throws How can I fix this? ...

Connection hangs after time of inactivity

In my application, Spring manages connection pool for database access. Hibernate uses these connections for its queries. At first glance, I have no problems with the pool: it works correctly with concurrent clients and a pool with only one connection. I can execute a lot of queries, so I think that I (or Spring) don't leave open connecti...

How do I determine where a JSTL expression variable (pageContext attribute) originated in IDEA?

We've got an app that makes heavy use of JSTL expressions and custom taglibs, which means our pageContext attributes could have been set just about anywhere. How do I go about determining where they originated? Consider something like: <c:out value="${ myObject['SOME_KEY'] }" /> I need to know where myObject came from -- how did it ma...

Eclipse RCP app, find duplicate entries for some plugin after update, same plugins then fail

have an Eclipse Galileo RCP application with updates provided by an Eclipse Update Site Project put on a web server. after the update, the application fails (in particular, one of the update plugins fails). when looking at the informations about the application and clicking 'Installation Details', it can be noted that the plugin (the fai...

How to bind table row to Edit-button in jsf?

It's trivial but unfortunately I don't understand some processes 'behind the scenes' in JSF. So, I'm also interested in links to related articles. The problem: I have a list of User-objects. And I represent this list as a dataTable. <h:dataTable var="user" value="#{userService.allUsers}"> <h:column> <f:facet name="header"> ...

Documenting J2EE comonents in Ant script

I'd like to document J2EE components that we create. Our ant scripts have targets to build them all. I was wondering if there is anything like "javadoc" for an ant script. In other words, I could annotate the ant targets: <target name="some.war'> <antdoc> This war file provides the user interface for the foo application. </a...

JBOSS hanging on org.apache.jk.common.JkInputStream.receive() - IOException reading the http request inputstream

I have a problem that causes all threads in JBOSS to block while reading the input stream. It does not happen predictably and the system can run for days (or longer) before it starts to suffer. The problem looks similar to question 1624159 but I have yet to try setting -Dhttp.keepAlive=false as recommended in the answer because I wondere...

Extract Nouns from Text (Java)

Does anyone know the easiest way to extract only nouns from a body of text? I've heard about the TreeTagger tool and I tried giving it a shot but couldn't get it to work for some reason. Any suggestions? Thanks Phil EDIT: import org.annolab.tt4j.*; TreeTaggerWrapper tt = new TreeTaggerWrapper(); try { tt.setModel("/Nouns/english...

Maven: How to get all transitive dependencies programatically in a MOJO

Possible Duplicate: How to get access to Mavens dependency hierarchy within a plugin. The dependency:tree plugin:goal has an option 'verbose' which displays all conflicts & duplicates in the dependency tree. I am trying to reuse that information in my own mojo to generate reports, however - I can't seem to figure out exactly how...

Is there any book on Google App Engine for java?

I would like to start using Google App Engine for java. But i don't know, where to start. Is the tutorial provided by google [ http://code.google.com/appengine/docs/java/overview.html ] enough ? Also, please mention some good books on GAE [ java ] so that i can download those from rapidshare or torrent buy those books and start reading ...

Decrement at Regular Intervals in Java

I'm writing an application in Java, but need to know how to subtract from a variable once every second. What's the easiest way to do this? Thanks! ...

Measuring memory usage of a process on Linux

Hi I am trying to measure the memory usage of a process (a java program) on linux and have two questions related to that: I tried using the script ps_mem.py(sums values from /proc/$PID/smaps) and the peak of total memory usage was about 135MB (private and shared memory). The amount of shared memory is less than 1MB. Trying to use Valg...

Cookies...Http POST doesn't correctly work, why?

Probably this is often problem, but I can't solve it. I need to automaticallly fill out some fields on the web form, which is given from server. I use Apache HttpClient to make more easy my life) By now, one can consider my steps to acheive the aim: 1. I have not certificate to http://trac.edgewall.org/ so I download this software and...

Ballistics Library

Does anyone know if there has been a port of the GNU Ballistics library to C#, java, vb, etc? Is there a similar library out there in any other language, even C++? ...

Java: BigInteger, howto write it thru an OutputStream

Hi, I want to write a BigInteger to a file. What is the best way to do this. Of course I want to read (with the program, not by human) it from an inputstream. Do I have to use an ObjectOutputStream or are there better ways? The purpose is to use as less bytes as possible. Thanks Martijn ...