java

Do common JARs have to be repeated accross WARs in an EAR?

I have a JAR file for authorization. I need it for each of my WAR files. All the WAR files are packaged in an EAR file. Do I have to repeat this common JAR in every WAR, or is there a structure for common libraries? So my example looks something like this... big.ear - META-INF - MANIFEST.MF - application.xml - appl1.war ...

Best Java supported server/client protocol?

I'm in the process of writing a client/server application which should work message based. I would like re-use as much as possible instead of writing another implementation and curious what others are using. Features the library should offer: client and server side functionality should work message based support multi-threading should...

Stopping inheritance without using final

Is there any other method of stopping inheritance of a class apart from declaring it as final or by declaring its constructor as private? ...

Running a JNI application in the Sun VM under Valgrind

The sun JVM spits out a LOT of extra noise when run under valgrind, which makes tracking memory problems in the application very challenging. I'd like to find either a suppression file, or a VM runtime mode, that will strip out spurious memory errors in order to separate the wheat from the chaff in this situation. Any suggestions? ...

GSA Wrapper in java?

Hello, Does anybody knows a good wrapper implementation for Google Search Appliance? ...

Remove uses of certain Java classes at compile time

I am looking for a way to remove all uses of a particular class, including the class itself, at compile time. Basically a form of pre-processing, but I'd like to do it without having to surround all the instances with #ifdebug ... #endif. Is there any ant-based tool out there that can do this? If not, can anyone point me in the right di...

Valid characters for Excel sheet names

In Java, we're using the following package to programmatically create excel documents: org.apache.poi.hssf If you attempt to set a sheet's name (NOT file, but internal Excel sheet), you will get an error if: The name is over 31 characters The name contains any of the following characters: / \ * ? [ ] However, after creating a docu...

java designing tasks in concurrent mechanism

I am coming up with a design for a task based multi-thread java 1.5 system. Tasks will generally interact with a collection to determine failed or successfull match events. Based on the outcome, another task may be queued for IO transactions to inform clients and/or store important information about the transaction. Java provides a ...

Strategies for logging to application logs from library code?

Where I work we use Log4j for web application logging. The log4j.jar is at the application level, not the container level. We're using a daily rolling file appender. Our log4j.properties files define appenders based on the app package name, so only classes in our application's package and below get logged to our app's log file. In ...

How are java.lang.Object's protected methods protected from subclasses?

The keyword protected grants access to classes in the same package and subclasses (http://java.sun.com/docs/books/tutorial/java/javaOO/accesscontrol.html). Now, every class has java.lang.Object as superclass (http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html). Hence I conclude that every class may access java.lang.Object's ...

Why use hex values instead of normal base 10 numbers?

I was looking over this code to calculate math.sqrt in Java. I was just wondering why they used hex values in some of the loops and as normal values for variables. What benefits are there to use hex? Thanks for your help. ...

Java Swing programming book

I am starting out doing some GUI development in Java, and am looking for a good comprehensive book on Swing. Coming from more of a scientific background, my programs have sometimes been very complex, but this will be my first venture out of the command line. What book (or resource) did you use to learn? Is there a Swing book sitting abov...

What Java ORM do you prefer, and why?

It's a pretty open ended question. I'll be starting out a new project and am looking at different ORMs to integrate with database access. Do you have any favorites? Are there any you would advise staying clear of? ...

JPA java code generation

I am specifically looking for JPA code generation technique First, what are all the project could generate JPA complaint code? (Eg. HibernateTools) Second, I would also like to customize the code generation utility, as it has to compliant to our corporate standards. If not, what are all the framework available to generate java code us...

How can I find the IP of Active Directory Domain Controller(s) from Unix?

I can get the nameserver via NSLOOKUP on a Windows machine and get an AD DC via a WMI VBS script, but I can't use the VBS script from a Unix server ( which can ping the nameserver). I'd like to use Java to obtain all the Active Directory domain controllers from a Unix box. Is this possible? ...

Suggest a JPA Unit test framwork

How to unit test JPA code? is there any way to generate Unit Test case itself? Note : I am lazy and new to Unit Test code. ...

Are the unit test case for JPA worthy? anyway it is just going to access DB, why do we need it?

Are the unit test case for JPA worthy? anyway it is just going to access DB, why do we need it? ...

How does Java method dispatch work with Generics and abstract classes?

I ran into a situation today where Java was not invoking the method I expected -- Here is the minimal test case: (I'm sorry this seems contrived -- the 'real world' scenario is substantially more complex, and makes much more sense from a "why the hell would you do that?" standpoint.) I'm specifically interested in why this happens, I do...

Is there a good reason to configure hibernate with XML rather than via annotations?

I've been using Hibernate for a few years but have only used it with annotations, and by setting the connection parameters in my code. Am I "missing something" by not using the XML files? Are there important capabilities available only in XML? Are there situations or patterns where it makes sense to use the XML? ...

String altering in Ant

Given a property: <property name="classes" value="com.package.Class1,com.package.Class2" /> I'm trying to compile only the classes specified like: <javac srcdir="${src.dir}" destdir="${build.dir}"> <include name="${classes}" /> </javac> However the 'include' tag is specifying the file names to include, not the qualified class n...