Search Results

Search found 601 results on 25 pages for 'commons beanutils'.

Page 3/25 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • commons-exec: hanging when I call executor.execute(commandLine);

    - by Stefan Kendall
    I have no idea why this is hanging. I'm trying to capture output from a process run through commons-exec, and I continue to hang. I've provided an example program to demonstrate this behavior below. import java.io.DataInputStream; import java.io.IOException; import java.io.PipedInputStream; import java.io.PipedOutputStream; import org.apache.commons.exec.CommandLine; import org.apache.commons.exec.DefaultExecutor; import org.apache.commons.exec.ExecuteException; import org.apache.commons.exec.PumpStreamHandler; public class test { public static void main(String[] args) { String command = "java"; PipedOutputStream output = new PipedOutputStream(); PumpStreamHandler psh = new PumpStreamHandler(output); CommandLine cl = CommandLine.parse(command); DefaultExecutor exec = new DefaultExecutor(); DataInputStream is = null; try { is = new DataInputStream(new PipedInputStream(output)); exec.setStreamHandler(psh); exec.execute(cl); } catch (ExecuteException ex) { } catch (IOException ex) { } System.out.println("huh?"); } }

    Read the article

  • Problems using dual resolver

    - by user315228
    Hi, I ma using dual resolver and having a problem. Following is what i get when i run through ant in debug and verbose mode([http://repo1.maven.org/maven2/axis2/axis2/working@commons-lang/[email protected]]) [ivy:retrieve] resolved ivy file produced in c:\temp\ivy\[email protected] [ivy:retrieve] :: downloading artifacts :: [ivy:retrieve] [NOT REQUIRED] config#ego;4.3.1!ego.conf [ivy:retrieve] trying [http://repo1.maven.org/maven2/axis2/axis2/working@commons-lang/[email protected]] [ivy:retrieve] tried [http://repo1.maven.org/maven2/axis2/axis2/working@commons-lang/[email protected]] [ivy:retrieve] HTTP response status: 404 url=[http://repo1.maven.org/maven2/axis2/axis2/working@commons-lang/[email protected]] [ivy:retrieve] CLIENT ERROR: Not Found url=[http://repo1.maven.org/maven2/axis2/axis2/working@commons-lang/[email protected]] [ivy:retrieve] ibiblio: resource not reachable for axis2#axis2;working@commons-lang: res=[http://repo1.maven.org/maven2/axis2/axis2/working@commons-lang/[email protected]] [ivy:retrieve] WARN: [NOT FOUND ] axis2#axis2;working@commons-lang!axis2.jar (235ms) [ivy:retrieve] WARN: ==== commons-lang: tried [ivy:retrieve] WARN: ==== ibiblio: tried [ivy:retrieve] WARN: [http://repo1.maven.org/maven2/axis2/axis2/working@commons-lang/[email protected]] [ivy:retrieve] [NOT REQUIRED] axis#axis-saaj;1.4!axis-saaj.jar [ivy:retrieve] [NOT REQUIRED] axis#axis-wsdl4j;1.5.1!axis-wsdl4j.jar Can you please tell me what is wrong with my ivysetting file or wrong with ivy file? Following is excerpt from ivysettings.xml <dual name="dual4" <filesystem name="commons-lang" <ivy pattern="${localRepositoryLocation}/[module]/ivy/ivy.xml"/ </filesystem <ibiblio name="ibiblio" m2compatible="true" usepoms="false" / </dual The problem (may be) is for each and every dependancy that i defined i have seperate ivy.xml. and just one reolver as above? like just for an exampe, for axis2.jar i have two dependancies in another ivy.xml, the dependencies are axis-saaj and axis-wsdl4j. Please help Thanks, Almas

    Read the article

  • SLF4J, Common Logging, console output

    - by Mauricio Scheffer
    I have this 3rd party library that has: slf4j-api-1.5.5.jar slf4j-jdk14-1.5.5.jar jcl-over-slf4j-1.5.5.jar I want to write some tests against this library and see its log output, and I don't want to add any more logging libraries (no log4j or anything else). I understand that SLF4J and Common Logging are both logging abstractions so I probably need to write my own simple concrete logger (or maybe not, since jcl-over-slf4j includes org.apache.commons.logging.impl.SimpleLog?). If so, what interfaces should I implement, and more importantly, how do I set up SL4J/Common Logging to use my logger in my test? I read in the SLF4J docs that I have to modify the StaticLoggerBinder class... does that really mean that I actually have to download SLF4J sources, modify the class and recompile it?

    Read the article

  • javax.sql.DataSource.getConnection() locks system

    - by Ryan Elkins
    I'm using the Apache Commons DBCP library for connection pooling in a desktop application. I've done this before and never had a problem but the latest application has started sometimes locking up on the call to getConnection() on my DataSource. The application just hangs after that call. I'm closing up my resources when I'm done with them. Is there any known reason why this might happen? I'm not even sure where to being troubleshooting this now that I've got it narrowed down to this method. It doesn't always hang - sometimes it happens fairly quickly, sometimes it takes a long time. Sometimes it doesn't happen at all, although lately I can get it to happen within a few minutes.

    Read the article

  • How do I get google guice to inject a custom logger, say a commons-logging or log4j logger

    - by Miguel Silva
    Google guice has a built-in logger binding (http://code.google.com/p/google-guice/wiki/BuiltInBindings). But what if I want to use a commons-logging or log4j logger? Can I get guice to inject a Log created by LogFactory.getLog(CLASS.class) But having the same behavior as in built-in binding: The binding automatically sets the logger's name to the name of the class into which the Logger is being injected.. Does it even makes sense? Or shout I simply use the built-in java Logger? Or just use commons-logging without injections?

    Read the article

  • OSGI & Apache Commons-DBCP Classloading Issue

    - by Saul
    I inherited some code that is using the Apache commons-dbcp Connection pools in an OSGi bundle. This code works fine with Eclipse/Equinox OSGi version 3.4.3 (R34x_v20081215), commons-dbcp 1.2.2 and the postgres jdbc3 8.3.603 bundles from springsource.org. I wanted to modernize, maybe this was my first mistake! When I use the new version of Felix or Equinox OSGI Cores with the new postgresql JDBC3 or JDBC4 bundles along with the latest version of commons-dbcp (1.4.1), I am getting a classloading issue. I have done numerous searches and found that the commons-dbcp code should have a fix DBCP-214, but it still seems to fail. I have tried to put the org.postgresql on the commons-dbcp MANIFEST.MF import-package line, but that did not work either. I wrote a simple test in an activator that first does a basic class.forName() and DriverManager.getConnection(), this works fine, but when I add in BasicDataSource() and setup the connection with BasicDataSource.getConnection(), I get the ClassNotFoundException. See the code example below. Thanks in Advance for any help, suggestions, ... Sau! // This one fails with an exception public void dsTest() { BasicDataSource bds = new BasicDataSource(); ClassLoader cl; try { logger.debug("ContextClassLoader: {}", Thread.currentThread().getContextClassLoader().toString()); cl = this.getClass().getClassLoader(); logger.debug("ClassLoader: {}", cl); if (bds.getDriverClassLoader() != null) { logger.debug(bds.getDriverClassLoader().toString()); } // The failure is the same with and with the setDriverClassLoader() line bds.setDriverClassLoader(cl); bds.setDriverClassName("org.postgresql.Driver"); bds.setUrl("jdbc:postgresql://127.0.0.1/dbname"); bds.setUsername("user"); bds.setPassword("pword"); Class.forName("org.postgresql.Driver").newInstance(); conn = bds.getConnection(); Statement st = conn.createStatement(); ResultSet rs = st.executeQuery("SELECT COUNT(*) FROM table"); conn.close(); logger.debug("Closed DataSource Test"); } catch (Exception ex) { ex.printStackTrace(); logger.debug("Exception: {} ", ex.getMessage()); } } // This one works public void managerTest() { ClassLoader cl; try { cl = this.getClass().getClassLoader(); logger.debug("ClassLoader: {}", cl); Class.forName("org.postgresql.Driver").newInstance(); String url = "jdbc:postgresql://127.0.0.1/dbname"; conn = DriverManager.getConnection(url, "user", "pword"); Statement st = conn.createStatement(); ResultSet rs = st.executeQuery("SELECT COUNT(*) FROM table"); conn.close(); logger.debug("Closed Manger Test"); } catch (Exception ex) { ex.printStackTrace(); logger.debug("Exception: {} ", ex.getMessage()); } }

    Read the article

  • Why do I get empty request from the Jakarta Commons HttpClient?

    - by polyurethan
    I have a problem with the Jakarta Commons HttpClient. Before my self-written HttpServer gets the real request there is one request which is completely empty. That's the first problem. The second problem is, sometimes the request data ends after the third or fourth line of the http request: POST / HTTP/1.1 User-Agent: Jakarta Commons-HttpClient/3.1 Host: 127.0.0.1:4232 For debugging I am using the Axis TCPMonitor. There every things is fine but the empty request. How I process the stream: StringBuffer requestBuffer = new StringBuffer(); InputStreamReader is = new InputStreamReader(socket.getInputStream(), "UTF-8"); int byteIn = -1; do { byteIn = is.read(); if (byteIn > 0) { requestBuffer.append((char) byteIn); } } while (byteIn != -1 && is.ready()); String requestData = requestBuffer.toString(); How I send the request: client.getParams().setSoTimeout(30000); method = new PostMethod(url.getPath()); method.getParams().setContentCharset("utf-8"); method.setRequestHeader("Content-Type", "application/xml; charset=utf-8"); method.addRequestHeader("Connection", "close"); method.setFollowRedirects(false); byte[] requestXml = getRequestXml(); method.setRequestEntity(new InputStreamRequestEntity(new ByteArrayInputStream(requestXml))); client.executeMethod(method); int statusCode = method.getStatusCode(); Have anyone of you an idea how to solve these problems? Alex

    Read the article

  • How to set the path to "context path" for uploaded files using Apache Common fileupload?

    - by BugKiller
    Hi, I'm using Apache common fileupload library with Netbeans 6.8 + Glassfish.I'm trying to change the current upload path to be in the current context path of the servlet , something like this: WEB-INF/upload so I wrote : File uploadedFile = new File("WEB-INF/upload/"+fileName); session.setAttribute("path",uploadedFile.getAbsolutePath()); item.write(uploadedFile); but I notice that the library save the uploaded files into glassfish folder , here what I get when I print the absolute path of the uploaded file : C:\Program Files\sges-v3\glassfish\domains\domain1\WEB-INF\upload\xx.rar My Question : How can I force the common fileupload to save the uploaded file in a path relative to the current servlet path , so I don't need to specify the whole path ? is this possible ?

    Read the article

  • Where to get Rhino Commons

    - by Rasmus Christensen
    Hi I'm working on an asp.net mvc project using nhibernate. At the moment I think Rhino Commons session management is the best spproach to control isession. But Where should I get Rhino Commons From? I found it located on Horn, Github, think the svn is obsolete. Please point me to a version that works.

    Read the article

  • Wikimedia Commons not working properly from IE 8

    - by Johannes Rössel
    It happens fairly often that a page on Wikimedia Commons doesn't load in IE. This happens to me on both machines I use, each one Windows 7 with IE 8. The page just loads endlessly (or connects—can't really tell) and timeouts after a while. Repeated attempts (trying to load the same page in 5 to 10 tabs) sometimes work, but sometimes it takes a lot more tries. As far as I can tell, no other program is affected—Firefox or PowerShell have no trouble loading the page. Also, when I use Fiddler it seems to load fine on the first try as well. Anyone has an idea what might be going on? I didn't change any settings that I am aware of (and most likely didn't do so in the same way on both machines). Preemptive note: I don't need advice in the form of »Use another browser instead.«.

    Read the article

  • java.io.FileNotFoundException: /target/test.log

    - by sword101
    Greetings all I am using Apache Camel and Apache CXF in this example: http://camel.apache.org/better-jms-transport-for-cxf-webservice-using-apache-camel.data/cxfcamelexample.zip I followed the readme and when tried to run the client & server classes i got this exception: log4j:ERROR setFile(null,true) call failed. java.io.FileNotFoundException: /target/test.log (No such file or directory) at java.io.FileOutputStream.openAppend(Native Method) at java.io.FileOutputStream.<init>(FileOutputStream.java:177) at java.io.FileOutputStream.<init>(FileOutputStream.java:102) at org.apache.log4j.FileAppender.setFile(FileAppender.java:289) at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:163) at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:256) at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:132) at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:96) at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:654) at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:612) at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:509) at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:415) at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:441) at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:470) at org.apache.log4j.LogManager.<clinit>(LogManager.java:122) at org.apache.log4j.Logger.getLogger(Logger.java:104) at org.apache.commons.logging.impl.Log4JLogger.getLogger(Log4JLogger.java:283) at org.apache.commons.logging.impl.Log4JLogger.<init>(Log4JLogger.java:108) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at org.apache.commons.logging.impl.LogFactoryImpl.createLogFromClass(LogFactoryImpl.java:1040) at org.apache.commons.logging.impl.LogFactoryImpl.discoverLogImplementation(LogFactoryImpl.java:838) at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:601) at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:333) at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:307) at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:645) at org.springframework.context.support.AbstractApplicationContext.<init>(AbstractApplicationContext.java:146) at org.springframework.context.support.AbstractRefreshableApplicationContext.<init>(AbstractRefreshableApplicationContext.java:84) at org.springframework.context.support.AbstractRefreshableConfigApplicationContext.<init>(AbstractRefreshableConfigApplicationContext.java:59) at org.springframework.context.support.AbstractXmlApplicationContext.<init>(AbstractXmlApplicationContext.java:58) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:136) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93) at com.example.customerservice.impl.CustomerServiceClient.main(CustomerServiceClient.java:34) so any ideas, how to solve this exception ?

    Read the article

  • commons-exec: Executing a program on the system PATH?

    - by Stefan Kendall
    I'm trying to execute a program (convert from ImageMagick, to be specific) whose parent folder exists on the path. Ergo, when I run convert from the command line, it runs the command. The following, however, fails: String command = "convert" CommandLine commandLine = CommandLine.parse(command); commandLine.addArgument(...) ... int exitValue = executor.execute(commandLine); If I specify the full path of the convert executable (C:\Program files\...) then this code works. If I don't do this, I get an exception thrown with exit value 4. How do I get commons-exec to recognize the system path?

    Read the article

  • Why does the BigFraction class in the Apache-Commons-Math library return incorrect division results?

    - by Timothy Lee Russell
    In the spirit of using existing, tested and stable libraries of code, I started using the Apache-Commons-Math library and its BigFraction class to perform some rational calculations for an Android app I'm writing called RationalCalc. It works great for every task that I have thrown at it, except for one nagging problem. When dividing certain BigFraction values, I am getting incorrect results. If I create a BigFraction with the inverse of the divisor and multiply instead, I get the same incorrect answer but perhaps that is what the library is doing internally anyway. Does anyone know what I am doing wrong? The division works correctly with a BigFraction of 2.5 but not 2.51, 2.49, etc... // *** incorrect! *** BigFraction one = new BigFraction(1.524); //one: 1715871458028159 / 1125899906842624 BigFraction two = new BigFraction(2.51); //two: 1413004383087493 / 562949953421312 BigFraction three = one.divide(two); //three: 0 Log.i("solve", three.toString()); //should be 0.607171315 ?? //returns 0 // *** correct! **** BigFraction four = new BigFraction(1.524); //four: 1715871458028159 / 1125899906842624 BigFraction five = new BigFraction(2.5); //five: 5 / 2 BigFraction six = four.divide(five); //six: 1715871458028159 / 2814749767106560 Log.i("solve", six.toString()); //should be 0.6096 ?? //returns 0.6096

    Read the article

  • java: Preferences API vs. Apache Commons Configuration

    - by Jason S
    I need to allow the user to store/load an arbitrary number of lists of objects (assume they are Serializable). Conceptually I want a data model like class FooBean { /* bean stuff here */ } class FooList { final private Set<FooBean> items = new HashSet<FooBean>(); public boolean add(FooBean item) { return items.add(item); } public boolean remove(FooBean item) { return items.remove(item); } public Collection<FooBean> getItems() { return Collections.unmodifiableSet(items); } } class FooStore { public FooStore() { /* something... uses Preferences or Commons Configuration */ } public FooList load(String key) { /* something... retrieves a FooList associated with the key */ } public void store(String key, FooList items) { /* something... saves a FooList under the given key */ } } Should I use the Preferences API or Commons Config? What's the advantages of each?

    Read the article

  • Recommended Bean Utility Libraries for Java

    - by Jim Ferrans
    I'm looking for a good, well-supported, and efficient Java library that uses reflection to automate JavaBean operations. These include making a deep copy of an arbitrary bean hierarchy (with nested lists and maps of beans), comparing two bean hierarchies for deep equality, and "transmorphing" one bean to another of a different class. Some possibilities include Apache Commons BeanUtils, Spring's BeanUtils, and Java's Bean support. Which libraries would you recommend?

    Read the article

  • java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory

    - by Sanjeev
    I am using My-eclipse and doing a struts project there is no syntax error but on starting tomcat server the following error appear in console. java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory and javax.servlet.UnavailableException: Parsing error processing resource path jndi:/localhost/strutspro/WEB-INF/struts-config.xml any idea whats the problem.

    Read the article

  • Page appears indexed in Google but not findable for any search terms?

    - by Jeff Atwood
    (Note that I am going to use screenshots here because I suspect writing about this will change the behavior over time.) If you do a Google search for uiviewcontroller best practices either with or without the quotes, you end up with results like this: Note that none of these pages resolve to the actual Stack Overflow question containing those words in the title. They resolve to either a) sites that are mirroring our creative commons data and correctly pointing back to the source question without nofollow, as properly specified by our attribution requirements or b) our own internal links to the question, but not the actual question itself. The actual page with the title ... Custom UIView and UIViewController best practices? ... does exist at this URL ... http://stackoverflow.com/questions/3300183/custom-uiview-and-uiviewcontroller-best-practices ... and apparently it is present in Google's index! But why does it not appear when we search for uiviewcontroller best practices ? We know that Google contains this page in its index Our search terms match the title of the question Stack Overflow has much higher pagerank than the other sites that are mirroring this question under Creative Commons I don't get it. What are we doing wrong here?

    Read the article

  • Software licensing template that gives room for restricting usage to certain industries/uses of software/source

    - by BSara
    *Why this question is not a duplicate of the questions specified as such: I did not ask if there was a license that restricted specific uses and I did not ask if I could rewrite every line of any open source project. I asked very specifically: "Does there exist X? If not, can I Y with Z?". As far as I can tell, the two questions that were specified as duplicates do not answer my specific question. Please remove the duplicate status placed on the question. I'm developing some software that I would like to be "semi" open source. I would like to allow for anyone to use my software/source unless they are using the software/source for certain purposes. For example, I don't want to allow usage of the software/source if it is being used to create, distribute, view or otherwise support pornography, illegal purposes, etc. I'm no lawyer and couldn't ever hope to write a license myself nor do I have to time to figure how to best do this. My question is this: Does there exist a freely available license or a template for a license that I can use to license my software under they conditions explained above just like one can use the Creative Commons licenses? If not, am I allowed to just alter one of Creative Commons licenses to meet my needs?

    Read the article

  • Groovy GDK equivalent of Apache Commons StringUtils.capitalize(str) or Perl's ucfirst(str)

    - by knorv
    Yes/no-question: Is there a Groovy GDK function to capitalize the first character of a string? I'm looking for a Groovy equivalent of Perl's ucfirst(..) or Apache Commons StringUtils.capitalize(str) (the latter capitalizes the first letter of all words in the input string). I'm currently coding this by hand using .. str = str[0].toUpperCase() + str[1 .. str.size() - 1] .. which works, but I assume there is a more Groovy way to do it. I'd imagine ucfirst(..) being a more common operation than say center(..) which is a standard method in the Groovy GDK (see http://groovy.codehaus.org/groovy-jdk/java/lang/String.html).

    Read the article

  • Download file using java apache commons?

    - by Kyle
    How can I use the library to download a file and print out bytes saved? I tried using import static org.apache.commons.io.FileUtils.copyURLToFile; public static void Download() { URL dl = null; File fl = null; try { fl = new File(System.getProperty("user.home").replace("\\", "/") + "/Desktop/Screenshots.zip"); dl = new URL("http://ds-forums.com/kyle-tests/uploads/Screenshots.zip"); copyURLToFile(dl, fl); } catch (Exception e) { System.out.println(e); } } but I cannot display bytes or a progress bar. Which method should I use?

    Read the article

  • apache commons http client efficiency

    - by wo_shi_ni_ba_ba
    I use apache commons http client to send data via post every second, is there a way to make the following code more efficient? I know http is stateless, but is there anything I can do to improve since the base url is always the same in this case(only the parameter value change. private void sendData(String s){ try { HttpClient client = getHttpClient(); HttpPost method = new HttpPost("http://192.168.1.100:8080/myapp"); System.err.println("send to server "+s); List formparams = new ArrayList(); formparams.add(new BasicNameValuePair("packet", s)); UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, "UTF-8"); method.setEntity(entity); HttpResponse resp=client.execute(method); String res = EntityUtils.toString(resp.getEntity()); System.out.println(res); } catch (Exception e) { e.printStackTrace(); } } private HttpClient getHttpClient() { if(httpClient==null){ httpClient = new DefaultHttpClient(); } return httpClient; }

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >