Re: [text] using a map as a value for StringSubstitutor
Or you can use something like https://docs.spring.io/spring-vault/docs/current/api/org/springframework/vault/support/JsonMapFlattener.html > On 24.06.2020, at 20:12, Nicolas Peltier wrote: > > Hey here (hope i'm on the good list), > > i have a StringSubstitutor use case where i'd need arbitrary level of depth > in my values, that could be hashmap containing hashmaps etc... to > substitute things like > "my ${job.name} is ${adjective.wealth.good}" and where i only put in the > initial map and hashmap at the key "job", and another at "adjective". Both > being filled as you guess it. > > Should i write my own string lookup? or something exists already and i'm > overcomplicating things? > > Nicolas - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [text] using a map as a value for StringSubstitutor
Hi Nicolas, Either you simplify your setup so you have a flat map or you look into full-blown template engines ... Thanks in advance, Siegfried Goeschl PS: In the Apache land there is FreeMarker & Velocity ... > On 24.06.2020, at 20:12, Nicolas Peltier wrote: > > Hey here (hope i'm on the good list), > > i have a StringSubstitutor use case where i'd need arbitrary level of depth > in my values, that could be hashmap containing hashmaps etc... to > substitute things like > "my ${job.name} is ${adjective.wealth.good}" and where i only put in the > initial map and hashmap at the key "job", and another at "adjective". Both > being filled as you guess it. > > Should i write my own string lookup? or something exists already and i'm > overcomplicating things? > > Nicolas - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: Question about usage of org.apache.commons.exec.ExecuteWatchdog
Hi Carsten, I guess the documentation is indeed misleading - it is there for 15 years :-) Maybe it was intended as if (executor.isFailure(exitValue) || watchdog.killedProcess()) { // failed or was killed on purpose by the watchdog } Thanks in advance, Siegfried Goeschl > On 24.04.2020, at 02:15, Carsten Dreesbach > wrote: > > I'm a little confused about why the code example > <https://github.com/apache/commons-exec/blob/4055e401ef7e4ad763cc69b892135b449baf0f13/src/main/java/org/apache/commons/exec/ExecuteWatchdog.java#L32-L34> > says to check executor.isFailure(exitValue) to see if the process was killed > by the watchdog. Since the only way that watchdog.killedProcess())could ever > return true, why would the extra exit status be necessary? It seems to me > that just checking watchdog.killedProcess() by itself would be sufficient - > or am I missing something here? > > > Thanks, > > Carsten > - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [email] Is there a way to unset CC/BCC?
Hi Pavlo, many years ago (15?) ago I build some email service where it was very useful to avoid sending real emails to real customers during tests or write the emails to disk. My entry point was 4 <https://commons.apache.org/proper/commons-email/xref/org/apache/commons/mail/Email.html#L1484> /** 1485 <https://commons.apache.org/proper/commons-email/xref/org/apache/commons/mail/Email.html#L1485> * Sends the email. Internally we build a MimeMessage 1486 <https://commons.apache.org/proper/commons-email/xref/org/apache/commons/mail/Email.html#L1486> * which is afterwards sent to the SMTP server. 1487 <https://commons.apache.org/proper/commons-email/xref/org/apache/commons/mail/Email.html#L1487> * 1488 <https://commons.apache.org/proper/commons-email/xref/org/apache/commons/mail/Email.html#L1488> * @return the message id of the underlying MimeMessage 1489 <https://commons.apache.org/proper/commons-email/xref/org/apache/commons/mail/Email.html#L1489> * @throws IllegalStateException if the MimeMessage was already built, ie {@link #buildMimeMessage()} 1490 <https://commons.apache.org/proper/commons-email/xref/org/apache/commons/mail/Email.html#L1490> * was already called 1491 <https://commons.apache.org/proper/commons-email/xref/org/apache/commons/mail/Email.html#L1491> * @throws EmailException the sending failed 1492 <https://commons.apache.org/proper/commons-email/xref/org/apache/commons/mail/Email.html#L1492> */ 1493 <https://commons.apache.org/proper/commons-email/xref/org/apache/commons/mail/Email.html#L1493> public String send() throws EmailException 1494 <https://commons.apache.org/proper/commons-email/xref/org/apache/commons/mail/Email.html#L1494> { 1495 <https://commons.apache.org/proper/commons-email/xref/org/apache/commons/mail/Email.html#L1495> this.buildMimeMessage(); 1496 <https://commons.apache.org/proper/commons-email/xref/org/apache/commons/mail/Email.html#L1496> return this.sendMimeMessage(); 1497 <https://commons.apache.org/proper/commons-email/xref/org/apache/commons/mail/Email.html#L1497> } So there is a clear distinction between building the MimeMessage and sending it - so this might help Thanks in advance, Siegfried Goeschl > On 27 Aug 2019, at 15:34, sebb wrote: > > On Tue, 27 Aug 2019 at 12:02, Pavlo Polishchuk wrote: >> >> Good day, >> Is there a way to unset CC/BCC through "org.apache.commons.mail.Email" ? >> >> I tried "email.setCC" with empty collection but there is a check for >> null/empty collection inside. >> Also, tried to "email.getMimeMessage().setRecipients(...)" but this fails >> with NPE since MimeMessage is not build at that time. >> >> Do I miss something? > > The underlying list is accessible as a protected field and via code of the > form: > > List list = email.getBccAddresses(); > > so it's easy enough to clear the list if required. > > An alternative is not to set the list in the first place ... > >> Thanks in advance! >> >> -- >> Best regards, >> Paul > > - > To unsubscribe, e-mail: user-unsubscr...@commons.apache.org > For additional commands, e-mail: user-h...@commons.apache.org >
Re: [email] Email sent with commons email having long filename attachments, show problems in Outlook
Hi Raffaele, Had a quick look at the code - the code directly uses the JDK MimeUtility class to implement the folding. And doing something differently is hard to find out since there are many email clients out there - and actually following the RFC is quite hard Thanks in advance, Siegfried Goeschl > On 06.02.2019, at 14:05, Raffaele Gambelli wrote: > > Hi all, > > this is probably a known issue, Outlook is not fully conform to RFC 2231 so > it's unable to parse long filename attachments, this happens when sender > applies RFC 822 folding rules, so for example a filename > "CANALI+GIOVANNI+SRL+-+NOTA+PROT.+0001461+DEL+04.02.2019.pdf.p7m" once sent > (via commons email) becomes: > > Content-Type: application/pkcs7-signature; > name*0=CANALI+GIOVANNI+SRL+-+NOTA+PROT.+0001461+DEL+04.02.2019.pdf.; > name*1=p7m > Content-Transfer-Encoding: base64 > Content-Disposition: attachment; > filename*0=CANALI+GIOVANNI+SRL+-+NOTA+PROT.+0001461+DEL+04.02.2019.pdf.; > filename*1=p7m > > This problem has been present in Outlook for many years, I could suppose > Microsoft doesn't think to fix it, maybe they think it's not an issue, I > really don't know. > > What I would like to know is if with "commons email" exists the possibility > to avoid folding of header parameter names, besides that I would like to know > your opinion if what I've just said is right or if it could bring problems on > some other different clients. > > Thanks, best regards > > Some useful references: > > https://bugzilla.mozilla.org/show_bug.cgi?id=309566 > > https://tools.ietf.org/html/rfc2231 > [https://westpole.it/firma/logo.png] > > Raffaele Gambelli > WebRainbow(r) Software Developer > > P +39 051 8550 576 > M # > E r.gambe...@westpole.it > W https://westpole.webex.com/meet/R.Gambelli > A Via Ettore Cristoni, 84 - 40030 Casalecchio di Reno > > [https://westpole.it/firma/sito.png]<https://westpole.it> > [https://westpole.it/firma/twitter.png] <https://twitter.com/WESTPOLE_SPA> > [https://westpole.it/firma/facebook.png] > <https://www.facebook.com/WESTPOLESPA/> > [https://westpole.it/firma/linkedin.png] > <https://www.linkedin.com/company/westpole/> > > > This email for the D.lgs.196/2003 (Privacy Code) and European Regulation > 679/2016/UE (GDPR) may contain confidential and/or privileged information for > the exclusive use of the intended recipient. Any review or distribution by > others is strictly prohibited. If you are not the intended recipient, you > must not use, copy, disclose or take any action based on this message or any > information here. If you have received this email in error, please contact us > (email:priv...@westpole.it) by reply email and delete all copies. Legal > privilege is not waived because you have read this email. Thank you for your > cooperation. > > > [https://westpole.it/firma/ambiente.png] Please consider the environment > before printing this email > > > - > To unsubscribe, e-mail: user-unsubscr...@commons.apache.org > For additional commands, e-mail: user-h...@commons.apache.org > - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [csv] Slicing through CSVRecords
Hi Thomas, Happy new year as well :-) Had a quick look - yes, it is powerful but not what I’m looking for. I guess I will code my stuff locally on top of Apache Commons CSV and look how it goes … Thanks in advance, Siegfried Goeschl > On 02.01.2019, at 13:25, Thomas Vandahl wrote: > > Hi Siegfried, > > Happy New Year btw.! > > On 31.12.18 15:34, Siegfried Goeschl wrote: >> somehow I’m working a lot with ad-hoc scripting and commons-csv and it >> would be helpful to have additional functionality slicing through CSV >> records, e.g. >> >> * group CSVRecord by the value of column >> * get a list of distinct values from a column >> >> No rocket science but to avoid typing the same code over and over >> >> * has anyone implemented that already and I’m just unaware of it >> * if not - could this be a valuable contribution? > > I prefer SuperCSV (http://super-csv.github.io/super-csv/) for tasks like > this. It supports bean mapping and cell-processors which makes record > handling super easy. > > Bye, Thomas > > > - > To unsubscribe, e-mail: user-unsubscr...@commons.apache.org > For additional commands, e-mail: user-h...@commons.apache.org > - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
[csv] Slicing through CSVRecords
Hi folks, somehow I’m working a lot with ad-hoc scripting and commons-csv and it would be helpful to have additional functionality slicing through CSV records, e.g. * group CSVRecord by the value of column * get a list of distinct values from a column No rocket science but to avoid typing the same code over and over * has anyone implemented that already and I’m just unaware of it * if not - could this be a valuable contribution? Thanks in advance, Siegfried Goeschl - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [exec] Misunderstanding DaemonExecutor and DefaultExecutor for asynchronous execution
Hi Edgar, had a quick look and I can spot no obvious issue (apart from starting batch files which is error prone). Having said that could you check out * https://issues.apache.org/jira/browse/EXEC-57 <https://issues.apache.org/jira/browse/EXEC-57> * http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/issues/Exec57Test.java?view=markup <http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/issues/Exec57Test.java?view=markup> Thanks in advance, Siegfried Goeschl > On 03.12.2017, at 00:33, Edgar H <kaotix...@gmail.com> wrote: > > Hey guys, > > Recently I've been working with exec in order to execute several scripts > via Java. > > The thing is that I don't clearly understand how they work as I'm trying to > perform asycnhronous tasks and the process seems to keep on blocking > without continuing the execution, so what I did in the meantime is to > create manual Java Thread classes to perform all of them, which isn't > elegant at all. > > For example, I'm trying to run Icecast as a background process, and keep on > executing and instantiating more background ones, but it seems that with my > approach it keeps blocking. > >private void runIcecast() { >File file = new File("Icecast"); >for (File s : file.listFiles()) { >if (s.getName().equals("icecast.bat")) { >DaemonExecutor executor = new DaemonExecutor(); >executor.setWorkingDirectory(file); >executor.setExitValue(1); >CommandLine commandLine = new > CommandLine(s.getAbsolutePath()); > >try { >executor.execute(commandLine); >String line = "icecast -c icecast.xml"; >commandLine = CommandLine.parse(line); >executor.execute(commandLine, new > DefaultExecuteResultHandler()); >} catch (ExecuteException e) { >e.printStackTrace(); >} catch (IOException e) { >e.printStackTrace(); >} >} >} >} > > What should I do so a new Thread is created whenever the command is > executed? Or should I just create normal Thread classes as I've been doing > until now?
Re: [email] ImageHtmlEmail and base64 encoded image in html body throws exception
Hi Raffale, because poor old commons-email (or at least me) was not aware of the feature :-) I had a quick look * Sending a HTML file with embedded images (without DataSourceResolver) seems to work but the email is not properly displayed with all email clients. Does this * Do you have a working code snippet showing what you are doing? Or a Gist? Thanks in advance, Siegfried Goeschl > On 07.12.2017, at 17:16, Raffaele Gambelli > <r.gambe...@hitachi-systems-cbt.com> wrote: > > Hi Andreas, > > yes I did! I did what I specified in my first email, so I did what, maybe, > would have to do commons email, identifying the encoded image, extracting its > bytes, decoding them, transforming them into ByteArrayDataSource (javamail) > and give it to the embed method, it worked but commons email why can't do > it for us? > > Thanks Andreas, bye > > Raffaele Gambelli > WebRainbow® Software Analyst & Developer > > Hitachi Systems CBT > r.gambe...@hitachi-systems-cbt.com | Phone +39 051 8550 576 > Via Ettore Cristoni, 84 | 40033 Casalecchio Di Reno > www.hitachi-systems-cbt.com > > This email for the D.Lgs n.196/2003 (Privacy Code), may contain confidential > and/or privileged information for the sole use of the intended recipient. Any > review or distribution by others is strictly prohibited. If you are not the > intended recipient, you must not use, copy, disclose or take any action based > on this message or any information here. If you have received this email in > error, please contact us (e-mail: priv...@hitachi-systems-cbt.com) by reply > e-mail and delete all copies. Legal privilege is not waived because you have > read this e-mail. Thank you for your cooperation. > > > -Andreas Kuhtz <andreas.ku...@gmail.com> ha scritto: - > Per: Commons Users List <user@commons.apache.org> > Da: Andreas Kuhtz <andreas.ku...@gmail.com> > Data: 07/12/2017 05.03PM > Oggetto: Re: [email] ImageHtmlEmail and base64 encoded image in html body > throws exception > > Hi Raffaele, > > I think the form " supported, that's why unknown protocol "data" is thrown. The "data" is the > first part of the uri for src that you provided. > > Have you tried to add the image as attachment and use the "cid" protocol as > shown in the user guide? > > Hope this helps. > > Cheers, > Andreas > > > 2017-12-07 16:46 GMT+01:00 Raffaele Gambelli < > r.gambe...@hitachi-systems-cbt.com>: > >> Hi Martin, >> >> have you read my question? Why are you continueing to talk about a >> different matter, can I ask you to try to explain me, if you know it, if I >> found a bug or not? >> Saying differently, how do you send an email containing base64 encoded >> images in its html? >> >> Thanks, bye >> >> Raffaele Gambelli >> WebRainbow® Software Analyst & Developer >> >> Hitachi Systems CBT >> r.gambe...@hitachi-systems-cbt.com | Phone +39 051 8550 576 >> Via Ettore Cristoni, 84 | 40033 Casalecchio Di Reno >> www.hitachi-systems-cbt.com >> >> This email for the D.Lgs n.196/2003 (Privacy Code), may contain >> confidential and/or privileged information for the sole use of the intended >> recipient. Any review or distribution by others is strictly prohibited. If >> you are not the intended recipient, you must not use, copy, disclose or >> take any action based on this message or any information here. If you have >> received this email in error, please contact us (e-mail: >> priv...@hitachi-systems-cbt.com) by reply e-mail and delete all copies. >> Legal privilege is not waived because you have read this e-mail. Thank you >> for your cooperation. >> >> >> -Martin Gainty <mgai...@hotmail.com> ha scritto: - >> Per: Commons Users List <user@commons.apache.org> >> Da: Martin Gainty <mgai...@hotmail.com> >> Data: 07/12/2017 04.43PM >> Oggetto: Re: [email] ImageHtmlEmail and base64 encoded image in html body >> throws exception >> >> break the rules at your own peril >> >> >> bye >> __ >> >> >> >> >> From: Raffaele Gambelli <r.gambe...@hitachi-systems-cbt.com> >> Sent: Wednesday, December 6, 2017 10:43 AM >> To: Commons Users List >> Subject: Re: [email] ImageHtmlEmail and base64 encoded image in html body >> throws exception >> >> Hi Martin, >> >> do you think that applying what you said resolves the exception Caused by: >> java.net.MalformedURLExc
Re: [EXEC] Question
Hi Dan, any progress on your problem? Thanks in advance, Siegfried Goeschl > On 5 Jun 2017, at 12:36, Siegfried Goeschl <siegfried.goes...@it20one.com> > wrote: > > Hi Dan, > > some thoughts along the line > > * Just to make sure - you are running NOT on Windows? > * are you redirecting streams within your Java code and the Bash scripts? If > so, can you get rid of them? I vaguely remember issues where a process was > killed by the ExecuteWatchdog but hang on a re-directed stream > * do you have more information regarding the “ExecuteWatchdog” problem - > maybe some code snippet to reproduce the issues > > Thanks in advance, > > Siegfried Goeschl > > >> On 1 Jun 2017, at 18:26, Dan C <golfd...@hotmail.com> wrote: >> >> Thanks for the reply!! >> >> Here’s my situation: >> I’m using the Apache Commons Exec version 1.3 code to call a bash script >> (which in turn calls one or more bash scripts). In most cases, everything >> works and the calling Java code gets a response. However, on some >> occasions, the call to DefaultExecutor’s execute method never returns (I’m >> calling one of the synchronous execute methods) … >> >> I have tracing in the bash scripts which indicate that they have finished. >> Also, I am using the ExecuteWatchdog class, but it doesn’t recognize the >> fact that my timeout has been exceeded. >> >> So, I’m looking for the following : >> - Some help (tips/tricks/what to look for/at) with how to debug my problem. >> - A good clear example of how to use the Apache Commons Exec for >> - a synchronous call to a bash script >> - an asynchronous call to a bash script >> >> Thanks in advance for any help!! >> >>> On Jun 1, 2017, at 11:26 AM, Amey Jadiye <ameyjad...@gmail.com> wrote: >>> >>> Hi Dan, >>> >>> You can post the question directly on mailing list. With questions you can >>> give some references like Github gist or link to github commits url. >>> >>> Regards, >>> Amey >>> >>> On Thu, Jun 1, 2017 at 8:33 PM, Dan C <golfd...@hotmail.com> wrote: >>> >>>> Now that I think I’m a registered user, is the the proper way to submit a >>>> question on the Apache Commons Exec code?? >>> >>> >>> >>> >>> -- >>> >>> - >>> >>> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org >>> >>> For additional commands, e-mail: dev-h...@commons.apache.org >> >> >> - >> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org >> For additional commands, e-mail: user-h...@commons.apache.org >> > - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [Re] Proper use of Executors
Hi Chris, the “recurring theme” does ring a bell - I guess you already know https://www.mail-archive.com/user@commons.apache.org/msg10368.html <https://www.mail-archive.com/user@commons.apache.org/msg10368.html> :-) Do you have some Git repo to re-produce the problem? Thanks in advance, Siegfried Goeschl > On 21 Jun 2017, at 17:48, Chris Gamache <cgama...@gmail.com> wrote: > > Ok so, it's hard to tell if this made much of a difference. There might be a > few less messages? Hard to be sure. > > I'm still getting those messages, but I'm now suspecting Selenium is > generating the majority of these messages. It is behaving badly when it comes > to killing its spawned phantomjs processes, thereby leaving the executors > open. Seems like a recurring theme, eh Siegfried? ;) > > Selenium is co-opting the Apache Commons Exec. It looks like it is using > ExecuteWatchdog.INFINITE_TIMEOUT, so no help there. I see they are making a > pretty good effort to kill the processes. I won't rule-out that I'm doing it > wrong, but I'm pretty sure > > } finally { > driver.quit(); > } > > is all I'm responsible for if I want Selenium to close phantomjs processes. I > do have some room to upgrade Selenium and PhantomJS which might help. I > didn't see any meaningful changes in Selenium that would lead me to believe > that an upgrade would fix the issue. But, it's a good practice and any > patches will have to be made at the head of the project anyway. > > Thanks for all the help! > > CG > > > On Mon, Jun 19, 2017 at 4:11 PM, Siegfried Goeschl > <siegfried.goes...@it20one.com <mailto:siegfried.goes...@it20one.com>> wrote: > Staying tuned :-) > > > On 5 Jun 2017, at 13:59, Chris Gamache <cgama...@gmail.com > > <mailto:cgama...@gmail.com>> wrote: > > > > Hi Siegfried, > > > > I have implemented the executor watchdogs and shutdown hooks. I will know > > if our efforts have been fruitful when we make our first restart which I'm > > sure will be soon. I promise I'll write back and let you know how it goes. > > > > Thank you vary much for checking in with me! > > > >> On Jun 5, 2017, at 11:45 AM, Siegfried Goeschl > >> <siegfried.goes...@it20one.com <mailto:siegfried.goes...@it20one.com>> > >> wrote: > >> > >> Hi Chris, > >> > >> any new findings from your side? > >> > >> Thanks in advance, > >> > >> Siegfried Goeschl > >> > >>> On 28 May 2017, at 21:41, Siegfried Goeschl > >>> <siegfried.goes...@it20one.com <mailto:siegfried.goes...@it20one.com>> > >>> wrote: > >>> > >>> Hi Chris, > >>> > >>> there are couple of things to consider > >>> > >>> * You are using a PumpStreamHander but the STDERR is not consumed. Each > >>> process has an internal buffer (size depends on the OS) and when the > >>> buffer is full any write to STDERR is blocked > >>> * That could happen if the process being executed actually writes some > >>> error messages :-) > >>> * Are you 100% sure that the processes will terminate? See ExecuteWatchdog > >>> * You might habe a look at ProcessDestroyer to cleanup during shutdown > >>> > >>> Thanks in advance, > >>> > >>> Siegfried Goeschl > >>> > >>> > >>>> On 27 May 2017, at 14:27, Chris Gamache <cgama...@gmail.com > >>>> <mailto:cgama...@gmail.com>> wrote: > >>>> > >>>> Hi all, > >>>> > >>>> I'm using org.apache.commons:commons-exec:1.3 on Java 8. > >>>> > >>>> I'm having an issue where my Tomcat server is bleeding out hundreds of > >>>> threads and all of the memory in the form of Executors that I'm running > >>>> but > >>>> don't seem to be closing down ... When the server finally grinds to a > >>>> halt > >>>> I have to restart. When I do it looks like this at shutdown time: > >>>> > >>>> > >>>> > >>>> 27-May-2017 07:56:21.631 WARNING [localhost-startStop-11] > >>>> org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads > >>>> The > >>>> web application [ROOT##000252] appears to have started a thread named > >>>> [Exec > >>>> Default Executor] but has failed to stop it. This is very likely to > >>>> create > >>&
Re: [Re] Proper use of Executors
Staying tuned :-) > On 5 Jun 2017, at 13:59, Chris Gamache <cgama...@gmail.com> wrote: > > Hi Siegfried, > > I have implemented the executor watchdogs and shutdown hooks. I will know if > our efforts have been fruitful when we make our first restart which I'm sure > will be soon. I promise I'll write back and let you know how it goes. > > Thank you vary much for checking in with me! > >> On Jun 5, 2017, at 11:45 AM, Siegfried Goeschl >> <siegfried.goes...@it20one.com> wrote: >> >> Hi Chris, >> >> any new findings from your side? >> >> Thanks in advance, >> >> Siegfried Goeschl >> >>> On 28 May 2017, at 21:41, Siegfried Goeschl <siegfried.goes...@it20one.com> >>> wrote: >>> >>> Hi Chris, >>> >>> there are couple of things to consider >>> >>> * You are using a PumpStreamHander but the STDERR is not consumed. Each >>> process has an internal buffer (size depends on the OS) and when the buffer >>> is full any write to STDERR is blocked >>> * That could happen if the process being executed actually writes some >>> error messages :-) >>> * Are you 100% sure that the processes will terminate? See ExecuteWatchdog >>> * You might habe a look at ProcessDestroyer to cleanup during shutdown >>> >>> Thanks in advance, >>> >>> Siegfried Goeschl >>> >>> >>>> On 27 May 2017, at 14:27, Chris Gamache <cgama...@gmail.com> wrote: >>>> >>>> Hi all, >>>> >>>> I'm using org.apache.commons:commons-exec:1.3 on Java 8. >>>> >>>> I'm having an issue where my Tomcat server is bleeding out hundreds of >>>> threads and all of the memory in the form of Executors that I'm running but >>>> don't seem to be closing down ... When the server finally grinds to a halt >>>> I have to restart. When I do it looks like this at shutdown time: >>>> >>>> >>>> >>>> 27-May-2017 07:56:21.631 WARNING [localhost-startStop-11] >>>> org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The >>>> web application [ROOT##000252] appears to have started a thread named [Exec >>>> Default Executor] but has failed to stop it. This is very likely to create >>>> a memory leak. Stack trace of thread: >>>> java.lang.Object.wait(Native Method) >>>> java.lang.Object.wait(Object.java:502) >>>> java.lang.UNIXProcess.waitFor(UNIXProcess.java:396) >>>> org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:364) >>>> org.apache.commons.exec.DefaultExecutor.access$200(DefaultExecutor.java:48) >>>> org.apache.commons.exec.DefaultExecutor$1.run(DefaultExecutor.java:200) >>>> java.lang.Thread.run(Thread.java:745) >>>> >>>> 27-May-2017 07:56:21.633 WARNING [localhost-startStop-11] >>>> org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The >>>> web application [ROOT##000252] appears to have started a thread named [Exec >>>> Stream Pumper] but has failed to stop it. This is very likely to create a >>>> memory leak. Stack trace of thread: >>>> java.io.FileInputStream.readBytes(Native Method) >>>> java.io.FileInputStream.read(FileInputStream.java:255) >>>> java.io.BufferedInputStream.fill(BufferedInputStream.java:246) >>>> java.io.BufferedInputStream.read1(BufferedInputStream.java:286) >>>> java.io.BufferedInputStream.read(BufferedInputStream.java:345) >>>> java.io.FilterInputStream.read(FilterInputStream.java:107) >>>> org.apache.commons.exec.StreamPumper.run(StreamPumper.java:107) >>>> java.lang.Thread.run(Thread.java:745) >>>> >>>> >>>> >>>> And my thread dump is a mile long. >>>> >>>> I am certainly willing to concede I'm Doing It Wrong(tm) ... Here's the >>>> relevant code. It is called from a regular method in a regular class, >>>> nothing fancy: >>>> >>>> CommandLine cmdLine = CommandLine.parse(command.toString()); >>>> DefaultExecutor executor = new DefaultExecutor(); >>>> PumpStreamHandler esh = new PumpStreamHandler(os,null,is); >>>> executor.setStreamHandler(esh); >>>> executor.execute(cmdLine); >>>> >>>> `is` and `os` are passed in on the constructor. Their opens and closes are >>>> managed well and cleaned up on the outside of this class... >>>> Are there further steps I'm missing to ensure the threads I'm creating are >>>> getting shut down properly and the resources they are using are being >>>> returned? >>>> >>>> Any help is much appreciated. >>> >> - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
[Re] Proper use of Executors
Hi Chris, any new findings from your side? Thanks in advance, Siegfried Goeschl > On 28 May 2017, at 21:41, Siegfried Goeschl <siegfried.goes...@it20one.com> > wrote: > > Hi Chris, > > there are couple of things to consider > > * You are using a PumpStreamHander but the STDERR is not consumed. Each > process has an internal buffer (size depends on the OS) and when the buffer > is full any write to STDERR is blocked > * That could happen if the process being executed actually writes some error > messages :-) > * Are you 100% sure that the processes will terminate? See ExecuteWatchdog > * You might habe a look at ProcessDestroyer to cleanup during shutdown > > Thanks in advance, > > Siegfried Goeschl > > >> On 27 May 2017, at 14:27, Chris Gamache <cgama...@gmail.com> wrote: >> >> Hi all, >> >> I'm using org.apache.commons:commons-exec:1.3 on Java 8. >> >> I'm having an issue where my Tomcat server is bleeding out hundreds of >> threads and all of the memory in the form of Executors that I'm running but >> don't seem to be closing down ... When the server finally grinds to a halt >> I have to restart. When I do it looks like this at shutdown time: >> >> >> >> 27-May-2017 07:56:21.631 WARNING [localhost-startStop-11] >> org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The >> web application [ROOT##000252] appears to have started a thread named [Exec >> Default Executor] but has failed to stop it. This is very likely to create >> a memory leak. Stack trace of thread: >> java.lang.Object.wait(Native Method) >> java.lang.Object.wait(Object.java:502) >> java.lang.UNIXProcess.waitFor(UNIXProcess.java:396) >> org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:364) >> org.apache.commons.exec.DefaultExecutor.access$200(DefaultExecutor.java:48) >> org.apache.commons.exec.DefaultExecutor$1.run(DefaultExecutor.java:200) >> java.lang.Thread.run(Thread.java:745) >> >> 27-May-2017 07:56:21.633 WARNING [localhost-startStop-11] >> org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The >> web application [ROOT##000252] appears to have started a thread named [Exec >> Stream Pumper] but has failed to stop it. This is very likely to create a >> memory leak. Stack trace of thread: >> java.io.FileInputStream.readBytes(Native Method) >> java.io.FileInputStream.read(FileInputStream.java:255) >> java.io.BufferedInputStream.fill(BufferedInputStream.java:246) >> java.io.BufferedInputStream.read1(BufferedInputStream.java:286) >> java.io.BufferedInputStream.read(BufferedInputStream.java:345) >> java.io.FilterInputStream.read(FilterInputStream.java:107) >> org.apache.commons.exec.StreamPumper.run(StreamPumper.java:107) >> java.lang.Thread.run(Thread.java:745) >> >> >> >> And my thread dump is a mile long. >> >> I am certainly willing to concede I'm Doing It Wrong(tm) ... Here's the >> relevant code. It is called from a regular method in a regular class, >> nothing fancy: >> >> CommandLine cmdLine = CommandLine.parse(command.toString()); >> DefaultExecutor executor = new DefaultExecutor(); >> PumpStreamHandler esh = new PumpStreamHandler(os,null,is); >> executor.setStreamHandler(esh); >> executor.execute(cmdLine); >> >> `is` and `os` are passed in on the constructor. Their opens and closes are >> managed well and cleaned up on the outside of this class... >> Are there further steps I'm missing to ensure the threads I'm creating are >> getting shut down properly and the resources they are using are being >> returned? >> >> Any help is much appreciated. > - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [EXEC] Question
Hi Dan, some thoughts along the line * Just to make sure - you are running NOT on Windows? * are you redirecting streams within your Java code and the Bash scripts? If so, can you get rid of them? I vaguely remember issues where a process was killed by the ExecuteWatchdog but hang on a re-directed stream * do you have more information regarding the “ExecuteWatchdog” problem - maybe some code snippet to reproduce the issues Thanks in advance, Siegfried Goeschl > On 1 Jun 2017, at 18:26, Dan C <golfd...@hotmail.com> wrote: > > Thanks for the reply!! > > Here’s my situation: > I’m using the Apache Commons Exec version 1.3 code to call a bash script > (which in turn calls one or more bash scripts). In most cases, everything > works and the calling Java code gets a response. However, on some occasions, > the call to DefaultExecutor’s execute method never returns (I’m calling one > of the synchronous execute methods) … > > I have tracing in the bash scripts which indicate that they have finished. > Also, I am using the ExecuteWatchdog class, but it doesn’t recognize the fact > that my timeout has been exceeded. > > So, I’m looking for the following : > - Some help (tips/tricks/what to look for/at) with how to debug my problem. > - A good clear example of how to use the Apache Commons Exec for >- a synchronous call to a bash script >- an asynchronous call to a bash script > > Thanks in advance for any help!! > >> On Jun 1, 2017, at 11:26 AM, Amey Jadiye <ameyjad...@gmail.com> wrote: >> >> Hi Dan, >> >> You can post the question directly on mailing list. With questions you can >> give some references like Github gist or link to github commits url. >> >> Regards, >> Amey >> >> On Thu, Jun 1, 2017 at 8:33 PM, Dan C <golfd...@hotmail.com> wrote: >> >>> Now that I think I’m a registered user, is the the proper way to submit a >>> question on the Apache Commons Exec code?? >> >> >> >> >> -- >> >> - >> >> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org >> >> For additional commands, e-mail: dev-h...@commons.apache.org > > > - > To unsubscribe, e-mail: user-unsubscr...@commons.apache.org > For additional commands, e-mail: user-h...@commons.apache.org > - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: Proper use of Executors
Hi Chris, there are couple of things to consider * You are using a PumpStreamHander but the STDERR is not consumed. Each process has an internal buffer (size depends on the OS) and when the buffer is full any write to STDERR is blocked * That could happen if the process being executed actually writes some error messages :-) * Are you 100% sure that the processes will terminate? See ExecuteWatchdog * You might habe a look at ProcessDestroyer to cleanup during shutdown Thanks in advance, Siegfried Goeschl > On 27 May 2017, at 14:27, Chris Gamache <cgama...@gmail.com> wrote: > > Hi all, > > I'm using org.apache.commons:commons-exec:1.3 on Java 8. > > I'm having an issue where my Tomcat server is bleeding out hundreds of > threads and all of the memory in the form of Executors that I'm running but > don't seem to be closing down ... When the server finally grinds to a halt > I have to restart. When I do it looks like this at shutdown time: > > > > 27-May-2017 07:56:21.631 WARNING [localhost-startStop-11] > org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The > web application [ROOT##000252] appears to have started a thread named [Exec > Default Executor] but has failed to stop it. This is very likely to create > a memory leak. Stack trace of thread: > java.lang.Object.wait(Native Method) > java.lang.Object.wait(Object.java:502) > java.lang.UNIXProcess.waitFor(UNIXProcess.java:396) > org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:364) > org.apache.commons.exec.DefaultExecutor.access$200(DefaultExecutor.java:48) > org.apache.commons.exec.DefaultExecutor$1.run(DefaultExecutor.java:200) > java.lang.Thread.run(Thread.java:745) > > 27-May-2017 07:56:21.633 WARNING [localhost-startStop-11] > org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The > web application [ROOT##000252] appears to have started a thread named [Exec > Stream Pumper] but has failed to stop it. This is very likely to create a > memory leak. Stack trace of thread: > java.io.FileInputStream.readBytes(Native Method) > java.io.FileInputStream.read(FileInputStream.java:255) > java.io.BufferedInputStream.fill(BufferedInputStream.java:246) > java.io.BufferedInputStream.read1(BufferedInputStream.java:286) > java.io.BufferedInputStream.read(BufferedInputStream.java:345) > java.io.FilterInputStream.read(FilterInputStream.java:107) > org.apache.commons.exec.StreamPumper.run(StreamPumper.java:107) > java.lang.Thread.run(Thread.java:745) > > > > And my thread dump is a mile long. > > I am certainly willing to concede I'm Doing It Wrong(tm) ... Here's the > relevant code. It is called from a regular method in a regular class, > nothing fancy: > > CommandLine cmdLine = CommandLine.parse(command.toString()); > DefaultExecutor executor = new DefaultExecutor(); > PumpStreamHandler esh = new PumpStreamHandler(os,null,is); > executor.setStreamHandler(esh); > executor.execute(cmdLine); > > `is` and `os` are passed in on the constructor. Their opens and closes are > managed well and cleaned up on the outside of this class... > Are there further steps I'm missing to ensure the threads I'm creating are > getting shut down properly and the resources they are using are being > returned? > > Any help is much appreciated.
Re: [imaging]
Hi Nikhil, some thoughts along the line * In https://github.com/sgoeschl/java-image-processing-survival-guide/tree/master/code/jipsg you find code resizing/resampling of images with a lot of open source libraries * The library being used depends on the range of source images - how many image formats, image sources, etc. * Stay clear of TIFF if possible and PDF scans - will cause endless grief * Personally I would use https://github.com/haraldk/TwelveMonkeys and Thumbnailator Thanks in advance, Siegfried Goeschl Disclaimer: I’m sort of affiliated with the “TwelveMonkeys” library since Harald Kuhr (the creator of the library) is a friend of mine and we did a couple of presentations together > On 6 Mar 2017, at 04:52, Nikhil <nikhilmac...@gmail.com> wrote: > > Thanks Siegfried. Your github details are really good. It gave a lot of > details but also confused me to find the optimal production ready approach > for the problem. Could you pls. guide me here ? > > Here are the few usecases that I have, > 1. Convert JPEG to PNG either color or grayscale depending upon the source > image color. (I believe I need utility to find the source image color e.g. > if image is already B/W , Grayscale or Color ) > 2. Update metadata and also resize the image to new dpi e.g. if source > image is 1200x1200 then upon conversion to PNG it should be 300x300 dpi > with same physical size. > > What would be best library to use for above usecases ? (I believe java > imageIO should be good enough for these tasks...correct ?) > What should be the steps to do above two usecases ? > > Thanks for your help. Appreciate it a lot ! > > Thanks, > Nikhil > > > On Sun, Mar 5, 2017 at 8:53 AM, Siegfried Goeschl < > siegfried.goes...@it20one.com> wrote: > >> Hi Nikhil, >> >> I do not know commons-image good enough to answer your questions but >> >> * Do you mean changing the DPI value (metadata only) or resizing the image? >> * While not related to Apache Commons Image the following link might help >> - https://github.com/sgoeschl/java-image-processing-survival-guide < >> https://github.com/sgoeschl/java-image-processing-survival-guide> >> >> Thanks in advance, >> >> Siegfried Goeschl >> >> >>> On 3 Mar 2017, at 07:53, Nikhil <nikhilmac...@gmail.com> wrote: >>> >>> Hi, >>> >>> >>> 1. Does Commons Imaging support changing dpi of an image ? E.g. Changing >>> 1200x1200 image (jpeg / png) to 300x300. >>> >>>If yes, could you point me to a sample ? >>> >>> 2. Can Image be converted to grayscale 4 bit or 8 bit using the Imaging >> api >>> ? If yes, could you point me to a sample ? >>> >>> >>> Thanks, >>> >>> Nikhil >> >> - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [imaging]
Hi Nikhil, I do not know commons-image good enough to answer your questions but * Do you mean changing the DPI value (metadata only) or resizing the image? * While not related to Apache Commons Image the following link might help - https://github.com/sgoeschl/java-image-processing-survival-guide <https://github.com/sgoeschl/java-image-processing-survival-guide> Thanks in advance, Siegfried Goeschl > On 3 Mar 2017, at 07:53, Nikhil <nikhilmac...@gmail.com> wrote: > > Hi, > > > 1. Does Commons Imaging support changing dpi of an image ? E.g. Changing > 1200x1200 image (jpeg / png) to 300x300. > > If yes, could you point me to a sample ? > > 2. Can Image be converted to grayscale 4 bit or 8 bit using the Imaging api > ? If yes, could you point me to a sample ? > > > Thanks, > > Nikhil
Re: [imaging] Changing compile baseline of library to JDK7
Hi folks, I think the latest version of TwelveMonkey supporting JDK 1.6 is http://search.maven.org/#artifactdetails%7Ccom.twelvemonkeys%7Ctwelvemonkeys%7C3.0.2%7Cpom <http://search.maven.org/#artifactdetails|com.twelvemonkeys|twelvemonkeys|3.0.2|pom> Cheers, Siegfried Goeschl > On 11 Oct 2016, at 18:10, Thad Humphries <thad.humphr...@gmail.com> wrote: > > Yes. I've had to pull commons-imaging from my apps and replace it with > JAI-IMAGEIO. JAI is old and unsupported, but its jar files still work with > Java 6. (There are also older versions of Twelve Monkeys that work with > Java 6. https://github.com/haraldk/TwelveMonkeys) > > On Tue, Oct 11, 2016 at 11:38 AM, Sergio Matone <ser...@cedeo.net> wrote: > >> I would like to express my disappoint since the library, which was working >> perfectly, is now compiled using Java 7 without issuing a version. >> >> I understand that the library is in SNAPSHOT, but why it wasn't issued at >> least a 1.0.0 version, tagging the Java 6 version. >> You broke builds of several of my programs in production. That's not the >> way Apache usually behaves. >> >> Sergio >> > > > -- > "Hell hath no limits, nor is circumscrib'd In one self-place; but where we > are is hell, And where hell is, there must we ever be" --Christopher > Marlowe, *Doctor Faustus* (v. 121-24)
Re: Help needed: commons-exec CLOSE_WAIT problem
It was a pleasure to help :-) Siegfried Goeschl > On 06 Feb 2016, at 03:53, Chris Gamache <cgama...@gmail.com> wrote: > > I saw that! I couldn't have done it without you. Many thanks! > > CG > > Sent from my iPhone > >> On Feb 5, 2016, at 12:24 PM, Siegfried Goeschl <siegfried.goes...@gmail.com> >> wrote: >> >> Hi Chris, >> >> according to https://github.com/SeleniumHQ/selenium/pull/1545 the PR is >> merged and closed :-) >> >> Cheers, >> >> Siegfried Goeschl >> >>> On 27.01.2016, at 14:52, Siegfried Göschl <siegfried.goes...@it20one.com> >>> wrote: >>> >>> Hi Chris, >>> >>> glad to help - please note that I took the freedom to post my findings at >>> https://github.com/SeleniumHQ/selenium/issues/1080 - could you do the same >>> :-) >>> >>> Cheers, >>> >>> Siegfried Goeschl >>> >>> >>> - Ursprüngliche Mail - >>> Von: "Chris Gamache" <cgama...@gmail.com> >>> An: "Commons Users List" <user@commons.apache.org> >>> Gesendet: Mittwoch, 27. Januar 2016 14:43:32 >>> Betreff: Re: Help needed: commons-exec CLOSE_WAIT problem >>> >>> I really appreciate the thorough inspection you have given. With your help >>> I think I've targeted the real problem... >>> >>> GhostDriver can't exist outside of phantomjs. GhostDriver is an >>> implementation of WebDriver Wire Protocol which runs on phantomjs's >>> JavaScript engine. It can't run without phantomjs. >>> >>> We can rest easy that commons-exec is not holding open the file handle. >>> That's good. I think the PhantomJSDriver is firing a copy of phantomjs up >>> using commons-exec, but it's not communicating with the service through >>> commons-exec. Upon closer inspection selenium-java is communicating through >>> tcp/ip to a WebDriver server phantomjs is popping up on random available >>> ports. This happens to be an instance of some class that implements >>> org.apache.http.client.HttpClient, by default it looks to >>> be org.apache.http.impl.client.CloseableHttpClient ... I think that when >>> commons-exec terminates phantomjs, thereby terminating the GhostDriver >>> server, the HttpClient is still attached to that port. >>> >>> Here's my take on the real problem: >>> >>> I think the selenium folks didn't consider port closing >>> (org.apache.http.client.HttpClient doesn't have a close method to >>> implement) a necessary step and they figured that if whatever service the >>> HttpClient was attached to shut itself down that the port would >>> automatically close itself down also. The standard use for selenium usually >>> doesn't require it to run for days and days on end. I can't fault them for >>> missing it. >>> >>> That being said, they made this difficult to override in consumer classes >>> by keeping a lot of the guts of the connections hidden behind private >>> classes and private member data. >>> >>> So, I'll need to dig into selenium-java, change a few interfaces to make >>> sure that whatever HttpClient is used will have a close() hook, and then >>> make sure that whatever is driving the HttpClient has access to the close >>> hook on shutdown, and fires it. When the HttpClient is closed, the file >>> descriptor should disappear. >>> >>> Thank you again for your help. It was indispensable! >>> >>> CG >>> >>> >>> On Tue, Jan 26, 2016 at 4:07 PM, Siegfried Göschl < >>> siegfried.goes...@it20one.com> wrote: >>> >>>> Hi Chris, >>>> >>>> I played with your GitHub repo [ >>>> https://github.com/cgamache/openfile](https://github.com/cgamache/openfile) >>>> >>>> ### 1. First Take >>>> >>>> Your test program actually starts a JVM and the Selenium library start >>>> multiple "phantomjs" executable to run the test as shown below >>>> >>>> ``` >>>> application> ps -ef | grep phantom >>>> 501 1021 460 0 9:26PM ttys0000:00.71 java -jar openfile.jar >>>> /usr/local/Cellar/phantomjs/2.1.0/bin/phantomjs >>>> 501 1073 1062 0 9:26PM ttys0000:00.08 >>>> /usr/local/Cellar/phantomjs/2.1.0/bin/phantomjs --webdriver=36418 >>>> --webdriver-logfile=/Users/sgoeschl/work/g
Re: Help needed: commons-exec CLOSE_WAIT problem
Hi Chris, according to https://github.com/SeleniumHQ/selenium/pull/1545 the PR is merged and closed :-) Cheers, Siegfried Goeschl > On 27.01.2016, at 14:52, Siegfried Göschl <siegfried.goes...@it20one.com> > wrote: > > Hi Chris, > > glad to help - please note that I took the freedom to post my findings at > https://github.com/SeleniumHQ/selenium/issues/1080 - could you do the same :-) > > Cheers, > > Siegfried Goeschl > > > - Ursprüngliche Mail - > Von: "Chris Gamache" <cgama...@gmail.com> > An: "Commons Users List" <user@commons.apache.org> > Gesendet: Mittwoch, 27. Januar 2016 14:43:32 > Betreff: Re: Help needed: commons-exec CLOSE_WAIT problem > > I really appreciate the thorough inspection you have given. With your help > I think I've targeted the real problem... > > GhostDriver can't exist outside of phantomjs. GhostDriver is an > implementation of WebDriver Wire Protocol which runs on phantomjs's > JavaScript engine. It can't run without phantomjs. > > We can rest easy that commons-exec is not holding open the file handle. > That's good. I think the PhantomJSDriver is firing a copy of phantomjs up > using commons-exec, but it's not communicating with the service through > commons-exec. Upon closer inspection selenium-java is communicating through > tcp/ip to a WebDriver server phantomjs is popping up on random available > ports. This happens to be an instance of some class that implements > org.apache.http.client.HttpClient, by default it looks to > be org.apache.http.impl.client.CloseableHttpClient ... I think that when > commons-exec terminates phantomjs, thereby terminating the GhostDriver > server, the HttpClient is still attached to that port. > > Here's my take on the real problem: > > I think the selenium folks didn't consider port closing > (org.apache.http.client.HttpClient doesn't have a close method to > implement) a necessary step and they figured that if whatever service the > HttpClient was attached to shut itself down that the port would > automatically close itself down also. The standard use for selenium usually > doesn't require it to run for days and days on end. I can't fault them for > missing it. > > That being said, they made this difficult to override in consumer classes > by keeping a lot of the guts of the connections hidden behind private > classes and private member data. > > So, I'll need to dig into selenium-java, change a few interfaces to make > sure that whatever HttpClient is used will have a close() hook, and then > make sure that whatever is driving the HttpClient has access to the close > hook on shutdown, and fires it. When the HttpClient is closed, the file > descriptor should disappear. > > Thank you again for your help. It was indispensable! > > CG > > > On Tue, Jan 26, 2016 at 4:07 PM, Siegfried Göschl < > siegfried.goes...@it20one.com> wrote: > >> Hi Chris, >> >> I played with your GitHub repo [ >> https://github.com/cgamache/openfile](https://github.com/cgamache/openfile) >> >> ### 1. First Take >> >> Your test program actually starts a JVM and the Selenium library start >> multiple "phantomjs" executable to run the test as shown below >> >> ``` >> application> ps -ef | grep phantom >> 501 1021 460 0 9:26PM ttys0000:00.71 java -jar openfile.jar >> /usr/local/Cellar/phantomjs/2.1.0/bin/phantomjs >> 501 1073 1062 0 9:26PM ttys0000:00.08 >> /usr/local/Cellar/phantomjs/2.1.0/bin/phantomjs --webdriver=36418 >> --webdriver-logfile=/Users/sgoeschl/work/github/cgamache/openfile/target/phantomjsdriver.log >> ``` >> >> So commons-exec is used under the hood to run the "phantomjs" binary and >> make sure nothing hangs (output & error thread pumping, watchdog, ..) >> >> When the "WebDriver" has finished its work there >> >> * is no ***phantomjs*** process running >> * is only your program running as shown below >> >> ``` >> application> ps -ef | grep phantom >> 501 1021 460 0 9:23PM ttys0000:00.72 java -jar openfile.jar >> /usr/local/Cellar/phantomjs/2.1.0/bin/phantomjs >> 501 1034 469 0 9:23PM ttys0010:00.00 grep phantom >> ``` >> >> And as described we have a couple of ports in CLOSE_WAIT stemming from >> your program >> >> ``` >> application> lsof -p 1021 | grep CLOSE_WAIT >> java1021 sgoeschl 16uIPv6 0x78418468470e25c7 0t0 TCP >> localhost:50581->localhost:40560 (CLOSE_WAIT) >> java1021 sgoeschl 18uIPv6 0x784184685ef
Re: Parse XML configuration file with namespaces
Hi Maurizio, I never used commons-configuration and this could be utterly wrong but could it be related that the XML parser can’t download/find your XSDs? Cheers, Siegfried Goeschl > On 24 Nov 2015, at 13:54, Maurizio Lattuada <maurizio.lattu...@gmail.com> > wrote: > > Hi guys, > > I'm dealing with a strange problem while parsing an XML file (with > namespaces) using commons configuration 1.10. > First of all, let me say that when I call the "load()" method on the > following XML file (validation is active), it is loaded flawless. > > This is an extract of the xml to be parsed: > > > action="create" >xmlns:ath="tdm:configuration:authentication" >xmlns:com="tdm:configuration:common" >xmlns:p="tdm:configuration:entities" >xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; >xsi:schemaLocation="tdm:configuration:entities ../xsd/model/persons.xsd "> > >Dr. >... > > >Mr. >... > > > > This is an extract of the persons.xsd, as you can see there are a > couple of imports > > xmlns:common="tdm:configuration:common" >xmlns:authentication="tdm:configuration:authentication" > targetNamespace="tdm:configuration:entities" >xmlns:xs="http://www.w3.org/2001/XMLSchema; elementFormDefault="qualified"> > namespace="tdm:configuration:common" /> > namespace="tdm:configuration:authentication" /> > > > > > And finally an extract of the code to setup the parse and to read the > document: > XMLConfiguration xmlPersonConfiguration = new XMLConfiguration(); > xmlPersonConfiguration.setDelimiterParsingDisabled(true); // needed > because I've attribute with multiple values like "a,b,c" > xmlPersonConfiguration.setExpressionEngine(new XPathExpressionEngine()); > xmlPersonConfiguration.setSchemaValidation(true); > xmlPersonConfiguration.setFileName("persons.xml"); > xmlPersonConfiguration.load(); > List xmlPersons; > xmlPersons = xmlPersonConfiguration.configurationsAt("person"); > > Shortly, either I try to search for (last statement): > * person > * p:person > * //person > * //p:person > * /p:persons/p:person > *... > > No elements are found. > According to the commons configuration documentation, "The XML Parser > will then use the schema defined in the XML document to validate it. > Enabling schema validation will also enable the parser's namespace > support.". > Please note: before I had such xml and xsd files without namespaces > and everything worked fine. > > I'm pretty sure I'm doing something wrong, but I can't figure what. > Any idea about this behavior? > > Thanks for your kind feedback > > -- > Maurizio Lattuada > > - > To unsubscribe, e-mail: user-unsubscr...@commons.apache.org > For additional commands, e-mail: user-h...@commons.apache.org > - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [Imaging] a quick resize sample needed
Hi folks, on GitHub I have sample code to resize images using different libraries * ImageIO * Thumbnailator * TwelveMonkeys https://github.com/sgoeschl/java-image-processing-survival-guide/tree/master/code/jipsg https://github.com/sgoeschl/java-image-processing-survival-guide/tree/master/code/jipsg Cheers, Siegfried Goeschl On 16 Jun 2015, at 19:45, Thad Humphries thad.humphr...@gmail.com wrote: Do you necessarily need to use this library? There are other solutions (Google java resize image). For example http://www.codejava.net/java-se/graphics/how-to-resize-images-in-java -- or -- http://www.thebuzzmedia.com/software/imgscalr-java-image-scaling-library/ On Tue, Jun 16, 2015 at 5:32 AM, javalishixml javalishi...@163.com wrote: Hi Gurus, Quite a silly question this is. But I really worked for one whole day but still could not get any result. I have below codes. I just want to finish a a simple function to resize the original picture. But I don't know how to set its param.. I tried to read the doc API and read the test code. But I still could not figure it out how to do.. Can you plz do me a favor? Looking forward to your early reply... -- public class ApacheCommonImaging { public static void main(String[] args) { // TODO Auto-generated method stub try { //!! File someFile = new File(E:\\deleteMe\\image\\original.jpg); File file = someFile; BufferedImage image_3 = Sanselan.getBufferedImage(file); File destination = new File(E:\\deleteMe\\image\\commonImaging\\destination.jpg); ImageFormat format1 = ImageFormat.IMAGE_FORMAT_JPEG; Map params = new HashMap(Object, Object); // Map params = new HashMap(JpegImageParser.TIFF_TAG_IMAGE_LENGTH, new TagInfo()); // Sanselan.writeImage(image_3, destination, format1, params); } catch (Exception e) { } } } -- -- Hell hath no limits, nor is circumscrib'd In one self-place; but where we are is hell, And where hell is, there must we ever be --Christopher Marlowe, *Doctor Faustus* (v. 121-24)
Re: [exec] Execution fails with quoted arguments
Hi Paulo, to be honest I’m puzzled as well - I think I need to play with your example to understand the difference of the invocations I keep you in the loop :-) Cheers, Siegfried Goeschl PS: I also think that commons-exec2 running on JDK 1.7+ would be a nice pet project of mine On 29 Apr 2014, at 18:25, Paulo Roberto Massa Cereda cereda.pa...@gmail.com wrote: Hi Siegfried, hey guys! Now I'm more puzzled after running the following test with ProcessBuilder: ** @Test public void testProcessBuilder() throws IOException { ProcessBuilder bibtex = new ProcessBuilder(); bibtex.command(new String[]{bibtex, file with spaces.aux}); Process process = bibtex.start(); InputStream inputStream = process.getInputStream(); InputStreamReader inputStreamReader = new InputStreamReader(inputStream); BufferedReader bufferedReader = new BufferedReader(inputStreamReader); String currentLine; while ((currentLine = bufferedReader.readLine()) != null) { System.out.println(currentLine); } try { int exitValue = process.waitFor(); System.out.println(exitValue); } catch (InterruptedException e) { } } ** I got the expected execution! vvv ** --- T E S T S --- Running cereda.tests.ProcessBuilderTest This is BibTeX, Version 0.99d (TeX Live 2013) The top-level auxiliary file: file with spaces.aux The style file: plain.bst Database file #1: master.bib Warning--I didn't find a database entry for with:1977 (There was 1 warning) 0 Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.61 sec ** I'm really lost now. And it's still Tuesday, so no excuses for getting a beer today. :) All the best, Paulo Em 28-04-2014 15:34, Siegfried Goeschl escreveu: Hi Paulo, I’m also a bit puzzled :-) 1) Can you remove the “.aux” extension when invoking “bibtex”? 2) Please check http://tex.stackexchange.com/questions/112606/how-to-make-space-recognized-in-bib-filename-when-setting-bibliography Cheers, Siegfried Goeschl On 24 Apr 2014, at 15:36, Paulo Roberto Massa Cereda cereda.pa...@gmail.com wrote: Hello Siegfried, sorry for the next dumb question (but I'm actually quite good at it) Don't say such thing, you are helping me a lot with these questions. :) There we go: * what is the result of the failed bibtex invocation? The message prompted is - I couldn't open file name `file with spaces.aux.aux' - And the program returns 1 as exit value. If I copy file with spaces.aux and rename it to filewithnospaces.aux, I get - This is BibTeX, Version 0.99d (TeX Live 2013) The top-level auxiliary file: filewithnospaces.aux The style file: plain.bst Database file #1: master.bib Warning--I didn't find a database entry for with:1977 (There was 1 warning) - And the program returns 0 as exit value. * is bibtex a native binary or a shell script? Native binary. paulo@alexandria ~$ file `which bibtex` /opt/texbin/bibtex: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped * depending on the error - can you replace the bibtex with a shell script to dump the current working directory - sometime the things are not executing where you expect them (just battled Java-native launchers where the current working directory can't be set I replaced bibtex with a script that prints $PWD and the provided arguments. I got Current directory ($PWD): /home/paulo/Projetos/commons-exec-report Arguments: file with spaces.aux Done. with 0 as exit value. Quite odd, isn't it? :) It's driving me crazy. Well, crazier. :P All the best, Paulo Em 24-04-2014 10:14, Siegfried Goeschl escreveu: Hi Pauolo, sorry for the next dumb question (but I'm actually quite good at it) * what is the result of the failed bibtex invocation? * is bibtex a native binary or a shell script? * depending on the error - can you replace the bibtex with a shell script to dump the current working directory - sometime the things are not executing where you expect them (just battled Java-native launchers where the current working directory can't be set Cheers, Siegfried Goeschl On 24.04.14 15:07, Paulo Roberto Massa Cereda wrote: Hello Siegfried! Wow, thanks for the fast response. :) Deeply sorry, I forgot to mention the environment. I'm running my code under Linux (Fedora 20, Java 1.7.0) and MacOSX (Mavericks, 10.9.2). I was unaware of the .aux thing under Windows, it's good to know about it; TeX tools use .aux files all the time, so it might be interesting to investigate some side effects from it. :) Apparently
Re: [exec] Execution fails with quoted arguments
Hi Paulo, it is politically probably not correct but you might checkout https://github.com/zeroturnaround/zt-exec * currently looking at the source and it looks familiar to me :-) * it is ASL 2.0 * it is available on Maven Central * maybe this could be the starting point for commons-exec2 Cheers, Siegfried Goeschl On 29 Apr 2014, at 22:52, Siegfried Goeschl sgoes...@gmx.at wrote: Hi Paulo, to be honest I’m puzzled as well - I think I need to play with your example to understand the difference of the invocations I keep you in the loop :-) Cheers, Siegfried Goeschl PS: I also think that commons-exec2 running on JDK 1.7+ would be a nice pet project of mine On 29 Apr 2014, at 18:25, Paulo Roberto Massa Cereda cereda.pa...@gmail.com wrote: Hi Siegfried, hey guys! Now I'm more puzzled after running the following test with ProcessBuilder: ** @Test public void testProcessBuilder() throws IOException { ProcessBuilder bibtex = new ProcessBuilder(); bibtex.command(new String[]{bibtex, file with spaces.aux}); Process process = bibtex.start(); InputStream inputStream = process.getInputStream(); InputStreamReader inputStreamReader = new InputStreamReader(inputStream); BufferedReader bufferedReader = new BufferedReader(inputStreamReader); String currentLine; while ((currentLine = bufferedReader.readLine()) != null) { System.out.println(currentLine); } try { int exitValue = process.waitFor(); System.out.println(exitValue); } catch (InterruptedException e) { } } ** I got the expected execution! vvv ** --- T E S T S --- Running cereda.tests.ProcessBuilderTest This is BibTeX, Version 0.99d (TeX Live 2013) The top-level auxiliary file: file with spaces.aux The style file: plain.bst Database file #1: master.bib Warning--I didn't find a database entry for with:1977 (There was 1 warning) 0 Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.61 sec ** I'm really lost now. And it's still Tuesday, so no excuses for getting a beer today. :) All the best, Paulo Em 28-04-2014 15:34, Siegfried Goeschl escreveu: Hi Paulo, I’m also a bit puzzled :-) 1) Can you remove the “.aux” extension when invoking “bibtex”? 2) Please check http://tex.stackexchange.com/questions/112606/how-to-make-space-recognized-in-bib-filename-when-setting-bibliography Cheers, Siegfried Goeschl On 24 Apr 2014, at 15:36, Paulo Roberto Massa Cereda cereda.pa...@gmail.com wrote: Hello Siegfried, sorry for the next dumb question (but I'm actually quite good at it) Don't say such thing, you are helping me a lot with these questions. :) There we go: * what is the result of the failed bibtex invocation? The message prompted is - I couldn't open file name `file with spaces.aux.aux' - And the program returns 1 as exit value. If I copy file with spaces.aux and rename it to filewithnospaces.aux, I get - This is BibTeX, Version 0.99d (TeX Live 2013) The top-level auxiliary file: filewithnospaces.aux The style file: plain.bst Database file #1: master.bib Warning--I didn't find a database entry for with:1977 (There was 1 warning) - And the program returns 0 as exit value. * is bibtex a native binary or a shell script? Native binary. paulo@alexandria ~$ file `which bibtex` /opt/texbin/bibtex: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped * depending on the error - can you replace the bibtex with a shell script to dump the current working directory - sometime the things are not executing where you expect them (just battled Java-native launchers where the current working directory can't be set I replaced bibtex with a script that prints $PWD and the provided arguments. I got Current directory ($PWD): /home/paulo/Projetos/commons-exec-report Arguments: file with spaces.aux Done. with 0 as exit value. Quite odd, isn't it? :) It's driving me crazy. Well, crazier. :P All the best, Paulo Em 24-04-2014 10:14, Siegfried Goeschl escreveu: Hi Pauolo, sorry for the next dumb question (but I'm actually quite good at it) * what is the result of the failed bibtex invocation? * is bibtex a native binary or a shell script? * depending on the error - can you replace the bibtex with a shell script to dump the current working directory - sometime the things are not executing where you expect them (just battled Java-native launchers where the current working directory can't be set Cheers, Siegfried Goeschl On 24.04.14 15:07, Paulo Roberto Massa Cereda wrote: Hello
Re: [exec] DefaultExecutor PumpStreamHandler and windows command prompt
Hi Alexander, no idea but the OS behave a bit differently especially with Windows stream re-direction does not work perfectly Cheers, Siegfried Goeschl On 24.04.14 22:26, Alexander Prishchepov wrote: Hello, All. I am starting new process with DefaultExecutor like that: -- DefaultExecutor executor = new DefaultExecutor(); executor.setStreamHandler(new PumpStreamHandler(System.out, System.err, System.in)); executor.execute(some command line); -- Everything works great, but somehow in windows command prompt input is not visible right away - only after Enter is pressed. Any idea, why that might happen? Tested it on unix (Solaris), and it does not happen - input is visible as I type. Regards, AlexP - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [exec] DefaultExecutor PumpStreamHandler and windows command prompt
Hi Alex, interesting - do you mind sharing your code? I can at least update the FAQ ... Cheers, Siegfried Goeschl On 28.04.14 17:27, Alex P wrote: I resolved the issue, but cannot use PumpStreamHandler - had to write my own. PumpStreamHandler implementation looks wrong to me now. 1) InputStreamPumper, what is used in case of System.in input waits for available() to return grater than 0, but it is not guarantied, and looks like in Windows it returns such only after Enter is pressed - that cased my original issue; 2) StreamPumper, what is used in other cases (for example if I wrap System.in in my own implementation) will read into buffer and therefore might wait until the whole buffer is filled in. Regards, AlexP On Mon, Apr 28, 2014 at 4:15 AM, Siegfried Goeschl sgoes...@gmx.at wrote: Hi Alexander, no idea but the OS behave a bit differently especially with Windows stream re-direction does not work perfectly Cheers, Siegfried Goeschl On 24.04.14 22:26, Alexander Prishchepov wrote: Hello, All. I am starting new process with DefaultExecutor like that: -- DefaultExecutor executor = new DefaultExecutor(); executor.setStreamHandler(new PumpStreamHandler(System.out, System.err, System.in)); executor.execute(some command line); -- Everything works great, but somehow in windows command prompt input is not visible right away - only after Enter is pressed. Any idea, why that might happen? Tested it on unix (Solaris), and it does not happen - input is visible as I type. Regards, AlexP - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [exec] Execution fails with quoted arguments
Hi Paulo, I’m also a bit puzzled :-) 1) Can you remove the “.aux” extension when invoking “bibtex”? 2) Please check http://tex.stackexchange.com/questions/112606/how-to-make-space-recognized-in-bib-filename-when-setting-bibliography Cheers, Siegfried Goeschl On 24 Apr 2014, at 15:36, Paulo Roberto Massa Cereda cereda.pa...@gmail.com wrote: Hello Siegfried, sorry for the next dumb question (but I'm actually quite good at it) Don't say such thing, you are helping me a lot with these questions. :) There we go: * what is the result of the failed bibtex invocation? The message prompted is - I couldn't open file name `file with spaces.aux.aux' - And the program returns 1 as exit value. If I copy file with spaces.aux and rename it to filewithnospaces.aux, I get - This is BibTeX, Version 0.99d (TeX Live 2013) The top-level auxiliary file: filewithnospaces.aux The style file: plain.bst Database file #1: master.bib Warning--I didn't find a database entry for with:1977 (There was 1 warning) - And the program returns 0 as exit value. * is bibtex a native binary or a shell script? Native binary. paulo@alexandria ~$ file `which bibtex` /opt/texbin/bibtex: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped * depending on the error - can you replace the bibtex with a shell script to dump the current working directory - sometime the things are not executing where you expect them (just battled Java-native launchers where the current working directory can't be set I replaced bibtex with a script that prints $PWD and the provided arguments. I got Current directory ($PWD): /home/paulo/Projetos/commons-exec-report Arguments: file with spaces.aux Done. with 0 as exit value. Quite odd, isn't it? :) It's driving me crazy. Well, crazier. :P All the best, Paulo Em 24-04-2014 10:14, Siegfried Goeschl escreveu: Hi Pauolo, sorry for the next dumb question (but I'm actually quite good at it) * what is the result of the failed bibtex invocation? * is bibtex a native binary or a shell script? * depending on the error - can you replace the bibtex with a shell script to dump the current working directory - sometime the things are not executing where you expect them (just battled Java-native launchers where the current working directory can't be set Cheers, Siegfried Goeschl On 24.04.14 15:07, Paulo Roberto Massa Cereda wrote: Hello Siegfried! Wow, thanks for the fast response. :) Deeply sorry, I forgot to mention the environment. I'm running my code under Linux (Fedora 20, Java 1.7.0) and MacOSX (Mavericks, 10.9.2). I was unaware of the .aux thing under Windows, it's good to know about it; TeX tools use .aux files all the time, so it might be interesting to investigate some side effects from it. :) Apparently, the error persists with other tool named makeglossaries that also uses this .aux file. I'm starting to get scared. :) All the best, Paulo Em 24-04-2014 09:50, Siegfried Goeschl escreveu: Hi Paulo, some stupid thought and it might not even be related to your problem aux is under Windows a reserved and can't be used as file name - see http://en.wikipedia.org/wiki/Filename - are you running the stuff under WIndows? Is it possible to rename the offending file to something different then .aux Cheers, Siegfried Goeschl On 24.04.14 14:36, Paulo Roberto Massa Cereda wrote: Dear friends, For some time, I was sure issue #54 (https://issues.apache.org/jira/browse/EXEC-54) was the culprit of one my programs misbehaving. Today, I decided to devote some time in understanding what's been happening in my code and apparently issue #54 does not appear to be culprit here! Here's a sample code that might explain what's happening. Note that I use two programs here (pdflatex and bibtex, hopefully available from any recent TeX distribution), and similar expansions lead to different results. Apologies for the long code excerpt. === @Test public void testCommonsExecExecution() throws IOException, InterruptedException { String program = bibtex; String argument = file with spaces.aux; CommandLine line = new CommandLine(program); line.addArgument(argument); // so far, everything ok assertEquals(line.toString(), [bibtex, \file with spaces.aux\]); DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler(); ByteArrayOutputStream out = new ByteArrayOutputStream(); PumpStreamHandler streamHandler = new PumpStreamHandler(out, out); DefaultExecutor executor = new DefaultExecutor(); executor.setStreamHandler(streamHandler); executor.execute(line
Re: [exec] Execution fails with quoted arguments
Hi Paulo, some stupid thought and it might not even be related to your problem aux is under Windows a reserved and can't be used as file name - see http://en.wikipedia.org/wiki/Filename - are you running the stuff under WIndows? Is it possible to rename the offending file to something different then .aux Cheers, Siegfried Goeschl On 24.04.14 14:36, Paulo Roberto Massa Cereda wrote: Dear friends, For some time, I was sure issue #54 (https://issues.apache.org/jira/browse/EXEC-54) was the culprit of one my programs misbehaving. Today, I decided to devote some time in understanding what's been happening in my code and apparently issue #54 does not appear to be culprit here! Here's a sample code that might explain what's happening. Note that I use two programs here (pdflatex and bibtex, hopefully available from any recent TeX distribution), and similar expansions lead to different results. Apologies for the long code excerpt. === @Test public void testCommonsExecExecution() throws IOException, InterruptedException { String program = bibtex; String argument = file with spaces.aux; CommandLine line = new CommandLine(program); line.addArgument(argument); // so far, everything ok assertEquals(line.toString(), [bibtex, \file with spaces.aux\]); DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler(); ByteArrayOutputStream out = new ByteArrayOutputStream(); PumpStreamHandler streamHandler = new PumpStreamHandler(out, out); DefaultExecutor executor = new DefaultExecutor(); executor.setStreamHandler(streamHandler); executor.execute(line, resultHandler); resultHandler.waitFor(); // bibtex is executed with file with spaces.aux.aux, // which is not what I expected assertEquals(out.toString(), I couldn't open file name `\file with spaces.aux\.aux'\n); program = pdflatex; argument = file with spaces.tex; line = new CommandLine(program); line.addArgument(argument); // so far, everything ok assertEquals(line.toString(), [pdflatex, \file with spaces.tex\]); resultHandler = new DefaultExecuteResultHandler(); out = new ByteArrayOutputStream(); streamHandler = new PumpStreamHandler(out, out); executor = new DefaultExecutor(); executor.setStreamHandler(streamHandler); executor.execute(line, resultHandler); resultHandler.waitFor(); // here, pdflatex works with file with spaces.tex assertTrue(out.toString().contains(! I can't find file `\file with spaces.tex\'.)); } === Note that Exec has both [ bibtex, file with spaces.aux ] [ pdflatex, file with spaces.tex ] parsed correctly, but only the latter execution is properly done. Now I'm not sure if it's even Exec's fault, but what strikes me is the fact that with pdflatex, the execution works. Maybe I'm missing something obvious. Could you guys shed some light into this problem? All the best, Paulo - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [exec] Execution fails with quoted arguments
Hi Pauolo, sorry for the next dumb question (but I'm actually quite good at it) * what is the result of the failed bibtex invocation? * is bibtex a native binary or a shell script? * depending on the error - can you replace the bibtex with a shell script to dump the current working directory - sometime the things are not executing where you expect them (just battled Java-native launchers where the current working directory can't be set Cheers, Siegfried Goeschl On 24.04.14 15:07, Paulo Roberto Massa Cereda wrote: Hello Siegfried! Wow, thanks for the fast response. :) Deeply sorry, I forgot to mention the environment. I'm running my code under Linux (Fedora 20, Java 1.7.0) and MacOSX (Mavericks, 10.9.2). I was unaware of the .aux thing under Windows, it's good to know about it; TeX tools use .aux files all the time, so it might be interesting to investigate some side effects from it. :) Apparently, the error persists with other tool named makeglossaries that also uses this .aux file. I'm starting to get scared. :) All the best, Paulo Em 24-04-2014 09:50, Siegfried Goeschl escreveu: Hi Paulo, some stupid thought and it might not even be related to your problem aux is under Windows a reserved and can't be used as file name - see http://en.wikipedia.org/wiki/Filename - are you running the stuff under WIndows? Is it possible to rename the offending file to something different then .aux Cheers, Siegfried Goeschl On 24.04.14 14:36, Paulo Roberto Massa Cereda wrote: Dear friends, For some time, I was sure issue #54 (https://issues.apache.org/jira/browse/EXEC-54) was the culprit of one my programs misbehaving. Today, I decided to devote some time in understanding what's been happening in my code and apparently issue #54 does not appear to be culprit here! Here's a sample code that might explain what's happening. Note that I use two programs here (pdflatex and bibtex, hopefully available from any recent TeX distribution), and similar expansions lead to different results. Apologies for the long code excerpt. === @Test public void testCommonsExecExecution() throws IOException, InterruptedException { String program = bibtex; String argument = file with spaces.aux; CommandLine line = new CommandLine(program); line.addArgument(argument); // so far, everything ok assertEquals(line.toString(), [bibtex, \file with spaces.aux\]); DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler(); ByteArrayOutputStream out = new ByteArrayOutputStream(); PumpStreamHandler streamHandler = new PumpStreamHandler(out, out); DefaultExecutor executor = new DefaultExecutor(); executor.setStreamHandler(streamHandler); executor.execute(line, resultHandler); resultHandler.waitFor(); // bibtex is executed with file with spaces.aux.aux, // which is not what I expected assertEquals(out.toString(), I couldn't open file name `\file with spaces.aux\.aux'\n); program = pdflatex; argument = file with spaces.tex; line = new CommandLine(program); line.addArgument(argument); // so far, everything ok assertEquals(line.toString(), [pdflatex, \file with spaces.tex\]); resultHandler = new DefaultExecuteResultHandler(); out = new ByteArrayOutputStream(); streamHandler = new PumpStreamHandler(out, out); executor = new DefaultExecutor(); executor.setStreamHandler(streamHandler); executor.execute(line, resultHandler); resultHandler.waitFor(); // here, pdflatex works with file with spaces.tex assertTrue(out.toString().contains(! I can't find file `\file with spaces.tex\'.)); } === Note that Exec has both [ bibtex, file with spaces.aux ] [ pdflatex, file with spaces.tex ] parsed correctly, but only the latter execution is properly done. Now I'm not sure if it's even Exec's fault, but what strikes me is the fact that with pdflatex, the execution works. Maybe I'm missing something obvious. Could you guys shed some light into this problem? All the best, Paulo - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [email] TLS not verified properly (security issue)
Hi Thomas, I check with my test case and update the documentation accordingly Thanks, Siegfried Goeschl On 09.10.13 22:42, Thomas Neidhart wrote: On 10/09/2013 12:26 PM, Carl Erberg wrote: Hi, in the user guide to commons email http://commons.apache.org/proper/commons-email/userguide.html I found the rather surprising statement: When using a secured transport (STARTTLS or SSL) you can force validating the server's certificate by calling Email.setSSLCheckServerIdentity(true). Having said that this does not seem to work on any of my test servers (GMAIL, GMX). I can confirm that my code also does not complain when I test it against a server with a self signed certificate. setSSLCeckServerIdentity not working means that commons email is vulnerable to MiTM attacks. Is there a fix for this? Am I doing something wrong? Some misunderstanding? Any workaround? Is the user guide wrong? [ I would not discuss such a security issue on a public mailing list, if it wasn't already disclosed in the user guide ] Hi Carl, I have tested sending emails to GMAIL and a local postfix installation with a self-signed certificate. For the purpose of debugging the ssl handshake, I enabled the following debug switch: System.setProperty(javax.net.debug, all); Results: * GMAIL: SSL and TLS work fine, the gmail server certificate is reported as trusted: Found trusted certificate: [ [ Version: V3 Subject: OU=Equifax Secure Certificate Authority, O=Equifax, C=US Signature Algorithm: SHA1withRSA, OID = 1.2.840.113549.1.1.5 * LOCAL: - without adding my local certificate to my trustStore, I get the following exception: Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:221) at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:145) at sun.security.validator.Validator.validate(Validator.java:203) at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:172) at com.sun.net.ssl.internal.ssl.JsseX509TrustManager.checkServerTrusted(SSLContextImpl.java:320) at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:841) ... 45 more Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:236) at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:194) at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:216) ... 50 more - after adding the certificate to my trustStore, I can successfully connect to the server and send emails So it seems to work fine for me. The problem stated in the userguide may relate to a time where the root CA (Equifax Secure Certificate Authority) of the gmail certificate was not yet in the default trustStore (it is now btw). Best regards, Thomas - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [EXEC] Performance problem
Hi Mehmet, a few questions * what is slowly versus faster in terms of your application? * does your application create a lot of output on stdout? Thanks in advance Siegfried Goeschl On 11.06.13 20:54, Mehmet Emin PAÇA wrote: Hi, I am running an exe file using commons-exec 1.1 version.But there are performance problems occuring. I mean when I compared running performances using cmd.exe vs running from a java application(using commons-exec), the application which called in common-exec is working slowly. But the other application run from cmd.exe is working faster. What can be problem ? Running exe file from my simple java application code is below: *CommandLine cmdlLine = CommandLine.parse(Application.exe); watchDog = new ExecuteWatchdog(ExecuteWatchdog.INFINITE_TIMEOUT); DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler(); Executor executor = new DefaultExecutor(); executor.setExitValue(0); executor.setWatchdog(watchDog); executor.execute(cmdlLine,resultHandler);* Running from cmd.exe: *C:\Users\test.user Application.exe * Thanks, - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [email] DKIM Signing
Hi Zhihong, AFAIK this is done by the mail server and not commons-email Cheers, Siegfried Goeschl On 19.04.13 12:48, Zhihong Zhang wrote: We just switched to Commons Email and everything works great. I just got a request to DKIM-sign the email. What's the best approach to sign the mail with Commons Email? Thanks for your help! Zhihong - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: commons-email sending email twice?
Indeed I do ... :-) ... Email.send() returns the msg id Cheers, Siegfried Goeschl On 01.04.13 19:12, David Hoffer wrote: Do you know the API to get that ID? I'd like to add that to the logs. -Dave On Mon, Apr 1, 2013 at 11:03 AM, Siegfried Goeschl sgoes...@gmx.at wrote: Hi folks, log seems okay - a few hints A hint every message constructed by the mail api has a unique mail id (if not overwritten by the application) - if your duplicates have different mail ids then the application sent indeed two emails Cheers, Siegfried Goeschl On 30.03.13 07:43, Maurizio Cucchiara wrote: Looking at the log, seems everything right to me. Anyway, when I face this kind of trouble (SMTP protocol is a strange beast :)), my best friend is tcpdump/wireshark. Tcpdump will address you to the side where you have to investigate. Twitter :http://www.twitter.com/m_**cucchiarahttp://www.twitter.com/m_cucchiara G+ :https://plus.google.com/**107903711540963855921https://plus.google.com/107903711540963855921 Linkedin :http://www.linkedin.com/in/**mauriziocucchiarahttp://www.linkedin.com/in/mauriziocucchiara VisualizeMe: http://vizualize.me/maurizio.** cucchiara?r=maurizio.cucchiarahttp://vizualize.me/maurizio.cucchiara?r=maurizio.cucchiara Maurizio Cucchiara On 30 March 2013 01:48, David Hoffer dhoff...@gmail.com wrote: I was able to redirect the system outputs to the log file...just easier that way for me. Here is what's in the log file (with some email addresses mods to protect the innocent): 2013-03-30 00:30:49,524 [main] INFO SYSOUT - DEBUG: JavaMail version 1.4.4 2013-03-30 00:30:49,533 [main] INFO SYSOUT - DEBUG: successfully loaded resource: /META-INF/javamail.default.**providers 2013-03-30 00:30:49,533 [main] INFO SYSOUT - DEBUG: Tables of loaded providers 2013-03-30 00:30:49,533 [main] INFO SYSOUT - DEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.**SMTPSSLTransport=javax.mail.** Provider[TRANSPORT,smtps,com.**sun.mail.smtp.**SMTPSSLTransport,Sun Microsystems, Inc], com.sun.mail.smtp.**SMTPTransport=javax.mail.** Provider[TRANSPORT,smtp,com.**sun.mail.smtp.SMTPTransport,**Sun Microsystems, Inc], com.sun.mail.imap.**IMAPSSLStore=javax.mail.** Provider[STORE,imaps,com.sun.**mail.imap.IMAPSSLStore,Sun Microsystems, Inc], com.sun.mail.pop3.**POP3SSLStore=javax.mail.** Provider[STORE,pop3s,com.sun.**mail.pop3.POP3SSLStore,Sun Microsystems, Inc], com.sun.mail.imap.IMAPStore=**javax.mail.Provider[STORE,** imap,com.sun.mail.imap.**IMAPStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3Store=**javax.mail.Provider[STORE,** pop3,com.sun.mail.pop3.**POP3Store,Sun Microsystems, Inc]} 2013-03-30 00:30:49,533 [main] INFO SYSOUT - DEBUG: Providers Listed By Protocol: {imaps=javax.mail.Provider[**STORE,imaps,com.sun.mail.imap.** IMAPSSLStore,Sun Microsystems, Inc], imap=javax.mail.Provider[**STORE,imap,com.sun.mail.imap.**IMAPStore,Sun Microsystems, Inc], smtps=javax.mail.Provider[**TRANSPORT,smtps,com.sun.mail.** smtp.SMTPSSLTransport,Sun Microsystems, Inc], pop3=javax.mail.Provider[**STORE,pop3,com.sun.mail.pop3.**POP3Store,Sun Microsystems, Inc], pop3s=javax.mail.Provider[**STORE,pop3s,com.sun.mail.pop3.** POP3SSLStore,Sun Microsystems, Inc], smtp=javax.mail.Provider[**TRANSPORT,smtp,com.sun.mail.** smtp.SMTPTransport,Sun Microsystems, Inc]} 2013-03-30 00:30:49,533 [main] INFO SYSOUT - DEBUG: successfully loaded resource: /META-INF/javamail.default.**address.map 2013-03-30 00:30:49,543 [main] INFO SYSOUT - DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,**smtp,com.sun.mail.smtp.** SMTPTransport,Sun Microsystems, Inc] 2013-03-30 00:30:49,543 [main] INFO SYSOUT - DEBUG SMTP: useEhlo true, useAuth true 2013-03-30 00:30:49,543 [main] INFO SYSOUT - DEBUG SMTP: useEhlo true, useAuth true 2013-03-30 00:30:49,543 [main] INFO SYSOUT - DEBUG SMTP: trying to connect to host smtp.gmail.com, port 587, isSSL false 2013-03-30 00:30:49,567 [main] INFO SYSOUT - 220 mx.google.com ESMTP dt10sm10366067qab.0 - gsmtp 2013-03-30 00:30:49,567 [main] INFO SYSOUT - DEBUG SMTP: connected to host smtp.gmail.com, port: 587 2013-03-30 00:30:49,567 [main] INFO SYSOUT - EHLO ip-10-144-154-209.ec2.internal 2013-03-30 00:30:49,585 [main] INFO SYSOUT - 250-mx.google.com at your service, [23.23.77.108] 250-SIZE 35882577 250-8BITMIME 250-STARTTLS 250 ENHANCEDSTATUSCODES 2013-03-30 00:30:49,585 [main] INFO SYSOUT - DEBUG SMTP: Found extension SIZE, arg 35882577 2013-03-30 00:30:49,585 [main] INFO SYSOUT - DEBUG SMTP: Found extension 8BITMIME, arg 2013-03-30 00:30:49,585 [main] INFO SYSOUT - DEBUG SMTP: Found extension STARTTLS, arg 2013-03-30 00:30:49,585 [main] INFO SYSOUT - DEBUG SMTP: Found extension ENHANCEDSTATUSCODES, arg 2013-03-30 00:30:49,585 [main] INFO SYSOUT - STARTTLS 2013-03-30 00:30:49,596 [main] INFO SYSOUT - 220 2.0.0 Ready to start TLS 2013-03-30 00:30:49,680 [main] INFO SYSOUT - EHLO ip-10-144-154-209.ec2.internal 2013-03-30 00:30:49,691 [main] INFO
Re: Remove headers on multipart email
Hi Ricardo, that is rather strange, since the from is the FROM address and is AFAIK mandatory according to RFC822 - so you are asked to send an invalid MimeMessage?! Can you check out if you can get the underlying MimeMessage (Email is just a wrapper) and tinker with it ... Cheers, Siegfried Goeschl On 15.02.13 22:44, Ricardo Bevilacqua wrote: Hi to all! I'm facing the following issue: my client has an SMTP server that blocks incomming mails that have the from header for some reason. If the mail doesn't have this header, it works. So my question is if there is a chance to remove this header. I've already tried to set the headers to null like this: code email.setHeaders(null); /code But that gives an exception. I also tried to set the From header empty: code HashMap String, String headers = new HashMapString, String(); headers.put(From, ); email.setHeaders(headers); /code But that gives an exception as well. Your help is greatly appreciated. Greetings, Richard. - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: Why execute a ping unavailable address will raise exception?
Hi folks, this works as expected - you start an external application and this application returns an exit value. Under many OS an non-zero exit value is considered as an error code hence commons-exec throws an exception (please note that the good exit values are OS-specific). So in your use case the behavior is perfectly reasonable since ping NOEXISTINGHOST does indeed not work properly. If you would like to consider certain exit values as success than checkout DefaultExecutor#setExitValue() Cheers, Siegfried Goeschl On 07.11.12 08:38, Yi Huang wrote: I did not use exec for a while but from what I remember, you had better set the default exit value. For example, if default exit value is set to 1, then exec will return 1 if it think the command is ok. Then your system will say there is an error because the system exit value 1 is an error while 0 is normal. Hope that helps somehow. --Yi Huang 2012/11/7 nie fei teclu...@gmail.com I'm a new learner for this API. Sorry for the last mail, my mistake with wrong button. CommandLine cmdLine = CommandLine.parse(ping 10.80.41.171 -n 1); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); DefaultExecutor exec = new DefaultExecutor(); PumpStreamHandler streamHandler = new PumpStreamHandler( outputStream); exec.setStreamHandler(streamHandler); exec.execute(cmdLine); System.out.println(outputStream.toString()); Normally, if the address is available, then there will be no exception raised. Otherwise, the exec.execute(cmdLine) will raise exception: Process exited with an error: 1 (Exit value: 1) Is it normal? Can anyone explain why? - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: Fwd: About mail and jdk 7
H Fabien, commons-email is not deprecated and using GMail SMTP is known to work. Please check your stack trace - the sun.security.ssl classes are used my mail-1.4.1.jar not it is a dependency. So if you are pulling in the wrong classes there must be a reason for that and this is probably caused by your environment. Can you try it with a different computer and/or JDK? Cheers, Siegfried Goeschl On 06.11.12 14:27, Fabien Grenier wrote: Hi there, I have a problem using commons.mail with jdk 7. I try to send an email by gmail smtp and I got the trace enclosed. It seems that commons.mail try to use old version of sun.security.ssl.* because when I try to come to the specific line of the trace with Eclipse, I got unvalid line number error. I can't find anything googling that. I can't be the only one person trying to send email with jdk 7 ? Is commons.mail deprecated ? Thanks for your help ! Fabien - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
[Email] Re: Fwd: About mail and jdk 7
Hi Fabien, good to hear and thanks for your feedback ... Cheers, Siegfried Goeschl On 07.11.12 17:05, Fabien Grenier wrote: Thanks for your answers. I tried to create a little test project with commons.email and jdk7 and it works. So, as you said Siegfried, my environment should be the problem. Best regards, --* **Fabien GRENIER* *RTONE */RD engineer/ www.rtone.fr http://www.rtone.fr - www.rbeesolar.com http://www.rbeesolar.com Tel: +33 (0)4 74 05 03 49 Fax: +33 (0)4 74 89 28 80 On Wed, Nov 7, 2012 at 9:15 AM, Siegfried Goeschl siegfried.goes...@it20one.at mailto:siegfried.goes...@it20one.at wrote: H Fabien, commons-email is not deprecated and using GMail SMTP is known to work. Please check your stack trace - the sun.security.ssl classes are used my mail-1.4.1.jar not it is a dependency. So if you are pulling in the wrong classes there must be a reason for that and this is probably caused by your environment. Can you try it with a different computer and/or JDK? Cheers, Siegfried Goeschl On 06.11.12 14:27, Fabien Grenier wrote: Hi there, I have a problem using commons.mail with jdk 7. I try to send an email by gmail smtp and I got the trace enclosed. It seems that commons.mail try to use old version of sun.security.ssl.* because when I try to come to the specific line of the trace with Eclipse, I got unvalid line number error. I can't find anything googling that. I can't be the only one person trying to send email with jdk 7 ? Is commons.mail deprecated ? Thanks for your help ! Fabien - To unsubscribe, e-mail:user-unsubscr...@commons.apache.org mailto:user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org mailto:user-h...@commons.apache.org
Re: [email] Version 1.3 in SVN?
Hi Stefan, the error message indicates that the SMTP server is not responding on the port Only the methods are deprecated and not the functionality ... :-) ... for an explaination please see https://issues.apache.org/jira/browse/EMAIL-105 So the methods would be * setSSLOnConnect - Sets whether SSL/TLS encryption should be enabled for the SMTP transport upon connection (SMTPS/POPS) * setStartTLSRequired - Set or disable the required STARTTLS encryption in both cases you wold use a secured connection for sending emails Cheers, Siegfried Goeschl On 25.08.12 22:48, Stefan at WPF wrote: Hello Siegfried, thank you for your reply. Today I finally had the chance to test 1.3. I tried sending a mail using TLS, however I always get a tiemout, here's the code: Email email = new SimpleEmail(); email.setSmtpPort(465); email.setAuthenticator(new DefaultAuthenticator(user, pass)); email.setDebug(false); email.setHostName(host.com http://host.com); email.setFrom(f...@host.com mailto:f...@host.com); email.setSubject(Hi); email.setMsg(This is a test mail ... :-)); email.addTo(t...@host.com mailto:t...@host.com); email.setTLS(true); email.send(); This gives me Exception in thread main org.apache.commons.mail.EmailException: Sending the email to the following server failed : host.com:465 http://host.com:465 at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1189) at org.apache.commons.mail.Email.send(Email.java:1214) at Mailtest.main(Mailtest.java:26) Caused by: javax.mail.MessagingException: Exception reading response; nested exception is: java.net.SocketTimeoutException: Read timed out at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:2210) at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1950) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:642) at javax.mail.Service.connect(Service.java:317) at javax.mail.Service.connect(Service.java:176) at javax.mail.Service.connect(Service.java:125) at javax.mail.Transport.send0(Transport.java:194) at javax.mail.Transport.send(Transport.java:124) at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1179) ... 2 more Caused by: java.net.SocketTimeoutException: Read timed out at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(SocketInputStream.java:150) at java.net.SocketInputStream.read(SocketInputStream.java:121) at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:110) at java.io.BufferedInputStream.fill(BufferedInputStream.java:235) at java.io.BufferedInputStream.read(BufferedInputStream.java:254) at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:89) at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:2188) ... 10 more Also I am wondering, what is the best way to send an email using TLS? setTLS is marked as deprecated? Thank you very much and best regards Stefan 2012/8/21 Siegfried Goeschl siegfried.goes...@it20one.at mailto:siegfried.goes...@it20one.at Hi Stefan, the vote did not pass simply because it did not attracted enough +1s ... :-( Technically the 1.3 release is the current trunk or the following SVN URL https://svn.apache.org/repos/asf/commons/proper/email/tags/EMAIL_1_3_RC3 If you give it a try it would be highly appreciated if you write a quick feedback (even if it worx without issues) ... ;-) Cheers, Siegfried Goeschl On 15.08.12 12:20, Stefan at WPF wrote: Hello, I think I have read that 1.3 is already finished, just not yet released, because it didn't pass the voting. 1) Anyone knows why it did not pass the voting? What's the problem with 1.3? 2) How can I find 1.3 on the SVN? Thanks :-) Best regards Stefan - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org mailto:user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org mailto:user-h...@commons.apache.org
Re: [email] Download Commons Email (1.3) not available on Website
Hi Raj, the vote for commons-email-1.3 release failed (therefore the library was nor released) and that's the reason why the library is not available on any mirrors. I will cut another RC tonight but you can check the current SVN trunk to get the latest (but unreleased) version Cheers, Siegfried Goeschl On 14.06.12 09:07, Raj Dave wrote: Hi, I am attempting to download the latest and current version (1.3) of the Commons Email so that I utilise the utf-8 charset. Can anyone assist with getting this file (commons-email-1.3-bin.zip). I tried to download it from the http://commons.apache.org/email/download_email.cgi url but there appears to be a problem with all mirrors including backup mirrors. Your help would be greatly appreciated. Regards Raj --- Raj Dave Application Developer --- - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [exec] How to ensure a subprocess ends with the parent application
Hi Robert, welcome at the Apache Commons mailing list then ... :-) Can you check out ProcessDestroyer and its implementation ShutdownHookProcessDestroyer - ShutdownHookProcessDestroyer registers a shutdown hook at JVM level and should do the trick in your case. Some test code is found at DefaultExecutorTest.java Cheers, Siegfried Goeschl On 22.04.12 11:59, Robert Heumüller wrote: Hello, this is my first post on the apache-commons mailing list - actually it's my first venture into mailing lists in general :) I currently use commons-exec in order to start instances of avahi-browse and avahi-publish. Everything seems to work neatly excepting the fact that avahi-publish does not quit when the application ends (for example when I kill via stop button in eclipse). How can I ensure that a subprocess started by exec is terminated when the parent process dies? My code looks like this: http://privatepaste.com/a6b0a35a3c Thank you for your assistance - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [email] JavaMail works Commons Email does not
Hi folks, it is also useful to call Mail.setDebug(true) which turns on the debugging of the mail session. Having said that some stepping though the code might provide some insight ... :-) Cheers, Siegfried Goeschl On 10.01.12 12:06, Christian Grobmeier wrote: On Tue, Jan 10, 2012 at 11:54 AM, Frank Sullivan fsulli...@strikeind.com wrote: Nothing happens. No exceptions. No logging (I set logging for org.apache.commons.mail to TRACE). Nothing. Thats weird. Have you tried to debug and look if all properties are set or if the code is actually called? Cheers Thanks, Frank -Original Message- From: Konstantin Kolinko [mailto:knst.koli...@gmail.com] Sent: Tuesday, January 10, 2012 5:37 AM To: Commons Users List Subject: Re: [email] JavaMail works Commons Email does not 2012/1/10 Frank Sullivanfsulli...@strikeind.com: I have a web application (Flex, Spring, Hibernate) that has a simple email module that uses Common Email. Currently it only sends plain text messages. Here is basically what happens: HtmlEmail email = new HtmlEmail(); email.setHostName(smtpHost); email.setAuthentication(smtpUser, smtpPassword); email.setTextMsg(plainText); email.setSubject(subject); email.addTo(recipientAddress); email.setFrom(fromAddress); email.send(); The problem is that is only works when invoke it from simple Java application. It does not work from a within the Spring service that is running in the Tomcat container. Even weirder is that if I put straight JavaMail code in the Spring service, it works! Properties props = new Properties(); props.put(mail.smtp.host, smtpHost); props.put(mail.smtp.user, smtpUser); props.put(mail.smtp.password, smtpPassword); Session session = Session.getDefaultInstance(props); Message msg = new MimeMessage(session); msg.setFrom(new InternetAddress(fromAddress)); msg.setRecipients(Message.RecipientType.TO, new InternetAddress[]{new InternetAddress(recipientAddress)}); msg.setSubject(subject); msg.setText(plainText); Transport.send(msg); Any clues? How exactly it fails? What exception is there if any? Best regards, Konstantin Kolinko - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [exec]How could I use exec to execute a java program with keyboard input in it?
Hi, if I understand that correctly you would like to get some keyboard input for your child process - I have never done that but I think the following snippet from DefaultExecutorTest might show you the way Cheers, Siegfried Goeschl /** * The test script reads an argument from codestdincode and prints * the result to stdout. To make things slightly more interesting * we are using an asynchronous process. * * @throws Exception the test failed */ public void testStdInHandling() throws Exception { ByteArrayInputStream bais = new ByteArrayInputStream(Foo.getBytes()); // newline not needed; causes problems for VMS CommandLine cl = new CommandLine(this.stdinSript); PumpStreamHandler pumpStreamHandler = new PumpStreamHandler( this.baos, System.err, bais); DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler(); Executor executor = new DefaultExecutor(); executor.setStreamHandler(pumpStreamHandler); executor.execute(cl, resultHandler); resultHandler.waitFor(WAITFOR_TIMEOUT); assertTrue(ResultHandler received a result, resultHandler.hasResult()); assertFalse(exec.isFailure(resultHandler.getExitValue())); String result = baos.toString(); assertTrue(Result '+result+' should contain 'Hello Foo!', result.indexOf(Hello Foo!) = 0); } On 27.09.11 09:41, Yi Huang wrote: For example: import java.util.Scanner; public class ToBeCalled { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); int t = keyboard.nextInt(); System.out.println(t); } } How could I use exec to let it run properly? I have tried this: // compile cmdline = CommandLine.parse(javac); executor = new DefaultExecutor(); cmdline.addArgument(ToBeCalled.java); exitValue = executor.execute(cmdline); System.out.println(compile: + exitValue); // run cmdline = CommandLine.parse(java); cmdline.addArgument(ToBeCalled); cmdline.addArgument(abc); cmdline.addArgument(def); executor = new DefaultExecutor(); exitValue = executor.execute(cmdline); System.out.println(run: + exitValue); It did compile, but crashed and said that there is no argument in nextInt() How could I fix that? - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [exec] Draining process output/error
Hi Diane, I think the best is to have a look at the JUnit test of commons-exec - there are a few examples how to consume stdout/stderr either pumping into stdout/stderr or collecting into a byte[] Regarding your requirements +) is it possible that your code can get stuck - if yes checkout Watchdog +) please note that there are issues killing grand-children processes of your child process (think recursive killing) Cheers, Siegfried Goeschl On 03.08.11 22:25, Diane Baumgartner wrote: Hi all, I'm trying to run a shell script from a Java program. I finally got a trivial example working wtih ProcessBuilder, and learned that I had to be sure to capture the child process's output so that my program would work correctly. I have also seen the warning in the Sun documentation which states, It is possible that the examples will deadlock if the subprocess generates enough output to overflow the system. A more robust solution requires draining the process stdout and stder in separate threads. That got me looking for information on draining these streams, and also led me to find Apache commons exec. My ultimate goal is to have the following. a. Java program calls shell script when user pushes a button. b. Shell script executes a sql script. This script produces several output files, some of which can be large. c. Shell script then calls a java program which uses Apache Commons Net to FTP the files to an FTP server. I have already successfully tested parts b and c, so now I'm trying to add part a (Java calls shell script). My problem is that I'm having a hard time finding examples of how to drain the stdout/stderr for large amounts of data. I have looked at the documentation, but don't have much experience with dealing with either streams or threads. Can you please point me in the right direction? Thanks. - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [email] Email attachment is inline for some reason
Hi David, that sound a little bit strange - can you have a look at the JUnit tests? There is an EmailLiveTest which allows sending real emails with a bit of tinkering - I suggest to have a look at the test, configure them to send test emails to your email account and then double-check your production code. Cheers, Siegfried Goeschl On 06.07.11 05:46, David Hoffer wrote: I have a strange problem. I've used commons-email for a while now with good success but now all of the sudden it isn't working right and I don't know why. The emails have 3 problems: 1. Although I attach a file to the email as an attachment it is received inline as base64 encoded text. I.e. my code does this: attachment.setDisposition(EmailAttachment.ATTACHMENT); 2. The subject is replaced with this: (no subject) 3. The from and reply to email addresses are dropped and replaced with the email address used in as the authenticator. This is only a problem when I run the code on the production server which is Linux (hosted virtual server). It works as expected on Windows during test. This code on the Linux server used to work but it was a prior build, not sure what changed but nothing in the email code changed...just a different file being sent with different description. Any ideas why these three things might be occurring? -Dave - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [email] Email attachment is inline for some reason
More specifically - do you have the geronimo mail libraries in your classpath? Cheers, Siegfried Goeschl On 06.07.11 14:28, James Carman wrote: Are you sure you have a clean classpath? Sent from my Android device. Please excuse typos and brevity. On Jul 6, 2011 8:12 AM, David Hofferdhoff...@gmail.com wrote: I've had another email failure this time it's usage with no attachment. I'll paste the code below. It's dropping the subject...same as the other case. Note that (No Subject) is being added by GMail on the receiving side as all emails with no subject show that. try { Email email = new SimpleEmail(); email.setHostName(smtp.gmail.com); email.setSmtpPort(587); final String gMailUsername = appProperties.getGMailUsername(); email.setAuthenticator(new DefaultAuthenticator(gMailUsername, appProperties.getGMailPassword())); email.setTLS(true); email.setFrom(gMailUsername); email.setSubject(App System Error); email.setMsg(msg); String[] toEmails = appProperties.getSystemErrorSendToEmails(); for (String toEmail : toEmails) { email.addTo(toEmail); } email.send(); } catch (EmailException e) { log.error(Failed to send system email, e); } Thanks, -Dave On Wed, Jul 6, 2011 at 3:08 AM, Siegfried Goeschl siegfried.goes...@it20one.at wrote: Hi David, that sound a little bit strange - can you have a look at the JUnit tests? There is an EmailLiveTest which allows sending real emails with a bit of tinkering - I suggest to have a look at the test, configure them to send test emails to your email account and then double-check your production code. Cheers, Siegfried Goeschl On 06.07.11 05:46, David Hoffer wrote: I have a strange problem. I've used commons-email for a while now with good success but now all of the sudden it isn't working right and I don't know why. The emails have 3 problems: 1. Although I attach a file to the email as an attachment it is received inline as base64 encoded text. I.e. my code does this: attachment.setDisposition(**EmailAttachment.ATTACHMENT); 2. The subject is replaced with this: (no subject) 3. The from and reply to email addresses are dropped and replaced with the email address used in as the authenticator. This is only a problem when I run the code on the production server which is Linux (hosted virtual server). It works as expected on Windows during test. This code on the Linux server used to work but it was a prior build, not sure what changed but nothing in the email code changed...just a different file being sent with different description. Any ideas why these three things might be occurring? -Dave --**--**- To unsubscribe, e-mail: user-unsubscribe@commons.**apache.org user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org --**--**- To unsubscribe, e-mail: user-unsubscribe@commons.**apache.org user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [email] Email attachment is inline for some reason
Hi David, this is a common issue coming up regularly (and the FAQ section is somehow missing on the deployed site which addresses the problem), e.g. see http://brightdadson.blogspot.com/2010/06/if-you-are-working-on-spring-web.html I would recommend to exclude all geronimo specs jars for javamail and activation and I'm pretty sure that this solves the issue ... :-) Cheers, Siegfried Goeschl On 06.07.11 15:31, David Hoffer wrote: Or can/should I configure commons-email to use geronimo? -Dave On Wed, Jul 6, 2011 at 7:25 AM, David Hoffer dhoff...@gmail.com mailto:dhoff...@gmail.com wrote: I didn't think so at first...but yes I do have geronimo-javamail_1.4_spec-1.3.jar geronimo-activation_1.1_spec-1.0.2.jar plus a bunch of other geronimo-xxx jars. I'm not sure where these came from but I do use CXF (web service) so I'm guessing geronimo is used by CXF. Also I have activation-1.1.jar and mail-1.4.1.jar used by commons-email-1.2.jar. Is that the problem that I have two mail jars? Can I safely exclude the geronimo-javamail_1.4_spec-1.3.jar geronimo-activation_1.1_spec-1.0.2.jar from CXF's dependencies? Thanks, -Dave On Wed, Jul 6, 2011 at 6:58 AM, Siegfried Goeschl siegfried.goes...@it20one.at mailto:siegfried.goes...@it20one.at wrote: More specifically - do you have the geronimo mail libraries in your classpath? Cheers, Siegfried Goeschl On 06.07.11 14:28, James Carman wrote: Are you sure you have a clean classpath? Sent from my Android device. Please excuse typos and brevity. On Jul 6, 2011 8:12 AM, David Hofferdhoff...@gmail.com mailto:dhoff...@gmail.com wrote: I've had another email failure this time it's usage with no attachment. I'll paste the code below. It's dropping the subject...same as the other case. Note that (No Subject) is being added by GMail on the receiving side as all emails with no subject show that. try { Email email = new SimpleEmail(); email.setHostName(smtp.gmail.com http://smtp.gmail.com); email.setSmtpPort(587); final String gMailUsername = appProperties.getGMailUsername(); email.setAuthenticator(new DefaultAuthenticator(gMailUsername, appProperties.getGMailPassword())); email.setTLS(true); email.setFrom(gMailUsername); email.setSubject(App System Error); email.setMsg(msg); String[] toEmails = appProperties.getSystemErrorSendToEmails(); for (String toEmail : toEmails) { email.addTo(toEmail); } email.send(); } catch (EmailException e) { log.error(Failed to send system email, e); } Thanks, -Dave On Wed, Jul 6, 2011 at 3:08 AM, Siegfried Goeschl siegfried.goes...@it20one.at mailto:siegfried.goes...@it20one.at wrote: Hi David, that sound a little bit strange - can you have a look at the JUnit tests? There is an EmailLiveTest which allows sending real emails with a bit of tinkering - I suggest to have a look at the test, configure them to send test emails to your email account and then double-check your production code. Cheers, Siegfried Goeschl On 06.07.11 05:46, David Hoffer wrote: I have a strange problem. I've used commons-email for a while now with good success but now all of the sudden it isn't working right and I don't know why. The emails have 3 problems: 1. Although I attach a file to the email as an attachment it is received inline as base64 encoded text. I.e. my code does this: attachment.setDisposition(**EmailAttachment.ATTACHMENT); 2. The subject is replaced with this: (no subject) 3. The from and reply to email addresses are dropped and replaced with the email address used in as the authenticator. This is only a problem when I run the code on the production server
Re: [email] Email attachment is inline for some reason
Hi David, the following snippet might help if you update it accordingly - this are the exclude I'm using for one of my projects. If it works please don't hesitate to send a success message - we all love to hear when something works ... ;-) Cheers, Siegfried Goeschl !-- Apache CXF -- dependency groupIdorg.apache.cxf/groupId artifactIdcxf-rt-frontend-jaxws/artifactId version${it20one.cxf.version}/version exclusions exclusion groupIdorg.apache.geronimo.specs/groupId artifactIdgeronimo-javamail_1.4_spec/artifactId /exclusion exclusion groupIdorg.apache.geronimo.specs/groupId artifactIdgeronimo-activation_1.1_spec/artifactId /exclusion /exclusions /dependency dependency groupIdorg.apache.cxf/groupId artifactIdcxf-rt-transports-http/artifactId version${it20one.cxf.version}/version exclusions exclusion groupIdorg.apache.geronimo.specs/groupId artifactIdgeronimo-javamail_1.4_spec/artifactId /exclusion exclusion groupIdorg.apache.geronimo.specs/groupId artifactIdgeronimo-activation_1.1_spec/artifactId /exclusion /exclusions /dependency On 06.07.11 15:31, David Hoffer wrote: Or can/should I configure commons-email to use geronimo? -Dave On Wed, Jul 6, 2011 at 7:25 AM, David Hoffer dhoff...@gmail.com mailto:dhoff...@gmail.com wrote: I didn't think so at first...but yes I do have geronimo-javamail_1.4_spec-1.3.jar geronimo-activation_1.1_spec-1.0.2.jar plus a bunch of other geronimo-xxx jars. I'm not sure where these came from but I do use CXF (web service) so I'm guessing geronimo is used by CXF. Also I have activation-1.1.jar and mail-1.4.1.jar used by commons-email-1.2.jar. Is that the problem that I have two mail jars? Can I safely exclude the geronimo-javamail_1.4_spec-1.3.jar geronimo-activation_1.1_spec-1.0.2.jar from CXF's dependencies? Thanks, -Dave On Wed, Jul 6, 2011 at 6:58 AM, Siegfried Goeschl siegfried.goes...@it20one.at mailto:siegfried.goes...@it20one.at wrote: More specifically - do you have the geronimo mail libraries in your classpath? Cheers, Siegfried Goeschl On 06.07.11 14:28, James Carman wrote: Are you sure you have a clean classpath? Sent from my Android device. Please excuse typos and brevity. On Jul 6, 2011 8:12 AM, David Hofferdhoff...@gmail.com mailto:dhoff...@gmail.com wrote: I've had another email failure this time it's usage with no attachment. I'll paste the code below. It's dropping the subject...same as the other case. Note that (No Subject) is being added by GMail on the receiving side as all emails with no subject show that. try { Email email = new SimpleEmail(); email.setHostName(smtp.gmail.com http://smtp.gmail.com); email.setSmtpPort(587); final String gMailUsername = appProperties.getGMailUsername(); email.setAuthenticator(new DefaultAuthenticator(gMailUsername, appProperties.getGMailPassword())); email.setTLS(true); email.setFrom(gMailUsername); email.setSubject(App System Error); email.setMsg(msg); String[] toEmails = appProperties.getSystemErrorSendToEmails(); for (String toEmail : toEmails) { email.addTo(toEmail); } email.send(); } catch (EmailException e) { log.error(Failed to send system email, e); } Thanks, -Dave On Wed, Jul 6, 2011 at 3:08 AM, Siegfried Goeschl siegfried.goes...@it20one.at mailto:siegfried.goes...@it20one.at wrote: Hi David, that sound a little bit strange - can you have a look at the JUnit tests? There is an EmailLiveTest which allows sending real emails with a bit of tinkering - I suggest to have a look at the test, configure them to send test emails to your email account and then double-check your production code. Cheers, Siegfried Goeschl On 06.07.11 05:46, David Hoffer wrote: I have a strange problem. I've used commons-email for a while now with good success but now all of the sudden it isn't working right and I don't know why. The emails have 3 problems: 1. Although I attach a file
Re: [exec] DefaultExecutor stalling.
Hi John sorry for the delay - I missed the email somehow. But I'm a bit confused - what you say is that your code blocks on the constructor of DefaultExecutor? If this is the case can you provide a thread dump to see exactly where it hangs? Cheers, Siegfried Goeschl On 01.04.11 13:13, John Reilly wrote: Hi, I have a patch that needs to run commands on a windows 2003 machine from inside a jar file. I'm using commons-exec to run these commands. There is an existing servlet on the machine that continuously runs commands using ProcessBuilder (Im in the process of changing this to commons-exec). When the patch runs it gets blocked at the follwing line DefaultExecutor executor = new DefaultExecutor(); When I restart the servlet the patch runs fine to completion. So the servlet code is blocking the patch. Is there anyway I can detect what is blocking from within the patch code. John - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [email] 1.3 release
Hi Nathan, IMHO there are no blockers but the last time I tried to release I hit a few infrastructure problems. I suggest let me check the current JIRA to get the ball rolling Cheers, Siegfried Goeschl On 16.02.11 19:34, Nathan Maves wrote: Are there any outstanding major or minor issues that are preventing the release of 1.3? Nathan - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [commons-email] Problem sending emails to groups
Hi Lorenzo, got also the previous mail but have no good answer ... :-) +) I think dispatching to group email id should be done by the server +) there are some callbacks where the SMTP server notifies you about partial delivery of emails +) if you have easy access to the SMTP server it would be interesting to get a wireshark trace to compare a Mail Client with commons-email Cheers, Siegfried Goeschl On 23.02.11 16:33, Lorenzo Solano wrote: Ok, Sorry by the e-mail to dev group. Well, I'll keep looking forward. Saludos, Lorenzo Solano IT, BILLING SYSTEM II(809)220-5225 ( lorenzo_sol...@codetel.com.do Antipatrones de diseño de software / Software design anti-patterns Reinventar la rueda: Enfrentarse a las situaciones buscando soluciones desde cero, sin tener en cuenta otras que puedan existir ya para afrontar los mismos problemas. Reinventing the wheel: Failing to adopt an existing, adequate solution Reinventar la rueda cuadrada: Crear una solución pobre cuando ya existe una buena. Reinventing the square wheel: To create a poor solution when a good one already exists. -Original Message- From: simone.trip...@gmail.com [mailto:simone.trip...@gmail.com] On Behalf Of Simone Tripodi Sent: Wednesday, February 23, 2011 10:31 AM To: Commons Users List Subject: Re: [commons-email] Problem sending emails to groups Hola Lorenzo, please don't send the same email message to both dev/users MLs, dev is not for supporting this kind of questions. Apologize but personally I'm not [email] expert, can't provide any help :( Hasta pronto, Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Wed, Feb 23, 2011 at 2:25 PM, Lorenzo Solano lorenzo_sol...@claro.com.do wrote: Hello, I'm sending messages using SimpleMail class; and have this problem: All email recipients, that are individual email accounts on my company receive the message; but when I add a group email ID; none of the members are not reached. Code snnipet: Email email = new SimpleEmail(); email.setHostName(XXX.XXX.XXX.XXX); email.setAuthenticator(new DefaultAuthenticator( X, )); MapString, String flags = new HashMapString, String(); String categoryFlag = null; switch (cat) { case INFO: categoryFlag = 4 (low); break; case WARN: categoryFlag = 3 (normal); break; case ERROR: categoryFlag = 2 (high); break; case FATAL: categoryFlag = 1 (highest); } flags.put(X-Priority, categoryFlag); email.setHeaders(flags); email.setTLS(true); email.setFrom(du...@my.domain.commailto:du...@my.domain.com); email.setSubject(Test Mail Using Apache SimpleEmail, from commons); email.setMsg(Test Mail Using Apache SimpleEmail, from commons.\n\n Please do not reply.); email.addTo(valid_individual_email...@my.domain.commailto:valid_individual_email...@my.domain.com%20 ); //This address is reached just fine. email.addTo(Valid_Group_Email_Id @my.domain.com );//This address, and any other group; is not reached! email.send(); Did someone has faced this problem before? Notes: We are using MS-Exchange. Regards, Saludos, Lorenzo Solano IT, BILLING SYSTEM * (809)220-5225 * lorenzo_sol...@codetel.com.domailto:lorenzo_sol...@codetel.com.do Antipatrones de diseño de software / Software design anti-patterns Reinventar la rueda: Enfrentarse a las situaciones buscando soluciones desde cero, sin tener en cuenta otras que puedan existir ya para afrontar los mismos problemas. Reinventing the wheel: Failing to adopt an existing, adequate solution Reinventar la rueda cuadrada: Crear una solución pobre cuando ya existe una buena. Reinventing the square wheel: To create a poor solution when a good one already exists. Este mensaje puede contener información privilegiada y confidencial. Dicha información es exclusivamente para el uso del individuo o entidad al cual es enviada. Si el lector de este mensaje no es el destinatario del mismo, queda formalmente notificado que cualquier divulgación, distribución, reproducción o copiado de esta comunicación está estrictamente prohibido. Si este es el caso, favor de eliminar el mensaje de su computadora e informar al emisor a través de un mensaje de respuesta. Las opiniones expresadas en este mensaje son propias del autor y no necesariamente coinciden con las de la Compañía Dominicana de Teléfonos. Gracias. Compañía Dominicana de Teléfonos This message may contain information that is priviliged and confidential. It is intended only for the use of the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified
Re: Apache commons email 1.2: How to ask for read and delivery receipts?
Hi Sebastian, will add that to the documentation ... Thanks, Siegfried Goeschl On 04.02.11 18:11, sebb wrote: I just sent myself an e-mail with return receipt. The header appears to be: Disposition-Notification-To: Google can probably give you some other information. On 4 February 2011 16:57, Brian Braunbrianbr...@gmail.com wrote: Hi, I'm using Apache Commons Email vr 1.2, the current version. I want to ask for a delivery receipt and a read receipt. How do I do it? I have read somewhere that I need to do it using the headers somehow, but didn't find any reliable and clear information. Thanks in advance! - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [EMAIL] - Issue with commons-net and MS Exchange email server
Oops - wrong email account On 2/2/11 9:42 PM, Siegfried Goeschl wrote: Hi Trascs, some hints +) try telnet to connect to the SMTP port +) try the mail.debug system property to dump SMTP communication (see http://java.sun.com/products/javamail/javadocs/javax/mail/package-summary.html) +) use a conventional mail client to send email using the SMTP port Cheers, Siegfried Goeschl On 2/2/11 2:54 PM, Trasca Virgil wrote: Hi Sebb, I goggled for SMTP 421 and I saw the meaning of it. I did not say it is a bug - I am only asking if people can give some hints as from where the problem can come. What I already tried * double checked the server settings to be ok * checked for firewalls/antivirus which might block the communication - it is not the case * goggled for SMTP 421 and saw it is a communication problem between the client and the server Thank you, Virgil From: sebbseb...@gmail.com To: Commons Users Listuser@commons.apache.org Sent: Wed, February 2, 2011 11:27:06 AM Subject: Re: [EMAIL] - Issue with commons-net and MS Exchange email server On 2 February 2011 08:42, Trasca Virgilvirgil_tra...@yahoo.com wrote: Hi, I am trying to send an email using commons-net and a MS Exchange server. I think you mean Commons EMAIL - subject changed accordingly. All the server connect settings were double checked and are correct. Also some firewall settings were adjusted to be sure nothing stays in between that could block the communication. Still things are not working and following is the stack trace. Any help will be greatly appreciated. org.apache.commons.mail.EmailException: Sending the email to the following server failed : CIBSE-MAIL.cibse.org:25 at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1242) at org.apache.commons.mail.Email.send(Email.java:1267) at com.smartwish.documentburster.sender.EmailSender.doSend(EmailSender.java:148) at com.smartwish.documentburster.sender.Sender.send(Sender.java:89) at com.smartwish.documentburster.engine.SimpleBurster.endDocument(SimpleBurster.java:272) ) at com.smartwish.documentburster.engine.SimpleBurster.doBurst(SimpleBurster.java:135) ) at com.smartwish.documentburster.facade.Facade.doBurst(Facade.java:59) at com.smartwish.documentburster.DocumentBurster.main(DocumentBurster.java:63) Caused by: javax.mail.MessagingException: Could not connect to SMTP host: CIBSE-MAIL.cibse.org, port: 25, response: 421 Response 421 means what? Googling SMTP 421 should help you here. This does not appear to be a Commons EMAIL problem. at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1694) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:525) at javax.mail.Service.connect(Service.java:313) at javax.mail.Service.connect(Service.java:172) at javax.mail.Service.connect(Service.java:121) at javax.mail.Transport.send0(Transport.java:190) at javax.mail.Transport.send(Transport.java:120) at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1232) ... 7 more Thank you, Virgil - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [email] 1.3 snapshot
Hi Nathan, good question ... :-) ... currently not implemented I have a look at it Siegfried Goeschl On 1/27/11 12:40 AM, Nathan Maves wrote: This all looks good so far. How can I specify the root of the classpath as the DataSourceResolverImpl location? On Mon, Jan 24, 2011 at 10:09 AM, Siegfried Goeschlsgoes...@gmx.at wrote: Hi Nathan, have a look at ImageHtmlEmailTest.java and DataSourceResolverTest.java - it should be possible to resolve the images from a relative URL Cheers, Siegfried Goeschl On 1/24/11 3:42 PM, Nathan Maves wrote: Siegfried, I did check it out yesterday and I installed in manually. I should give it some good testing today. How do you handle a url that is only local and will never be on the internet? I saw in the code that you can use file:// but is that a relative path or absolute? Nathan On Mon, Jan 24, 2011 at 6:32 AM, Siegfried Goeschlsgoes...@gmx.at wrote: Hi Nate, I have a look to upload the snapshot but for quick testing I would install it by hand. And I would appreciate feedback regarding the new ImageHtmlEmail so I can make changes before the release. Cheers, Siegfried Goeschl On 1/24/11 12:29 PM, Simone Tripodi wrote: Hi Nate!!! :) looks like the commons-email-1.3 is not available yet on apache snapshot repository[1], BTW you can bookmark the snapshot repo URL for future usages. HTH, Simo [1] http://repository.apache.org/snapshots/commons-email/commons-email/ http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Sun, Jan 23, 2011 at 7:14 PM, Nathan Mavesnathan.ma...@gmail.com wrote: I just saw the new ImageHtmlEmail class and would love to test it out. I don't seem to be able to find the 1.3-SNAPSHOT in any of the repositories. Is it available anywhere or do we have to install it locally by hand? Nathan - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [email] 1.3 snapshot
Hi Nate, I have a look to upload the snapshot but for quick testing I would install it by hand. And I would appreciate feedback regarding the new ImageHtmlEmail so I can make changes before the release. Cheers, Siegfried Goeschl On 1/24/11 12:29 PM, Simone Tripodi wrote: Hi Nate!!! :) looks like the commons-email-1.3 is not available yet on apache snapshot repository[1], BTW you can bookmark the snapshot repo URL for future usages. HTH, Simo [1] http://repository.apache.org/snapshots/commons-email/commons-email/ http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Sun, Jan 23, 2011 at 7:14 PM, Nathan Mavesnathan.ma...@gmail.com wrote: I just saw the new ImageHtmlEmail class and would love to test it out. I don't seem to be able to find the 1.3-SNAPSHOT in any of the repositories. Is it available anywhere or do we have to install it locally by hand? Nathan - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [email] 1.3 snapshot
Hi Nathan, have a look at ImageHtmlEmailTest.java and DataSourceResolverTest.java - it should be possible to resolve the images from a relative URL Cheers, Siegfried Goeschl On 1/24/11 3:42 PM, Nathan Maves wrote: Siegfried, I did check it out yesterday and I installed in manually. I should give it some good testing today. How do you handle a url that is only local and will never be on the internet? I saw in the code that you can use file:// but is that a relative path or absolute? Nathan On Mon, Jan 24, 2011 at 6:32 AM, Siegfried Goeschlsgoes...@gmx.at wrote: Hi Nate, I have a look to upload the snapshot but for quick testing I would install it by hand. And I would appreciate feedback regarding the new ImageHtmlEmail so I can make changes before the release. Cheers, Siegfried Goeschl On 1/24/11 12:29 PM, Simone Tripodi wrote: Hi Nate!!! :) looks like the commons-email-1.3 is not available yet on apache snapshot repository[1], BTW you can bookmark the snapshot repo URL for future usages. HTH, Simo [1] http://repository.apache.org/snapshots/commons-email/commons-email/ http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Sun, Jan 23, 2011 at 7:14 PM, Nathan Mavesnathan.ma...@gmail.com wrote: I just saw the new ImageHtmlEmail class and would love to test it out. I don't seem to be able to find the 1.3-SNAPSHOT in any of the repositories. Is it available anywhere or do we have to install it locally by hand? Nathan - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: How To Get The Output Of A Command Into A String Variable
Hi Carlo, you see the output because it is redirected to stdout. Can you check http://commons.apache.org/exec/xref-test/org/apache/commons/exec/DefaultExecutorTest.html we have a lot of tests (e.g. testExecute()) doing exactly that Cheers, Siegfried Goeschl On 12/23/10 10:36 AM, Carlo Camerino wrote: Hi, good day! is there anyway that I can get the output of a string variable CommandLine commandLine = new CommandLine(7z); commandLine.addArgument(e); commandLine.addArgument(-psa- emp); commandLine.addArgument(-y); commandLine.addArgument(-ooutput-folder); commandLine.addArgument(file-name-of-zip) DefaultExecutor executor = new DefaultExecutor(); int exitValue = executor.execute(commandLine); i could actually see the result in the console, however, i'm trying to find a way in which i can store the result into a string variable since it is a requirement to store the actual results. Here is a sample result Processing archive:file-name-of-zip Extractingfile-name Extractingfile-name is there anyway that i can get the outputstream and store it into a string variable? thanks a lot carlo - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [exec]Tutorial problem
Hi Susan, are you starting the Reader directly or using a batch file? Thanks in advance, Siegfried Goeschl On 12/18/10 6:35 PM, Susan Jolly wrote: Siegfried, Thanks for your reply. The tutorial already uses a watchdog but it doesn't help in this case. I wonder if the difference is because when the file sent to the Reader doesn't exist, the Reader process itself is waiting on the user rather than a process it invokes (e.g. printing) causing the problem. Susan - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [exec]Tutorial problem
Hi Susan, you might check the FAQ (http://commons.apache.org/exec/faq.html) Are child processes automatically killed? - This functionality is largely depend on the operating system - on Unix it works mostly and under Windows not at all (see Bug 4770092). In terms of stability and cross-platform support try to start your applications directly and avoid various wrapper scripts. So starting the process directly will solve your problem ... Cheers, Siegfried Goeschl On 12/23/10 7:31 PM, Susan Jolly wrote: I'm running a batch file with arguments as in the tutorial. I think the problem may be that Acrobat Reader (at least on Windows) isn't intended as a command line program. I note similar weird behavior when I just try to run the batch file directly. The tutorial approach seems to work well on my own small Java command line programs developed as test cases. Thanks for the feedback. I'll let you know if I have any problems running other executables. Susan Jolly - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [exec]Tutorial problem
Hi Susan, when you follow the tutorial you find a similar problem I had - my printer was out of paper so I was also politely informed. The general solution is using a watchdog which kills the process after a certain time. Cheers, Siegried Goeschl On 12/18/10 2:49 AM, Susan Jolly wrote: I'm an exec (but not Java) newbie. I got the Acrobat Reader tutorial running ok under Windows Vista but then changed it in order to pass a non-existent file. I end up with an open Acrobat window and a friendly message informing me there is no such file. I have to reply to the message and manually shut down the Reader. What am I doing wrong? (I realize that in this case I could check whether the file exists but I'm interested in a more general solution.) Thanks! - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [exec] Redirecting input
Hi Norman, I'm asking for it :-) Thanks in advance Siegfried Goeschl On 12/2/10 5:15 PM, n...@dad.org wrote: Update: Using your hint, I was able to get DefaultExecutor to redirect the invoker's stdin to the invokee's stdin. But I wasn't able to arrange for an EOF on the invoker's stdin to generate and EOF on the invokee's stdin. I'm ashamed to say that I've given up on apache.commons.exec. It was easier to roll my own. I'll send my sources to anybody who asks for them. Norman Shapiro 798 Barron Avenue Palo Alto CA 94306-3109 (650) 565-8215 n...@dad.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [Primitives] Does anyone use this?
And the Java primitives haven't changed lately ... :-) Siegfried Goeschl On 11/2/10 9:52 PM, sebb wrote: Note that lack of recent activity is not necessarily a bad sign; in this case I think it's because the code is working fine. I could find no outstanding bugs for the component. On 2 November 2010 20:10, Brian Pontarellibr...@pontarelli.com wrote: I probably wouldn't use these collections in a factory context. If I'm concerned about speed and size, I'm going to create the primitive collection using the constructor and then use it directly. Adding in any factories, AOP, etc. is just going to add overhead. The original issue is really whether or not the commons library is still active or if Trove is a better choice. I'd say either library will work and I've used both. Another thing to think about is your comfort with licenses. I prefer ASL over LGPL as a rule of thumb and Trove is LGPL. I tend to avoid anything with the letters G, P and L in the license. But if you can find something with BSD, that's the way to go. ;) -bp On Nov 2, 2010, at 1:24 PM, Martin Gainty wrote: also lookup methods from factories will reliably lookup ArrayListBoxedPrimitiveDatatype when bean definition has attribute dependency-check=object but wont lookup a collection of primitives such as int []PrimitiveDataTypeVariable even when the bean definition specified dependency-check=simple http://static.springsource.org/spring/docs/1.2.9/reference/beans.html thanks, Martin Gainty __ Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. From: josiah.d.hasw...@hp.com To: user@commons.apache.org Date: Tue, 2 Nov 2010 18:42:29 + Subject: RE: [Primitives] Does anyone use this? Gnu Trove includes a set of benchmarks vs. the JCF. I don't understand why this is so controversial; a developer should be able to assess the suitability of a library for his or her purposes without it turning into a huge debate. If dependency-management is an issue, Trove is available from numerous Ivy/Maven repositories. Joe H. | HP Software -Original Message- From: Martin Gainty [mailto:mgai...@hotmail.com] Sent: Tuesday, November 02, 2010 11:41 AM To: user@commons.apache.org Subject: RE: [Primitives] Does anyone use this? Brian how does primitive collections implementation perform better than JDK collections? thanks, Martin __ please do not alter or disrupt this transmission. thank you Subject: Re: [Primitives] Does anyone use this? From: br...@pontarelli.com Date: Tue, 2 Nov 2010 11:32:01 -0600 To: user@commons.apache.org I would assume once you get out of the autoboxing caches the performance will get even worse. It really depends on the application, but I've found a number of spots where primitive collections work much better than autoboxing and JDK collections. -bp On Nov 2, 2010, at 11:25 AM, James Carman wrote: Yet another dependency to add to the mix. On Tue, Nov 2, 2010 at 1:17 PM, Cogen, David - 1008 - MITLL co...@ll.mit.edu wrote: From: jcar...@carmanconsulting.com [jcar...@carmanconsulting.com] On Behalf Of James Carman [ja...@carmanconsulting.com] Sent: Tuesday, November 02, 2010 12:30 PM To: Commons Users List Subject: Re: [Primitives] Does anyone use this? Premature optimization with JDK5. I'd say stick to the JDK classes if you can and only try to beef up space/performance if you need to. Normally I agree about evils of premature optimization. But ArrayListInt is practically a drop-in replacement for ArrayListInteger and I see no reason not to use it if it is supported and reliable. My test of 2 billion accesses (reads and writes) ran in 35% of the time when I used ArrayListInt vs. ArrayListInteger. - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [exec] Re: Redirect shell output
Hi Johan, sorry for bugging you - any progress from your side? We also appreciate success stories ... :-) Thanks in advance Siegfried Goeschl On 10/24/10 11:33 PM, Johan Hertz wrote: Hi Siegfried, It is a bit late for me to test this now, but thank you very much for pointing me in the right direction. Regards Johan On 24/10/2010 20:51, Siegfried Goeschl wrote: Hi Johan, I used the following test Start public void testMe() throws Exception { if(OS.isFamilyUnix()) { File testScript = TestUtil.resolveScriptForOS(./src/test/scripts/standalone); System.out.println(Executing the following test script : + testScript.getAbsolutePath()); Executor exec = new DefaultExecutor(); exec.setStreamHandler(new PumpStreamHandler()); CommandLine cl = new CommandLine(testScript); exec.execute(cl); assertTrue(new File(./target/mybackup.gz).exists()); } } End using cat pom.xml | gzip ./target/mybackup.gz and it worked as expected Cheers, Siegfried Goeschl On 10/24/10 12:36 PM, Johan Hertz wrote: Hi Paul, Sorry about that. /Regards Johan On 24/10/2010 11:11, Paul Libbrecht wrote: Johan, which project are you asking this from? commons-exec? Please read the netiquette of this list... you need to make this clear otherwise you don't reach the right people. paul On 24 oct. 2010, at 10:56, Johan Hertz wrote: Hi, I am trying to redirect output using something like this: zfs send rpool/d...@test | gzip mybackup.gz I can't find a way to do it, is there not a way similar to how ant do it? http://ant.apache.org/faq.html#shell-redirect-2 Regards Johan __ Använder du Yahoo!? Är du trött på spam? Yahoo! E-post har det bästa spamskyddet som finns http://se.mail.yahoo.com - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org __ Använder du Yahoo!? Är du trött på spam? Yahoo! E-post har det bästa spamskyddet som finns http://se.mail.yahoo.com - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org __ Använder du Yahoo!? Är du trött på spam? Yahoo! E-post har det bästa spamskyddet som finns http://se.mail.yahoo.com - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [exec] Using Commons Exec to Input a Password to a Shell Script
Hi Charles, how are you reading the password into the shell script? And which shell are you using? Short exampe would be welcome Siegfried Goeschl On 10/11/10 10:21 PM, Charles Wesley wrote: We are trying to use Apache commons exec to execute a shell script which takes several inputs, one of which is a password which is not echoed to stdout for security purposes. We were using the PumpStreamHandler and using a ByteArrayInputStream object as the InputStream parameter for the PumpStreamHandler constructor. The clear text inputs are working as expected but we are not able to progress after the prompt for the password. Do you have any suggestions on how to approach sending a password via commons exec? Thanks, Charles - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [exec] Getting Error opening terminal error while trying to execute command on linux
Hi Mohammed, added the following test /** * Call a script to dump the environment variables of the subprocess * after adding a custom environment variable. * * @throws Exception the test failed */ public void testAddEnvironmentVariables() throws Exception { Map myEnvVars = new HashMap(); myEnvVars.putAll(EnvironmentUtils.getProcEnvironment()); myEnvVars.put(NEW_VAR,NEW_VAL); exec.execute(new CommandLine(environmentSript), myEnvVars); String environment = baos.toString().trim(); assertTrue(environment.contains(NEW_VAR)); } and it works Cheers, Siegfried Goeschl On 9/6/10 8:40 AM, Mohammed Sanaulla wrote: On 6 September 2010 02:02, Siegfried Goeschl siegfried.goes...@it20one.at mailto:siegfried.goes...@it20one.at wrote: Hi Mohamed, can you have a look at DefaultExecutorTest#testExecuteWithEnv() to check what's missing or wrong - http://commons.apache.org/exec/xref-test/org/apache/commons/exec/DefaultExecutorTest.html I see that the existing Environment variables from the current Process arent being copied instead only a new variable is being added (lines- 145,146) I did the following in my Code: Map myEnvVars = new HashMap(); myEnvVars.putAll(EnvironmentUtils.getProcEnvironment()); myEnvVars.put(NEW_VAR,NEW_VAL); Regards, Mohamed Sanaulla. On 9/5/10 10:09 PM, Mohammed Sanaulla wrote: I was able to execute the command. I got the environment variable map from the EnvironmentUtils and then added a new entry for TERM and then passed this Map along with execute() method of the DefaultExecutor. - Mohamed Sanaulla On 6 September 2010 00:43, Mohammed Sanaullasanaulla...@gmail.com mailto:sanaulla...@gmail.com wrote: Hi all, I have recently started to use Exec. I was trying to execute proz command (Command for Prozilla) on Linux using the CommandLine and DefaultExecutor as an asynchronous process. When ever I try to run the program I get the following error: Error opening terminal: unknown. And the code terminates with Exit Value=1. I did a bit of research to find out that- its not able to determine the type of terminal. So there were solutions to set the value of $TERM with the value obtained from echo $TERM (which in my case is xterm). I had a look at the EnvironmentUtils class and tried to use it to set the value of $TERM before executing the command. I used the following to set it: Map environment = EnvironmentUtils.getProcEnvironment(); EnvironmentUtils.addVariableToEnvironment(EnvironmentUtils.getProcEnvironment(),TERM=xterm); But am not able to set the env variable. Any idea what's going wrong in both the places (executing the command and setting the env variable) Regards, Mohamed Sanaulla - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org mailto:user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org mailto:user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [exec] Getting Error opening terminal error while trying to execute command on linux
Hi Mohamed, can you have a look at DefaultExecutorTest#testExecuteWithEnv() to check what's missing or wrong - http://commons.apache.org/exec/xref-test/org/apache/commons/exec/DefaultExecutorTest.html Cheers, Siegfried Goeschl On 9/5/10 10:09 PM, Mohammed Sanaulla wrote: I was able to execute the command. I got the environment variable map from the EnvironmentUtils and then added a new entry for TERM and then passed this Map along with execute() method of the DefaultExecutor. - Mohamed Sanaulla On 6 September 2010 00:43, Mohammed Sanaullasanaulla...@gmail.com wrote: Hi all, I have recently started to use Exec. I was trying to execute proz command (Command for Prozilla) on Linux using the CommandLine and DefaultExecutor as an asynchronous process. When ever I try to run the program I get the following error: Error opening terminal: unknown. And the code terminates with Exit Value=1. I did a bit of research to find out that- its not able to determine the type of terminal. So there were solutions to set the value of $TERM with the value obtained from echo $TERM (which in my case is xterm). I had a look at the EnvironmentUtils class and tried to use it to set the value of $TERM before executing the command. I used the following to set it: Map environment = EnvironmentUtils.getProcEnvironment(); EnvironmentUtils.addVariableToEnvironment(EnvironmentUtils.getProcEnvironment(),TERM=xterm); But am not able to set the env variable. Any idea what's going wrong in both the places (executing the command and setting the env variable) Regards, Mohamed Sanaulla - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [exec] redirect output via command
Hi Thomas, success stories are always welcome ... :-) Cheers, Siegfried Goeschl On 23.08.10 22:09, Thomas Tanneberger wrote: Hi Siegfried, many thx for your advise. The solution is quite simple. You can open a StreamWriter and write the output directly into. See example below. code PumpStreamHandler ps = new PumpStreamHandler(new FileOutputStream( fileName)); executor.setStreamHandler(ps); executor.execute(commandLine); /code Thomas Am Freitag, den 13.08.2010, 11:14 +0200 schrieb Siegfried Goeschl: Hi Thomas, +) redirection such as out.txt is implemented in the command line processor or shell. You would need a batch file to do that (a coule of the regression tests are using that redirection) +) executor.setStreamHandler(null) - should give you a NPE. Please comment out the line. Without a stream handler you application will block. +) Another was of getting the output is to use a StreamHandler and pass a FileOutputStream. Cheers, Siegfried Goeschl On 13.08.10 00:00, Thomas Tanneberger wrote: Hi All, while I am playing with Apache Common Exec I found out that is it obviously not possible to redirect output into a file via command. I want to exec cksum file file.chsum.txt. I get the output of cksum in ecplise but it is not written to disk. code public static String CHKSUM_CMD2 = cksum \${FILE_NAME}\ out.txt; HashMapString, String options = new HashMapString, String(); CommandLine commandLine = CommandLine.parse(CHKSUM_CMD2); options.put(FILE_NAME, fileName); commandLine.setSubstitutionMap(options); DefaultExecutor executor = new DefaultExecutor(); executor.setStreamHandler(null); executor.execute(commandLine); /code I suppose that I have to capture the output and write it to disk afterwards. Or is there other solution ahead? Many thx, Thomas - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [Email] How to extend Email.send()
Hi David, depends on what you would like to do - you can also check out http://turbine.apache.org/fulcrum/fulcrum-commonsemail/ how I use commons-email in a production environment. Cheers, Siegfried Goeschl On 23.08.10 21:48, David Parks wrote: I'd like to extend the send() method of class Email (to enable some throttling custom error check + retry functionality) I'd love to just extend this and make it all seamless. It looks like there's this createMimeMessage() designed to allow something like this. But I'm not wrapping my brain around it. If this is possible could someone give me a quick point in the right direction on how I should extend Email.send()? Thanks much, David - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [Email] Email send hangs thread indefinitely on intermittent failure
Hi David, don't know if you have set any timeouts for your tests such as +) Email.MAIL_SMTP_CONNECTIONTIMEOUT +) Email.MAIL_SMTP_TIMEOUT +) Email.setSocketConnectionTimeout() +) Email.setSocketTimeout() The first two go into the email session for (javax.mail) while the two others are set directly on Email - see http://java.sun.com/products/javamail/javadocs/com/sun/mail/smtp/package-summary.html Cheers, Siegfried Goeschl PS: Agreed on the fact the you should not hang indefinitely with a default configuration On 21.08.10 05:23, David Parks wrote: I set up a simple test to send 50 emails through google app's SMTP server with a short delay between them (just testing to see what I'm allowed to do). I set this up by opening 50 threads and pausing at different intervals for each thread. I notice that I sometimes end up with a thread that hangs indefinitely on a connection that seems to be hung, but never times out (see the thread dump below for one such case, it's been left hung for 10 min now): Any thoughts on this? Kind of scares me to think what might happen to a server posting emails in the background. I would expect network timeouts to all be handled at least with a default value by a simplifying wrapper class such as this is. Or am I missing some logic here maybe? Thanks, David Thread [Thread-23] (Suspended) SocketInputStream.socketRead0(FileDescriptor, byte[], int, int, int) line: not available [native method] SocketInputStream.read(byte[], int, int) line: not available InputRecord.readFully(InputStream, byte[], int, int) line: not available InputRecord.read(InputStream, OutputStream) line: not available SSLSocketImpl.readRecord(InputRecord, boolean) line: not available SSLSocketImpl.readDataRecord(InputRecord) line: not available AppInputStream.read(byte[], int, int) line: not available TraceInputStream.read(byte[], int, int) line: 106 BufferedInputStream.fill() line: not available BufferedInputStream.read() line: not available LineInputStream.readLine() line: 84 SMTPTransport.readServerResponse() line: 1903 SMTPTransport.issueSendCommand(String, int) line: 1808 SMTPTransport.finishData() line: 1634 SMTPTransport.sendMessage(Message, Address[]) line: 889 Transport.send0(Message, Address[]) line: 191 Transport.send(Message) line: 120 HtmlEmail(Email).sendMimeMessage() line: 1232 HtmlEmail(Email).send() line: 1267 GoogleAppsEmailTest.sendEmail(int) line: 51 GoogleAppsEmailTest$1.run() line: 17 Thread.run() line: not available - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [email] embed/include dynamic Java Server Pages content in email/NTLM Authentication to Exchange Server
Hi Ferindo, you are not annoying anyone ... :-) ... I will add your information to the FAQ section since information regarding NTLM setup are hard to find and I'm glad you take all the time to prepare the information. Thanks, Siegfried Goeschl On 17.08.10 05:10, Ferindo Middleton wrote: I finally figured out how to get the emails sent using NTLM authentication to a MS Exchange server for my webapps on my Tomcat servlet container again. Using the new NTLM support provided in the JavaMail API, I was able to configure a JNDI resource in the Tomcat server.xml file to be used by the mailer 1.1 taglib. I originally started using commons-email because I thought it was a viable option I could use to support sending emails from my JSPs with the same dynamic content provided by the JSP but I later discovered that commons-email would not provide the integration I needed with my JSPs for rapid development. While possible, it would require a whole lot of java coding that I just don't have the time for. I'll paste the config below because I think someone replied to previous posts I made indicating that it would be useful for further integration for commons-email package to know what my NTLM config required in order to work. Please note that I realize some of this isn't necessarily required for the NTLM authentication to work and there are a couple lines, maybe 3, that I hadn't tried just leaving out, but just my preference in total config options for JavaMail. This below works for my Tomcat JNDI resource config (I'm using JavaMail 1.4.3): (I know this isn't exactly the right list but in caase you'd like to know, I tested what I write below on both Tomcat 5 and 6 and works) Context path=...Tomcat configuration for my webapp goes here) Resource name= (I setup a database resource for this webapp here) !-- JavaMail Configuration starts here -- Resource name=mail/Session auth=Container type=javax.mail.Session mail.smtp.from= sharedmailboxofusersusingtheweb...@organization.com username=useridthatwillautheicatetoexchangeservertosendmessage password=passwordofuseraccountabove mail.transport.protocol=smtp mail.smtp.auth=true mail.smtp.auth.ntlm.domain=thenetworkidofexchangeserveronthenetwork mail.smtp.host=thenetworkidofexchangeserveronthenetwork mail.smtp.port=25 mail.smtp.user=useridthatwillautheicatetoexchangeservertosendmessage mail.smtp.password=passwordofuseraccountabove mail.debug=true mail.smtp.ssl.trust=* mail.smtp.starttls.enable=true mail.smtp.dsn.notify=FAILURE,DELAY mail.smtp.dsn.ret=FULL mail.smtp.sendpartial=true I used the documentation provided for Package com.sun.mail.smtp located here: http://java.sun.com/products/javamail/javadocs/com/sun/mail/smtp/package-summary.html I also had to download the latest jcifs jar file from the JCIFS site: http://jcifs.samba.org which is available under the LGPL license and of course include that in the server's Classpath along with the JavaMail .jar I imagine that if you're using commons-email, you'd need to include it in your path as well. Note that the 1.2.x versions JCIFS won't work as the API has apparently changed incompatibly so you have to use versions released after 1.2. The SMTP and IMAP providers in the JavaMail download support the use of NTLM with the following properties used to configure the NTLM support: mail.protocol.auth.ntlm.domain The NTLM authentication domain. mail.protocol.auth.ntlm.flags NTLM protocol-specific flags. See http://curl.haxx.se/rfc/ntlm.html#theNtlmFlags for details. So the main part of my Tomcat configuration above actually turning on the NTLM support is the mail.smtp.auth.ntlm.domain part but I imagine of course I do still need to provide login credentials... and I think I also needed to specify that auth is true and the mail.smtp.ssl.trust=* I think was especially important because, in previous testing, I noted how JavaMail was apparently unable to trust the Exchange server's certificate the mail.smtp.ssl.trust=* says to just trust everybody. This option takes a white-space separated list of hosts, those hosts are trusted so I guess I could've just put the servers network id there (the same serverid I provided in mail.smtp.auth.ntlm.domain) but I was unsure if it would simply work so I just said trust everybody and I think it's pretty safe to do that here though because this webapp is behind a pretty secure firewall. For some odd reason, I did have to include the authentication credentials above twice as I did in the config above but I think that is just because the actual Mailer Taglib I'm using requires login credentials for authentication to the server and for some reason the mail.smtp.user mail.smtp.password lines weren't enough to make the authentication happen. I did have to specify
Re: [exec] redirect output via command
Hi Thomas, +) redirection such as out.txt is implemented in the command line processor or shell. You would need a batch file to do that (a coule of the regression tests are using that redirection) +) executor.setStreamHandler(null) - should give you a NPE. Please comment out the line. Without a stream handler you application will block. +) Another was of getting the output is to use a StreamHandler and pass a FileOutputStream. Cheers, Siegfried Goeschl On 13.08.10 00:00, Thomas Tanneberger wrote: Hi All, while I am playing with Apache Common Exec I found out that is it obviously not possible to redirect output into a file via command. I want to exec cksum file file.chsum.txt. I get the output of cksum in ecplise but it is not written to disk. code public static String CHKSUM_CMD2 = cksum \${FILE_NAME}\ out.txt; HashMapString, String options = new HashMapString, String(); CommandLine commandLine = CommandLine.parse(CHKSUM_CMD2); options.put(FILE_NAME, fileName); commandLine.setSubstitutionMap(options); DefaultExecutor executor = new DefaultExecutor(); executor.setStreamHandler(null); executor.execute(commandLine); /code I suppose that I have to capture the output and write it to disk afterwards. Or is there other solution ahead? Many thx, Thomas - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [exec] interact with bat
Hi, just to clarify the problem and script del /p d:\133.mht dir deletes the file but ask for keyboard input (/P Give a Yes/No Prompt before deleting). The prompt is displayed so far but the file is not deleted and directory is listed (whcih should not be the case). I played around with it and have the following solution (tester under Mac OS X) Snippet ByteArrayInputStream bais = new ByteArrayInputStream(Y\n.getBytes()); CommandLine cl = new CommandLine(stdinSript); PumpStreamHandler pumpStreamHandler = new PumpStreamHandler( System.out, System.err, bais); Executor executor = new DefaultExecutor(); executor.setStreamHandler(pumpStreamHandler); assertTrue(executor.execute(cl) == 0); assertFalse(new File(./target/to-be-deleted.xml).exists()); stdin.sh mkdir target cp pom.xml target/to-be-deleted.xml ls -l target rm -i target/to-be-deleted.xml ls -l target Can you check if that would also work under Windows? In general the redirection causes a lot more problems on Windows compared to Unix. Cheers, SIegfried Goeschl On 12.08.10 04:49, 刘东 wrote: Hi all, When I use commons-exec to call os script like .bat on windows,I meet problem. the bat script like this: del /p d:\133.mht dir When use commons-exec to call this,There no pause after del /p d:\133.mht,and dir command execute. The code shows as follow: File testDir = new File( D:/eclipse_works/exec/opensource/exec/src/test/scripts); File testScript = TestUtil.resolveScriptForOS(testDir + /test); File printArgsScript = TestUtil .resolveScriptForOS(testDir + /deltest); ByteArrayOutputStream baos = new ByteArrayOutputStream(); PumpStreamHandler pumpStreamHandler = new PumpStreamHandler(baos, baos); pumpStreamHandler.start(); Executor exec = new DefaultExecutor(); exec.setStreamHandler(pumpStreamHandler); // exec.setStreamHandler(new PumpStreamHandler(baos, baos)); CommandLine cl = new CommandLine(printArgsScript); exec.execute(cl); System.out.println(out= + baos.toString().toString()); when run: out= D:\eclipse_works\execdel /p d:\133.mht d:\133.mht,要删除(Y/N)吗? D:\eclipse_works\execdir 驱动器 D 中的卷没有标签。 卷的序列号是 C850-03F6 D:\eclipse_works\exec 的目录 2010-08-10 20:35DIR . 2010-08-10 20:35DIR .. 2010-08-10 20:38 495 .classpath 2010-08-10 20:35 380 .project 2010-08-10 20:35DIR .settings 2010-08-10 20:38DIR bin 2010-08-10 20:35DIR opensource 2010-08-10 20:35DIR src 2 个文件875 字节 6 个目录 13,176,107,008 可用字节 how to resolve this problem? thanks ahead 2010-08-12 刘东 - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
[email] Re: Template based messages.
Hi Shammi, commons-email is about creating (and sending) various forms of MimeMessages so you need some infrastructure to create the messages dynamically. Over the years I've done that using +) embedded scripts +) XSLT +) Velocity Cheers, Siegfried Goeschl On 11.08.10 09:38, sha...@arosys.com wrote: Hi My requirement is to send the mails in bulk on the basis of some criteria (like age city etc.). Does it possible to prepare the templates to send the mails. How can I start with this? Thanks Shammi mail2web.com – Enhanced email for the mobile individual based on Microsoft® Exchange - http://link.mail2web.com/Personal/EnhancedEmail - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [email] embed/include dynamic Java Server Pages content in email/NTLM Authentication to Exchange Server
Hi Ferindo, some thoughts along the line 1) all email related libraries I'm aware of are using javax.mail. So you have to get the NTLM authentication working on this level. The last problem you had is related to the SSL certificate being used by your exchange server - please see http://blogs.sun.com/andreas/entry/no_more_unable_to_find for more information 2) regarding JSP integration - your observation is correct since we provide no direct JSP integration and we never will. But I pretty much assume that you will run into 1) quickly with all JSP taglibs you find on Google. Having said that you can always reconsider moving the mail functionality out of the presentation layer into a domain servcice or application service layer (where it might belong - remember the SQL taglibs running SQL queries from a JSP page) So have a look at 1) and keep us/me in the loop ... :-) Thanks in advance Siegfried Goeschl On 10.08.10 03:53, Ferindo Middleton wrote: Thanks for your incite with my posts regarding this Siegfried and Ricardo! I suppose that commons-email doesn't support the kind of integration I was hoping to use in my JSP pages. I was thinking that I could have the dynamic content of my JSP pages embedded via the functions of Class HtmlEmail. I had been using Mailer Tag library ( http://jakarta.apache.org/taglibs/doc/mailer-doc/) that was retired in the Jakarta Project but the security supported my company's Exchange server has been beefed up over the year and they no longer support the basic authentication I once was able to use in the Mailer Taglib as there is very little configuration that tag library supported besides sending basic SMTP email with basic authentication. I tried upgrading to the Mailer2 taglib ( http://jakarta.apache.org/taglibs/sandbox/doc/mailer2-doc/) via the svn made available on the site but I don't think that project ever came to a release point as there's no .tld or .jar files provided in the svn trunk ( http://svn.apache.org/repos/asf/jakarta/taglibs/deprecated-sandbox/mailer2/trunk/) and the the svn that's there won't build using ant because I don't that project ever came to a completion point. I had posted some other threads on trying to get commons-email to authenticate via the apparent NTLM authentication mechanism the Exchange server now requires but it appears that even once I get past that, this package doesn't have enough integration I would need with my JSP dynamic content I got used to being able to send dynamically with the Mailer Tag library. I realize this isn't quite the forum for this, but can you point me in the right direction to get updated resources for sending email from my JSPs? - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [email] embed/include parsed JSP page file in email HTML body
Hi Ricardo, that was pretty much my understanding ... :-) ... as I mentioned before in the commons-email trunk there is some new code which allows to pass a HTML string and a base url to resolve the referenced images within the HTML document. The images are than fetched from the server/filesystem and added as embedded images (ImageHmtlEmail). Cheers, Siegfried Goeschl On 09.08.10 19:18, Ricardo Duval wrote: As far as I understand he wants the HTML content generated by JSP parsing. Sorry, but I don't think that'll work because you don't have a servlet engine running when you try to attach the JSP, so obviously the servlet won't be generate and all you gonna have is the original JSP script. I recommend using a template engine, like velocity or freemarker to generate an HTML content as a String. 2010/8/8 Siegfried Goeschlsiegfried.goes...@it20one.at Hi Ferindo, I'm not sure if I understand what you are doing ... :-) What is a parsed JSP page? Recently there was some work on adding HTML content and automatically adding embedding images. Cheers, Siegfried Goeschl On 08.08.10 23:28, Ferindo Middleton wrote: I'm using Class HtmlEmail. Is there a way to embed a parsed JSP page in the email message body. I use Tomcat and Java Server Pages. In my JSP pages I can do something like:%@ include file=ticket_email_response_body.jsp % and want to be able to included this processed .jsp file in the body of the text message. I've looked at the examples in the documentation for embedding Files and images and I've tried the following example code but it doesn't embedded the actual parsed .jsp into the image. It includes the file as an attachment and puts the text string of the quoted text in the body of the message: File ticketEmailResponseBody = new File(webapps/utrad/web/radtickets/ticket_email_response/ticket_email_response_dispatcher_page.jsp); StringBuffer msg = new StringBuffer(); msg.append(%@ include file=\webapps/utrad/web/header.jsp\ %); msg.append(%@ include file=).append(email.embed(ticketEmailResponseBody)).append( %BRBR); msg.append(+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+); URL emailBodyURL = new URL( http://192.168.1.2:8080/utrad/web/radtickets/ticket_email_response/ticket_email_response_dispatcher_page.jsp ); String pid = email.embed(emailBodyURL, 2nd_ticket_email_response_dispatcher_EMBEDDED_page.jsp); msg.append(BRBRtry the above code again a different way:BR %@ include file=\ + pid + \ %BR- FerindoBRBR); email.setHtmlMsg(msg.toString()); email.send(); none of the appends I use above end up including the .jsp page as parsed data in the body of the email/not even the raw unparsed text is included in the message body. Looking at the logs, it looks like it's included the raw text content of the JSP file (unparsed) but it doesn't include the text in the body of the email, just the following: %@ include file=webapps/utrad/web/header.jsp %%@ include file=ekzvyazwil % ...and it included two of the .jsps in the message above as attachments instead, not exactly what I was trying to do. - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [email] embed/include parsed JSP page file in email HTML body
Hi Ferindo, I'm not sure if I understand what you are doing ... :-) What is a parsed JSP page? Recently there was some work on adding HTML content and automatically adding embedding images. Cheers, Siegfried Goeschl On 08.08.10 23:28, Ferindo Middleton wrote: I'm using Class HtmlEmail. Is there a way to embed a parsed JSP page in the email message body. I use Tomcat and Java Server Pages. In my JSP pages I can do something like:%@ include file=ticket_email_response_body.jsp % and want to be able to included this processed .jsp file in the body of the text message. I've looked at the examples in the documentation for embedding Files and images and I've tried the following example code but it doesn't embedded the actual parsed .jsp into the image. It includes the file as an attachment and puts the text string of the quoted text in the body of the message: File ticketEmailResponseBody = new File(webapps/utrad/web/radtickets/ticket_email_response/ticket_email_response_dispatcher_page.jsp); StringBuffer msg = new StringBuffer(); msg.append(%@ include file=\webapps/utrad/web/header.jsp\ %); msg.append(%@ include file=).append(email.embed(ticketEmailResponseBody)).append( %BRBR); msg.append(+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+); URL emailBodyURL = new URL( http://192.168.1.2:8080/utrad/web/radtickets/ticket_email_response/ticket_email_response_dispatcher_page.jsp ); String pid = email.embed(emailBodyURL, 2nd_ticket_email_response_dispatcher_EMBEDDED_page.jsp); msg.append(BRBRtry the above code again a different way:BR %@ include file=\ + pid + \ %BR- FerindoBRBR); email.setHtmlMsg(msg.toString()); email.send(); none of the appends I use above end up including the .jsp page as parsed data in the body of the email/not even the raw unparsed text is included in the message body. Looking at the logs, it looks like it's included the raw text content of the JSP file (unparsed) but it doesn't include the text in the body of the email, just the following: %@ include file=webapps/utrad/web/header.jsp %%@ include file=ekzvyazwil % ...and it included two of the .jsps in the message above as attachments instead, not exactly what I was trying to do. - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [email] Exchange Server Authentication / NTLM
Hi Ferindo, probably javamail-1.3.1 was installed with your mail taglib but it is outdated (the most current version is 1.4.1). Regarding javamail API - gogogle for some simple example to send a plain text message and use the latest javamail (authentication is handled in javamail and not commons-email). Having said that, enabling SMTP authentication again on your Exchange server would be a good idea. Cheers, Siegfried Goeschl On 03.08.10 15:54, Ferindo Middleton wrote: Looking at the logs, it appears that I'm running Javamail 1.3.1. I don't remember installing Javamail. Is that apart of whatever JRE/JDK I installed? To resolve the issue on Javamail API, would I be able to configure that using the commons-email classes/methods configuration properties in my existing code I posted before or are you talking about using classes outside the commons-email methods provided? Forgive, I'm new to this and not familiar with how it's all connected. I used to use mailer 1.1 taglib but support with this Exchange server stopped allowing simple smtp authentication and there's no jar/tls files in the apache svn for mailer 2 taglib. Ferindo - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [email] Exchange Server Authentication / NTLM
Hi, there seems to be support for NTLM authentication in javamail (which version are you using by the way?) but personally I have never used it with NTLM before. I think the best is to have a look at the javamail API (there are a couple of NTLM related properties) and try to solve the connectivity on javamail API level. If that works please post your result so I can help with commons-email integration. Cheers, Siegfried Goeschl On 01.08.10 09:12, Ferindo Middleton wrote: I'm trying to send email through an MS Exchange server that I have a user account on. My servlet connects to the server but is unable to authenticate using the login credentials I have on the server. My outlook email client says it's using Kerberos/NTLM authentication mechanism so I imagine that the servlet is failing to authenticate because it's not using NTLM authentication. I'm using commons-email-1.2. Is it possible to authenticate to exchange server using commons-email-1.2. I'm going to paste a snippet of my servlet code and debug info in Tomcat stdout_ log. servlet snippet below: HtmlEmail email = new HtmlEmail(); email.setHostName(xxx); email.setAuthentication(xx, xx); email.setSmtpPort(25); email.setTLS(true); try { // Create the email message email.addTo(, xxx); . (other properties of the email message added here) email.send(); stdout_ log messages below: DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc] DEBUG SMTP: useEhlo true, useAuth true DEBUG SMTP: useEhlo true, useAuth true DEBUG SMTP: trying to connect to host , port 25 220 Microsoft ESMTP MAIL Service ready at Sun, 1 Aug 2010 02:28:35 -0400 DEBUG SMTP: connected to host http://aus2k3e7smbx002.us.usaid.gov/, port: 25 EHLO XX 250- Hello [165.13.128.8] 250-SIZE 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-STARTTLS 250-X-ANONYMOUSTLS 250-AUTH NTLM 250-X-EXPS GSSAPI NTLM 250-8BITMIME 250-BINARYMIME 250-CHUNKING 250-XEXCH50 250 XRDST DEBUG SMTP: Found extension SIZE, arg DEBUG SMTP: Found extension PIPELINING, arg DEBUG SMTP: Found extension DSN, arg DEBUG SMTP: Found extension ENHANCEDSTATUSCODES, arg DEBUG SMTP: Found extension STARTTLS, arg DEBUG SMTP: Found extension X-ANONYMOUSTLS, arg DEBUG SMTP: Found extension AUTH, arg NTLM DEBUG SMTP: Found extension X-EXPS, arg GSSAPI NTLM DEBUG SMTP: Found extension 8BITMIME, arg DEBUG SMTP: Found extension BINARYMIME, arg DEBUG SMTP: Found extension CHUNKING, arg DEBUG SMTP: Found extension XEXCH50, arg DEBUG SMTP: Found extension XRDST, arg DEBUG SMTP: Attempt to authenticate DEBUG SMTP: use8bit false MAIL FROM: 530 5.7.1 Client was not authenticated QUIT - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [exec]
Hi Venkat, ad 1) please note that Windows does not kill the children of a parent process, e.g. you start a batch file which starts another long-running application than killing the batch process will not kill the long-running child process. ad 2) I think ver is a built-in command of the windows command interpreter - check out the regression tests suite. Cheers, Siegfried Goeschl On 15.07.10 12:58, venkateswara kumar myla wrote: Hi Team, I am very excited with this project and good to have this. It made my life easy. I have some questions which are as follows: 1. Watch Dog: When i attach a watch dog to a process with some time limit, the process is executing even the time limit reached. 2. I am unable to execute the dos commands. For example i want to execute the ver command in windows 2003. I tried to execute the command as follows: 1. CommandLine cl = new CommandLine(ver); DefaultExecutor dfe = new DefaultExecutor(); dfe.execute(cl); 2. CommandLine cl = new CommandLine(CMD /C ver); DefaultExecutor dfe = new DefaultExecutor(); dfe.execute(cl); The command did not get executed. Could any one please let me know what i am doing wrong here? Best Regards Venkat Myla - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
RFC: Line Ending Conversion between Unix and Windows ....
Hi folks, I just had to type stupid code to do line ending conversion between Windows and Unix since I couldn't find existing code doing that. Would this be a useful contribution to Commons (e.g. lang, codec, io) Thanks in advance, Siegfried Goeschl - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [LANG] Having problems with trunk
Hi Adrian, are you interested in coverage or the M2 reports? If it is coverage only +) look at Emma - there is a Eclipse integration and M2 plugin +) IntelliJ has coverage measurement out-of-the box Cheers, Siegfried Goeschl On 15.04.10 20:09, Adrian Crum wrote: Thanks Gary! That solved the out of memory error while running mvn site. The rest of the problems are still there. :-( -Adrian --- On Thu, 4/15/10, Gary Gregoryggreg...@seagullsoftware.com wrote: From: Gary Gregoryggreg...@seagullsoftware.com Subject: RE: [LANG] Having problems with trunk To: Commons Users Listuser@commons.apache.org Date: Thursday, April 15, 2010, 10:55 AM You need to give your JVM more memory. The settings for each JVM vendor is different. For example, for Sun's JVM on Windows I use: MAVEN_OPTS=-Xmx512M -XX:MaxPermSize=128M Check your JVM documentation and experiment with different settings to get your specific set up to work. Gary Gregory Senior Software Engineer Seagull Software email: ggreg...@seagullsoftware.com email: ggreg...@apache.org www.seagullsoftware.com -Original Message- From: Adrian Crum [mailto:adrian.c...@yahoo.com] Sent: Thursday, April 15, 2010 10:17 To: user@commons.apache.org Subject: [LANG] Having problems with trunk I'm having problems working with the lang trunk. I use mvn package to create the package, and I use mvn site to generate the cobertura reports - which is what I'm focusing on right now. When I tried to run mvn site, the process aborted with a Java out of memory error (heap space). I commented out all but the cobertura reports in the reporting section of the pom.xml file and that got it to work. The cobertura report task keeps aborting with parse errors. It appears that it is choking on certain annotations. Then I noticed the cobertura report was cumulative - each test run would add to the coverage. So, I tried to run mvn clean to clear the report between each test run. That didn't work - the coverage still included test runs before clean. I tried to delete the contents of the target folder manually, but I got an error message saying that the cobertura folder was being used by another user or process. I'm the only user and I couldn't find any processes that were using the folder. After restarting my computer I was able to delete the folder. I don't know what I'm doing wrong. I seem to be having more problems than one would expect. Any help would be greatly appreciated! -Adrian - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: Line Ending Conversion between Unix and Windows ....
Hi Michael, this was my initial reaction as well ... :-) ... afterwards I had to write code to transform to platform specific line endings or repair strings with potentially mixed line endings. Having said that it is not difficult to write but existing code would have been appreciated. Cheers, Siegfried Goeschl On 19.04.10 22:08, E. Michael Akerman wrote: Forgive me if I'm missing something obvious. Can't this be done with just String.replace() ? Michael Akerman Systems Analyst University IT Services - Original Message - From: Siegfried Goeschl siegfried.goes...@it20one.at To: Commons Users List user@commons.apache.org Sent: Monday, April 19, 2010 12:16 PM Subject: RFC: Line Ending Conversion between Unix and Windows Hi folks, I just had to type stupid code to do line ending conversion between Windows and Unix since I couldn't find existing code doing that. Would this be a useful contribution to Commons (e.g. lang, codec, io) Thanks in advance, Siegfried Goeschl - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: some basic defination in common exec
I added a similar test to the code base - can you double-check the following snippet? Cheers, Siegfried Goeschl === START OF SNIPPET === CommandLine cl = new CommandLine(gdal_translate); cl.addArgument(HDF5:\/home/kk/grass/data/4404.he5\://HDFEOS/GRID/OMI_Column_Amount_O3/Data_Fields/ColumnAmountO3/home/kk/4.tif, false); DefaultExecutor executor = new DefaultExecutor(); int exitValue = executor.execute(cl); === END OF SNIPPET === On 04.03.10 10:52, maven apache wrote: HI: I want to use common-exec,however I am confusing with some definations - which is the arguments in a cmd to be executed: for example, the cmd I want to execute is : *gdal_tran HDF:d:\data\hdf5\new\m0729_**v003-127.he5://HDFEOS/GRIDS/** Amount_O3/Data_Fields/**SolarZenithAngle d:\aa.tif -a_ullr -180 90 180 -90* The gdal_tran is the command name, all of the later are the parameters required, *HDF:d:\data\hdf5\new\m0729_**v003-127.he5://HDFEOS/GRIDS/** Amount_O3/Data_Fields/**SolarZenithAngle*-- is the organial data *d:\aa.tif* --- the target file *-a_ullr -180 90 180 -90*-- the option parameters So I want to know which parameter can be added using the commandLine.addArgument() method? - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: common exec
Hi, I think checking the FAQ might help : http://commons.apache.org/exec/faq.html#complex-quoting Cheers, Siegfried Goeschl On 02.03.10 02:59, maven apache wrote: Hi: I want to know can the common exec can handle the command with double quotation? For example ,I have a cmd as following: *r.gisenv set=LOCATION=al file=HF5:OMI-Aura_L3-OMTO3e_2009m0729_v003-2009m0731t020127.he5://HDFEOS/GRIDS/OMI_Column_Amount_O3/Data_Fields/ColumnAmountO3 * There are some double quotation in the command, I should use the string.replace() to change the to \, but it may cause some upexpected problem,so I want to know if the common exec can do it ? - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: common exec
+) Check out http://commons.apache.org/exec/xref-test/index.html and CommandLine Test +) CommandLine.add() allows to add arguments with/without quoting magic Siegfried Goeschl On 02.03.10 12:13, maven apache wrote: 2010/3/2 Siegfried Goeschlsiegfried.goes...@it20one.at Hi, I think checking the FAQ might help : http://commons.apache.org/exec/faq.html#complex-quoting Cheers, Thanks, I have checked the faq, however I am not sure the usage.So I woner if there are some examplse? Siegfried Goeschl On 02.03.10 02:59, maven apache wrote: Hi: I want to know can the common exec can handle the command with double quotation? For example ,I have a cmd as following: *r.gisenv set=LOCATION=al file=HF5:OMI-Aura_L3-OMTO3e_2009m0729_v003-2009m0731t020127.he5://HDFEOS/GRIDS/OMI_Column_Amount_O3/Data_Fields/ColumnAmountO3 * There are some double quotation in the command, I should use the string.replace() to change the to \, but it may cause some upexpected problem,so I want to know if the common exec can do it ? - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: commons-exec
Hi, correct - it wraps the existing Java API, adds some bells and whistles and makes sure that this all runs on a wide range of OS and Java versions - I assume that I need to update the documentation ... :-) Cheers, Siegfried Goeschl maven apache wrote: Hi: What is the reason for using commons-exec? Since I read the tutorial at :http://commons.apache.org/exec/tutorial.html. It seems that the commons-exec just wrap the command string, it can solove the space problem and etc.. However I do not think this is the reason, is there other feature of commons-exec? - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: commons-exec
Hi Simone, you are right - will fix that ... Cheers, Siegfried Goeschl Simone Tripodi wrote: Hi Sigfried, I take advance to notify you the homepage still reports Jakarta Commons Exec... shouldn't be just Commons Exec instead? Best regards, Simo http://people.apache.org/~simonetripodi/ On Sun, Jan 31, 2010 at 1:24 PM, Siegfried Goeschl siegfried.goes...@it20one.at wrote: Hi, correct - it wraps the existing Java API, adds some bells and whistles and makes sure that this all runs on a wide range of OS and Java versions - I assume that I need to update the documentation ... :-) Cheers, Siegfried Goeschl maven apache wrote: Hi: What is the reason for using commons-exec? Since I read the tutorial at : http://commons.apache.org/exec/tutorial.html. It seems that the commons-exec just wrap the command string, it can solove the space problem and etc.. However I do not think this is the reason, is there other feature of commons-exec? - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: Php png attachement with commons.mail
Hi Sebastien, not sure if you got the execption due to the space issue or the .htaccess problem. Do you have a stack trace for the access denied? Cheers, Siegfried Goeschl Sébastien Bonaimé wrote: Dear all, Thank you for you help. I realised that I had two problems. First one was the space and %20 problem in the address The second one was a .htaccess. I did not allow 127.0.0.1 to acces my php script. Is it a bug ? If you can not access the URL because of a htaccess deny, you receive org.apache.commons.mail.EmailException: Invalid URL Thank you Sébastien Bonaimé Tel: +33 (0)1 44 27 24 17 Fax: +33 (0)1 44 27 38 94 GEOSCOPE Dept Sismologie Institut de Physique du Globe Paris Tour 14-15, 4ème étage 4, place Jussieu 75252 Paris cedex 05 France Le 20 janv. 10 à 20:18, Siegfried Goeschl a écrit : Hi Stefano, good catch ... :-) Siegfried Goeschl Stefano Bagnara wrote: The whitespace is not a valid character for URLs. Your browser automatically convert the space to %20 when making the request. Try using %20 instead of space in your code (param2 value) and I guess it will work. Stefano 2010/1/20 Sébastien Bonaimé bona...@ipgp.fr: I have the following error: org.apache.commons.mail.EmailException: Invalid URL set:http://myserver.mydomain.org/myphpscript.php?param1=122param2=2009-01-01 20:10:52 I changed name of the server, script and parameters... Do you think it is possible to do that ? In my browser, http://myserver.mydomain.org/myphpscript.php?param1=122param2=2009-01-01 20:20:20 returns a correct png image. I use the code that I found here: http://commons.apache.org/email/userguide.html Thank you - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: Php png attachement with commons.mail
Hi Sebastian, are you using MultipartEmail or HtmlEmail? Cheers, Siegfried Goeschl Sébastien Bonaimé wrote: Hi ! I would like to use commons.mail to send with java with an attached png image from an URL. My problem is that the image in php generated and I think it creates a problem. I have the following error: org.apache.commons.mail.EmailException: Invalid URL set:http://myserver.mydomain.org/myphpscript.php?param1=122param2=2009-01-01 20:10:52 I changed name of the server, script and parameters... Do you think it is possible to do that ? In my browser, http://myserver.mydomain.org/myphpscript.php?param1=122param2=2009-01-01 20:20:20 returns a correct png image. I use the code that I found here: http://commons.apache.org/email/userguide.html Thank you - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: npe setting exit values in EXEC-1.0
Hi, the NPE was my overly stupid bug in commons-exec-1.0 - please try to upgrade to commmons-exec-1.0.1 (download from http://commons.apache.org/exec/download_exec.cgi or pick it up from the M2 repo) Cheers, Siegfried Goeschl Jean-François MAUREL wrote: Hi everyone, I tried to set exitValue to null in DefaultExecutor as stated in Executor interface to avoid throwing exception but got this exception: Exception in thread main java.lang.NullPointerExceptionat org.apache.commons.exec.DefaultExecutor.setExitValues(DefaultExecutor.java:201) Could you please tell me if I am missing something? (windows vista jdk1.6) regards - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: Html mail sent to gmail or hotmail is received as attachment file
Hi, which version of commons-email are you currently using - commons-email-1.2 fixed this issues (hopefully) Cheers, Siegfried Goeschl maria maria wrote: I wrote an email, which has the HTML email and its plain text email related to it. When I receive that mail in a webmail it shows as plain text with the html file as an attachment, though if i receive it in Outlook it shows perfect html email. It looks like gmail, hotmail, etc in their webmail don't permit HTML mail, but I receive lots of newsletters with different fonts and colors in my webmail of gmail, hotmail, etc. Any idea how they do it? Thanks Maria My code is: HtmlEmail email = new HtmlEmail(); email.setHostName(mail.envio.com); email.setFrom(no-respo...@envio.com, Mi nombre); email.setCharset(HtmlEmail.ISO_8859_1); email.setAuthentication(envio@ en...@denvio.com, mypassword); email.setBounceAddress(en...@envio.com); email.addTo(emailAddress, name); email.setSubject(the subject); email.setHtmlMsg(creaContenido(noticia)); email.setTextMsg(Doesn't support HTML email ); email.send(); private final static String creaContenido(NoticiaVO noticia) { String salida = ; salida += html ; salida += head /head body ; salida += h3 +noticia.getTitulo() +/h3; salida += p em +noticia.getEntradilla()+/em/p; salida += p+noticia.getCiudad()+. - ; salida += noticia.getAutor()+ br/ +noticia.getContenido()+/p; salida += /body /html; return salida; } - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: Mail with attachment
Hi Markus, a few questions regarding your problem +) which commons-email version are you using? +) are you sending emails across multiple threads (I would assume so) +) sending is a synchronous operation anyway (when considering mail transmission to the SMTP server) so serializing is easy +) are the mail attachment resources shared across multiple emails or asking the other way around - are the attachments deleted somewhere in your busing logic Cheers, Siegfried Goeschl Markus Mehrwald wrote: Hi, I have a problem with the commons mail package. I send mails with attachments but only the attachment from the first mail comes in. The second mail is there but without attachment. When I use the debugger it works so it seems for me that it is a time problem. Do I have the possibility to get informed when the first mail is gone and send then the second one? Thanks, Markus - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: commons-graph
Hi Weijan, commons-graph is not maintained and did not make it into commons (I have seen the source code somewhere) - therefore I'm using jgrapht (http://jgrapht.sourceforge.net/) which is under LGPL Cheers, Siegfried Goeschl Weijian Fang wrote: Hi, Here (https://olex.openlogic.com/packages/commons-graph) says Commons Graph is now a defunct Apache commons project. And I can not find it mentioned anywhere on apache commons website. Is commons-graph no more a desired component of apache commons? Any alternatives recommended? Many thanks in advance! Cheers, Weijian - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [EMAIL] Using Apache Commons Email and Google
Hi folks, see my comments below ... Cheers, Siegfried Goeschl Stefano Kismet Lenzi wrote: On Mon, Nov 16, 2009 at 16:45, Christopher Schultz ch...@christopherschultz.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Stephano, On 11/16/2009 9:43 AM, Stefano Kismet Lenzi wrote: I was trying to use the Commons Email project for sending email with the Google provider, but I failed. I tried with the following code SimpleEmail email = new SimpleEmail(); email.setDebug(true); email.addTo(MAIL_DESTINATION, Stefano Lenzi); email.setFrom(MAIL_SENDER, Test); email.setSubject(Test message); email.setMsg(This is a simple test of commons-email); email.setHostName(SMTP_HOST_NAME); email.setAuthentication(SMTP_AUTH_USER, SMTP_AUTH_PWD); email.setTLS(true); email.setSmtpPort(SMTP_HOST_PORT); email.send(); but nothing happened. Try setting -Dmail.debug=true and run it again. This will give you much more output from Javamail. I have tried to set the option but the output didn't change [SG] you already enabled the debug mode using email.setDebug() It's unclear from the javadoc, but it's possible that setTLS(true) merely configures Javamail to use STARTTLS over a plaintext SMTP connection. If you want to use SMTPS, try setting - -Dmail.transport.protocol=smtps to see if that helps. Even the -Dmail.transport.protocol=smtps system property didn't change anything, it looks like that the system properties are not used by Commons Email [SG] correct - all the required properties are set within commons-email thereby not relying on system properties. DEBUG SMTP: trying to connect to host smtp.gmail.com, port 465, isSSL false See that SSL=false. If you want SSL, use setSSL(true) instead of setTLS(true). I don't know why I haven't tried it before, but I'm glad to say that it worked :) It's strange that the first lines of the output didn't change [SG] Should provide some QA covering connectivity to GMAIL DEBUG: JavaMail version 1.4.1ea-SNAPSHOT DEBUG: not loading file: C:\Programmi\Java\jre6\lib\javamail.providers DEBUG: java.io.FileNotFoundException: C:\Programmi\Java\jre6\lib\javamail.providers (Impossibile trovare il file specificato) DEBUG: !anyLoaded DEBUG: not loading resource: /META-INF/javamail.providers DEBUG: successfully loaded resource: /META-INF/javamail.default.providers DEBUG: Tables of loaded providers DEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.SMTPSSLTransport=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc], com.sun.mail.imap.IMAPSSLStore=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]} DEBUG: Providers Listed By Protocol: {imaps=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc], imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], smtps=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc], pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]} DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map DEBUG: !anyLoaded DEBUG: not loading resource: /META-INF/javamail.address.map DEBUG: not loading file: C:\Programmi\Java\jre6\lib\javamail.address.map DEBUG: java.io.FileNotFoundException: C:\Programmi\Java\jre6\lib\javamail.address.map (Impossibile trovare il file specificato) DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc] DEBUG SMTP: useEhlo true, useAuth true DEBUG SMTP: useEhlo true, useAuth true DEBUG SMTP: trying to connect to host smtp.gmail.com, port 465, isSSL false 220 mx.google.com ESMTP 3sm5919994fge.24 DEBUG SMTP: connected to host smtp.gmail.com, port: 465 In particular, the lines: DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc] DEBUG SMTP: trying to connect to host smtp.gmail.com, port 465, isSSL false I'm not sure what gmail prefers
[ANNOUNCEMENT] Apache Commons Exec 1.0.1 Released
The commons-exec-team is pleased to announce the commons-exec-1.0.1.jar release! A library to reliably execute external processes from within the JVM Changes in this version include: Fixed Bugs: o On a Mac, the unit tests never finish. Culprit is InputStreamPumper which sets its stop member in the run method; however, run might really be executed after the stopProcessing method is called if the process thread completes before the InputStreamPumper starts. Issue: EXEC-33. o Fixes NPE in DefaultExecutor.setExitValues(). Issue: EXEC-40. Thanks to Peter Henderson. o Copies all data from an System.input stream to an output stream of the executed process. Issue: EXEC-33. Thanks to Milos Kleint. Have fun! -commons-exec-team - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [Mail] Hangs on send()
Hi Mike, have a look at http://java.sun.com/products/javamail/javadocs/overview-summary.html and mail.debug Cheers, Siegfried Goeschl Mike Baranski wrote: My app hangs on send, but I can telnet to port 25 on the mail server I'm using and send an email. Can someone explain to me how to turn on debug for the commons-mail and see what's hanging? - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: Commons Exec overview
Will apply the changes :-) Siegfried Goeschl Mark Fortner wrote: As long as we're nitpicking, it should probably read to handle the various issues (plural). Mark On Wed, Oct 7, 2009 at 8:19 AM, Toor, Andeep to...@pragmatics.com wrote: This is obviously a really small issue, but the text on the overview page for Commons Exec needs a correction (under Rationale): The are currently several different libraries that for their own purposes has implemented frameworks around Runtime.exec() to handle the various issue outlined above. It should read: There are currently several different libraries that for their own purposes have implemented frameworks around Runtime.exec() to handle the various issue outlined above. Andeep Toor Software Engineer Pragmatics, Inc. (703) 761- 4033 x1045 www.pragmatics.com Practical. Reliable. Secure. This e-mail message, including any attachments, is intended only for the identified recipient(s). It may contain proprietary or otherwise legally protected information of Pragmatics, Inc. Any unauthorized review, use, copying, disclosure or distribution is strictly prohibited. If you have received this communication in error and are not the intended recipient, please immediately notify the sender of this message by reply e-mail and delete or otherwise destroy the e-mail, attachments, and any copies. - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: Send multiple email
Hi Frans, a few thoughts along the line +) no idea what 1st mailer concept is +) there is no pressing need for Quartz +) I'm using commons-email for sending electronic invoices in production - you might want to have a look at Fulcrum Commons Email service (http://turbine.apache.org/fulcrum/fulcrum-commonsemail/index.html) Cheers, Siegfried Goeschl Frans Thamura wrote: hi there i use the email and use Common Email, and work well but i want to create a campaign program and one email send to 100 email user i love the 1st mailer concept, but it is stand alone, i want the server side mechanism any idea to work with? how to handle the sending process in background must i use like quartz that send every mail, Frans - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [Email] Problem embeding Inline images
Hi Marcio, a lot of this problems (if not all) have been fixed in the current main branch - can you have it a try? Cheers, Siegfried Goeschl Marcio Carvalho wrote: Hi all, I'm experiencing some problems trying to embed images in my emails. I use commons-email-1.1. I have the following code: *HtmlEmail email = new HtmlEmail(); email.setCharset(ISO-8859-1); email.setHostName(EMAIL_SERVER); email.addTo(x, y); email.setFrom(sys...@domain, ACME); email.setSubject(suvject); String cid = email.embed(myFile.jpg); String body = htmlMyFile - img src=\cid:+cid+\/html email.setHtmlMsg(body); email.send(); * So. The email is correctly sent and my images are correctly attached. But the email is not correctly rendered by any of my email clients. Neither Lotus Notes nor Gmail. Checking the email header and payload, everything looks ok. The references are made thru cid and the cids are correctly generated (I guess). All the email formatting is done ok, but the images are not shown in the correct positions. At Gmail, all the images are shown as regular attachment, not inline images. Please, have a look at my original email below and tell me if I am doing something wrong. Any help would be appreciated. Regards, Marcio Carvalho. --- Some parts omitted MIME-Version: 1.0 X-MIMETrack: Itemize by SMTP Server on () at 14/09/2009 14:59:11, Serialize by Router on Y(Release 8.0.2FP1 HF386|May 28, 2009) at 14/09/2009 14:59:15 Content-Type: multipart/related; boundary==_Part_123_81622377.1252951151420 --=_Part_123_81622377.1252951151420 Content-Type: multipart/alternative; boundary==_Part_124_81624107.1252951151420 --=_Part_124_81624107.1252951151420 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=ISO-8859-1 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.=w3.org/TR/html4/loose.dtd; html xmlns=3D'http://www.w3.org/1999/xhtml' head style type='text/css' *, body { background: url(cid:snbjfupfwj) no-repeat top; position: relative; } ... /html --=_Part_124_81624107.1252951151420-- --=_Part_123_81622377.1252951151420 Content-Type: image/jpeg; name=header.jpg Content-Disposition: inline; filename=header.jpg Content-ID: snbjfupfwj Content-Transfer-Encoding: base64 /9j/4AAQSkZJRgABAQEASABIAAD/4QkdRXhpZgAASUkqAAgDABoBBQABMgAAABsBBQAB OgAAACgBAwABAgAAAEIAAABIAQAAAEgBBgADAQMAAQYaAQUA AQAAAJAbAQUAAQAAAJgoAQMAAQIBAgQAAQAAAKACAgQAAQAAAHUI SAEAAABIAQAAAP/Y/+AAEEpGSUYAAQEBAEgASAAA/9sAQwAGBAUGBQQGBgUGBwcG CAoQCgoJCQoUDg8MEBcUGBgXFBYWGh0lHxobIxwWFiAsICMmJykqKRkfLTAtKDAlKCko/9sAQwEH ... - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [Email] Problem embeding Inline images
Hi Marcio, please have a look at http://people.apache.org/builds/commons/email/1.2/RC2/staged/commons-email/commons-email/1.2/ It contains the latest release candidate before SVN infrastructure problems and project pressure stopped my release effort. Cheers, Siegfried Goeschl Marcio Carvalho wrote: I couldn't connect to Apache SVN server. I tried http://svn.apache.org/repos/asf/commons/proper/email/trunk The error was RA layer request failed. Thanks. Marcio On Tue, Sep 15, 2009 at 2:40 PM, Siegfried Goeschl siegfried.goes...@it20one.at wrote: Hi Marcio, a lot of this problems (if not all) have been fixed in the current main branch - can you have it a try? Cheers, Siegfried Goeschl Marcio Carvalho wrote: Hi all, I'm experiencing some problems trying to embed images in my emails. I use commons-email-1.1. I have the following code: *HtmlEmail email = new HtmlEmail(); email.setCharset(ISO-8859-1); email.setHostName(EMAIL_SERVER); email.addTo(x, y); email.setFrom(sys...@domain, ACME); email.setSubject(suvject); String cid = email.embed(myFile.jpg); String body = htmlMyFile - img src=\cid:+cid+\/html email.setHtmlMsg(body); email.send(); * So. The email is correctly sent and my images are correctly attached. But the email is not correctly rendered by any of my email clients. Neither Lotus Notes nor Gmail. Checking the email header and payload, everything looks ok. The references are made thru cid and the cids are correctly generated (I guess). All the email formatting is done ok, but the images are not shown in the correct positions. At Gmail, all the images are shown as regular attachment, not inline images. Please, have a look at my original email below and tell me if I am doing something wrong. Any help would be appreciated. Regards, Marcio Carvalho. --- Some parts omitted MIME-Version: 1.0 X-MIMETrack: Itemize by SMTP Server on () at 14/09/2009 14:59:11, Serialize by Router on Y(Release 8.0.2FP1 HF386|May 28, 2009) at 14/09/2009 14:59:15 Content-Type: multipart/related; boundary==_Part_123_81622377.1252951151420 --=_Part_123_81622377.1252951151420 Content-Type: multipart/alternative; boundary==_Part_124_81624107.1252951151420 --=_Part_124_81624107.1252951151420 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=ISO-8859-1 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.=w3.org/TR/html4/loose.dtd; html xmlns=3D'http://www.w3.org/1999/xhtml' head style type='text/css' *, body { background: url(cid:snbjfupfwj) no-repeat top; position: relative; } ... /html --=_Part_124_81624107.1252951151420-- --=_Part_123_81622377.1252951151420 Content-Type: image/jpeg; name=header.jpg Content-Disposition: inline; filename=header.jpg Content-ID: snbjfupfwj Content-Transfer-Encoding: base64 /9j/4AAQSkZJRgABAQEASABIAAD/4QkdRXhpZgAASUkqAAgDABoBBQABMgAAABsBBQAB OgAAACgBAwABAgAAAEIAAABIAQAAAEgBBgADAQMAAQYaAQUA AQAAAJAbAQUAAQAAAJgoAQMAAQIBAgQAAQAAAKACAgQAAQAAAHUI SAEAAABIAQAAAP/Y/+AAEEpGSUYAAQEBAEgASAAA/9sAQwAGBAUGBQQGBgUGBwcG CAoQCgoJCQoUDg8MEBcUGBgXFBYWGh0lHxobIxwWFiAsICMmJykqKRkfLTAtKDAlKCko/9sAQwEH ... - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org -- Do or do not. There is no try. (Master Yoda) = Marcio Ribeiro de Carvalho marw...@gmail.com marcio.carva...@petrobras.com.br = - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: commons-exec and streams
Hi Steve, as user of your dockook plugin I try to look into the issue - but I'm will be on holidays the next few days ... Cheers, Siegfried Goeschl Steve Ebersole wrote: I am having a problem with using commons-exec and having file output streams end up containing truncated results. I have to assume that the streams are closed by the pump handler before all the output it piped (or perhaps because there is no flush before closing). Here is my usage: http://anonsvn.jboss.org/repos/labs/labs/jbossbuild/maven-plugins/tags/maven-jdocbook-plugin-2.2.0/src/main/java/org/jboss/jdocbook/i18n/gettext/TranslationBuilderImpl.java @ the very end in the generateTranslatedXML method. In digging in to the code, it seems that after Executor#execute() is done processing the launched process, it already closes the streams managed by the PumpStreamHandler so I don't think my explicit flush() and close() in the finally block really have any effect. Can someone outline the correct way to pipe stdout from a process managed by Executor to a file such that the results are not truncated? - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org