>Dear sir, > >I have a problem with my servlet file.I want to create >html file from the xml file using xslt through xsl >processor.My 1st servlet creating xml file which is >taking data from data base and 2nd servlet convert >that xml file to html. >My first servlet working perfectly.But when I >communicate two servlet through sendRedirect() >method.Server giving error:- >{500 Internal Server Error >The servlet named xlm1 at the requested URL > >http://127.0.0.1:8080/servlet/xlm1 >reported this exception: Read timed out. Please report >this to the administrator of the web server.}In 2nd >servlet saxon.bat file converting xml to html >file.Please guide me where I done a mistake. > >Here is my 1st servlet:- > >import java.io.*; >import org.apache.crimson.tree.*; >import org.w3c.dom.*; >import java.sql.*; >import javax.servlet.*; >import javax.servlet.http.*; >import org.apache.crimson.parser.*; > > >public class xlm extends HttpServlet >{ > public void doGet(HttpServletRequest >req,HttpServletResponse res) > throws ServletException,IOException > { > > res.setContentType("text/xml"); > PrintWriter out = res.getWriter(); > try{ > Connection con=null; > Statement st ; > ResultSet rs; > String itemName; > String itemDescription; > String add ; > String city ; > String country; > > ElementNode item; > ElementNode name ; > ElementNode desc ; > ElementNode address ; > ElementNode cityname; > ElementNode countryname ; > > > XmlDocument xmlDoc = new XmlDocument (); > >ElementNode items = >(ElementNode)xmlDoc.createElement("ITEMS"); > >Writer out1 = new OutputStreamWriter(new >FileOutputStream("c:\\xy3.xml")); > >xmlDoc.appendChild(items); >System.out.println("BEFORE >CONNECTION------------------------------------------"); > >Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); > >con >=DriverManager.getConnection("jdbc:odbc:biku2","sa",""); >System.out.println("AFTER >CONNECTION------------------------------------------"); >st = con.createStatement(); >System.out.println("before >queryE------------------------------------------"); >String sQry = "SELECT NAME, SNAME, ADDRESS, >CITY,COUNTRY FROM TEST_DATA"; > > rs = st.executeQuery(sQry); > > while(rs.next()) > { > itemName = rs.getString("NAME"); > itemDescription = rs.getString("SNAME"); > add = rs.getString("ADDRESS"); > city = rs.getString("CITY"); > country = rs.getString("COUNTRY"); > > > > item = (ElementNode)xmlDoc.createElement("ITEM"); > items.appendChild (item); > > name = >(ElementNode)xmlDoc.createElement("NAME"); > item.appendChild (name); > name.appendChild(xmlDoc.createTextNode(itemName)); > desc = (ElementNode)xmlDoc.createElement("SURNAME"); > item.appendChild (desc); > >desc.appendChild(xmlDoc.createTextNode(itemDescription)); > > address = >(ElementNode)xmlDoc.createElement("ADDRESS"); > item.appendChild (address); > address.appendChild(xmlDoc.createTextNode(add)); > > cityname = (ElementNode)xmlDoc.createElement("CITY"); > item.appendChild (cityname); > cityname.appendChild(xmlDoc.createTextNode(city)); > > countryname = >(ElementNode)xmlDoc.createElement("COUNTRY"); > item.appendChild (countryname); > >countryname.appendChild(xmlDoc.createTextNode(country)); > > } > > > > > > xmlDoc.write (out1); > > out1.flush (); > > con.close(); > } > catch(Exception ex) > {} > >res.sendRedirect("http://127.0.0.1:8080/servlet/xlm1"); > > > > > } >} > >2nd servlet file:- > >import java.io.*; >import java.util.*; >import javax.servlet.*; >import javax.servlet.http.*; >public class xlm1 extends HttpServlet > { > public void doGet(HttpServletRequest >req,HttpServletResponse res) > throws ServletException,IOException > { > > res.setContentType("text/html"); > PrintWriter out=res.getWriter(); > BufferedReader b = new BufferedReader( new >InputStreamReader(req.getInputStream())); > String line1 = b.readLine(); > while((line1=b.readLine()) !=null) > { > FileWriter f1=new FileWriter("c:\\xy3.xml"); > f1.write(line1); > f1.close(); > } > > Runtime r = Runtime.getRuntime(); > Process p=null; > try > { > p=r.exec("c:\\saxon.bat"); > > } > catch(Exception e) > { > out.println("Error from execution" + >e.toString()); > } > out.println("Your file created successfully"); > > } > > } >With Regards >Bikash
I'm sorry, but there's no evidence that your problem has anything to do with Saxon, and I can't help you with general servlet programming problems.
Mike Kay
>Dear sir,
>
>I have a problem with my servlet file.I want to create
>html file from the xml file using xslt through xsl
>processor.My 1st servlet creating xml file which is
>taking data from data base and 2nd servlet convert
>that xml file to html.
>My first servlet working perfectly.But when I
>communicate two servlet through sendRedirect()
>method.Server giving error:-
>{500 Internal Server Error
>The servlet named xlm1 at the requested URL
>
>http://127.0.0.1:8080/servlet/xlm1
>reported this exception: Read timed out. Please report
>this to the administrator of the web server.}In 2nd
>servlet saxon.bat file converting xml to html
>file.Please guide me where I done a mistake.
>
>Here is my 1st servlet:-
>
>import java.io.*;
>import org.apache.crimson.tree.*;
>import org.w3c.dom.*;
>import java.sql.*;
>import javax.servlet.*;
>import javax.servlet.http.*;
>import org.apache.crimson.parser.*;
>
>
>public class xlm extends HttpServlet
>{
> public void doGet(HttpServletRequest
>req,HttpServletResponse res)
> throws ServletException,IOException
> {
>
> res.setContentType("text/xml");
> PrintWriter out = res.getWriter();
> try{
> Connection con=null;
> Statement st ;
> ResultSet rs;
> String itemName;
> String itemDescription;
> String add ;
> String city ;
> String country;
>
> ElementNode item;
> ElementNode name ;
> ElementNode desc ;
> ElementNode address ;
> ElementNode cityname;
> ElementNode
countryname ;
>
>
> XmlDocument xmlDoc = new XmlDocument ();
>
>ElementNode items =
>(ElementNode)xmlDoc.createElement("ITEMS");
>
>Writer out1 = new OutputStreamWriter(new
>FileOutputStream("c:\\xy3.xml"));
>
>xmlDoc.appendChild(items);
>System.out.println("BEFORE
>CONNECTION------------------------------------------");
>
>Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
>
>con
>=DriverManager.getConnection("jdbc:odbc:biku2","sa","");
>System.out.println("AFTER
>CONNECTION------------------------------------------");
>st = con.createStatement();
>System.out.println("before
>queryE------------------------------------------");
>String sQry = "SELECT NAME, SNAME, ADDRESS,
>CITY,COUNTRY FROM TEST_DATA";
>
> rs = st.executeQuery(sQry);
>
> while(rs.next())
> {
> itemName = rs.getString("NAME");
> itemDescription = rs.getString("SNAME");
> add = rs.getString("ADDRESS");
> city = rs.getString("CITY");
> country = rs.getString("COUNTRY");
>
>
>
> item = (ElementNode)xmlDoc.createElement("ITEM");
> items.appendChild (item);
>
> name =
>(ElementNode)xmlDoc.createElement("NAME");
> item.appendChild (name);
> name.appendChild(xmlDoc.createTextNode(itemName));
> desc = (ElementNode)xmlDoc.createElement("SURNAME");
> item.appendChild (desc);
>
>desc.appendChild(xmlDoc.createTextNode(itemDescription));
>
> address =
>(ElementNode)xmlDoc.createElement("ADDRESS");
> item.appendChild (address);
> address.appendChild(xmlDoc.createTextNode(add));
>
> cityname = (ElementNode)xmlDoc.createElement("CITY");
> item.appendChild (cityname);
> cityname.appendChild(xmlDoc.createTextNode(city));
>
> countryname =
>(ElementNode)xmlDoc.createElement("COUNTRY");
> item.appendChild (countryname);
>
>countryname.appendChild(xmlDoc.createTextNode(country));
>
> }
>
>
>
>
>
> xmlDoc.write (out1);
>
> out1.flush ();
>
> con.close();
> }
> catch(Exception ex)
> {}
>
>res.sendRedirect("http://127.0.0.1:8080/servlet/xlm1");
>
>
>
>
> }
>}
>
>2nd servlet file:-
>
>import java.io.*;
>import java.util.*;
>import javax.servlet.*;
>import javax.servlet.http.*;
>public class xlm1 extends HttpServlet
> {
> public void doGet(HttpServletRequest
>req,HttpServletResponse res)
> throws ServletException,IOException
> {
>
> res.setContentType("text/html");
> PrintWriter out=res.getWriter();
> BufferedReader b = new BufferedReader( new
>InputStreamReader(req.getInputStream()));
> String line1 = b.readLine();
> while((line1=b.readLine()) !=null)
> {
> FileWriter f1=new
FileWriter("c:\\xy3.xml");
> f1.write(line1);
> f1.close();
> }
>
> Runtime r = Runtime.getRuntime();
> Process p=null;
> try
> {
> p=r.exec("c:\\saxon.bat");
>
> }
> catch(Exception e)
> {
> out.println("Error from execution" +
>e.toString());
> }
> out.println("Your file created successfully");
>
> }
>
> }
>With Regards
>Bikash
I'm sorry, but there's no evidence that your problem has anything to do with Saxon, and I can't help you with general servlet programming problems.
Mike Kay