Please help .. OutOfMemoryError   ServletException

Hi All,
I don't know why I am getting this exception while working with strings, I am just trying to compare two or more Strings, I did not use not StringBuff !!! ??
Please help
javax.servlet.ServletException:
     at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:485)
     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.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.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:2343)
     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.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.warp.WarpRequestHandler.handle(WarpRequestHandler.java:217)
     at org.apache.catalina.connector.warp.WarpConnection.run(WarpConnection.java:194)
     at java.lang.Thread.run(Thread.java:484)
root cause
java.lang.OutOfMemoryError:
     at java.io.BufferedReader.(BufferedReader.java:83)
     at java.io.BufferedReader.(BufferedReader.java:94)
     at org.apache.jasper.compiler.ServletWriter.printMultiLn(ServletWriter.java:210)
     at org.apache.jasper.compiler.ScriptletGenerator.generate(ScriptletGenerator.java:85)
     at org.apache.jasper.compiler.JspParseEventListener$GeneratorWrapper.generate(JspParseEventListener.java:834)
     at org.apache.jasper.compiler.JspParseEventListener.generateAll(JspParseEventListener.java:241)
     at org.apache.jasper.compiler.JspParseEventListener.endPageProcessing(JspParseEventListener.java:197)
     at org.apache.jasper.compiler.Compiler.compile(Compiler.java:215)
     at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:552)
     at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:177)
     at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:189)
     at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
     at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
     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.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.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:2343)
     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.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.warp.WarpRequestHandler.handle(WarpRequestHandler.java:217)
     at org.apache.catalina.connector.warp.WarpConnection.run(WarpConnection.java:194)
     at java.lang.Thread.run(Thread.java:484)

thank you :)
here is the piece of code where the error occures
<%
Vector Items = new Vector();
Vector ItemsMatch = new Vector();
String SearchText = "What ever";
String ItemInfo = "";
DbConnect temp;
try{
SearchText = SearchText.toLowerCase();
creatConnection = godb.creatConn();
Items = godb.selectViewedItems("items",1);
creatConnection =creatConnection + godb.closeConn();
}catch(Exception e){ out.println(e.toString()); }
try{
               for(j=0;j< Items.size();j++)
               temp =(DbConnect)Items.elementAt(j);
               ItemInfo = temp.getName().toLowerCase() + " "+temp.getDesc().toLowerCase()+" "+temp.getDimensions().toLowerCase()+" "+temp.getReference().toLowerCase()+" "+temp.getFound().toLowerCase()+" "+temp.getCondition().toLowerCase();
if(ItemInfo.indexOf(SearchText)!=-1)
               ItemsMatch.add(temp);
}catch(Exception e){ out.println(e.toString()); }
%>

