java

Find which class in which jar has a given serialVersionUID

When I get a java.io.InvalidClassException, it gives me the serialVersionUID that it wants, and the serialVersionUID that it got. Is there an easy way to tell which of my dozens of jars using the wrong serialVersionUID? Update: I should mention that our intention is to update everything at the same time, but I'm trying to debug a probl...

Web Service throwing exception using Axis2 Java

Hi, I'm actually developing a Web Service in Java using Axis 2. I designed my service as a POJO (Plain Old Java Object) with public method throwing exceptions : public class MyService { public Object myMethod() throws MyException { [...] } } I then generated the WSDL using Axis2 ant task. With the WSDL I generate a clien...

Attach Source Issue in Eclipse

In Eclipse (Ganymede) I'm debugging some code that uses Apache Commons HttpClient and would like to step into the HttpClient code. I've downloaded the source code and tried to attach it in the normal fashion (CTRL-click on the method name and use the Attach Source button). I've tried to attach both as external file and external folder wi...

Java: How do I get the size of a java.sql.ResultSet?

Shouldn't this be a pretty straightforward operation? However, I there is no size() or length() method. ...

improved collection Iterator

Hi, Personally, I find the range of functionality provided by java.util.Iterator to be fairly pathetic. At a minimum, I'd like to have methods such as: peek() returns next element without moving the iterator forward previous() returns the previous element Though there are lots of other possibilities such as first() and last(). Does...

Setting a log file name to include current date in Log4j

I would like to set the log file name for a log4j and log4net appender to have the current date. We are doing Daily rollovers but the current log file does not have a date. The log file name format would be logname.2008-10-10.log Anyone know the best way for me to do this? edit: I forgot to mention that we would want to do this i...

Ant's wrong directory on property

I'm a newbie on Ant so instead of posting this on the official buglist(because its probably not a bug), I decided to post here: When I run my Ant build.xml file everything works well except for the build directory, that instead of translating the property ${classes.dir} into build/ver_2.0.0/classes it creates a file ${cv.build.dir}/clas...

Consuming web services with jboss

Can someone point me a good step-by-step tutorial to consuming an already running web service in java? PS: I tried creating the classes with wsconsume, but it cries with [ERROR] rpc/encoded wsdls are not supported in JAXWS 2.0. (my web service is rpc/encoded) If I can consume web services entirely by hand (using no wizards), and under...

JNDI without a J2EE Container (with JNP? Maybe some other provider?)

I need to run a JNDI provider without the overhead of a J2EE container. I've tried to follow the directions in this article, which describes (on page 3) exactly what I want to do. Unfortunately, these directions fail. I had to add the jboss-common.jar to my classpath too. Once I did that, I get a stack trace: $ java org.jnp.server.M...

Generating a globally unique identifier in Java

Summary: I'm developing a persistent Java web application, and I need to make sure that all resources I persist have globally unique identifiers to prevent duplicates. The Fine Print: I'm not using an RDBMS, so I don't have any fancy sequence generators (such as the one provided by Oracle) I'd like it to be fast, preferably all in mem...

Java Setting tab size in table cell renderer

I have a class which extends DefaultTableCellRenderer, which renders strings in a monospace font, with a particular color. By default, it appears that tabs are not rendered at all (0 spaces). How can I set the tab size and/or cause them to be rendered? edits: By "tabs" i mean tab characters, which I would just like to be rendered as som...

Good Java Process Control Library

Java process control is notoriously bad - primarily due to inadequate support by the Java VM/JDK classes (e.g. java.lang.Process). I am wondering, are there any good open source libraries out there that are reliable. The requirements would be: OSS Start/Stop processes Manage STDIN and STDOUT cross platform (at least Linux, Windows, S...

server-side css selectors

I am creating a tool that will check dynamically generated XHTML and validate it against expected contents. I need to confirm the structure is correct and that specific attributes exist/match. There may be other attributes which I'm not interested in, so a direct string comparison is not suitable. One way of validating this is with XPa...

Getting drawable area of an AWT frame in Mac OS X?

I have subclassed java.awt.Frame and have overridden the paint() method as I wish to draw the entire contents of the window manually. However, on the graphics object, (0,0) corresponds to the upper left hand corner of the window inside the title bar decoration, not the first drawable pixel. Can I determine the co-ordinate of the first ...

How to create an .INI file to store some settings in Java?

I want to create an ini file to store some settings for my application. Is it a good idea to find where the jar file is located and create an ini file there? If yes, then how can I find the location of the jar file? But if you know a better solution for something like this, I would like to hear some of them. EDIT: I'm using mac and I ...

How to specify JVM argument for Maven built executable JAR

When using Maven to build an executable JAR, how do I specify the JVM arguments that are used when the JAR is executed? I can specify the main class using <mainClass>. I suspect there's a similar attribute for JVM arguments. Specially I need to specify the maximum memory (example -Xmx500m). Here's my assembly plugin: <plugin> <a...

Simple Java web services

Does anyone know of a really simple way of publishing Java methods as web services? I don't really want the overhead of using Tomcat or Jetty or any of the other container frameworks. Scenario: I've got a set of Java methods in a service type application that I want to access from other machines on the local LAN. ...

Stop JAVA and C from truncating my floats and doubles!

When I give JAVA and C BIG floats and doubles (in the billion range), they convert it to scientific notation, losing precision in the process. How can I stop this behavior? ...

BGGA closures as a bolt-on solution to java?

Yesterday @headius / Charles Nutter came up with a very interesting idea on twitter: @danny_l Gafter made the same mistake; I don't mean a forked Java any more than Groovy is a fork. I want a "mostly Java" with closures. or the reply by @danny_l / Danny Lagrouw: @headius or could the BGGA prototype be "bolted on" any future version o...

ArrayIndexOutOfBoundsException in XMLEntityScanner.peekChar reading XML from HttpRequest

I'm reading XML data from the HttpServletRequest in my servlets doPost() and passing the Reader from req.getReader() to a JAXB unmarshaller. I've tried a couple of different input XMLs but I always get this exception. SEVERE: Servlet.service() for servlet RESTPhotoAdmin threw exception java.lang.ArrayIndexOutOfBoundsException: 8192 ...