java

Apache commons PredicatedList with no IllegalArgumentException

Is there a way in Apache Commons Collections to have a PredicatedList (or similar) which does not throw an IllegalArgumentException if the thing you are trying to add doesn't match the predicate? If it does not match, it would just ignore the request to add the item to the list. So for example, if I do this: List predicatedList = List...

Spring prototype beans in combination with singleton beans and dependency injection. Is there an approach that is configuration only?

Hi all, I have a singleton bean which needs for each call of a function to return a reference to a different (new) prototype bean. The only way that I can think of doing this is to programmatically retrieve a new prototype bean instance from the BeanFactory/ApplicatioContext by invoking its getBean() method. Code sample will follow... I...

Netbeans incompatible types question

Hi there, I am getting the following warning in Netbeans: incompatible types found : carPackage.port.search required : carPackage.SearchResponse In my JSP page, I have the following code: CarService service = new CarService(); CarPort port = service.getCarPort(); SearchResponse searchResult = port.search("Toyota"); The error obviou...

Getting today's date in java - I've tried the regular ways

I need today's date - and zero anything else (" 05/06/08 00:00:00 ") I've tried Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.HOUR, 0); Date date1 = calendar.getTime(); System.out.println(date1); Run: (This is seriously messed up) If the hour on the computer is < 12:00 at no...

Unable to authenticate to SSL site in java: "pathLenConstraint violated - this cert must be the last cert in the certification path"

Hi, I'm trying to read from a secure (i.e. SSL) web page, in Java code. I'm trying to use both URLConnection (java.net) and Apache's HTTPClient. In both cases, when I make the request, I get this exception: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path validation failed: java.securit...

How can I get around this classloader hierarchy problem?

I run iplanet's java applcation server, something in it is loading commons-logging-1.0.4.jar That's fine until one of my applications calls AuthSSLProtocolSocketFactory which is another apache library that also uses commons logging. I put the jar on the jvm classpath and get this error Invalid class loader hierarchy. You have more tha...

Contigious Pages/Physical Memory in Java

My goal is to ensure that an array allocated in java is allocated across contiguous physical memory. The issue that I've run into is that the pages an array is allocated across tend not to be contiguous in physical memory, unless I allocate a really large array. My questions are: Why does a really large array ensure pages which are co...

Spring MVC @SessionAttributes confusion!

I'm using 2.5 and doing everything via annotations. I have a simple form that allows the user to edit an object. The controller behind it creates the object and adds it to the model on GET, and processes the changes on POST (submit). It works fine, but I don't understand why. The object is never explicitly added to the session, and the ...

Best practices for developing customized B2B Java software?

I'm working on Java-based server software that needs to be customized for a few, but large customers. A separate instance of the server runs for each customer. Each customer has sufficiently differing requirements such that different business logics is required for each of the implementations. At this time, the different business logic...

Automatically detect hanging threads

I'm currently looking for a way to identify hanging threads in java. Anyone knows whats the best way to do this? Currently I could think off 2 possible ways to do this: Calling a (callback-)method periodically within all methods of the Application. This seems a "bit" complex and unsightly... Moreover I have no control when calling ext...

Is there a way in CXF to disable the SoapCompressed header for debugging purposes?

I'm watching CXF service traffic using DonsProxy, and the CXF client sends an HTTP header "SoapCompressed": HttpHeadSubscriber starting... Sender is CLIENT at 127.0.0.1:2680 Packet ID:0-1 POST /yada/yada HTTP/1.1 Content-Type: text/xml; charset=UTF-8 SoapCompressed: true Accept-Encoding: gzip,gzip;q=1.0, identity; q=0.5, *;q=0 SOAPActio...

How to parse and interpret ant's build.xml

Is there an Ant API for reading and ant build.xml and retrieving elements from it? Specifically I want to be able to retrieve the values in a path element and be able to walk all of the elements in the path. My purpose is to retrieve a given path and ensure that it is referenced correctly in a manifest, so that the build and the manifes...

Eclipse: Is it possible to edit Java source known via source code "attachment"

I am using Eclipse 3.4.2 to develop my code. As part of my project definition I reference a utility library to which I have attached the source code. So far, so good - I can see that source when I bring up classes from the library and while I am debugging. Now however I would like to make a change to one of the classes while still ret...

Constructor with all class properties or default constructor with setters?

Following are the two approaches: constructor with all the class properties Pros: I have to put an exact number of types of parameters so if I make an error the compiler warns me (by the way, is there a way to prevent the problem of having erroneously switched two Integer on the parameter list?) Cons: if I have lots of properties t...

In ColdFusion, is there a way to determine what server the code is running on?

Is there any way in ColdFusion code to determine on what server the code is executing? I have few load-balanced ColdFusion servers. I want to be able to know on which server the code is running when I catch an exception, so I can include that information in the logging / reporting code. The servers are Windows 2003/IIS, if that matters....

non-java files in package structure

We have a developer who is in the habit of committing non-java files (xsd, dtd etc) in the java packages under the src/java folder in our repository. Admittedly, these are relevant files to that package, but I just hate to see non-java files in the src folder. Is this is a common practice that I should get used to or are we doing somet...

How can Java access COM control (on windows platform) APIs

Hello All, I have a COM control (on windows) that exposes a set of APIs. I have written applications in VC++ and C# and can access the APIs. Now I need to write a Java application that will use those COM APIs. Could you let me know how can I do that? Do I need to write a Java wrapper for the COM control (like JNI)? Thanks. ...

Migrating Delphi App to Java or to Web App

We want to migrate UI rich application from delphi to java or Web Application. Reason is that we want application to be portable on all Operating Systems. Current Components and Modules of Application in Delphi : In Delphi we are utilizing TWebBrowser component to display HTML content We are playing mp3 that is extracted from FileSt...

A problem with Runtime exec and a custom built RTF editor

I have a class that manages the creation of RTF documents and a method in that class that calls the RTF editor with a xml file for display. All but one user can access this editor without any issues. This one user consistently runs into an issue where their application just hangs. There are no errors in any logs. Normally this kind o...

Is it possible to use Java webstart execute .exe or dll?

Hi Gurus, I know java webstart is running under a secure sandbox. Is it possible to include a .dll/.exe in the jar (or have the webstart download it to the local machine) and then execute it (using Runtime.exec or process,etc) Please Advise. Any suggestion/comment is welcome! ...