tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "cib" <c....@laposte.net>
Subject Re: xsp kills Tomcat and Cocoon2
Date Fri, 28 Sep 2001 07:25:18 GMT
Thanks for correcting me, I make the code by adding lines I get in tutorial
and books, but without really knowing java.
It didn't kill Tomcat this time, but it didn't create the file output2.txt
neither.
If you've got another idea for that
Thanks again.
Cib

France, Bordeaux , xml and gay pride.

----- Original Message -----
From: "Craig R. McClanahan" <craigmcc@apache.org>
To: "Tomcat User Mail List" <tomcat-user@jakarta.apache.org>; "cib"
<vendo1@caramail.com>
Sent: Friday, September 28, 2001 4:00 AM
Subject: Re: xsp kills Tomcat and Cocoon2


Why are you calling System.exit()?  *That* is what kills Tomcat!

Craig


On Thu, 27 Sep 2001, cib wrote:

> Date: Thu, 27 Sep 2001 22:30:33 +0200
> From: cib <c.cib@laposte.net>
> Reply-To: tomcat-user@jakarta.apache.org, cib <vendo1@caramail.com>
> To: Tomcat User Mail List <tomcat-user@jakarta.apache.org>
> Subject: xsp kills Tomcat and Cocoon2
>
> Hi,
> I've modified "localhost" to "mydomain" as Karl Øie suggested, but each
time
> I try this, I can't get any other request, even Tomcat home index is down,
> and the only message is in the dos-java window:
>
> CheckedIODemo: java.net.UnknownHostException: www.mydomain
>
> Here is make2.xsp:
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
>
> <xsp:page
>           language="java"
>           xmlns:xsp="http://apache.org/xsp"
>           xmlns:esql="http://apache.org/cocoon/SQL/v2">
>
> <xsp:structure>
>   <xsp:include>java.io.*</xsp:include>
>   <xsp:include>java.net.*</xsp:include>
> </xsp:structure>
>
>
>
> <xsp:logic>
>
>
>
> class make_xsl {
>    public void main() {
>
> try {
> URL myurl = new URL( "http://www.mydomain/cocoon/test/a1.html" );
> BufferedInputStream inn = new BufferedInputStream(myurl.openStream());
> BufferedWriter out = new BufferedWriter( new OutputStreamWriter( new
> FileOutputStream("output2.txt") ) );
> for(;;) {
>      int data = inn.read();
> if (data == -1) {
> break;
> }
> else {
> out.write((char) data);
> }
> }
> out.flush();
>
>
>        } catch (FileNotFoundException e) {
>            System.err.println("CheckedIODemo: " + e);
>            System.exit(-1);
>        } catch (java.io.IOException e) {
>            System.err.println("CheckedIODemo: " + e);
>            System.exit(-1);
>  } catch (NoSuchMethodError e) {
>            System.err.println("CheckedIODemo: " + e);
>            System.exit(-1);
>  } catch (Exception e) {
>            System.err.println("CheckedIODemo: " + e);
>            System.exit(-1);
>       }
>  }
> }
>
> </xsp:logic>
>
>
>   <page>
>
> <xsp:logic>
>     make_xsl anObject = new make_xsl();
>     anObject.main();
> </xsp:logic>
>
>
> If you see this, it works.
>
>   </page>
> </xsp:page>
>
> As I said in a rather private thread to Karl (on Cocoon user mailing
list),
> my previous attempt worked but the input filed wasn't accessed through an
> url. This previous code also killed Tomcat and cocoon2 if the input file
> wasn't in Tomcat/bin directory (I found out by puting a file a1.html in
> every directory one by one). The file "output.txt" was also be created in
> Tomcat/bin.
>
>
> class make_xsl {
>    public void main() throws IOException {
>  try {
>  FileReader entree = new FileReader("a1.html");
>   FileWriter sortie = new FileWriter("output.txt");
>  int c;
>  while ( (c = entree.read()) != -1 )
> sortie.write(c);
> sortie.close();
> entree.close();
>  } catch (FileNotFoundException e) {
>            System.err.println("CheckedIODemo: " + e);
>            System.exit(-1);
>        } catch (java.io.IOException e) {
>            System.err.println("CheckedIODemo: " + e);
>            System.exit(-1);
>        }
>
>      }
> }
>
> If someone knows how to get the input file through an url without killing
> Tomcat...
> Thanks in advance.
>
> Cib,
>
> France, Bordeaux, xml and gay pride.
>
>



Mime
View raw message