apache-commons

dynamic reload in apache DatabaseConfiguration

Has anyone developed a dynamic reload mechanism for the apache commons database configuration object? ...

Reopening FileObject with a different reader in commons-vfs

I'm using commons-vfs to traverse down folder hierarchies. As an example: /foo /test.jar If I use the locator file:///foo I can successfully find the child file:///foo/test.jar However, if I try to descend into it, via FileObject.getChildren(), it says that there are no children. By prepending the jar: schema, things work ...

Apache installation on Windows 7

I am newbie with Apache. I am learning .. after the installation when i try to start the service I am see the following errors. The Apache service named reported the following error: Unable to open logs . The Apache service named reported the following error: no listening sockets available...

Visiting all entries of Sparse Matrix in the org.apache.commons.math.linear package

Hi, I see 2 implementations of sparse matrix in this package. OpenMapRealMatrix SparseFieldMatrix Both are documented as "Sparse matrix implementation based on an open addressed map". Do you know what are the diffrences between the two? also, what's the best way to iterate over all entries in a fast way (which means, iterating over...

run interactive command with apache commons exec

Hi, I want to run an interactive command with apache commons exec. Everything works except that when my command is executed and waits for user input I don't see my input in the console until I press enter which makes it effectively unusable. This is an example of an interactive program: public static void main(String[] args) { ...

Logging framework incompatibility

I'm building a small Java app and hoping to use logback for logging. My app has a dependency on an older project that does its logging via org.apache.commons | com.springsource.org.apache.commons.logging | 1.1.1 ...so my plan was to use org.slf4j | jcl-over-slf4j | 1.5.6 ...to redirect the JCL logging to org.slf4j | slf4j-api ...

Why is my InputStream not working in Android?

I'm writing an image file uploader for android for my favorite image gallery software and it uses FTP. I've started using Apache-Commons Net FTP as my ftp library based on past stack overflow questions. Like so: FTPClient ftp = new FTPClient(); try{ ftp.connect(host); Log.i(TAG,"we connected"); if(!ftp.login(user,pass)){ ftp.l...

Touch a file using apache FileUtils

I have looked at the source code of Apache Commons FileUtils.java class to see how they implement unix like touch functionality. But I wanted to confirm with the community here if my use case would be met by the implementation as it opens and closes a FileOutputStream to provide touch functionality We have two webservers and one common ...

can anyone tell me whats the use of having digestor-rules.xml.

I know it is used for parsing xml data and converting them into objects.Does that make any sense in using this in an enterprise application. Please help me . ...

How to install commons-lang src to local repository?

I want to use the commons-lang by maven,but apache repository isn't ,I down commons-lang-src publish in local repository ,but is warning. [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.4.3:test (default-test) on project commons-lang: There are test failures. how to solve? ...

SSLSocketImpl.startHandshake() throws SSLHanshakeException/EOFException when resuming cached sessions

Using Apache FTPSClient to listFiles(String).... The aplication crashes sometimes after resuming an SSL Session and then calling sslSocketImpl.startHandshake() from the Apache FTPSClient code. I set javax.net.debug to print the ssl information... System.setProperty("javax.net.debug", "all"); And this is what I get. %% Client cached...

How to evict or "kill" open connections when these are above a fixed limit (using dbcp w/ oracle)

Hi all, Does anyone know how to evict or kill open connections (in use or not it doesn't matter) if the number of connections is above of a fixed limit (e.g. maxActive) Currently I'm using DBCP from Apache under a Sun One 6.1. Thanks in advance!, ...

Concise example of file upload via Java lib Apache Commons

[edit] I've removed my convoluted and badly malformed question so that it doesn't detract from the very neat and correct answer beneath. Given the (surprising) difficulty of finding an on-line example for doing this incredibly common task, I hope Yoni gets a few more up-ticks for his response. So... the question in a nutshell... How do...

Java boolean CLI options

I'm getting my feet wet with the Apache Commons CLI library for command-line parsing. It works fine for String-valued options, but I'm not sure how to cleanly handle boolean-valued command-line flags. I've tried this: CommandLineParser parser = new GnuParser(); Options options = new Options(); options.addOption(new Option(...

How to convert byte size into human readable format in java?

How to convert byte size into human-readable format in Java? Like 1024 should become "1 Kb" and 1024*1024 should become "1 Mb". I am kind of sick of writing this utility method for each project. Are there any static methods in Apache Commons for this? ...

Java Imports Error

I'm trying to import org.apache.commons.fileupload.* but I am being told that it does not exist. I am downloading this JAR: http://commons.apache.org/fileupload/ And placing it on the classpath. So what am I doing wrong here? ...

Is apache commons-lang 3.0 available in any maven repo?

commons-lang 3.0 is still beta, but can it be found in some maven repository (I couldn't) ...

org.apache.commons.collections.map.ListOrderedMap

I'm refactoring some legacy code, and I keep running into this Object. I would like to get more use out of this Class, but I'm having a hard time finding an example of its use that is relevant. So far I only have found javadocs and source code. Does anyone know of a good example out there? --Update Wow, quick turnaround on those answers...

Apache Commons UrlValidator

I have the following java code: UrlValidator urlValidator = new UrlValidator(); boolean validUrl = urlValidator.isValid("http://www.google.com"); System.out.println("result: " + validUrl); When I run the above code, I always get: result: false Why does apache commons UrlValidator not regard "http://www.google.com" as valid? If I...

Coldfusion Web Service - Connection refused

Hello, I am receiving following error while connecting to coldfusion web service from client machine org.apache.commons.httpclient.HttpException : Connection refused: connect ( actual link to cfc component ) any idea? ...