Jsp as a stream in a servlet

hello,
I have to create a text file with the result of a jsp. So,
I have to execute a jsp inside a servlet (I have the URL) and have to get the result in a stream, read the stream line by line and create this file in a text format.
Any ideas ? I am a beginner in J2EE. Thanks by advance.

OUF : for whom who are interrested, I found THE/ONE solution to my problem. This code export the result of a jsp page to the filesystem.
URL url = RequestUtils.absoluteURL(request, currentBody);
URLConnection conn = WebUtils.openURL(request, url);
WebUtils.exportFile(conn, fileName);
- currentBody is a relative url string,
- RequestUtils come from the org.apache.struts.util package,
- WebUtils is a personnal class, with those methods :
public static URLConnection openURL(HttpServletRequest request,
               URL url) throws IOException {
          URLConnection conn = null;
          conn = url.openConnection();
          conn.setAllowUserInteraction(false);
          conn.setDoInput(true);
          conn.setDoOutput(false);
          if ((conn instanceof HttpURLConnection)
          && request.getRequestedSessionId() != null
          && request.isRequestedSessionIdFromCookie()) {
          StringBuffer sb = new StringBuffer("JSESSIONID=");
          sb.append(request.getRequestedSessionId());
          conn.setRequestProperty("Cookie", sb.toString());
          conn.connect();
          return conn;
     public static void exportFile(URLConnection conn, String fileURL) throws IOException {
          StringBuffer sb = new StringBuffer();
          BufferedInputStream is = new BufferedInputStream(conn.getInputStream());
          BufferedReader in = new BufferedReader(new InputStreamReader(is));
          FileWriter out = new FileWriter(new File(fileURL));
          String line = "";
          while((line = in.readLine()) != null) { 
          out.write(line);
          in.close();
          out.close();
See you soon, I guess some other problems are coming...
Cyril.

Similar Messages

  • FOP + servlet, external graphic streamed from another servlet

    Howdy,
    I currently have a servlet that assembles fragments of XHTML into a single document and then either sends it as straight XHTML or transforms it into Formatting Objects using XSLT. The FO are then used to generate a PDF file.
    The rub is with the external graphic src attribute in the FO. The image data has to be streamed using a servlet and while a relative URL works fine for sending straight HTML, FOP can't find the servlet specified in the translated external graphic src attribute.
    The first problem is that I do not know how to get the current URL from the servlet context or some other source. I would rather not hard code this value for obvious reasons but if I can obtain it from the servlet it will be easy to prepend it to the graphic src attributes.
    The second problem is that when I achieve this, I'm sure FOP will throw a wobbly because it can't determine the image type from the URL. I'm thinking that this can be fixed by adding the appropriate image extension to the servlet name in the URL then messing about with servlet mapping in Tomcat. The first problem is my biggest concern right now.
    Has anyone met this problem before or know of a standard way around it? Any suggestions would be greatly appreciated.
    Cheers.

    I can only try and move it there with my Jedi mind power...rather than commit the ultimate sin of crossposting.

  • Corrupted java.io.stream.CorruptedException in servlet

    I am getting
    Corrupted java.io.stream.CorruptedException in servlet
    while reading data from JApplet.
    The error description is
    Caught EOF Exeption while reading the streamheader.
    Kindly let me know if anybody has got a solution to this.
    regards

    are you passing serialized objects through the i/o stream? If you're code is sending serialized objects they may be reconstructed incorrectly by the recipiant. When reading the input stream, its likely your JAplet is misinterpreting the object it recieves, resulting in a 'corrupted' exception. If this is the case, make sure your JAplet is constructing the correct type of object from its input.
    not much help really, but better than nothing I guess.
    rob

  • How does a JSP page send data to a servlet?

    I know, elementary school question, but I can't seem to do it no matter what I tried to do. Here is my code:
           URL url = new URL("http://" + ChatGlobals.SERVER_NAME + "/" +
                    ChatGlobals.SERVLET_PATH + "/ppowell.ChatServlet?message=" +
                    URLEncoder.encode("/a " + cookieArray.getValue())
    out.println("<P>" + url.toString());
    HttpURLConnection conn = (HttpURLConnection)url.openConnection();
    conn.setDoInput(true);     // NOT REALLY INTERESTED IN INPUT BUT MUST BE TRUE
    conn.setDoOutput(false);     // NO OUTPUT
    conn.setUseCaches(false);
    conn.setDefaultUseCaches(false);
    conn.setRequestProperty("Content-type", "text/plain");
         * Do servlet connection to retrieve from ChatServlet URL instance
         * by instantiating an InputStreamReader object
         * @see ChatServlet
    BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
    String stuff = null;
    stuff = in.readLine();
    out.print(stuff);
    in.close();
    in = null;
    conn = null;
    Upon running this code my page just locks up.. URL: http://www.myjavaserver.com/~ppowell/chat.jsp
    But if I call the servlet directly:
    http://www.myjavaserver.com/servlet/ppowell.ChatServlet?message=/a+Phil
    Everything works perfectly, no lockups, no errors, the log and txt files are created. So if my browser calls the servlet everything is ok, but my JSP script in the same directory as my servlet is the one that needs to call the servlet.
    How then does a JSP send data to a servlet?
    Please help, I've been searching in books and online resources for days now with absolutely no apparent luck to do it.
    Thanx
    Phil

    It's correct that a JSP is compiled to a servlet. All HTTP servlets receive requests and send responses via HTTP, of course.
    But this JSP is making a URL connection to a servlet and sending data.
    Are you sure that the URL your JSP creates is identical to the one that works in your browser? Have you printed it out to stdout to verify that it's true? (Code inspection and "it looks right" doesn't count.)
    Why are you doing it this way? It's common to have a JSP send to a servlet, but the usual way of doing it is to put an HTML form in the JSP, including an HTML <input type="submit">, and POSTing the form data to a servlet URL. Why aren't you doing that? - MOD

  • Streaming files through servlet

    Hi,
    I'm trying to stream a file to the client browser via a Struts action. I use a helper method as follows:
    public static void streamFile(HttpServletResponse response, String contentType, String fileName, InputStream fileData) throws Exception {
              response.setContentType(contentType);
              response.setHeader("Content-disposition", "attachment; filename=" + fileName);
              BufferedInputStream bis = null;
              BufferedOutputStream bos = null;
              OutputStream out = response.getOutputStream();
              try {     
                   bis = new BufferedInputStream(fileData);
                   bos = new BufferedOutputStream(out);
                   byte[] buff = new byte[2048];
                   int bytesRead;
                   //     Simple read/write loop.
                   while(-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
                        bos.write(buff, 0, bytesRead);
              } catch (Exception e) {
                   throw new Exception("Could not stream file. Error: " + e.getMessage());
              } finally {
                   if (bis != null) {
                        bis.close();
                   if (bos != null) {
                        bos.close();
         }Here's the execute method code for my download action:
    InputStream is = new FileInputStream(new File("g:/Test.txt"));
              FileHelper.streamFile(response, "text/plain", "Test.txt", is);
              return null; "G:\Test.txt" is a valid file. When I tried to run the code, I got this error from the client:
    Internet Exporer cannot download download.do from 127.0.0.1. Internet Explorer was not able to open this site.
    The requested site is either unavailable or cannot be found. Please try again later.
    Any ideas what I'm missing here?
    Thanks in advance for any suggestions!

    Hi all,
    Have found out what's wrong with this.
    Seems like the struts contoller was set to use nocache="true" option, which causes problems because in order for files to be downloaded onto the client, caching must be enabled.
    This applies for all web application processes which need to download files onto the client.
    E.g., if you are using servlets/JSP, you need to make sure that you do not send the pragma=no-cache header.
    E.g. if you use a framework like Struts, you need to make sure that the framework does not disable caching for the module which handles the download.

  • Unable to get the errorlogin.jsp to run correctly in a servlet.

    I am attempting to read the users input using jsp and run the servlet LoginServlet to cross check the database to see if that are in the database. The problem i am having is that i can get the login working but am unable to get the errorlogin to run if the details are incorrect. Can anyone see where i have gone wrong? Thanks!
    package Login;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    public class LoginServlet extends HttpServlet {
        @Override
        protected void doPost(HttpServletRequest request, HttpServletResponse response)
                throws ServletException, IOException {
            try {
                try {
                    Connection con = DBConnect.DbConnection.getConnection();
                    Statement st = con.createStatement();
                    String user = request.getParameter("t1");
                    String pass = request.getParameter("t2");
                    String strSQL = "SELECT username, password FROM users "
                            + "WHERE username = '" + user + "' "
                            + "AND password = '" + pass + "'";
                    ResultSet rs = st.executeQuery(strSQL);
                    String username, password;
                    HttpSession session = request.getSession();
                    while (rs.next()) {
                        username = rs.getString("username");
                        password = rs.getString("password");
                        if (user.equals(username) && pass.equals(password)) {
                            response.sendRedirect("next.jsp");
                        } else {
                            response.sendRedirect("errorlogin.jsp");
                } catch (ClassNotFoundException cnfe) {
                    cnfe.getMessage();
            } catch (SQLException sqle) {
                sqle.getMessage();
    }

    How do You ensure that an exception is raised? Do You see any info in log files?
    Not sure if this helps but try:
        response.sendRedirect(request.getConextPath()+"/errorlogin.jsp");In this case errorlogin.jsp should be put on the same level as WEB-INF directory is.

  • Form jsp data are not going to servlet

    Hi guys
    i got a problem doing my uni assignment. this is an assignment about taking data from a html webpage. then storing the data in a xml document through java servlet. the problem is when i try to pass tha data through servlet it doesnt work. the error message it give is following:
    Error: 500
    Location: /BookingApp/servlet/BookingProcessServlet
    Internal Servlet Error:
    java.lang.NullPointerException
         at BookingProcessServlet.generateDOM(BookingProcessServlet.java:119)
         at BookingProcessServlet.doPost(BookingProcessServlet.java:294)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java:574)
         at org.apache.tomcat.core.Handler.invoke(Handler.java:322)
         at org.apache.tomcat.core.Handler.service(Handler.java:235)
         at org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:485)
         at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:917)
         at org.apache.tomcat.core.ContextManager.service(ContextManager.java:833)
         at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10Interceptor.java:176)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:494)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:516)
         at java.lang.Thread.run(Thread.java:479)
    the coding in the corresponding linnes mentioned in the error message i have givan below:
    for at BookingProcessServlet.generateDOM(BookingProcessServlet.java:119)
              BookingBean [] bookinglist = (BookingBean []) bookings;
         >>>>     for(int i=0; i<bookinglist.length; i++) >>>> this the line where the error is shown
                   if (bookinglist[i] != null)
                        bookingcount++;
                   else
                        continue;
    for at BookingProcessServlet.doPost(BookingProcessServlet.java:294)
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
         String action = request.getParameter("action");
         if (action != null && action.equals("Back"))
              if(insertBookingToSession(request))
                   response.sendRedirect("../jsp/deafault.html");
              else
              response.sendRedirect("../jsp/ListFullError.html");
         else if (action != null && action.equals("Confirm"))
              Document newDOMTree = generateDOM(request);
              generateXMLDocument(newDOMTree);
              HttpSession session = request.getSession(true);
              session.removeAttribute("BookingList ");
              response.sendRedirect("../jsp/confirm.html");
    Please this is is urgent. the problem is I am new in JSP and Java Servlet programming. So I dont have any idea what is this problem.
    please reply as soon as possible. thank u guys.
    waiting for the replies.

    hei chk d ff code : this code works i tried dis before i gave it to u
    <HTML>
    <%@ page import="java.io.*"%>
    <%@ page import="java.util.*"%>
    <%
    if(request.getParameter("submit")!=null){
         String filename="C:/Program Files/Apache Group/Tomcat 4.1/webapps/lbc/xml/test.xml";
         String xmlString = "<xml>";
         Enumeration enums = request.getParameterNames();
         while(enums.hasMoreElements()){
         String tagname= (String) enums.nextElement();
         xmlString = xmlString +"<"+tagname+">";
         xmlString = xmlString +request.getParameter(tagname);
         xmlString = xmlString +"</"+tagname+">";
         System.out.println(xmlString);
         try {
         BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(new File(filename)));
         bos.write(xmlString.getBytes());
         bos.flush();
         bos.close();
         catch (IOException ioe) {
         System.out.println(ioe.toString());
    response.sendRedirect("Confirmation.jsp");     
    %>
    <TABLE CELLSPACING="1" CELLPADDING="0" BORDER="0" WIDTH="50%">
    <FORM method="post" NAME="test">     
         <TR>
         <TD BGCOLOR="#94976E">First Name:</TD>
         <TD><input type="text" name="fname"/></TD>
         </TR>
         <TR>
         <TD BGCOLOR="#94976E">Last Name</TD>
         <TD><input type="text" name="lname"/></TD>
         </TR>
         <TR>
         <TD BGCOLOR="#94976E">Middle Initial</TD>
         <TD><input type="text" name="iname"/></TD>
         </TR>
         <tr>
         <td colspan="2" align="center"><INPUT TYPE="SUBMIT" NAME="submit" VALUE="Send"/></td>
         </tr>
    </FORM>
    </TABLE>
    </HTML>

  • Flush parameter of jsp:include has no effect on servlet code

    I am running 9.0.3 and my jsp code looks like:
    &lt;jsp:include page =".." flush="false"/&gt;
    but the resulting servlet code is:
    pageContext.include( __url);
    Which defaults to flushing the buffer!
    Does anyone know a work around or if Oracle is going to fix this?
    Thanks,
    Mike

    Try:
    public class ...  extends ...
        private static final boolean antialias = Boolean.getBoolean ("swing.aatext");
        private static Map hintsMap = null;
        @SuppressWarnings("unchecked")
        static final Map getHints() {
           if (hintsMap == null) {
                hintsMap = (Map)(Toolkit.getDefaultToolkit().getDesktopProperty("awt.font.desktophints")); //NOI18N
                 if (hintsMap == null) {
                    hintsMap = new HashMap();
                     if (antialias) {
                          hintsMap.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
           return hintsMap;
    ... later in class ...
        @Override
        protected void paintComponent(Graphics g) {
            Graphics2D g2d = (Graphics2D) g;
            g2d.addRenderingHints(getHints());
            super.paintComponent(g);
            ...needed this so custom paint would use AA. In my app I wrote text in my component and it was not AA, this turned it on.
    I don't think I had the same problem you, as my jlabels were always aa.
    Edited by: 805835 on Oct 27, 2010 5:06 PM
    Edited by: 805835 on Oct 27, 2010 5:07 PM

  • Jsp to get info out of servlet question

    Hey, I'm looking for a good site or tutorial with examples in how to get info out of a bean or servlet.
    for example I have a bean that querys a db for info. how do I print that info to a jsp page with out using the out.printWriter? I know I need to use the <jsp:useBean...
    but after I instantiate the bean how do I pull info off of it?

    The Sun Java Developer site has a tutorial for almost everything. Check out the J2EE tutorial at http://java.sun.com/j2ee/tutorial/1_3-fcs/index.html
    There is a section on using JavaBeans in JSP pages.

  • JSP accesing data from inside a servlet

    Is there any way. I dont want to have to forward anything
    Is there any include I can do and the contents would be parsed then
    I could run servlet methods and display the data on the JSP?

    Why dont u try to use some java non-servlet class rather than servlet.

  • Retrieving session data in JSP  which is forwarded from a servlet

    I'm trying to retrieve session data which is set in a servlet and pass to a jsp. But its returning NULL . The session IDs are equal.
    Scenario:
    JSP display the checkbox, user selects it and submits to a servlet. the servlet display the selected items and stores the data in session.
    when the user press back button in servlet all i want to do is display those checked box which were selected before as checked in the JSP so that user can edit.
    Following is a small test code
    JSP
    <html>
         <head>
              <title>Item List</title>
         </head>
         <body bgcolor="#fedeab"><br><br><br>
         <p align=center>
              <font size=4>
              Choose the item you want!!!
         </p>
         <form action="/demo/showitem" method="post">
              <%=session.getId()%>
              <div align=center>
              <fieldset style="width:250px">
              <legend style="text-align:center">List of item</legend> <br>
              <%     
                   if (session.getAttribute("book1")!=null) {
              %>
                   <input type="checkbox" name="book1" value="book1" checked > Book 1 <br>
              <% } else {%>
                   <input type="checkbox" name="book1" value="book1" > Book 1 <br>
              <% }%>
              <input type="submit" value="Enter">
              </fieldset>
              </div>
         </form>
         </body>
    </html>               
    Servlet
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class ShowItem extends HttpServlet
         public void doPost (HttpServletRequest req, HttpServletResponse res)throws ServletException, IOException
              HttpSession session = req.getSession(true);
              res.setContentType("text/html");
              PrintWriter out = res.getWriter();
              out.println(session.getId());
              out.println("<br>");
              out.println("<form>");
              String book1 = req.getParameter("book1");
              session.setAttribute("book1",book1);
              if (book1 != null)
                   out.println ("1." + book1 +"<br>");
                   out.println("<br><br><input type=\"submit\" name=\"buy\" value=\"Buy\">");
              else
                   out.println("No item to display<br>");
              out.println("&nbsp&nbsp<input type=\"submit\" name=\"back\" value=\"Back\">");
              out.println("</form>");
              RequestDispatcher page = getServletContext().getRequestDispatcher("/jsp/litemlist.jsp");
              if ((req.getParameter("buy"))!= null)
                        page.forward(req, res);
              if ((req.getParameter("back"))!= null)
                        page.forward(req, res);
         public void doGet (HttpServletRequest req, HttpServletResponse res)throws ServletException, IOException
              doPost(req,res);
    }

    req.getParameter("book1") is not NULL and returning the value of the checkbox "book1". The problem occurs when the back button is press and try to retrieve the session value in the JSP. At that time, session.getAttribute("book1") returns NULL.
    But if i convert the servlet to JSP then everything is working fine.
    So i wanted to know if there is anything wrong in the way i store the session value in the servlet and forwarding to the JSP.
    Thanks

  • Jsp give me this error javax.servlet.ServletException: oracle.jdbc.driver.O

    Hi master
    Sir I use orace 9i easily in java class with following code
    ===========
    import java.sql.*;
    public class ttst {
    public ttst() {
    public static void main (String args [])
    try{
    Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@fahim:1521:aamir","muhammad","mfa786");
    Statement stmt = conn.createStatement();
    ResultSet rset = stmt.executeQuery("select accid from accbal where accid='K1101'");
    System.out.println ("going for connection");
    while (rset.next())
    s= rset.getString("accid");
    System.out.println (s);
    catch(Exception e){
    e.printStackTrace();
    system give me right result
    and when I use jsp with this code
    <HTML>
    <%@ page import="java.sql.*,java.util.*" %>
    <% String url="jdbc:oracle:thin:@fahim:1521:aamir";
    Connection con;
    Statement stmt;
    ResultSet rs;
    Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    con = DriverManager.getConnection(url,"muhammad","mfa786");
    stmt=con.createStatement();
    %>
    <%
    %>
    <select name="ltpid">
    <%
    try{
    rs= stmt.executeQuery("select accid,title from chartofacc");
    while (rs.next()){
    %>
    <option Value=<%=rs.getString(1)%>> <%=rs.getString(2) %> </option>
    <%
    catch(Exception e){}
    %>
    </select>
    <br>
    TEST DONE!
    </HTML>
    sir I have class12.zip and class11.zip I same folder
    but system give me this error
    Apache Tomcat/4.0.6 - HTTP Status 500 - Internal Server Error
    type Exception report
    message Internal Server Error
    description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: oracle.jdbc.driver.OracleDriver
    at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:471)
    at org.apache.jsp.bistest$jsp._jspService(bistest$jsp.java:128)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet$JspServletWrapper.service(IDEJspServlet.java:173)
    at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.serviceJspFile(IDEJspServlet.java:246)
    at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.service(IDEJspServlet.java:339)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:226)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.netbeans.modules.web.monitor.catalina.MonitorValve.invoke(MonitorValve.java:148)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
    at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
    at java.lang.Thread.run(Thread.java:534)
    root cause
    java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1406)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1254)
    at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:198)
    at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:132)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:141)
    at org.apache.jsp.bistest$jsp._jspService(bistest$jsp.java:70)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet$JspServletWrapper.service(IDEJspServlet.java:173)
    at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.serviceJspFile(IDEJspServlet.java:246)
    at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.service(IDEJspServlet.java:339)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:226)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.netbeans.modules.web.monitor.catalina.MonitorValve.invoke(MonitorValve.java:148)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
    at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
    at java.lang.Thread.run(Thread.java:534)
    but jsp page not run
    please give me idea how I how my oracle data in jsp page
    thank
    aamir

    sir i post my problem but they reply me it java problem not oracle problem
    *** oracle reply**********
    You metioned that you use
    jdbc:oracle:thin:@<ip or hostname of machine where your db is installed>: 1521:aamir , description to connect the remote database. So, I think it's not related to your tnsname.ora problem. It's only java oracle thin connection string. Please check this string, make sure the ip and database service name is right.
    one more thing, use sqlplus check your tnsname.ora, if ok, then try to check jdbc and make sure the jdbc driver match to oracle server.
    sir please give me idea how i show my oracle data in clinet browser
    thank's
    aamir 

  • How to parse a XML stream sent to servlet with PUT method

    Hi,
    I have to interface my servlet app with other apps communicating with XML.
    This way, My servlet will receive a XML stream in the http request, parse it and send back a XML message.
    What I've done is :
    An html page to send a XML File with a put method :
    <form enctype="multipart/form-data" method="PUT" action="http://localhost:8080/MyApp/servlet/TestUploadServlet">
         <input type="file" size="20" name="FileToUpload" value="Select File">
         <input type="submit" name="UploadFile" value="Upload">
         <input type="reset" value="Reset">
    </form>
    A servlet TestUploadServlet with :
    SAXParser parser = new SAXParser( );
    Trace.traceLine( "SAXParser" );
    parser.setContentHandler (this);
    try {
    parser.parse( new InputSource( requete.getInputStream() ) );
    catch (SAXException e) {
    Trace.traceLine( e.getMessage() );
    catch (IOException e) {
    Trace.traceLine( e.getMessage() );
    and the methods startElement, stopElement and other to work with the elements detected by the parser (already used by other programs parsing local xml files).
    And it doesn't work.
    is the html code is a good way to send a file in the http Put method ?
    is the parser.parse( new InputSource( requete.getInputStream() ) ); a good method to read the stream ?
    please help.

    I think the problemn comes from the method used to send the <XML> stream.
    Using an html form doesn't seem to be a good method.
    I tried several methods or examples found and none of them seems to work.
    here is another example in the servlet side :
    public void doPost(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException
    ServletOutputStream output = res.getOutputStream();
    output.println("ContentType: " + req.getContentType() + "<BR>");
    int content_length = req.getContentLength();
    output.println("ContentLength: " + content_length + "<BR>");
    if(content_length > 0) {
    output.println("Content: ");
    ServletInputStream input = req.getInputStream();
    byte [] buffer = new byte[1024];
    int nb;
    while((nb=input.read(buffer))!= -1) {
    output.write(buffer,0,nb);
    Can somebody tell me how to write a java code sending a http request with the content of a file in the content of the request ?

  • jsp:forward ... tag in servlet doesn't work in 7.0

              I have a problem with <jsp:forward ... > command.
              I found a post in the newsgroups that this is a bug traced by
              CR078071 and I am stucked because of this problem. Please, send me a patch.
              

              I have a problem with <jsp:forward ... > command.
              I found a post in the newsgroups that this is a bug traced by
              CR078071 and I am stucked because of this problem. Please, send me a patch.
              

  • How to -only- invoke a Servlet/JSP

    Hi,
    I would like to invoke a Servlet or JSP inside a standalone application WITHOUT opening a stream. When I use url.openConnection() or con.connect() the servlet/JSP is not executed, I must also do "ObjectInputStream o = new ObjectInputStream(con.getInputStream());" in order to get the servlet/jsp executed.
    I just want to invoke the servlet/JSP, because I use the returned data for nothing.
    Thanks

    If you openConnection, you might also have to get the output stream from the servlet to make it work properly. (Otherwise, the server, or proxies in-between, might consider that the client has decided it doesn't want the page after all, and may stop requesting it.)
    A cheap way to request a page but get less data back would be..
    conn.setRequestMethod("HEAD");HEAD is exactly like GET, except it doesn't return the body (just the headers, hence the name.) Not entirely sure if it works on Java.
    Failing that, you should be able to just open the input stream, and close it again straight away.

Maybe you are looking for

  • Sometimes when using the Google search engine, after using the Back button in the Firefox 4.0.1 browser, I am no longer able to click in the Google search box.

    Sometimes when using the Google search engine, after using the Back button in the Firefox 4.0.1 browser, I am no longer able to click in the Google search box. This problems has been occurring on two different machines over the last two days.

  • Staging Area with OWB 10.2 - necessary or not?

    Hi to all, I have read so much about Staging Area and OWB 10.2 that I am totally confused: Some documents and powerpoints in the web say you do not need one, others say you need one. The thing is I am planning a DWH and now I am not sure if a staging

  • How do i 'undo' changes in logic instruments?

    Can anyone help with this please? im using Ultrabeat and cant work out how to 'UNDO' changes - step back to where i was before i changed a setting etc. I'm new to Logic and could really do with a hand with this one. I dont want to have to save before

  • Finesse - Admin gadget

    Hello all, I install finesse 9.0.1 all is ok, but when I connect to cfadmin I see same problem as describe in CICSO bug CSCtw61972, Buttons (Submit, Reset) on the Admin gadget not active, circle image. Do you have any help? I need configure installat

  • MOD__OSE.conf not found.

    I have installed 9iAS on windows 2000, after successfully installed , when i try to start the apache it's giving an error, fopen: no such file or directory. apache: could not open document config file d:\oracle\isuites\apache\apache\conf\mod__ose.con