java

array dependency injection in spring?

Hi, is there a way to use dependency injection to inject all available implementations of a specific interface in spring? This is kind of the same thing as asked here for .NET. Though my aim is to use @Autowired for this: public class Foo{ @Autowired private IDataCollector[] collectors; } Is this supported, would this require h...

Biff exception in Java

When I tried to read an Excel file in Java it throws "biff exception". What does this mean? I tried to Google it but wasn't able to find a proper explanation. jxl.read.biff.BiffException: Unable to recognize OLE stream at jxl.read.biff.CompoundFile.<init>(CompoundFile.java:116) ...

having problem with proguard trying to obfuscate code that uses Spring

My project uses spring for IoC. After obfuscation the application context fails to find the bean since it's class name has been changed. I tried to use -adaptresourcefilecontents option to get context.xml file be updated according to the class name, but it didn't work: the file wasn't changed. Any ideas? ...

"Type safe" UUIDs ?

We use make heavy usage of java.util.UUID in our projects to identify ojbects and do operations on them like in this interface: List<UUID> searchPerson(String text); Person fetchPerson(UUID personUUID); List<UUID> searchAdress(String text); Person fetchAdress(UUID adressUUID); But what can happen now, and is a source of Runtime error...

How to print bytes using System.out.println ?

Hi all, I've declared a byte array (I'm using Java): byte test[] = new byte[3]; test[0] = 0x0A; test[1] = 0xFF; test[2] = 0x01; How could I print the different values stored in the array? If I use System.out.println(test[0]) it will print '10'. I'd like it to print 0x0A Thanks to everyone! ...

Mapping db-imported countries to address entity with JPA

I ran some DDL script to setup a complete country table in my database. The country table's primary key column contains the corresponding ISO code for every country. In my JPA project I have a User entity having an embedded Address entity and this Address entity has a reference to a Country. The relationship between User and Address se...

Download attachments using Java Mail

Now that I`ve downloaded all the messages, and store them to Message[] temp; How do I get the list of attachments for each of those messages to List<File> attachments; Note: no thirdparty libs, please, just JavaMail. ...

Pros and Cons of the use of DAO pattern

As I mention, I'm interested to know what do you (as experienced developers) thinks about the use of DAO pattern, specifically within a Web Application. If possible what advantages have you found, or consequences of it use. Thanks. ...

Get form parameters from multipart request without getting the files

I'm looking for a way to get the form parameters of a HTTP multi-part request in a Servlet-filter without uploading files (yet). request.getParameterMap() returns empty. I understand this is because of the request being multi-part. I've looked at commons.HttpFileUpload but this seems to be overkill for my situation. In this filter I'm ...

DefaultMessageListenerContainer not working with Websphere MQ

Hello everyone, I am using spring 2.5.6 and spring-integration 1.0.3 and MQ client 6.0.2.2 I have had to add a message selector to my message-driven-channel-adapter, but now I am getting the following error: MQJMS2008: failed to open MQ queue ; nested exception is com.ibm.mq.MQException: MQJE001: Completion Code 2, Reason 2085 It wor...

How to delete file which is used/locked by windows in java

I have some application, which has ability to update itself. Its downloads the jar file from the net, and then tries to replace used jar to run this application by downloaded one. But I cannot to do that, because the file is locked by windows, because application is still running. Does anybody know some workaround of that? Thanks a lot....

Can you pass by reference in Java?

Hi. Sorry if this sounds like a newbie question, but the other day a Java developer mentioned about passing a paramter by reference (by which it was ment just pass a Reference object) From a C# perspective I can pass a reference type by value or by reference, this is also true to value types I have written a noddie console application...

Java Windows Mobile Application Taking Too Long To Reestablish Network Connectivity

We have a Java application running on the JBed JVM on Windows mobile 6.1. When it loses connectivity the application is taking a long time (8 - 10 minutes) to re-establish VPN network connectivity, despite the fact that other applications can see the VPN far sooner (roughly 2 - 3 minutes). From our application logs we can see that two ...

How to access images loaded from css in Qt Webkit (java)

Hi, In Qt WebKit you can call QWebFrame.renderTreeDump() to see the render tree. For images in html <img src=...> you get something like: RenderImage {IMG} at (0,0) size 174x71 However, there is no render information for images loaded from ccs (backgrounds etc). Is there a way to access these? I'd also like to be get the urls of ...

Sorting of 2 or more massive resultsets ?

I need to be able to sort multiple intermediate result sets and enter them to a file in sorted order. Sort is based on a single column/key value. Each result set record will be list of values (like a record in a table) The intermediate result sets are got by querying entirely different databases. The intermediate result sets are alrea...

Problem with persisting data in Google Application Engine

Hi, we are having a hard time persisting data in our google app project, we have the classes "Customer" "Reservation" and "Room". Our goal is to map a relation between these, with a one-to-many relation from Customer to Reservation and a one-to-many relation from Room to the same Reservation. The exception we get is: Error in meta-dat...

EXT GWT + java EE

Hello. My question is: what is the best way to send my jee annotated entity beans' data to the clientside to use it in a grid for example? Surely I could make the BaseModel-extended client models for each entity manually, but I wonder what could be the best-practice here. I need a step-by-step tutorial if possible. regards ...

Does anyone know of a Java implementation similar to the .NET SoapFormatter

I am looking for a library or code snippet to allow me to serialize and de serialize an object into a SOAP representation. Similar to what the .NET SoapFormatter does but an implementation in Java. I have looked on Google and web but so far I have been unable to find something which does it. I know there is a namepsace in javax for SO...

Have program recognize it crashed last time?

What is the best way to have a (Java) program recognize it crashed last time it ran and show a message along the lines of "it looks like this program crashed on you last time. Report this problem here: [email protected] ...." Is there a recommended way of doing this? (Bad?) ideas I had would be: Have the program store a temporary key file a...

Separate threads for socket input and output

I got assigned to work on some performance and random crashing issues of a multi-threaded java server. Even though threads and thread-safety are not really new topics for me, I found out designing a new multi-threaded application is probably half as difficult as trying to tweak some legacy code. I skimmed through some well known books in...