java

Tomcat sessions expiring unexpectedly

We are running tomcat application server that handle over 100 concurrent sessions. In the last 2 months the most active users noticed that sometimes they are getting kicked off from the system. As I understood from the log tomcat sessions are getting expired without any reason. I see no problems from the web application side. Is ther...

What are the pros and cons of eclipse vs netbeans vs others for j2me development?

What are the pros and cons of eclipse vs netbeans vs others for j2me development? Which would you choose and why? [edit] When asking the question this one didn't turn up in the list ...

How do you design your application for different presentation layers?

I am part of a team that is developing a web application using a proprietary mvc framework. This framework behaves a bit like a very poor man's struts! It has a central controller, configuration in properties file, torque like generated database action classes and no form beans. Say you have a user account editing screen, Here is a typ...

For two methods who need to call each other: how do I prevent an infinite loop?

Hello! I have two classes (A and B) which depend on each other in following sense: Each class has a method performing some action. The action of each class depends on an action of the other class. So, if the user calls action of class A, it should automatically call action of class B. Same for the other way. But an infinite loop should...

Short way of making many beans depend-on one bean

When using database migrations, I obviously want none of the DAOs to be usable before the migrations are run. At the moment I'm declaring a lot of DAOs, all having a depends-on=databaseMigrator property. I find this troubling, especially since it's error prone. Is there a more compact way of doing this? Notes: the depends-on attr...

How to replace a set of tokens in a Java String?

I have the following template String: "Hello [Name] Please find attached [Invoice Number] which is due on [Due Date]". I also have String variables for name, invoice number and due date - what's the best way to replace the tokens in the template with the variables? (Note that if a variable happens to contain a token it should NOT be ...

Java sockets - asynchronous wait, synchronous read

I want to be able to asynchronously wait on socket, then synchronously read from it: for (;;) { while (data available on socket) { read message from socket; process it; } do something else; } (I need this because I want to poll a queue with messages from GUI at the same time, so the "do something else...

Is there an open source library to handle Polar heart rate monitor sound files?

Some of the Polar heart rate monitors can emit training session information using sound. The devices emit a sound like the modems used to do. Are there any Java based libraries to parse these sound files and extract the data? I prefer a Java library, but other implementations are fine too. ...

How to retrieve data from 10g in java servlet & JSP

Retrieve data from database 10g in Servlet & JSP ...

Recommend A Java Framework

I'm a php developer that uses Zend Framework extensively for developing at work. I've always liked some of the concepts put forward by Java but as I've rolled out big websites with ZF and had to work through performance/security issues I would like to use a framework in java that has similar features to Zend Framework or maybe bypasses s...

NoClassDefFoundError inside jar

I have a class that that sits in a package called com.toptur.sysTray all it does is load system tray it does not use any external packages. i create a SysTray object to install the system tray. Everthing builds fine. i can run the application from command line and systray gets installed. But when i try to create a jar from the class file...

Copying selected text to a Swing Java app?

My goal is assign a global hotkey (JIntellitype, JXGrabKey) that would pass an arbitrary selected text to a java app. The initial plan is to utilize the java.awt.Robot to emulate Ctrl-C keypress and then get the value from clipboard. Probably there's a more elegant solution? EXAMPLE: Open Notepad, type in some text, select that text. ...

Rounding Errors?

In my course, I am told: Continuous values are represented approximately in a memory, and therefore computing with floats involves rounding errors. These are tiny discrepancies in bit patterns; thus the test e==f is unsafe if e and f are floats. Referring to Java. Is this true? I've used comparison statements with doub...

How to set up java logging using a properties file? (java.util.logging)

I'm having a stupid java logging problem: I'm loading the logging configuration from my app configuration file - but it just doesn't log anything after reading the file (which looks pretty much like the examples you will find on the net except for the additional application configuration - removing this also doesn't help). The "initializ...

Why does my SWT Shell always comes up in the background?

When I start my SWT Application from Eclipse, the Shell always starts up in the background, with the IDE in front of it. I tried everything, like setting the focus, activating the shell, etc. Did someone else experience the same behaviour and maybe even solved it? ...

Help with Cron Jobs for Java Google App Engine

I am developing an application on google app engine and was just checking out cron jobs. Looking at this document it seems pretty easy to schedule the jobs with config files and so on. My question is related to what I should actually put in the url the scheduled task triggers. I was thinking a jsp which triggers a servlet that does wha...

How to set Google App Engine java Content-Type to UTF-8

It seems I cannot get UTF-8 encoding to be sent in the response headers. I tried using this to no avail: resp.setHeader("Content-Encoding", "utf-8"); Does anyone know when is this bug to be fixed or is there a workaround? References: http://groups.google.com/group/google-appengine/browse_thread/thread/68a480cb7bec869e http://www.oz...

Using a java object in jsp

<c:set var="nameLookup" value="${names}" /> <c:forEach var="result" items="${results}"> <tr> <td>${result.uglyDisplayName}</td> <td>${result.phonenum}</td> </tr> </c:forEach> This is an excerpt from a jsp I'm trying to edit. Results is a List<Object> being returned in the ModelAndView from the controller, of which ...

Setting up Eclipse EE Layout

Hi Since Eclipse is doing so much out of saying it's a flexible platform, how do I change the Java EE view to display a JSF project like this: http://clausjoergensen.dk/media/files/eclipse_setup.png Bascially I don't have ANY need to EVER see the Library Folders (why is there more than one?!?!?) and I don't need to have a "build" fold...

Are there faster XML parsers in Java than Xalan/Xerces

I haven't found many ways to increase the performance of a Java application that does intensive XML processing other than to leverage hardware such as Tarari or Datapower. Does anyone know of any open source ways to accelerate XML parsing? ...