[NET - Telnet] Second execution of task hangs forever.

2011-09-28 Thread Fischer, Till
Hello all,

I'm trying to remote control an embedded system using telnet. The system is 
running QNX (A realtime Unixoid).
The first connection with telnet works without any problem. But the second 
hangs forever.
I prepared a minimal working (or rather not working) example:

=
project name=test basedir=. default=telnet2

target name=telnet2 depends=telnet1   
telnet server=192.168.118.130 userid=root password=root 
timeout=5
read#/read
write echo=truels/write
/telnet
/target

target name=telnet1
telnet server=192.168.118.130 userid=root password=root
read#/read
write echo=truels/write
/telnet
echo message=sleeping 2s/
sleep seconds=2/
echo message=slept 2s/
/target
/project
=
If I execute this I get the following output from ant:

=
C:\tmpant
Buildfile: C:\tmp\build.xml

telnet1:
   [telnet]
   [telnet]
   [telnet] QNX Neutrino (localhost) (ttyp0)
   [telnet]
   [telnet]
   [telnet]
   [telnet] login:
   [telnet] root
   [telnet]  Password:
   [telnet]
   [telnet] Wed Sep 28 15:00:20 2011 on /dev/ttyp0
   [telnet] Last login: Wed Sep 28 14:59:24 2011 on /dev/ttyp0
   [telnet] #
   [telnet] ls
 [echo] sleeping 2s
 [echo] slept 2s

telnet2:
Batchvorgang abbrechen (J/N)? J

C:\tmp
=

The second telnet task hung for more than five minutes (note the 5s timeout 
specified).

On the remote systems side I looked for the connection using netstat. It was 
there during the first task execution. Then gone afterwards, and another 
connection was made for the second execution.
So I verified, that the first connection is properly closed, at least on the 
remote system.

Does anybody know of this problem? Can you give me any directions to further 
investigate?
I am writing in the hopes of not having to dig into the commons-net source code 
and debugging it myself.

Best regards
Till

--
Till Fischer
Software Engineer
Software Release Management

Neusoft Technology Solutions GmbH
Hugh-Greene-Weg 2-4
22529 Hamburg - Germany

Mailto: till.fisc...@neusoft.com
www.neusoft.com


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



DBCP 1.4 autocommit

2011-09-28 Thread Andrea Sodomaco

Hi all,
I can't understand why in 
org.apache.commons.dbcp.PoolableConnectionFactory in the passivateObject 
method autocommit is set true:


lines 688-680 (dbcp 14)
 if(!conn.getAutoCommit()) {
conn.setAutoCommit(true);
}

If defaultAutoCommit is set to false the query SET autocommit=1 should 
be executed for each getConnection() call.

This is the all queries log result:

* 12 QuerySET autocommit=1
   12 QuerySET autocommit=0
* 12 Queryselect 
chiave,email,password,status,props,syncro,tipoUtente,sito,newprops from 
utenti where sito='fie' and (tipoUtente='SCUOLASCI' and status=2)

   12 Queryrollback
*   12 QuerySET autocommit=1
   12 QuerySET autocommit=0
*   12 Queryselect 
chiave,email,password,status,props,syncro,tipoUtente,sito,newprops from 
utenti where sito='fie' and (tipoUtente='BIKERENTAL' and status=2)

   12 Queryrollback
*   12 QuerySET autocommit=1
   12 QuerySET autocommit=0
*   12 Queryselect 
chiave,email,password,status,props,syncro,tipoUtente,sito,newprops from 
utenti where sito='fie' and (tipoUtente='RIFUGIO' and status=2)

   12 Queryrollback
*  12 QuerySET autocommit=1
   12 QuerySET autocommit=0
*  12 Queryselect 
chiave,email,password,status,props,syncro,tipoUtente,sito,newprops from 
utenti where sito='fie' and (tipoUtente='SKIRENTAL' and status=2)

   12 Queryrollback
   12 QuerySET autocommit=1

thank you in advance for any suggestion.
Andrea




[jexl] JEXL project status

2011-09-28 Thread Guy Dumais
Hi,

I am planning to use JEXL as part of our commercial product.  I would
like to better understand the current status of the project.  More
precisely,

 

1.   Is the project currently active?

2.   Is there a plan to release a new JEXL revision in a near
future?

 

I would also appreciate if someone in the list could give feedback on
existing commercial software using JEXL.

 

Thank you,

 

Guy Dumais

Senior Software Developer

 

 


***

This e-mail and attachments are confidential, legally privileged, may be 
subject to copyright and sent solely for the attention of the addressee(s). Any 
unauthorized use or disclosure is prohibited. Statements and opinions expressed 
in this e-mail may not represent those of Radialpoint.

Le contenu du présent courriel est confidentiel, privilégié et peut être soumis 
à des droits d'auteur. Il est envoyé à l'intention exclusive de son ou de ses 
destinataires. Il est interdit de l'utiliser ou de le divulguer sans 
autorisation. Les opinions exprimées dans le présent courriel peuvent diverger 
de celles de Radialpoint.


Re: [exec]How could I use exec to execute a java program with keyboard input in it?

2011-09-28 Thread Siegfried Goeschl

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]How could I use exec to execute a java program with keyboard input in it?

2011-09-28 Thread Yi Huang
Thank you very much!
That was exactly what I want.

在 2011年9月28日星期三,Siegfried Goeschl siegfried.goes...@it20one.at 写道:
 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