java

How does Eclipse debug code in an application server?

What communication is going on between Eclipse and my application server (JBoss) when I run the server from within Eclipse in debugging mode? How does this work? ...

Is this a realistic expectation of a distributed mechanism?

I've been evaluating ActiveMQ as a candidate message broker. I've written some test code to try and get an understanding of ActiveMQ's performance limitations. I can produce a failure state in the broker by sending messages as fast as possible like this: try { while(true) { byte[] payload = new byte[(int) (Math.random() *...

Is there a .NET analogue for Java app servers?

Are there any what in the Java community would be called "application servers" for .NET? Similar to Tomcat, Resin, and Jetty. I'm not interested in a JSP equivalent, I'm looking for a servlet-based technology for XML/HTTP transaction processing (no UI). If there is not a product like this, what would a good stack be to emulate this? Mi...

How to get user roles in a JSP / Servlet

Hi, Is there any way to get a String[] with the roles a user has in the JSP or Servlet? I know about request.isUserInRole("role1") but I also want to know all the roles of the user. I searched the servlet source and it seems this is not possible, but this seems odd to me. So... any ideas? ...

How do I combine a java.util.Date object with a java.sql.Time object?

I'm pulling back a Date and a Time from a database. They are stored in separate fields, but I would like to combine them into a java.util.Date object that reflects the date/time appropriately. Here is my original approach, but it is flawed. I always end up with a Date/Time that is 6 hours off what it should be. I think this is because t...

XML to DOC to PDF

what is the easiest(and fastest) way to perform this kind of transformation: "Data in XML" to "Some MS Word 2003 Supported format" to PDF using Java? My first guess was to fill the template with XML data (using Placeholders for example) and then save it and convert it to PDF. But I can't just put placeholders to DOC files, and I can't c...

Is there anything like OpenMP on Java?

Is there anything like OpenMP on Java? ...

Why is January month 0 in Java Calendar ?

In java.util.Calendar, January is defined as month 0, not month 1. Is there any specific reason to that ? I have seen many people getting confused about that... ...

method-invoking Spring bean

Hi, I've declared the following bean in my Spring config <bean id="templateCacheClearingTask" class="org.springframework.scheduling.timer.ScheduledTimerTask"> <property name="delay" value="5000" /> <property name="period" value="5000" /> <property name="timerTask"> <bean class="org.springframework.scheduling.timer....

Eclipselink problem in a javase project

I am getting this error when I am running my eclipselink project. [EL Warning]: 2008.12.05 11:47:08.056--java.lang.NoClassDefFoundError: org/jboss/resource/adapter/jdbc/ValidConnectionChecker was thrown on attempt of PersistenceLoadProcessor to load class com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker. The class is ignore...

Implementing a tree from scratch

Hello everyone, I'm trying to learn about trees by implementing one from scratch. In this case I'd like to do it in C# Java or C++. (without using built in methods) So each node will store a character and there will be a maximum of 26 nodes per node. What data structure would I use to contain the pointers to each of the nodes? Basica...

How to use a file in a jar as javax.net.ssl.keystore?

I'm trying to do something like URL clientks = com.messaging.SubscriptionManager.class.getResource( "client.ks" ); String path = clientks.toURI().getPath(); System.setProperty( "javax.net.ssl.keyStore", path); Where client.ks is a file stored in com/messaging in the jar file that I'm running. The thing that reads the javax.net.ssl.k...

Nested Folders in Eclipse Classpath

I'm trying to add two folders to my eclipse project's classpath, let's say Folder A and Folder B. B is inside A. Whenever I add A to the classpath <classpathentry kind="lib" path="/A"/> it works just fine, but I need to be able to access the files in B as well. Whenever I try to add <classpathentry kind="lib" path="/A/B"/> to th...

what would make a single task executor stop processing tasks?

I'm using a java.util.concurrent.ExecutorService that I obtained by calling Executors.newSingleThreadExecutor(). This ExecutorService can sometimes stop processing tasks, even though it has not been shutdown and continues to accept new tasks without throwing exceptions. Eventually, it builds up enough of a queue that my app shuts down wi...

Can I extract a file from a jar that is 3 directories deep?

I have a jar file that has a file named "client.ts" in (when viewing in ZipGenius) "/com/something/messaging". When I do JarFile jarFile = new JarFile("Client.jar"); JarEntry zipFile = jarFile.getJarEntry("client.ts"); It can't find the "client.ts" file. If I package the file in "/resources/" instead it can find it. Does JarFile.getE...

Making a JDialog button respond to the Enter key

I have a JQueryDialog with a text field, an OK button and a cancel button. I want to be able to hit the enter key after filling in the text fields and have it do the same action as when I click the OK button. ...

Is it possible to create a Java UDP Socket to listen on all addresses?

I would like to have a single DatagramSocket to listen for both unicast and broadcast messages. Is this possible? ...

How does JOGL search for OpenGL libraries?

I'm writing a desktop app using JOGL, and deploying on Win/Mac/Linux. On Linux we find that the OpenGL libraries installed are not always up to the job, and we need to have the capability of switching our own software emulation OpenGL in. Naturally we expected that we could place out libraries after /usr/lib or before /usr/lib to favour ...

How Can I Avoid Using Exceptions for Flow Control?

I have been assigned a project to develop a set of classes that act as an interface to a storage system. A requirement is that the class support a get method with the following signature: public CustomObject get(String key, Date ifModifiedSince) Basically the method is supposed to return the CustomObject associated with the key if an...

Firing a mainline event from a background thread in Java

Hiya, My question pertains to multi-threading in Java. I'm translating an app I wrote in Visual Basic 2008 into Java. There is a class in VB called BackgroundWorker, which allows the coder to perform a task on another thread, a lot like SwingWorker in Java. The only distinct difference is that, with the BackgroundWorker thread is run(),...