Similar Messages

  • Urgent, OutOfMemoryError, please help !!!

    Guru,
    I receive the following program from GNome, which scan and save multipage tiff image. But the program cannot scan more than 16 pages, it has 'java.lang.OutOfMemoryError'. Is there a way to solve this problem, please help as soon as possible.
    Here is the code:
    * $Id: Example9.java,v 1.8 2002/07/15 13:48:55 mmotovsk Exp $
    * Copyright (c) 1999-2002 Gnome spol. s r.o. All Rights Reserved.
    * This software is the confidential and proprietary information of
    * Gnome spol. s r.o. You shall not disclose such Confidential
    * Information and shall use it only in accordance with the terms
    * of the license agreement you entered into with Gnome.
    // JavaTwain package version 5.0
      Example9 demonstrates scanning multiple images with
      Automatic Document Feeder and saving them in multi-page tiff image .<BR>
    import javax.media.jai.*;
    import java.io.*;
    import com.sun.media.jai.codec.*;
    import java.awt.*;
    import SK.gnome.twain.*;
    import java.awt.image.*;
    import java.util.Vector;
    public class Example9 extends Component
    { static int pageNumber = 0;
      static Vector bufferedImages = new Vector();
      public void addToBufferedImages(Twain source)
         { Image image = Toolkit.getDefaultToolkit().createImage(source);
        MediaTracker tracker = new MediaTracker(this);
        tracker.addImage(image, 0);
        try
        { tracker.waitForAll();
        catch (InterruptedException e)
        { e.printStackTrace();
        int width = image.getWidth(null);
        int height = image.getHeight(null)+20;
        BufferedImage bimg = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
        bimg.createGraphics().drawImage(image, 0, 0, null);
        bufferedImages.add(bimg);
      public void saveAsMultipageTIFF(Vector images, String file) throws IOException
      { if (images.size() < 1)
          return;
        RenderedImage firstImage = (RenderedImage)images.get(0);
        images.remove(0);
        OutputStream out = new SeekableOutputStream(new RandomAccessFile(file,"rw"));
        TIFFEncodeParam param = new TIFFEncodeParam();
        ImageEncoder encoder = ImageCodec.createImageEncoder("TIFF", out, param);
        System.err.println(1);
        if (images.size() > 0)
        { param.setExtraImages(images.iterator());
        System.err.println(2);
        encoder.encode(firstImage);
        System.err.println(3);
        out.close();
      public static void main(String[] args) throws Exception
      { Example9 ex = new Example9();
        Twain twain = new Twain();
        twain.setFeederEnabled(true);
        twain.setAutoFeed(true);
        do
             { ex.addToBufferedImages(twain);
             while (twain.hasMoreImages());
        ex.saveAsMultipageTIFF(bufferedImages, "multipage.tiff" );
    }Many thanks in advance.

    * This software is the confidential and proprietary
    information of
    * Gnome spol. s r.o. You shall not disclose such
    Confidential
    * Information and shall use it only in accordance
    with the terms
    * of the license agreement you entered into with
    Gnome.oo you bugger, your in trouble now.

  • [b]java.lang.OutOfMemoryError.......PLEASE HELP A.S.A.P.!!!!!![/b]

    I am currently writing code for a database software using Joins, Collections, Vectors, etc. and when running the code I keep getting a java.lang.OutOfMemoryError. The thing is that I have a parser that parses through different XML files and Java files. It seems as though some of my collections need more space or something else doesn't have enough memory for the parser to pick up everything. It only happens after I add a new constrainable or selectable to the XML file and try and run Queries with that (at least that is where I think the problem is). At this point I have no clue as to what is going on. Could someone please help me out.
    Thanks in Advance!

    This is touching on the obvious but can you refer to your logs and find out where your program is running out of memory. I have a sneaky suspcion your're in a loop with an condition gone horribly wrong.
    Based on your system specs, your collections should be able to handle your data.

  • Getting Error:closing a connection for you. Please help

    Hello All,
    I'm using jboss3.2.6. I used ejb2.1 (session bean and entity bean[BMP]). I did few data base transations in cmp and few in simple data source connection.
    I'm getting below errors occasionally
    'No managed connection exception
    java.lang.OutOfMemoryError: Java heap space
    [CachedConnectionManager] Closing a connection for you. Plea
    se close them yourself: org.jboss.resource.adapter.jdbc.WrappedConnection@11ed0d
    5
    I've given below my dao connection code here,
    package com.drtrack.util;
    import java.sql.Connection;
    import java.sql.SQLException;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.sql.DataSource;
    public class DAOUtil {
    private static DataSource _ds;
    public Connection con;
    public DAOUtil() throws SQLException {
    try {
    if (_ds == null)
    assemble();
    if(_ds != null && con == null) {
    con = _ds.getConnection();
    }catch(SQLException ex) {
    ex.printStackTrace();
    private void assemble() {
    Context ic = null;
    try {
    ic = new InitialContext();
    DrTrackUtil drutil = new DrTrackUtil();
    _ds = (DataSource) ic.lookup("java:/" + drutil.getText("SOURCE_DIR"));
    drutil = null;
    }catch (Exception e) {
    e.printStackTrace();
    }finally {
    try {
    ic.close();
    }catch(NamingException ne) {}
    public void closeConnection() throws SQLException {
    if(con != null)
    con.close();
    con = null;
    }below is the code with get connection and doing transaction in it.
    public static AccountMasterValueBean getAccountMasterByAcctId(String acctId) {
    AccountMasterValueBean bean = null;
    DAOUtil dao = null;
    CallableStatement cst = null;
    ResultSet rs = null;
    try {
    dao = new DAOUtil();
    cst = dao.con.prepareCall(DrTrackConstants.MSSQL_USP_ACCOUNTMASTER_BY_ACCTID);
    cst.setObject(1, acctId);
    rs = cst.executeQuery();
    if(rs != null && rs.next()) {
    bean = new AccountMasterValueBean(
    Integer.valueOf(rs.getString("accountkeyid")),
    rs.getString("latitude"),
    rs.getString("longitude"));
    }catch(SQLException se) {
    logger.info("SQL Error: " + se);
    finally {
    if(rs != null){
    try {
    rs.close();
    }catch(SQLException se) {
    logger.info("SQL Error: " + se);
    finally {
    rs = null;
    if(cst != null) {
    try{
    cst.close();
    }catch(SQLException se) {
    logger.info("SQL Error: " + se);
    finally {
    cst = null;
    if(dao != null) {
    try {
    dao.closeConnection();
    }catch(SQLException se) {
    logger.info("SQL Error: " + se);
    finally {
    dao = null;
    return bean;
    }I closed connections, resultsets and statements properly.
    Why I'm getting these errors.? Where I'm doing wrong. ? Please help me. I have to fix them ASAP.
    Thanks.

    Hello All,
    I'm using jboss3.2.6. I used ejb2.1 (session bean and entity bean[BMP]). I did few data base transations in cmp and few in simple data source connection.
    I'm getting below errors occasionally
    'No managed connection exception
    java.lang.OutOfMemoryError: Java heap space
    [CachedConnectionManager] Closing a connection for you. Plea
    se close them yourself: org.jboss.resource.adapter.jdbc.WrappedConnection@11ed0d
    5
    I've given below my dao connection code here,
    package com.drtrack.util;
    import java.sql.Connection;
    import java.sql.SQLException;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.sql.DataSource;
    public class DAOUtil {
    private static DataSource _ds;
    public Connection con;
    public DAOUtil() throws SQLException {
    try {
    if (_ds == null)
    assemble();
    if(_ds != null && con == null) {
    con = _ds.getConnection();
    }catch(SQLException ex) {
    ex.printStackTrace();
    private void assemble() {
    Context ic = null;
    try {
    ic = new InitialContext();
    DrTrackUtil drutil = new DrTrackUtil();
    _ds = (DataSource) ic.lookup("java:/" + drutil.getText("SOURCE_DIR"));
    drutil = null;
    }catch (Exception e) {
    e.printStackTrace();
    }finally {
    try {
    ic.close();
    }catch(NamingException ne) {}
    public void closeConnection() throws SQLException {
    if(con != null)
    con.close();
    con = null;
    }below is the code with get connection and doing transaction in it.
    public static AccountMasterValueBean getAccountMasterByAcctId(String acctId) {
    AccountMasterValueBean bean = null;
    DAOUtil dao = null;
    CallableStatement cst = null;
    ResultSet rs = null;
    try {
    dao = new DAOUtil();
    cst = dao.con.prepareCall(DrTrackConstants.MSSQL_USP_ACCOUNTMASTER_BY_ACCTID);
    cst.setObject(1, acctId);
    rs = cst.executeQuery();
    if(rs != null && rs.next()) {
    bean = new AccountMasterValueBean(
    Integer.valueOf(rs.getString("accountkeyid")),
    rs.getString("latitude"),
    rs.getString("longitude"));
    }catch(SQLException se) {
    logger.info("SQL Error: " + se);
    finally {
    if(rs != null){
    try {
    rs.close();
    }catch(SQLException se) {
    logger.info("SQL Error: " + se);
    finally {
    rs = null;
    if(cst != null) {
    try{
    cst.close();
    }catch(SQLException se) {
    logger.info("SQL Error: " + se);
    finally {
    cst = null;
    if(dao != null) {
    try {
    dao.closeConnection();
    }catch(SQLException se) {
    logger.info("SQL Error: " + se);
    finally {
    dao = null;
    return bean;
    }I closed connections, resultsets and statements properly.
    Why I'm getting these errors.? Where I'm doing wrong. ? Please help me. I have to fix them ASAP.
    Thanks.

  • Please help with my helper class

    Hi,
    plz I need some assistance with this:
    I have a big table which consist of 200 columns. This table gets fields from different tables. It has records of orders which may have several items and each item can have up to 8 taxes. So i have fields reaping for other order order records. I need to display an order then have a navigation to list items in details, with all its taxes, one by one.
    Here is how I have decided to do it in a nutshell. I have decided to get all taxes of a particular item and put in a map with tax_codes as values and tax details arraylist as values. I then add this to an item with its other details. then I add items to a particular order. I have separated orders,items and taxes in their separate beans. Im trying to first the implimentation for each order, item and taxes by displaying them on a JSP. However am currently getting the following error with taxdetails:
    java.lang.ClassCastException: OrderItems.ItemTax cannot be cast to java.lang.String
    at OrderItems.OrderDetails.getItemTaxDetails(OrderDetails.java:166)
    at OrderItems.Controller.processRequest(Controller.java:57)
    at OrderItems.Controller.doGet(Controller.java:72)
    I have a list of all itemTaxCodes am iterating and am casting to string...am not casting ItemTax object.Here is my code below:
    OrderDetails.java
    package orderitems;
    import java.sql.*;
    import java.util.*;
    public class OrderDetails {
        private LineOder lineOrder;
        private Map lineItems;
        //returns an item number, key_item, from its unique keys
        public int getItemNumber(int key_item, String key_year,
                String key_office,String key_client,String key_company){
            Connection conn = null;
            Statement stat = null;
            ResultSet rst = null;
            int itmNum = 0;
             * key_item a unique number for an item.
             * key_year,key_office,key_client,key_company unique keys
             * for each order where this key_item is taken
             * from.
            String select = "SELECT key_item FROM "+
                    Constants.WEB_TABLE +" WHERE key_item = " + key_item +
                    " AND key_year = '" + key_year + "'" +
                    " AND key_office = '" + key_office + "'" +
                    " AND key_client = '" + key_client + "'" +
                    " AND key_company = '" + key_company +"'";
            DbConnection dbConn = new DbConnection();
            try {
                conn = dbConn.getDbConnection(Constants.WEB_JNDI);
                stat = conn.createStatement();
                rst = stat.executeQuery(select);
                if(rst.next()){
                    itmNum = Integer.parseInt(rst.getString("key_item"));
            } catch (SQLException ex) {
                ex.printStackTrace();
            } finally{
                SQLHelper.cleanUp(rst, stat, conn);
            return itmNum;
        //get a list of item number(item codes)
        public List getAllItemNumbers(String key_year,
                String key_office,String key_client,String key_company){
            List itemNumbers = new ArrayList();
            LineItem itemNumber = null;
            Connection conn = null;
            Statement stat = null;
            ResultSet rst = null;
            String select = "SELECT key_item FROM "+ Constants.WEB_TABLE +
                    " WHERE key_year = '" + key_year + "'" +
                    " AND key_office = '" + key_office + "'" +
                    " AND key_client = '" + key_client + "'" +
                    " AND key_company = '" + key_company + "'";
            DbConnection dbConn = new DbConnection();
            try {
                conn = dbConn.getDbConnection(Constants.WEB_JNDI);
                stat = conn.createStatement();
                rst = stat.executeQuery(select);
                while(rst.next()){
                    itemNumber = new LineItem();
                    itemNumber.setKey_item(Integer.parseInt(rst.getString("key_item")));
                    itemNumbers.add(itemNumber);
            } catch (SQLException ex) {
                ex.printStackTrace();
            } finally{
                SQLHelper.cleanUp(rst, stat, conn);
            return itemNumbers;
        //get a list of tax codes
        public List getAllTaxCodes(int key_item, String key_year,
                String key_office,String key_client,String key_company){
            Connection conn = null;
            Statement stat = null;
            ResultSet rst = null;
            ItemTax taxCode;
            List taxCodes = new ArrayList();
            int itemNum = getItemNumber(key_item, key_year,
                    key_office,key_client,key_company);
            String select = "SELECT key_tax_code FROM "+
                    Constants.WEB_TABLE +" WHERE key_item = " + itemNum +
                    " AND key_year = '" + key_year + "'" +
                    " AND key_office = '" + key_office + "'" +
                    " AND key_client = '" + key_client + "'" +
                    " AND key_company = '" + key_company +"'";
            DbConnection dbConn = new DbConnection();
            try {
                conn = dbConn.getDbConnection(Constants.WEB_JNDI);
                stat = conn.createStatement();
                rst = stat.executeQuery(select);
                while(rst.next()){
                    taxCode = new ItemTax();
                    taxCode.setKey_tax_code(rst.getString("key_tax_code"));
                    taxCodes.add(taxCode);
            } catch (SQLException ex) {
                ex.printStackTrace();
            } finally{
                SQLHelper.cleanUp(rst, stat, conn);
            return taxCodes;
        //use tax code to get tax details
        public Map getItemTaxDetails(String key_year,String key_office,
                String key_client,String key_company,int key_item){
            ItemTax taxDetail = null;
            List taxDetails = new ArrayList();
            List itemTaxCodes = new ArrayList();
            Map itemTaxdetails = new HashMap();
            Connection conn = null;
            Statement stat = null;
            ResultSet rst = null;
            //get a list of all tax codes of an item with a
            //given item number
            itemTaxCodes = getAllTaxCodes(key_item,key_year,///a list of tax codes
                    key_office,key_client,key_company);
            DbConnection dbConn = new DbConnection();
            try {
                conn = dbConn.getDbConnection(Constants.WEB_JNDI);
                stat = conn.createStatement();
                for(Iterator taxCodeIter= itemTaxCodes.iterator(); taxCodeIter.hasNext();){
                    String taxCode = (String)taxCodeIter.next();/////casting taxtCode to string***exception occurs from here
                    String select = "SELECT tax_type,tax_value," +
                            "tax_limit_val FROM "+ Constants.WEB_TABLE +
                            " WHERE key_item = "+ key_item +
                            " AND key_year = '" + key_year + "'" +
                            " AND key_office = '" + key_office + "'" +
                            " AND key_client = '" + key_client + "'" +
                            " AND key_company = '" + key_company +"'" +
                            " AND key_tax_code = '" + taxCode + "'";///tax code string
                    rst = stat.executeQuery(select);
                    while(rst.next()){
                        taxDetail = new ItemTax();
                        //records to be displayed only
                        taxDetail.setKey_item(Integer.parseInt(rst.getString("key_item")));
                        taxDetail.setTax_value(rst.getString("tax_value"));
                        taxDetail.setTax_limit_val(Float.parseFloat(rst.getString("tax_limit_val")));
                        //////other details records ommited//////////////////////////
                        taxDetails.add(taxDetail);
                //a HashMap of all tax code as keys and list of details as values 4 each key
                for(int i = 0;i<itemTaxCodes.size(); i++){
                    itemTaxdetails.put(itemTaxCodes.get(i),taxDetails.get(i));
            } catch (SQLException ex) {
                ex.printStackTrace();
            } finally{
                SQLHelper.cleanUp(rst, stat, conn);
            return itemTaxdetails;
        //details of an item with all its taxes
        public List getAllItemDetails(String key_year,
                String key_office,String key_client,String key_company){
            List lineItems = new ArrayList();
            List itemNumbers = new ArrayList();
            Map taxDetails = new HashMap();
            LineItem item = null;
            Connection conn = null;
            Statement stat = null;
            ResultSet rst = null;
            //A list of all item numbers in the declaration
            itemNumbers = getAllItemNumbers(key_year,
                    key_office,key_client,key_company);
            DbConnection dbConn = new DbConnection();
            try {
                conn = dbConn.getDbConnection(Constants.WEB_JNDI);
                stat = conn.createStatement();
                for(Iterator itemIter= itemNumbers.iterator(); itemIter.hasNext();){
                    int itemNumber = ((Integer)itemIter.next()).intValue();
                    String select = "SELECT item_description,item_mass," +
                            "item_cost" +
                            " FROM " + Constants.WEB_TABLE +
                            " WHERE key_year = '"+key_year+"'" +
                            " AND key_office = '"+key_office+ "'"+
                            " AND key_client = '"+key_client+ "'"+
                            " AND key_company = '"+key_company+ "'"+
                            " AND key_item = " + itemNumber;
                    rst = stat.executeQuery(select);
                    while(rst.next()){
                        item = new LineItem();
                        item.setItem_description(rst.getString("item_description"));
                        item.setItem_mass(Float.parseFloat(rst.getString("item_mass")));
                        item.setKey_item(Integer.parseInt(rst.getString("item_cost")));
                        //////other details records ommited//////////////////////////
                        //A HashMap of all itemTaxeCodes as its keys and an ArrayList of itemTaxedetails as its values
                        taxDetails = getItemTaxDetails(item.getKey_year(),item.getKey_office(),
                                item.getKey_client(),item.getKey_company(),item.getKey_item());
                        //item tax details
                        item.setItmTaxes(taxDetails);
                        //list of items with tax details
                        lineItems.add(item);
            } catch (SQLException ex) {
                ex.printStackTrace();
            } finally{
                SQLHelper.cleanUp(rst, stat, conn);
            return lineItems;
        public Set getDeclarations(String key_year,String key_cuo,
                String key_dec,String key_nber){
            List lineItems = new ArrayList();
            Set lineOrders = new HashSet();
            Connection conn = null;
            Statement stat = null;
            ResultSet rst = null;
            LineOder lineOrder = null;
            String select = "SELECT * FROM " + Constants.WEB_TABLE +
                    " WHERE key_year = '" + key_year + "'" +
                    " AND key_cuo = '" + key_cuo + "'" +
                    " AND key_dec = '" + key_dec + "'" +
                    " AND key_nber = '" + key_nber + "'";
            DbConnection dbConn = new DbConnection();
            try {
                conn = dbConn.getDbConnection(Constants.WEB_JNDI);
                stat = conn.createStatement();
                rst = stat.executeQuery(select);
                while(rst.next()){
                    lineOrder = new LineOder();
                    lineOrder.setKey_year(rst.getString("key_year"));
                    lineOrder.setKey_office(rst.getString("key_cuo"));
                    lineOrder.setKey_client(rst.getString("key_dec"));
                    lineOrder.setKey_company(rst.getString("key_nber"));
                    ////list of items with all their details
                    lineItems = getAllItemDetails(lineOrder.getKey_year(),lineOrder.getKey_office(),
                            lineOrder.getKey_client(),lineOrder.getKey_company());
                    //setting item details
                    lineOrder.setItems(lineItems);
                    //a list of order with all details
                    lineOrders.add(lineOrder);
            } catch (SQLException ex) {
                ex.printStackTrace();
            } finally{
                SQLHelper.cleanUp(rst, stat, conn);
            return lineOrders;
    } and my testing servlet controller
    Controller.java
    package orderitems;
    import java.io.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class Controller extends HttpServlet {
        private Map taxDetails = new HashMap();
        //private List itemDetails = new ArrayList();
        //private Set orderDetails = new HashSet();
        private OrderDetails orderDetails = null;
        protected void processRequest(HttpServletRequest request,
                HttpServletResponse response)throws
                ServletException, IOException {
            response.setContentType("text/html;charset=UTF-8");
            String key_year = "2007";
            String key_office = "VZX00";
            String key_company = "DG20";
            String key_client =  "ZI001";
            int key_item = 1;
            String nextView = "/taxdetails_list.jsp";
            //String nextView = "/order_list.jsp";
            //String nextView = "/items_list.jsp";
            orderDetails = new OrderDetails();
            taxDetails = orderDetails.getItemTaxDetails(key_year,key_office,
                    key_company,key_client,key_item);
            //Store the collection objects into HTTP Request
            request.setAttribute("taxDetails", taxDetails);
            RequestDispatcher reqstDisp =
                    getServletContext().getRequestDispatcher(nextView);
            reqstDisp.forward(request,response);
        protected void doGet(HttpServletRequest request,
                HttpServletResponse response)throws
                ServletException, IOException {
            processRequest(request, response);
        protected void doPost(HttpServletRequest request,
                HttpServletResponse response)throws
                ServletException, IOException {
            processRequest(request, response);
    }I have not included code for beans to reduce on bulk.please help and with suggestions...
    Thanx in advance.
    Edited by: aiEx on Oct 3, 2007 8:13 AM

    aiEx wrote:
    sometimes a tap on the head is needed to really learn and understand :-)You're casting them to the String type while they are of the ItemTax type and you've confirmed it yourself. Likely you misunderstood the concepts behind "casting" and you was expecting some magic that they are automatically converted somehow from the ItemTax type to the String type while the ItemTax class isn't a subclass of the String class :)

  • Please Help::How to display a Map with LIsts as Keys and Values using JSTL

    Hi,
    I need some assistance on how to display a Map in JSP using struts or core JSTL. I have a HashMap which has a List of keys and each key maps to a value of an ArrayList.i.e I have an ArrayList of taxCodes and each taxCode maps to a value of taxDetails which is an ArrayList of details for for that particular taxCode. I have some trouble to display each taxCode then display taxDetails for each taxCode. Here is my code below:
    OrderDetails.java
    package orderitems;
    import java.sql.*;
    import java.util.*;
    public class OrderDetails {
        private LineOder lineOrder;
        private Map lineItems;
        //returns an item number, key_item, from its unique keys
        public int getItemNumber(int key_item, String key_year,
                String key_office,String key_client,String key_company){
            Connection conn = null;
            Statement stat = null;
            ResultSet rst = null;
            int itmNum = 0;
             * key_item a unique number for an item.
             * key_year,key_office,key_client,key_company unique keys
             * for each order where this key_item is taken
             * from.
            String select = "SELECT key_item FROM "+
                    Constants.WEB_TABLE +" WHERE key_item = " + key_item +
                    " AND key_year = '" + key_year + "'" +
                    " AND key_office = '" + key_office + "'" +
                    " AND key_client = '" + key_client + "'" +
                    " AND key_company = '" + key_company +"'";
            DbConnection dbConn = new DbConnection();
            try {
                conn = dbConn.getDbConnection(Constants.WEB_JNDI);
                stat = conn.createStatement();
                rst = stat.executeQuery(select);
                if(rst.next()){
                    itmNum = Integer.parseInt(rst.getString("key_item"));
            } catch (SQLException ex) {
                ex.printStackTrace();
            } finally{
                SQLHelper.cleanUp(rst, stat, conn);
            return itmNum;
        //get a list of item number(item codes)
        public List getAllItemNumbers(String key_year,
                String key_office,String key_client,String key_company){
            List itemNumbers = new ArrayList();
            LineItem itemNumber = null;
            Connection conn = null;
            Statement stat = null;
            ResultSet rst = null;
            String select = "SELECT key_item FROM "+ Constants.WEB_TABLE +
                    " WHERE key_year = '" + key_year + "'" +
                    " AND key_office = '" + key_office + "'" +
                    " AND key_client = '" + key_client + "'" +
                    " AND key_company = '" + key_company + "'";
            DbConnection dbConn = new DbConnection();
            try {
                conn = dbConn.getDbConnection(Constants.WEB_JNDI);
                stat = conn.createStatement();
                rst = stat.executeQuery(select);
                while(rst.next()){
                    itemNumber = new LineItem();
                    itemNumber.setKey_item(Integer.parseInt(rst.getString("key_item")));
                    itemNumbers.add(itemNumber);
            } catch (SQLException ex) {
                ex.printStackTrace();
            } finally{
                SQLHelper.cleanUp(rst, stat, conn);
            return itemNumbers;
        //get a list of tax codes
        public List getAllTaxCodes(int key_item, String key_year,
                String key_office,String key_client,String key_company){
            Connection conn = null;
            Statement stat = null;
            ResultSet rst = null;
            ItemTax taxCode;
            List taxCodes = new ArrayList();
            int itemNum = getItemNumber(key_item, key_year,
                    key_office,key_client,key_company);
            String select = "SELECT key_tax_code FROM "+
                    Constants.WEB_TABLE +" WHERE key_item = " + itemNum +
                    " AND key_year = '" + key_year + "'" +
                    " AND key_office = '" + key_office + "'" +
                    " AND key_client = '" + key_client + "'" +
                    " AND key_company = '" + key_company +"'";
            DbConnection dbConn = new DbConnection();
            try {
                conn = dbConn.getDbConnection(Constants.WEB_JNDI);
                stat = conn.createStatement();
                rst = stat.executeQuery(select);
                while(rst.next()){
                    taxCode = new ItemTax();
                    taxCode.setKey_tax_code(rst.getString("key_tax_code"));
                    taxCodes.add(taxCode);
            } catch (SQLException ex) {
                ex.printStackTrace();
            } finally{
                SQLHelper.cleanUp(rst, stat, conn);
            return taxCodes;
        /////This methode returns a Map which am trying to display in JSP
        //use tax code to get tax details
        public Map getItemTaxDetails(String key_year,String key_office,
                String key_client,String key_company,int key_item){
            ItemTax taxDetail = null;
            List taxDetails = new ArrayList();
            List itemTaxCodes = new ArrayList();
            Map itemTaxDetails = new HashMap();
            Connection conn = null;
            Statement stat = null;
            ResultSet rst = null;
            //get a list of all tax codes of an item with a
            //given item number
            itemTaxCodes = getAllTaxCodes(key_item,key_year,
                    key_office,key_client,key_company);
            DbConnection dbConn = new DbConnection();
            try {
                conn = dbConn.getDbConnection(Constants.WEB_JNDI);
                stat = conn.createStatement();
                for(Iterator taxCodeIter= itemTaxCodes.iterator(); taxCodeIter.hasNext();){
                    ItemTax itemTaxCode = (ItemTax)taxCodeIter.next();
                    String taxCode = itemTaxCode.getKey_tax_code();
                    String select = "SELECT tax_type,tax_value," +
                            "tax_limit_val FROM "+ Constants.WEB_TABLE +
                            " WHERE key_item = "+ key_item +
                            " AND key_year = '" + key_year + "'" +
                            " AND key_office = '" + key_office + "'" +
                            " AND key_client = '" + key_client + "'" +
                            " AND key_company = '" + key_company +"'" +
                            " AND key_tax_code = '" + taxCode + "'";
                    rst = stat.executeQuery(select);
                    while(rst.next()){
                        taxDetail = new ItemTax();
                        //records to be displayed only
                        taxDetail.setKey_item(Integer.parseInt(rst.getString("key_item")));
                        taxDetail.setTax_value(rst.getString("tax_value"));
                        taxDetail.setTax_limit_val(Float.parseFloat(rst.getString("tax_limit_val")));
                        //////other details records ommited//////////////////////////
                        taxDetails.add(taxDetail);////An ArrayList of taxDetails for each taxCode
                     * A HashMap which has all taxCodes of an item as its keys
                     * and an ArrayList of taxdetails as its values.
                     * I return this for display in a JSP.
                    itemTaxDetails.put(taxCode,taxDetails);
                System.out.println();
                System.out.println("*********CONSOLE OUTPUT*************");//display on console
                Set set = itemTaxDetails.keySet();
                Iterator iter = set.iterator();
                System.out.println("Key\t\tValue\r\n");
                while (iter.hasNext()) {
                    Object taxCode=iter.next();
                    Object details=itemTaxDetails.get(taxCode);
                    System.out.println(taxCode +"\t" + details);
                System.out.println("************************************");
            } catch (SQLException ex) {
                ex.printStackTrace();
            } finally{
                SQLHelper.cleanUp(rst, stat, conn);
            return itemTaxDetails;
        //details of an item with all its taxes
        public List getAllItemDetails(String key_year,
                String key_office,String key_client,String key_company){
            List lineItems = new ArrayList();
            List itemNumbers = new ArrayList();
            Map taxDetails = new HashMap();
            LineItem item = null;
            Connection conn = null;
            Statement stat = null;
            ResultSet rst = null;
            //A list of all item numbers in the declaration
            itemNumbers = getAllItemNumbers(key_year,
                    key_office,key_client,key_company);
            DbConnection dbConn = new DbConnection();
            try {
                conn = dbConn.getDbConnection(Constants.WEB_JNDI);
                stat = conn.createStatement();
                for(Iterator itemIter= itemNumbers.iterator(); itemIter.hasNext();){
                    LineItem itemNum = (LineItem)itemIter.next();
                    int itemNumber = itemNum.getKey_item();
                    String select = "SELECT item_description,item_mass," +
                            "item_cost" +
                            " FROM " + Constants.WEB_TABLE +
                            " WHERE key_year = '"+key_year+"'" +
                            " AND key_office = '"+key_office+ "'"+
                            " AND key_client = '"+key_client+ "'"+
                            " AND key_company = '"+key_company+ "'"+
                            " AND key_item = " + itemNumber;
                    rst = stat.executeQuery(select);
                    while(rst.next()){
                        item = new LineItem();
                        item.setItem_description(rst.getString("item_description"));
                        item.setItem_mass(Float.parseFloat(rst.getString("item_mass")));
                        item.setKey_item(Integer.parseInt(rst.getString("item_cost")));
                        //////other details records ommited//////////////////////////
                        /* A HashMap of all itemTaxeCodes as its keys and an
                         * ArrayList of itemTaxedetails as its values
                        taxDetails = getItemTaxDetails(item.getKey_year(),item.getKey_office(),
                                item.getKey_client(),item.getKey_company(),item.getKey_item());
                        //item tax details
                        item.setItmTaxes(taxDetails);
                        //list of items with tax details
                        lineItems.add(item);
            } catch (SQLException ex) {
                ex.printStackTrace();
            } finally{
                SQLHelper.cleanUp(rst, stat, conn);
            return lineItems;
        public Set getOrders(String key_year,String key_office,
                String key_client,String key_company){
            List lineItems = new ArrayList();
            Set lineOrders = new HashSet();
            Connection conn = null;
            Statement stat = null;
            ResultSet rst = null;
            LineOder lineOrder = null;
            String select = "SELECT * FROM " + Constants.WEB_TABLE +
                    " WHERE key_year = '" + key_year + "'" +
                    " AND key_office = '" + key_office + "'" +
                    " AND key_client = '" + key_client + "'" +
                    " AND key_company = '" + key_company + "'";
            DbConnection dbConn = new DbConnection();
            try {
                conn = dbConn.getDbConnection(Constants.WEB_JNDI);
                stat = conn.createStatement();
                rst = stat.executeQuery(select);
                while(rst.next()){
                    lineOrder = new LineOder();
                    lineOrder.setKey_year(rst.getString("key_year"));
                    lineOrder.setKey_office(rst.getString("key_office"));
                    lineOrder.setKey_client(rst.getString("key_client"));
                    lineOrder.setKey_company(rst.getString("key_company"));
                    ////list of items with all their details
                    lineItems = getAllItemDetails(lineOrder.getKey_year(),lineOrder.getKey_office(),
                            lineOrder.getKey_client(),lineOrder.getKey_company());
                    //setting item details
                    lineOrder.setItems(lineItems);
                    //a list of order with all details
                    lineOrders.add(lineOrder);
            } catch (SQLException ex) {
                ex.printStackTrace();
            } finally{
                SQLHelper.cleanUp(rst, stat, conn);
            return lineOrders;
    Controller.java
    package orderitems;
    import java.io.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class Controller extends HttpServlet {
        private Map taxDetails = new HashMap();
        private OrderDetails orderDetails = null;
        protected void processRequest(HttpServletRequest request,
                HttpServletResponse response)throws
                ServletException, IOException {
            response.setContentType("text/html;charset=UTF-8");
            String key_year = "2007";
            String key_office = "VZX00";
            String key_company = "DG20";
            String key_client =  "ZI001";
            int key_item = 1;
            String nextView = "/taxdetails_list.jsp";
            orderDetails = new OrderDetails();
            taxDetails = orderDetails.getItemTaxDetails(key_year,key_office,
                    key_company,key_client,key_item);
            //Store the collection objects into HTTP Request
            request.setAttribute("taxDetails", taxDetails);
            RequestDispatcher reqstDisp =
                    getServletContext().getRequestDispatcher(nextView);
            reqstDisp.forward(request,response);
        protected void doGet(HttpServletRequest request,
                HttpServletResponse response)throws
                ServletException, IOException {
            processRequest(request, response);
        protected void doPost(HttpServletRequest request,
                HttpServletResponse response)throws
                ServletException, IOException {
            processRequest(request, response);
    taxdetails_list.jsp
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
        <head>
            <title>Simple Tax Detail Diaplay ::</title>
            <link rel="stylesheet" type="text/css" href="imgs/orders.css"/>
        </head>
        <body>
            <jsp:useBean id="taxDetails" class="java.util.HashMap" scope="request"/>
            <table>
                <c:forEach items="${taxDetails}" var="hMap">
                    <tr>
                        <td><c:out value="${hMap.key}" /></td>
                        <!--td><%--c:out value="${hMap.value}" /--%></td-->
                    </tr>
                </c:forEach>
            </table>
        </body>
    </html>am displaying taxCodes(in this case i have VAT and ICD) fine but cant figure out how to display a list of value for each taxCode.Here is the output am getting
    both in my JSP and on the console:
    *******************************CONSOLE OUTPUT****************************
    Key          Value
    ICD     [orderItems.ItemTax@13e6226, orderItems.ItemTax@9dca26]
    VAT [orderItems.ItemTax@13e6226, orderItems.ItemTax@9dca26]
    Edited by: aiEx on Oct 8, 2007 6:54 AM

    hi evnafets,
    yes i need a nested for loop.I have tried your advice but my bean properties are not found.Am getting this error:
    javax.servlet.ServletException: Unable to find a value for "key_item" in object of class "java.lang.String" using operator "."
    I have tried this as stated earlier in the post:I have tried to make the method getItemTaxDetails return a List and get the returned list value as taxDetails. I then tested to display this list on JSP and its displaying fine.
    public List getItemTaxDetails(String key_year,String key_office,
                String key_client,String key_company,int key_item){
            ItemTax taxDetail = null;
            List taxDetails = new ArrayList();
            List itemTaxCodes = new ArrayList();
            Map itemTaxDetails = new HashMap();
            Connection conn = null;
            Statement stat = null;
            ResultSet rst = null;
            //get a list of all tax codes of an item with a
            //given item number
            itemTaxCodes = getAllTaxCodes(key_item,key_year,
                    key_office,key_client,key_company);
            DbConnection dbConn = new DbConnection();
            try {
                conn = dbConn.getDbConnection(Constants.WEB_JNDI);
                stat = conn.createStatement();
                for(Iterator taxCodeIter= itemTaxCodes.iterator(); taxCodeIter.hasNext();){
                    ItemTax itemTaxCode = (ItemTax)taxCodeIter.next();
                    String taxCode = itemTaxCode.getKey_tax_code();
                    String select = "SELECT tax_type,tax_value," +
                            "tax_limit_val FROM "+ Constants.WEB_TABLE +
                            " WHERE key_item = "+ key_item +
                            " AND key_year = '" + key_year + "'" +
                            " AND key_office = '" + key_office + "'" +
                            " AND key_client = '" + key_client + "'" +
                            " AND key_company = '" + key_company +"'" +
                            " AND key_tax_code = '" + taxCode + "'";
                    rst = stat.executeQuery(select);
                    while(rst.next()){
                        taxDetail = new ItemTax();
                        //records to be displayed only
                        taxDetail.setKey_item(Integer.parseInt(rst.getString("key_item")));
                        taxDetail.setTax_value(rst.getString("tax_value"));
                        taxDetail.setTax_limit_val(Float.parseFloat(rst.getString("tax_limit_val")));
                        //////other details records ommited//////////////////////////
                        taxDetails.add(taxDetail);////An ArrayList of taxDetails for each taxCode
                     * A HashMap which has all taxCodes of an item as its keys
                     * and an ArrayList of taxdetails as its values.
                     * I return this for display in a JSP.
                    itemTaxDetails.put(taxCode,taxDetails);
            } catch (SQLException ex) {
                ex.printStackTrace();
            } finally{
                SQLHelper.cleanUp(rst, stat, conn);
            //return itemTaxDetails;
            return taxDetails;
        }And my JSP
    taxdetails_list.jsp
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <link rel="stylesheet" type="text/css" href="imgs/orders.css"/>
        </head>
        <body>
            <table>
                <c:forEach var="curRecord" items="${taxDetails}" varStatus="rowCounter">
                        <c:choose>
                            <c:when test="${rowCounter.count % 2 == 0}">
                                <c:set var="rowStyle" scope="page" value="odd" />
                            </c:when>
                            <c:otherwise>
                                <c:set var="rowStyle" scope="page" value="even" />
                            </c:otherwise>
                        </c:choose>
                        <tr class="${rowStyle}">
                            <td>${curRecord.key_item}</td>
                            <td>${curRecord.tax_value}</td>
                            <td>${curRecord.tax_limit_val}</td>
                        </tr>
                    </c:forEach>
            </table>
        </body>
    </html>I can't see where am going wrong even with your advice.Please help.
    Thnx.

  • Please help me to rectify this error..\Apache was unexpected at this time.

    Hi,
    I have installed Jdeveloper 11g ..when i try to run the serlet pgm i m getting this error..:\Apache was unexpected at this time.
    I have tried all the possible ways .. I m not getting it done. Please help me out..
    import java.io.IOException;
    import java.io.PrintWriter;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class myservlet extends HttpServlet {
    private static final String CONTENT_TYPE = "text/html; charset=windows-1252";
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    response.setContentType(CONTENT_TYPE);
    PrintWriter out = response.getWriter();
    out.println("<html>");
    out.println("<head><title>myservlet</title></head>");
    out.println("<body>");
    out.println("<p>The servlet has received a GET. This is the reply.</p>");
    out.println("</body></html>");
    out.close();
    output:
    *** Using HTTP port 7101 ***
    *** Using SSL port 7102 ***
    C:\Users\sony\AppData\Roaming\JDeveloper\system11.1.2.1.38.60.81\DefaultDomain\bin\startWebLogic.cmd
    [waiting for the server to complete its initialization...]
    \Apache was unexpected at this time.
    Process exited.

    Have a look at your CLASSPATH environment variable - if it has any parenthesis in it (for example "c:\program files (x86)") - try removing those entries from the CLASSPATH variable.
    John

  • Error 500--Internal Server Error.PLEASE   HELP .

    hi,
    I am using BEA weblogic server 9.0.i created a new domain named myproject.I have created directory mywebapp under applications dir.
    i.e C:\bea\user_projects\domains\myproject\applications\mywebapp
    I have placed my servlet class in :
    C:\bea\user_projects\domains\myproject\applications\mywebapp\WEB-INF\classes\Mypackage
    I deployed my apllication mywebapp using admin console.
    when i run the program in the browser,i get this error:
    Error 500--Internal Server Error
    javax.servlet.ServletException: [HTTP:101249][weblogic.servlet.internal.WebAppServletContext@17e5fde - name: 'mywebapp', context-path: '/mywebapp']: Servlet class HelloServlet for servlet myHello could not be loaded because the requested class was not found in the classpath C:\bea\user_projects\domains\myproject\applications\mywebapp\WEB-INF\classes.
    java.lang.ClassNotFoundException: HelloServlet.
         at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:497)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:234)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:2970)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:1888)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1810)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1274)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:167)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:139)
    what should i do?please help me.
    bye

    you are reason our error is slightly different is
    Error 500--Internal Server Error
    javax.servlet.ServletException: [HTTP:101249][ServletContext(id=21255917,name=BonusRoot,context-path=/BonusRoot)]: Servlet class Beans.BonusServlet for servlet BonusServlet could not be loaded because the requested class was not found in the classpath C:\bea\weblogic81\samples\domains\workshop\cgServer\.wlnotdelete\essai\war-ic.war.
    java.lang.ClassNotFoundException: Beans.BonusServlet.
         at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:799)
         at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:518)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:362)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6350)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
         at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3635)
         at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2585)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    We have try with your proposition but we find the same error
    we must request servlet??? because i've one
    package Beans;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import javax.naming.*;
    import javax.rmi.PortableRemoteObject;
    public class BonusServlet extends HttpServlet {
      CalcHome homecalc;
      public void init(ServletConfig config) throws ServletException{
    //Look up home interface
       try {
         InitialContext ctx = new InitialContext();
         Object objref = ctx.lookup("calcs");
         homecalc = (CalcHome)PortableRemoteObject.narrow(objref, CalcHome.class);
       } catch (Exception NamingException) {
         NamingException.printStackTrace();
      public void doGet (HttpServletRequest request,
         HttpServletResponse response)
         throws ServletException, IOException
        String socsec = null;
        int multiplier = 0;
        double calc = 0.0;
        PrintWriter out;
        response.setContentType("text/html");
        String title = "EJB Example";
        out = response.getWriter();
        out.println("<HTML><HEAD><TITLE>");
        out.println(title);
        out.println("</TITLE></HEAD><BODY>");
        try{
        Calc theCalculation;
    //Retrieve Bonus and Social Security Information
       String strMult =
               request.getParameter("MULTIPLIER");
       Integer integerMult = new Integer(strMult);
       multiplier = integerMult.intValue();
       socsec = request.getParameter("SOCSEC");
    //Calculate bonus
        double bonus = 100.00;
        theCalculation = homecalc.create();
        calc = theCalculation.calcBonus(multiplier, bonus);
        }catch(Exception CreateException){
           CreateException.printStackTrace();
    //Display Data
        out.println("<H1>Bonus Calculation</H1>");
        out.println("<P>Soc Sec: " + socsec + "<P>");
        out.println("<P>Multiplier: " + multiplier + "<P>");
        out.println("<P>Bonus Amount: " + calc + "<P>");
        out.println("</BODY></HTML>");
        out.close();
      public void destroy() {
        System.out.println("Destroy");
    }Help us please
    Thanks

  • Please help me regarding implemenatation of plsql webservices

    hello every one,
    My name is anil, I am working on the topic "building pl/sql web services". I successfully deployed my pl/sql function. But i got an error while invoking the function from a web service.
    my error is
    08/04/22 10:40:23 javax.servlet.ServletException: Cannot generate Class: java.lang.NoClassDefFoundError: com/sun/tools/javac/M
    ain
    Exception in thread "main"
    08/04/22 10:40:23 at oracle.j2ee.ws.RpcWebService.generateWrapperClass(RpcWebService.java:569)
    08/04/22 10:40:23 at oracle.j2ee.ws.RpcWebService.generate(RpcWebService.java:467)
    08/04/22 10:40:23 at oracle.j2ee.ws.RpcWebService.getWrapper(RpcWebService.java:614)
    08/04/22 10:40:23 at oracle.j2ee.ws.RpcWebService.doGetRequest(RpcWebService.java:725)
    08/04/22 10:40:23 at oracle.j2ee.ws.BaseWebService.doGet(BaseWebService.java:1199)
    08/04/22 10:40:23 at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
    08/04/22 10:40:23 at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    08/04/22 10:40:23 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:691)
    08/04/22 10:40:23 at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370
    08/04/22 10:40:23 at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
    08/04/22 10:40:23 at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
    08/04/22 10:40:23 at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
    08/04/22 10:40:23 at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
    08/04/22 10:40:23 at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
    08/04/22 10:40:23 at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
    08/04/22 10:40:23 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.ja
    va:303)
    08/04/22 10:40:23 at java.lang.Thread.run(Unknown Source)
    please help me

    SowmyRaj wrote:
    But i am unable to run it successfully...please help me regarding this... No wonder. Script is full of entries:
    **MOBILE CODE**Modify script:
    1. Change:
    **MOBILE CODE** immediateto:
    execute immediate2. Change:
    **MOBILE CODE**to:
    end ifRun the script. If you will run it second time, change:
    u_exist PLS_INTEGER;
    t_exist PLS_INTEGER;
    ts_exist PLS_INTEGER;
    ss_exist PLS_INTEGER;to:
    u_exist PLS_INTEGER := 1;
    t_exist PLS_INTEGER := 1;
    ts_exist PLS_INTEGER := 1;
    ss_exist PLS_INTEGER := 1;This way existing objects will be dropped before recreating them.
    SY.

  • Rendering an error-display - Please help!!

    Hi everyone,
    I'm about to give up. I use the Orion 1.5.2 appserver for EJB, JSP and servlets. It works great and is the best appserver i've tried so far. Except for one thing:
    As it seems, Orion doesn't have a custom error-page. When I invoke 'response.sendError(...)', Internet Explorer receives the status-code and displays its own error-page ("this site could not be reached"). Netscape displays some similiar page, showing the status-code and the attached message. But I want to show a custom error-page, that show more information about the message, and looks good as well. How can I accomplish that? I've looked through the forum and browsed through the documentation of Orion... nothing...
    Ohh, and one more thing... Does anyone know how to make orion use another database than HSQL for EJB's? I want to use MySQL with the MySQL J/Connector.
    Please help me!
    Nille

    Finally!!!
    Thank you very much.
    Would it be possible to accomplish something like this:
    <error-page>         
         <error-code>*</error-code>
         <location>/error.jsp</location>   
    </error-page>and the corresponding JSP:
    <%
       int errorCode = ((Integer)request.getParameter("status-code");
       String message = (String)request.getParameter("message");
    %>
    <HTML>
       <HEAD>
          <TITLE>Error <%= errorCode %></TITLE>
       </HEAD>
       <BODY>
          Status-code: <%= errorCode %><br>
          Cause: <%= message %>
       </BODY>
    </HTML>So that I have a generic error-page that renders all sendError invokations, and can fetch the status-code and the attached message.
    If a ServletException occures and I have a page that handles this exception, can I reach the exception from the error-page? Something like request.getAttribute("exception"), or something like that.
    Thank you alot for answering!
    Nille

  • WAR cookie example not working. Please help!

    Hi,
              The cookie example worked fine if I put everything unpackaged under the
              public_html/cookie directory. However, when I jarred this directory as
              cookie.war and registered it with WLS, I got this exception when trying
              to access CookieCounter servlet.
              javax.servlet.ServletException: Servlet class: servlets.CookieCounter
              could not
              be loaded - the requested class wasn't found in the classpath
              Also, I was able to get to the hello.html page (my welcome-file) when I
              put in this request
              http://127.0.0.1:7001/cookie
              That means the server was able to extract the cookie.war file and parse
              web.xml correctly.
              The structure of my cookie.war file is exactly the same as the cookie
              directory's.
              This is what my cookie.war file looks like
              error.jsp
              WEB-INF/classes/servlets/CookieCounter.class
              WEB-INF/classes/CookieCounter.class
              WEB-INF/CookieCounter.java
              WEB-INF/web.xml
              images/cookie.jpg
              hello.html
              This is the entry in weblogic.properties
              weblogic.httpd.webApp.cookie=c:/weblogic/myserver/public_html/cookie.war
              my web.xml is
              <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
              1.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
              <web-app>
              <!--
              <context-param>
              <param-name>weblogic.servlet.reloadCheckSecs</param-name>
              <param-value>0</param-value>
              </context-param>
              -->
              <servlet>
              <servlet-name>CookieCounter</servlet-name>
              <servlet-class>servlets.CookieCounter</servlet-class>
              </servlet>
              <servlet-mapping>
              <servlet-name>CookieCounter</servlet-name>
              <url-pattern>monster</url-pattern>
              </servlet-mapping>
              <welcome-file-list>
              <welcome-file>hello.html</welcome-file>
              </welcome-file-list>
              <error-page>
              <error-code>404</error-code>
              <location>/error.jsp</location>
              </error-page>
              </web-app>
              The problem seems to be that weblogic was able to find
              CookieCounter.class under the unpackaged cookie directory but not inside
              cookie.war
              Please help.
              Thanks a lot.
              By the way, if you have a war file that works, please send it to me at
              [email protected]
              I would greatly appreciate it.
              

    Try resetting it:
    Press and hold the On/Off Sleep/Wake button and the Home
    button at the same time for at least ten seconds, until the Apple logo appears.
    Next try restoring via itunes.

  • Urgent please help, this program should work

    Urgent please help.
    I need to solve or I will be in big trouble.
    This program works at my home computer which is not networked.
    The hard disk was put onto another computer at another location whihc is networked. Here my program worked on Monday 14 october but since for the last two days it is not working without me changing any code. Why do I receive this error message???
    Error: 500
    Location: /myJSPs/jsp/portal-project2/processviewfiles_dir.jsp
    Internal Servlet Error:
    javax.servlet.ServletException
    at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:460)
    at jsp.portal_0002dproject2.processviewfiles_dir_1._jspService(processviewfiles_dir_1.java:162)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java)
    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:536)
    Root cause:
    java.lang.NullPointerException
    at jsp.portal_0002dproject2.processviewfiles_dir_1._jspService(processviewfiles_dir_1.java:132)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java)
    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:536)

    foolishmatt,
    The code is quit large.
    to understand the program I think all the code needs to be examined.
    I would need to send to you in an email.
    Here is my e-mail
    [email protected]
    if you contact me than I can send the code to you.
    Thank you in advance.

  • Please Help ?? Tomcat 6 and JDK 6 Class Not Found Exception when deploying

    Hi,
    I am deploying this application in Tomcat 6, but I am getting ClassNotFoundException when I try to the application. I am a novice at this.
    SEVERE: Error loading WebappClassLoader
      delegate: false
      repositories:
    ----------> Parent Classloader:
    org.apache.catalina.loader.StandardClassLoader@146c1d4
    com.jbe.test.HelloWorldServlet
    java.lang.ClassNotFoundException: com.jbe.test.HelloWorldServlet
         at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1359)
         at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1205)
         at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1068)
         at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:791)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:127)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
         at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
         at java.lang.Thread.run(Thread.java:619)
    Oct 15, 2007 12:57:31 AM org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Allocate exception for servlet asterisk
    java.lang.ClassNotFoundException: com.jbe.test.HelloWorldServlet
         at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1359)
         at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1205)
         at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1068)
         at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:791)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:127)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
         at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
         at java.lang.Thread.run(Thread.java:619)My web xml configuration
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
        version="2.4">
         <display-name>Hello, World Application</display-name>
        <description>
         Simple Test with a servlet.
        </description>
        <servlet>
             <servlet-name>helloworld</servlet-name>
             <servlet-class>com.jbe.test.HelloWorldServlet</servlet-class>
        </servlet>
        <servlet-mapping>
             <servlet-name>helloworld</servlet-name>
             <url-pattern>/hello.htm</url-pattern>
        </servlet-mapping>
    </web-app>My JSP: <html>
         <head><title>Test Hello World</title>
         </head>
         <body>
         <form>
         <a href = "hello.htm">Hello World</a>
         </form>
         </body>
    </html>
    Please Help !!!

    Are you sure your HelloWorldServlet has doGet method?
    package com.jbe.test;
    // Import servlet packages
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class HelloWorldServlet extends HttpServlet {
         public HelloWorldServlet() {}
         public void init() throws ServletException     {}
         public void doGet(HttpServletRequest request, HttpServletResponse response)
         throws ServletException, IOException           {
              response.setContentType("text/html");
            // then get the writer and write the response data
            PrintWriter out = response.getWriter();
            out.println("<HEAD><TITLE> SimpleServlet Output</TITLE></HEAD><BODY>");
            out.println("<h1> SimpleServlet Output </h1>");
            out.println("<P>This is output is from SimpleServlet.");
         out.println("</BODY>");
         out.close();
         public void destroy()     {}
    }

  • Hi I am newbie to Jsp,could anybody please help me

    Hi ,I am designing one login form using Jsp and servlets,these are my programs:
    import java.io.IOException;
    import javax.servlet.RequestDispatcher;
    import javax.servlet.ServletConfig;
    import javax.servlet.ServletContext;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class login2 extends HttpServlet {
         private String target = "/welcome.jsp";
         private String getUser(String username, String password) {
    //          Just return a static name
    //          If this was reality, we would perform a SQL lookup
              return "Shopping cart";
         public void init(ServletConfig config)
         throws ServletException {
              super.init(config);
         public void doGet(HttpServletRequest request,
                   HttpServletResponse response)
         throws ServletException, IOException {
    //          If it is a get request forward to doPost()
              doPost(request, response);
         public void doPost(HttpServletRequest request,
                   HttpServletResponse response)
         throws ServletException, IOException {
    //          Get the username from the request
              String username = request.getParameter("username");
    //          Get the password from the request
              String password = request.getParameter("password");
              String user = getUser(username, password);
    //          Add the fake user to the request
              request.setAttribute("USER", user);
    //          Forward the request to the target named
              ServletContext context = getServletContext();
              RequestDispatcher dispatcher =
                   context.getRequestDispatcher(target);
              dispatcher.forward(request, response);
         public void destroy() {
    This is my servlet program and these are my jsp programs:
    <html>
    <head>
    <title>OnJava Demo</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <b>Welcome To: <%= request.getAttribute("USER")
    %>
    </html>
    this is welcome.jsp and this is login.jsp
    <html>
    <head>
    <title>OnJava Demo</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <SCRIPT language=JavaScript>
    function checkUserName( thisform ) {
    if ( thisform.username.value == null || thisform.username.value == "") {
         alert( "You must supply value for Name");
         thisform.username.focus();
         thisform.username.select();
         return false ;
    /* if ( thisform.eMail.value == null || thisform.eMail.value == "" ) {
         alert( "You must supply value for eMail");
         thisform.eMail.focus();
         thisform.eMail.select();
         return false ;
         var myreturn = 0;
         myreturn = thisform.eMail.value.search("@");
         if ( myreturn == -1 ) {
         alert( "Please provide a valid eMail address like '[email protected]'");
         thisform.eMail.focus();
         thisform.eMail.select();
         return false ;
    return true;
    //end hiding -->
    </SCRIPT>
    <body bgcolor="#66CCFF" onLoad="document.loginForm.username.focus()">
    <Form name=loginform onsubmit="return checkUserName(this);"
    action=welcome.jsp method=post>
    <h><font face="Times New Roman" size="+3" color="#FF0000">Shopping cart Login form</font></h>
    <table width="500" border="0" cellspacing="0" cellpadding="0" align="center" >
    <tr>
    <td>
    <table width="500" border="0" cellspacing="20%" cellpadding="10%">
    <form name="loginForm" method="post" action="servlet/login2">
    <tr>
    <r>
    <td width="401" align="center"><div align="right">User Name: </div></td>
    <td width="399" align="left"><input type="text" name="username"></div></td>
         </center>
    </tr>
    <tr>
    <td width="401"><div align="right">Password: </div></td>
    <td width="399"><input type="password" name="password"></td>
    </tr>
    <tr>
    <td width="401"> </td>
    <td width="399"><br><input type="Submit" name="Submit" value="Login"></td>
    </tr>
    </form>
    </table>
    </td>
    </tr>
    </table>
    </body>
    </html>
    and I got Welcome to:null,but instead of i would like to get Welcome To Shopping Cart.
    What's the with my code,could anybody please help me...

    Hi,
    change loginform action to login2 (servlet) for validate user.
    <Form name=loginform onsubmit="return checkUserName(this);"
    action=login2 method=post>Regards,
    Ram.

  • Please help-image problem (display)

    Can someone please help with this?
    I keep receiving an error (below) while trying to execute the code...
    2001-07-19 11:55:02 - Ctx( /dev ): IOException in: R( /dev + /servlet/getImage + null) Connection reset by peer: socket write error
    My setup is Tomcat 3.2
    JDBC: Oracle's classes12.zip
    JDK: Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
    Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
    I have copied my simple code below for review:
    package lmmfcd.images;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.sql.*;
    import javax.servlet.jsp.*;
    import javax.servlet.jsp.tagext.*;
    import org.apache.jasper.runtime.*;
    import java.beans.*;
    import org.apache.jasper.JasperException;
    public class getImages extends HttpServlet
         public void doGet(HttpServletRequest request, HttpServletResponse response)
                   throws ServletException, IOException
              //Grabs and assigns the PageContext
                   JspFactory _jspxFactory = null;
                   PageContext pageContext = null;
                   Object page = this;
                   _jspxFactory = JspFactory.getDefaultFactory();
                   pageContext = _jspxFactory.getPageContext(this, request, response,
                        "", true, 8192, true);
              //End of the PageContext Stuff
              Connection conn = (Connection)pageContext.findAttribute("conn");
                   try
                        ResultSet rset = null;
                        String queryCmd =
                                  "SELECT     image "+
                                  "FROM          sgps.images "+
                                  "WHERE          pn = '13507028' "+
                                  " AND          pic_num = '1' ";
                        Statement stmt = conn.createStatement();
                        rset = stmt.executeQuery(queryCmd);
                        rset.next();
                        Blob blob = null;
                        blob = rset.getBlob("image");
                        response.setContentType("image/jpeg");
                        byte[] ba = blob.getBytes(1, (int)blob.length());
                        System.out.println("just above OutputStream");
                        response.getOutputStream().write(ba, 0, ba.length);
                        response.getOutputStream().flush();
                        response.getOutputStream().close();                    
                   catch(SQLException e)
                        throw new ServletException("Problem");
    }

    It compiled okay, but still displayed the broken image as the result....
              if (rset != null)
                   try
                        BLOB blob = null;
                        blob = (BLOB)rset.getObject("image");
                        response.setContentType("image/jpeg");
                        InputStream in = rset.getBinaryStream("image");
                        //Have also used:
                        //InputStream in = blob.getBinaryStream();
                        OutputStream out = response.getOutputStream();
                        byte b;
                        while ((b = (byte)in.read()) != 1)
                             out.write(b);
                        in.close();
                        out.flush();
                        out.close();
                   catch(SQLException e)
                        throw new ServletException("Problem");
              }

Maybe you are looking for

  • Error in Adhoc Query

    Hi Experts In an  info set , I have added two additional fields  to IT0001 ,Dotted position and Dotted Position text  and I have added field code for  both the fields . When I select these fields independently as output fields I am getting values exp

  • Best way to use PersistenceManagers in Web Applications

    Beacuse each PersistenceManager manages it's own cache , and I would like to benefit from this cache is it a good practice to keep in each user's session a PersistenceManager instance? By keeping this cache , wouldn't be a problem when many users acc

  • The browser's back button doesn't work for portlet navigation

    I developed a simple portlet that uses webflow navigation to navigate within a portlet. I made this portlet visible on a portal's home page. When I view my main portal page, the URL is "http://localhost:7501/samplePortal/index.jsp " In this page I ca

  • Emails not sent

    stmp cannot send emails from iphone 4s reset,deleted and re entered account details ....help i have no hair left and the phone is gonna be going out the window,thanks

  • Export PUBLIC database link

    Hi there, Possibly overlooking something but can I export a public database link using SQL Developer? Thanks.