Problem while encoding byte[] with RSA

Hi all,
I am trying to encode a byte array using RSA encoding. I use the following code (It tries to encode a byte array, "data", with the public key, "publicKey"):
byte[] encryptData  = new byte[data.length];
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
ByteArrayInputStream inStream = new ByteArrayInputStream(data);
CipherInputStream cipherStream = new CipherInputStream(inStream, cipher);
cipherStream.read(encryptData);And all I get is a empty array: encryptData is full of zero!
Does anyone have an idea about what I did wrong ?
Thanks in advance

ok...
Indeed, my data length is far more than my key length. So you tell me that I should cut my data to have some chunks of smalled size (key length max), and use directly something Cipher ?
EDIT: Oh, I just got it. I should cut the data into bits of KEY_SIZE minus 11 (for the minimum padding). I'm going to test that.
EDIT 2: Ok, that's fine, you were right. My error was to use CipherInputStream on data which length was more than key size minus padding. Thank you very much for your answer.
Edited by: Reeter on Mar 29, 2009 1:10 PM
Edited by: Reeter on Mar 29, 2009 1:35 PM

Similar Messages

  • Experiencing the problems while encoding the barcode with Code 128 font

    Hi Tim,
    Hope you are doing good.
    We are experiencing the problems while encoding the barcode with Code 128 font.we have followed the Oracle BI Publisher Blog i.e Barcoding 102 http://blogs.oracle.com/xmlpublisher/discuss/msgReader$281.
    Before applying the encoding Java class we were able to display the barcode but after applying this encoding Java class we are not able to display the barcode.
    We are requesting you to help us for encoding the barcode with Code 128 font and read barcode by scanner.
    We will appreciate and thankful if anybody help us in this regard
    Thanks,
    SubbaRao.

    Hi Tim,
    I am trying to create 128 Barcode, output shows little junk characters. I followed the your "Barcoding 102 instrucitons but no luck. I apprciate your help if you provide some help on this.
    http://blogs.oracle.com/xmlpublisher/2006/06/06
    1. Created Java class under $JAVA_TOP/oracle/apps/oracle/xdo/template/util/barcoder
    2. Registeted and applied the format the barcode to the form field. I will sedn my XML, RTF and Java class, Would you pleae advice me on this
    Thanks
    Venu

  • Problem while creating xml with cdata section

    Hi,
    I am facing problem while creating xml with cdata section in it. I am using Oracle 10.1.0.4.0 I am writing a stored procedure which accepts a set of input parameters and creates a xml document from them. The code snippet is as follows:
    select xmlelement("DOCUMENTS",
    xmlagg
    (xmlelement
    ("DOCUMENT",
    xmlforest
    (m.document_name_txt as "DOCUMENT_NAME_TXT",
    m.document_type_cd as "DOCUMENT_TYPE_CD",
    '<![cdata[' || m.document_clob_data || ']]>' as "DOCUMENT_CLOB_DATA"
    ) from table(cast(msg_clob_data_arr as DOCUMENT_CLOB_TBL))m;
    msg_clob_data_arr is an input parameter to procedure and DOCUMENT_CLOB_TBL is a pl/sql table of an object containing 3 attributes: first 2 being varchar2 and the 3rd one as CLOB. The xml document this query is generating is as follows:
    <DOCUMENTS>
    <DOCUMENT>
    <DOCUMENT_NAME_TXT>TestName</DOCUMENT_NAME_TXT>
    <DOCUMENT_TYPE_CD>BLOB</DOCUMENT_TYPE_CD>
    <DOCUMENT_CLOB_DATA>
    &lt;![cdata[123456789012345678901234567890123456789012]]&gt;
    </DOCUMENT_CLOB_DATA>
    </DOCUMENT>
    </DOCUMENTS>
    The problem is instead of <![cdata[....]]> xmlforest query is encoding everything to give &lt; for cdata tag. How can I overcome this? Please help.

    SQL> create or replace function XMLCDATA_10103 (elementName varchar2,
      2                                             cdataValue varchar2)
      3  return xmltype deterministic
      4  as
      5  begin
      6     return xmltype('<' || elementName || '><![CDATA[' || cdataValue || ']]>
      7  end;
      8  /
    Function created.
    SQL>  select xmlelement
      2         (
      3            "Row",
      4            xmlcdata_10103('Junk','&<>!%$#&%*&$'),
      5            xmlcdata_10103('Name',ENAME),
      6            xmlelement("EMPID", EMPNO)
      7         ).extract('/*')
      8* from emp
    SQL> /
    <Row>
      <Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
      <Name><![CDATA[SMITH]]></Name>
      <EMPID>7369</EMPID>
    </Row>
    <Row>
      <Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
      <Name><![CDATA[ALLEN]]></Name>
      <EMPID>7499</EMPID>
    </Row>
    <Row>
      <Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
      <Name><![CDATA[WARD]]></Name>
      <EMPID>7521</EMPID>
    </Row>
    <Row>
      <Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
      <Name><![CDATA[JONES]]></Name>
      <EMPID>7566</EMPID>
    </Row>
    <Row>
      <Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
      <Name><![CDATA[MARTIN]]></Name>
      <EMPID>7654</EMPID>
    </Row>
    <Row>
      <Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
      <Name><![CDATA[BLAKE]]></Name>
      <EMPID>7698</EMPID>
    </Row>
    <Row>
      <Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
      <Name><![CDATA[CLARK]]></Name>
      <EMPID>7782</EMPID>
    </Row>
    <Row>
      <Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
      <Name><![CDATA[SCOTT]]></Name>
      <EMPID>7788</EMPID>
    </Row>
    <Row>
      <Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
      <Name><![CDATA[KING]]></Name>
      <EMPID>7839</EMPID>
    </Row>
    <Row>
      <Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
      <Name><![CDATA[TURNER]]></Name>
      <EMPID>7844</EMPID>
    </Row>
    <Row>
      <Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
      <Name><![CDATA[ADAMS]]></Name>
      <EMPID>7876</EMPID>
    </Row>
    <Row>
      <Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
      <Name><![CDATA[JAMES]]></Name>
      <EMPID>7900</EMPID>
    </Row>
    <Row>
      <Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
      <Name><![CDATA[FORD]]></Name>
      <EMPID>7902</EMPID>
    </Row>
    <Row>
      <Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
      <Name><![CDATA[MILLER]]></Name>
      <EMPID>7934</EMPID>
    </Row>
    14 rows selected.
    SQL>

  • Problem while Creating MVLOG with synonym in Oracle 9i:Is it an Oracle Bug?

    Hi All,
    I am facing a problem while Creating MVLOG with synonym in Oracle 9i but for 10G it is working fine. Is it an Oracle Bug? or i am missing something.
    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    SQL>
    SQL> create table t ( name varchar2(20), id varchar2(1) primary key);
    Table created.
    SQL> create materialized view log on t;
    Materialized view log created.
    SQL> create public synonym syn_t for t;
    Synonym created.
    SQL> CREATE MATERIALIZED VIEW MV_t
      2  REFRESH ON DEMAND
      3  WITH PRIMARY KEY
      4  AS
      5  SELECT name,id
      6  FROM syn_t;
    Materialized view created.
    SQL> CREATE MATERIALIZED VIEW LOG ON  MV_t
      2  WITH PRIMARY KEY
      3   (name)
      4    INCLUDING NEW VALUES;
    Materialized view log created.
    SQL> select * from v$version;
    BANNER
    Oracle9i Enterprise Edition Release 9.2.0.6.0 - Production
    PL/SQL Release 9.2.0.6.0 - Production
    CORE    9.2.0.6.0       Production
    TNS for Solaris: Version 9.2.0.6.0 - Production
    NLSRTL Version 9.2.0.6.0 - Production
    SQL>
    SQL> create table t ( name varchar2(20), id varchar2(1) primary key);
    Table created.
    SQL> create materialized view log on t;
    Materialized view log created.
    SQL> create public synonym syn_t for t;
    Synonym created.
    SQL> CREATE MATERIALIZED VIEW MV_t
    REFRESH ON DEMAND
    WITH PRIMARY KEY
    AS
      2    3    4    5  SELECT name,id
    FROM syn_t;   6
    Materialized view created.
    SQL> CREATE MATERIALIZED VIEW LOG ON  MV_t
    WITH PRIMARY KEY
    (name)
      INCLUDING NEW VALUES;  2    3    4
    CREATE MATERIALIZED VIEW LOG ON  MV_t
    ERROR at line 1:
    ORA-12014: table 'MV_T' does not contain a primary key constraintRegards
    Message was edited by:
    Avinash Tripathi
    null

    Hi Nicloei,
    Thanks for the reply. Actually i don't want any work around (Creating MVLOG on table rather than synonym is fine with me) . I just wanted to know it is actually an oracle bug or something else.
    Regards
    Avinash

  • Problem while uploading data with GUI UPLOAD Function

    Hi,
      I am facing problem while uploading data with FM GUI UPLOAD    in out text file there are 7 row  but after the FM GUI UPLOAD  there are 14 entries are coming in Internal table   and each alternate row is coming as blank  with  0000 in some column   in internal table first row is proper and second line is blank so on.
    what can be the problem .
    The program in which we are using this we are using it from last 2 year but we are facing problem today only.
    regards,
      zafar

    Hi,
      The file formate is same as it is from last two years it is automatically generated by one another bar code server and there is no change  in the file formate.
      So waht can be the problem  to check any inconsistancy in system  i have develop a samll program fro  uploading a text file with same function module ,  but it is working fine.
    regards,
      zafar

  • Problem while reversing allocations with KEU5

    Dear Experts,
    we encounter some problems when reversing allocations with KEU5 (using KSU5 in the background). When doing so all 4 update processes will be occupied by the system on our 2 servers. Which means that the systems is blocked. 
    Thanks in advance for help and best regards
    Melanie

    SAP OSS Says the following
    This is not a program
    error and completely correct
    behaviour. Nevertheless, I would like provide the following
    recommendations which could possibly reduce workload/improve the
    runtime in the transaction KEU5:
    1. Please make sure that
    the flag for 'detail list' is not activated.
    If the option 'detailed list' is selected, a detailed output list is
    created for every segment. This takes up the largest amount of time
    during the process.
    2. Ensure that the Summarization that you use are updated on a regular
    basis, daily if possible.
    3. Also consider the
    cycles dimensions recommended by SAP (a maximum
    of 50 segments per cycle, a maximum total of 10,000 sender-receiver
    relationships, see documentation). If possible, enter only those
    objects in the cycle that are valid senders or receivers. Consider
    that if, for example, you entered 100 cost centers in a group of which
    only 20 are valid receivers, the complete master data validation and
    database selection is carried out for all 100. See note 79224 and
    130350 for further information.
    4. For the definition of segments and their summary in cycles, you
    should take into account the technical aspects included in note 420081.
    Please take into account that the selection of data is carried out
    from CE3xxxx, CE4xxxx (no effect at this point if you have archived
    CE1xxxx), as explained in note 420081.
    The selection of the reference data can both be carried out from a
    summarization level or from object level (tables CE3xxxx, CE4xxxx).
    In additional , you are
    recommended to perform
    this transaction during the evening/night. This will affect the system
    processes/workload during peak period.

  • Net_PRICE problem while creating PO with BAPI_PO_CREATE1 ***ASAP

    Dear All,
    While creating PO with bapi BAPI_PO_CREATE1, The net price is not populating, though the logic is correct, as when i change the net price to some otrher value of in the bapi, while debugging, it is taking the Net price, but in general run, the price is over written by Gross price in PO, Please Help, Its Urgent.
    Any Sample codes are welcomed, where Net_price is used.
    Thanks in Advance..
    Rewards Guaranteed.

    Dear All,
    While creating PO with bapi BAPI_PO_CREATE1, The net price is not populating, though the logic is correct, as when i change the net price to some otrher value of in the bapi, while debugging, it is taking the Net price, but in general run, the price is over written by Gross price in PO, Please Help, Its Urgent.
    Any Sample codes are welcomed, where Net_price is used.
    Thanks in Advance..
    Rewards Guaranteed.

  • How to encrypt more than 117 bytes with RSA?

    Hi there,
    I am struggling to encrypt more than 117 bytes of data with a 1024 bit RSA key.
    If I try to encrypt (write to my OutputStreamWriter) 118 Bytes ("A"s) or more, the file I am writing to is just empty and I get an exception whe trying to read it.
    I know the encryptable bytes (blocksize) are related to the key length: blocksize = keylength / 8 -11
    I also know RSA encryption of large files is discouraged, because it is like 100x slower than for instance AES and was originally only intended to exchange symmetric keys.
    Still I need to be able to asymmetrically encrypt at least 5kb of Data.
    I am out of ideas here and have no understanding of why the block size is limited (i know from hours of "googling" that it is limited as described above though).
    So, I would be very glad If somebody could point out a way how I could encrypt more than 117 bytes (without using a longer key of course).
    import java.io.FileInputStream;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.io.OutputStream;
    import java.io.FileOutputStream;
    import java.io.Reader;
    import java.io.Writer;
    import java.io.OutputStreamWriter;
    import java.security.PublicKey;
    import java.io.IOException;
    import java.security.InvalidKeyException;
    import java.security.KeyPair;
    import java.security.KeyPairGenerator;
    import java.security.NoSuchAlgorithmException;
    import java.security.PrivateKey;
    import javax.crypto.*;
    public class strchrbty {
         public static void main(String[] args) {
              //generate Keys
              PublicKey publicKey = null;
              PrivateKey privateKey = null;
              try {
                   KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA");
                   kpg.initialize(1024);
                   KeyPair kp = kpg.generateKeyPair();
                   publicKey = kp.getPublic();
                   privateKey = kp.getPrivate();
              } catch (NoSuchAlgorithmException e) {
                   e.printStackTrace();
              //------ENCODE------
              try {
                  //initialize cipher
                  Cipher cipher = Cipher.getInstance("RSA");  
                   cipher.init(Cipher.ENCRYPT_MODE, publicKey);   
                   OutputStream cos = new CipherOutputStream(new FileOutputStream("c:\\test.txt"), cipher);
                  Writer out = new OutputStreamWriter(cos);
                  // 1024 bit (key length) / 8 bytes - 11 bytes padding = 117 Bytes Data.
                  //  for 118 Bytes (or more) Data: c:\\test.txt is empty annd no Data is read.
                  for(int i = 0; i<117; i++) {
                       out.write("A");
                  out.close();
                  cos.close();
             } catch (InvalidKeyException e) {
                  e.printStackTrace();      
             } catch (NoSuchPaddingException e) {
                  e.printStackTrace();           
             } catch (NoSuchAlgorithmException e) {
                  e.printStackTrace();      
             } catch (IOException e) {
                  e.printStackTrace();
             //------DECODE------
             try {
                  StringBuffer buf = new StringBuffer();
                  Cipher cipher2 = Cipher.getInstance("RSA"); 
                  cipher2.init(Cipher.DECRYPT_MODE, privateKey);
                  //read char-wise
                  InputStream cis = new CipherInputStream(new FileInputStream("c:\\test.txt"), cipher2);
                  Reader in = new InputStreamReader(cis);
                  for(int c = in.read(); c != -1; c = in.read()) {
                    buf.append((char)c);
                  //output
                  System.out.println(buf.toString());
                  in.close();
                  cis.close();
              } catch (InvalidKeyException e) {
                  e.printStackTrace();      
             } catch (NoSuchPaddingException e) {
                  e.printStackTrace();           
             } catch (NoSuchAlgorithmException e) {
                  e.printStackTrace();      
              } catch(IOException e) {
                 e.printStackTrace();
    }Regards.
    Edited by: junghansmega on Sep 10, 2008 3:41 PM
    Sorry about the bad autoformating.... It only occurrs in here, in my eclipse it looks fine =(

    junghansmega wrote:
    Hi there,
    I am struggling to encrypt more than 117 bytes of data with a 1024 bit RSA key.
    If I try to encrypt (write to my OutputStreamWriter) 118 Bytes ("A"s) or more, the file I am writing to is just empty and I get an exception whe trying to read it.
    Good, it should be painful.
    >
    Still I need to be able to asymmetrically encrypt at least 5kb of Data.
    In this forum, 99.999% of the time this kind of claim is due to a lack of understanding of the role of public key cryptography.
    I am out of ideas here and have no understanding of why the block size is limited (i know from hours of "googling" that it is limited as described above though).
    It should not be difficult to break up the input into 117 byte chunks and encrypt each chunk through a newly initted cipher object. Of course you will have to be very careful in properly encoding the output. You might naively think that the output is always 128 bytes, but is that true? Might it be 127 bytes sometimes? Maybe even 126 bytes?

  • Problem while using XML with Oracle

    I have a problem using XML with oracle applications
    The process I am following
    1. Making a XML string.
    2. Parsing it to get a document
    3. Free the parser using xmlparser.freeparser
    4. Traversing through nodes .
    5. Freeing the document.
    The whole Process is executed in batch mode.
    The problem occurs after executing the procedure for 5000 records and I get the error
    ORA-04031: unable to allocate 4176 bytes of shared memory ("shared pool","unknown object","sga
    heap","library cache")
    Can you please help me out to overcome this problem
    It's urgent
    I have
    Oracle version 8.1.7.0.0
    XML version 1.2
    OS Windows NT
    To resolve the problem I have increase shared memory size and java initialization parameters ,which seems OK
    Looking forward for your answer.

    Hello, Reena
    Your process flow seems to be correct in term of getting/freeing memory.
    Following error
    The problem occurs after executing the procedure for 5000 records and I get the error
    ORA-04031: unable to allocate 4176 bytes of shared memory ("shared pool","unknown object","sga
    heap","library cache")may be caused by memory leaks in xdk or memory fragmentation(due to get/free memory cycle)
    To find out if this is an memory leak issue you could try to monitor V$SGASTAT from one session while running your batch process in another session.
    To prevent (or lower its impact) fragmentation issues try to PIN objects, and adjust java_pool_size and shared_pool_reserved_size.
    Anyway, counsult your Oracle DBA.
    Oracle version 8.1.7.0.0I think, you should apply database patch first of all. The latest one (8.1.7.4.x) could be accured from Metalink.

  • Problem while sync iPhone with itunes (with cable)

    hello guys
    i am using iPhone 3GS version 5.1.1,
    whilie i am syncing my iPhone with itunes 11 using cable (or perivious version), a message appears as
    "itune is stop working, please close itune"
    this message appears when itunes is "BACKING UP" the data.
    please help me. i have change three cables also but still issue
    i cannt understand this problem
    thanks!
    i am using windows 7 (64-bit)

    Hey wavymitch,
    I changed my iTunes account email address and Apple ID Sign-in.  My iPhone and iPad 3 keeps bring up my old email address when I go to download any updates to any of the apps on the phone/pad and from there I am unable to log into my Apple ID. When I enter the settings on the devices to view "iTunes & Apps Stores" and then select "View Apple ID" I am once again unable to access with existing password which did not change in iTunes. 
    I appreciate your response and look forward to a solution(s).  Thanks much for your help and patience!

  • Facing problems while encoding..

    Hi guys,
    Finally i am able to send the TV channel signals by using live encoder. It works good with few problems .
    problems:
    1) In player after connect to server the screen( channel screen) is not exactly showing that means bottom 1/4 portion is cut off. Is there any setting to avoid this problem??
    2) After connect to server, on client machine the video is not running smoothly,it breaks upto 2 sec then skip that portion and then continue...it is continuing like this for every 5min
    3) On FMLE the input and output panel showing with high color quality but once it send to server(even local server also) on web casting  it delivers very poor quality
    is there any setting to solve this problem?
    4)Last question (but not final one) i played  all these games on my local machine (with static IP) for testing purpose, i planning to take dedicated server in order to webcast my client channel for public. Please give me some suggestions which one i can prefer in the sense bandwidth,speed,RAM..etc so that i can make my client satisfy by avoiding all problems mentioned above..
    Waiting for your reply
    Thanks in advance

    Can you give some details about your current configuration:
    1. What are you using to capture your video source?
    2. What resolution/output size/bitrate are you using?
    3. What is the bandwidth on the connection between your computer running FMLE and the server?
    4.  What computer are you using to encode (CPU/RAM/etc)?

  • A wierd problem while encoding URLs

    Hi all,
    I'm facing a wierd problem with the java.net.URLEncoder class. The encode function in this class is used for encoding URL based on standards like "UTF-8" etc..
    I need to encode the URLs, because i have to send this information in a XML to another server.. Here's what the URLEncoder is doing if i give it the URL
    http://mydomain.com:80/myServlet?_fileName=filename.mp3&_useStreaming=true
    its encoding this as
    http%3A%2F%2Fmydomain.com%3A80%2FmyServlet%3F_fileName%3Dfilename.mp3%26_useStreaming%3Dtrue
    but, all I wanted is to encode only '&' character ( as XML misinterprets this character with schemes ).
    So, my question is .. is there any way that i can selectively encode the characters in the URL?
    Any help wud be appriciated in this regard. :-)

    I accept what you are saying.. URLEncoder encodes any string that's passed to it..
    I infact have two different problems in hand.. The reason i mentioned only one above is because the solution to the first problem cud as well solve the second.. Anyway, here's the second problem ...
    I'm recieving an XML from a server, where i get the URL info and i have to download the CONTENT from that URL.. Sample xml is given below
    <Music>
    <Singer>Tata Young</Singer>
    <contentURL>http://myMusic.com/sexy naughty.mp3</contentURL>
    </Music>
    if you see the URL in the xml, that infact contains spaces in it.. I have my logic which checks if the given URL is a absolute URL or relative URL
    if( relative URL)
    I append "http://domain name:" stuff to make it absolute
    else
    i connect to the URL directly to get the Content
    I'm using
    URI i = new URI(str);
    i.isAbsolute() method to determine whether its a absolute URL or not..
    but this method doesn't seem to work for URLs that have spaces in them.. So, i encoded the URL and tried passing it to the method.. but it still doesn't work..
    I probed into URI class itself and found out to my amazement that URI class assumes that URL contains only alpha numeric characters and few special characters like '+' , '/' , ':' etc..
    Since the encoded URL has '%' character in it.. its not able to say that its a absolute URL.. Tht's the reason I asked for selective encoding.. ( say, which encodes only [space] character)..

  • Problem while encoding JPEG image from JFrame paintComponent in a servlet

    Hello!
    I m developing webapplication in which I made one servlet that calls JFrame developed by me, and then encoding into JPEG image to send response on client browser. I m working on NetBeans 5.5 and the same code runs well. But my hosting server is Linux and I m getting the following error:
    java.awt.HeadlessException:
    No X11 DISPLAY variable was set, but this program performed an operation which requires it.
         java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:159)
         java.awt.Window.<init>(Window.java:406)
         java.awt.Frame.<init>(Frame.java:402)
         java.awt.Frame.<init>(Frame.java:367)
         javax.swing.JFrame.<init>(JFrame.java:163)
         pinkConfigBeans.pinkInfo.pinkModel.pinkChartsLib.PinkChartFrame.<init>(PinkChartFrame.java:36)
         pinkConfigBeans.pinkController.showLastDayRevenueChart.processRequest(showLastDayRevenueChart.java:77)
         pinkConfigBeans.pinkController.showLastDayRevenueChart.doGet(showLastDayRevenueChart.java:107)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.25 logs.
    I m building the application in NetBeans and when runs then it runs well, even while browsing from LAN. But when I place the web folder creted under buil directory of NetBeans in the Tomcat on Linux, then it gives above error.
    Under given is the servlet code raising exception
    response.setContentType("image/jpeg"); // Assign correct content-type
    ServletOutputStream out = response.getOutputStream();
    /* TODO GUI output on JFrame */
    PinkChartFrame pinkChartFrame;
    pinkChartFrame = new PinkChartFrame(ssnGUIAttrInfo.getXjFrame(), ssnGUIAttrInfo.getYjFrame(), headingText, xCordText, yCordText, totalRevenueDataList);
    pinkChartFrame.setTitle("[::]AMS MIS[::] Monthly Revenue Chart");
    pinkChartFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    //pinkChartFrame.setVisible(true);
    //pinkChartFrame.plotDataGUI();
    int width = 760;
    int height = 460;
    try {
    BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
    Graphics2D g2 = image.createGraphics();
    pinkChartFrame.pinkChartJPanel.paintComponent(g2);
    JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
    encoder.encode(image);
    } catch (ImageFormatException ex) {
    ex.printStackTrace();
    response.sendRedirect("index.jsp");
    } catch (IOException ex) {
    ex.printStackTrace();
    response.sendRedirect("index.jsp");
    out.flush();
    Do resolve anybody!
    Edited by: pinkVag on Oct 15, 2007 10:19 PM

    >
    I m developing webapplication in which I made one servlet that calls JFrame developed by me, and then encoding into JPEG image to send response on client browser. I m working on NetBeans 5.5 and the same code runs well. But my hosting server is Linux and I m getting the following error:
    java.awt.HeadlessException: >That makes sense. It is saying that you cannot open a JFrame in an environment (the server) that does not support GUIs!
    To make this so it will work on the server, it will need to be recoded so that it uses the command line only - no GUI.
    What is it exactly that PinkChartFrame is generated an image of? What does it do? (OK probably 'generate a chart') But what APIs does it use (JFreeChart or such)?

  • [File] Problem while creating files with long pathnames

    Hello everybody
    I'm trying to create File objects corresponding to physical files. These files have very long pathnames because they are located in directories tree with large depth. So, my pathname conatins a lot of directories plus the name of the file itself.
    It seems, that there is a limitation in the length of the pathname that I pass to the File constructor because files with small pathnames are OK bu the ones with very large pathnames cannot be created.
    I tried the different File constructors (File(String pathname) and File(File parent, String childname)) but it still does not work. Even if the second constructor is a little bit better as it succeeds on files where the first constructor failed. But still, it's not enough.
    Please Help!
    Thank you
    Hugo

    RESOLVED!
    The problem was from the OS itself (Windows XP) which accepts at most 255 characters long path names.

  • Facing problem while connecting N70 with bluetooth

    I am connecting N70 with my laptop thru bluetooth. But im facing a error msg saying that hardware problem with MODEM.
    do i need to install Modem & if so which one suitable.
    all others application working thru bluetooth expect net connection.
    description:
    Window XP
    Nokia PC suite letest one
    thru blutooth.
    plz suggest. Thanks

    When one installed pcsuites successfully it installed all drivers including the modem, the reasons why it takes sometimes when one is prompted to connect the cable.
    Try to uninstall pcsuite again & run the pcsuites cleaner afterwards then re-install pcsuite. Don't connect the cable until told to so & check. If it does fail again, make a backup & format your phone; is the firmware of your N70 the latest one?
    Knowledge not shared is knowledge wasted!
    If you find it helpfull, it's not hard to click the STAR..

Maybe you are looking for

  • Snow Leopard and Lion on external hard drive

    I successfully installed Snow Leopard on an external hard drive in one of the partitions.  I am also able to boot from the Snow Leopard on the partition, access the internet, get my email and have successfully installed Evernote. I am also able to ac

  • Material Assignment in Master recipe

    Hi, Is there any FM/BAPI to assign material into a master recipe? Currently, we are using BDC to call C202 transaction for this purpose. This process takes long time for material assignment which leads to performance issue. Thanks in advance Senthil

  • AC 5.3 CUP - authorization for CUP's users

    Dear Friends, We are trying to see what are the authorizations that we should give the users who are going to use the CUP system. We have some users who are approvers. We want to give them the authorizations maintain and view only the request that th

  • Can't create the file 'bled_top-1.png'

    hi, when trying to publish my site to the web, i get this message. any idea what i need to change ? says that disk might be damaged or i might have insufficient access privileges. only thing I can think of is that i had a 3 month free period and the

  • Select selecting too much

    I guess I have managed to tap a keyboard shortcut by mistake. Because now everytime I selecting something from within a tag dreamweaver tries to help and selects about another 250 words and lines of code that I dont want. This is really annoying. I h