RecordStore problem!!

RecordStoreNotFoundException :javax.microedition.rms.RecordStoreNotFoundException: cannot find record store file
RecordStoreNotFoundException :javax.microedition.rms.RecordStoreNotFoundException: cannot find record store file

bpmf wrote:
RecordStoreNotFoundException :javax.microedition.rms.RecordStoreNotFoundException: cannot find record store file
RecordStoreNotFoundException :javax.microedition.rms.RecordStoreNotFoundException: cannot find record store fileNice one!
I saw this one today: java.io.IOException: HTTP response code: 500
Ok, so you finally stopped hijacking other threads and created your own. Now please try to ask an actual question with all the details that could be important.

Similar Messages

  • Recordstore problems?

    I'v been working on this application for quite a while now.
    The complete app. is working on different emulators but I came accross problems on some (actually all I tested) real devices.
    I did some debugging as best I could and traced the problem down to the run() method of my updateModel.
    The code:
        public void run() {
            int recordCount = 0;
            byte[] byteLength;
            int noOfBytesRead = 0, bytesReadThisLoop;
            //Maak de connectie naar het update bestand
            //connection = getClass().getResourceAsStream("/databases/update.db");
            try{
                connection = Connector.openInputStream("http://xxx.com/update");
            catch(Exception e){error = "error 1";}
            //Leegmaken van de update RMS
            try {
                Controller.recordStore.closeRecordStore();
                RecordStore.deleteRecordStore("update");
                Controller.recordStore = RecordStore.openRecordStore("update", true);
            catch(Exception e){error += " 2";}
            updating: while(updating){
                try {
                    byteLength = new byte[4];       // de lengte van de data in te lezen
                    noOfBytesRead = 0;
                    //Inlezen van de lengte
                    while(noOfBytesRead != 4){
                        bytesReadThisLoop = connection.read(byteLength, noOfBytesRead, 4 - noOfBytesRead);
                        if(bytesReadThisLoop == -1){
                            break updating;
                        noOfBytesRead += bytesReadThisLoop;
                    noOfBytesRead = 0;
                    int length = Integer.parseInt(new String(byteLength)) + 1;
                    byte[] data = new byte[length];
                    //Lees de content. De blockread hoeft niet alles te lezen wat opgegeven word.
                    //Controlleer dus of alles is gelezen
                    while(noOfBytesRead != length){
                        noOfBytesRead += connection.read(data, noOfBytesRead, length - noOfBytesRead);
                    //Opslaan van de complete index (eerste keer) of de records
                    Controller.recordStore.addRecord(data, 1, data.length - 1);
                    connection.skip(1);             //Sla de '/n' over
                    recordCount++;
                catch (Exception ex) {
                    error += " 3";
            Controller.recordStoreCount = recordCount;
            updating = false;
            connection = null;
        }Anybody ideas of what can go wrong? Don't pay attention to the exceptionhandling cause I will improve on that as soon as I've fixed this problem.
    Edited by: JosN on Jun 10, 2008 1:13 AM

    That's the thing. I don't really know.
    In the Game Loop's load code it looks like this:
            finally
                try
                    rs.closeRecordStore();
                    rs = null;
                    System.out.println("3�");
                catch (RecordStoreException e) { System.err.println(e); }
            System.out.println("4");I get the error between the println("3�!); and the println("4"); - but the error is not a RecordStoreException. I changed the System.err.println(e) to System.out.println("Here's the error"); but the error was still a NullPointerException.
    PS: And thank you so much for wanting to help!
    Edited by: Little-Burrito on Nov 20, 2007 3:36 AM

  • Javafx and RecordStore problem

    Hi,
    I am creating a contact management mobile app with javafx, and I am using a RecordStore to store the data. As long as the emulator is open I have verified that the records are being added to the recordstore.
    However when I close the emulator and re start the app, the recordstore disappears, and it recreates the store (it says it has 0 records).
    I am using netbeans, and using the mobile profile.
    Any help will be highly appreciated...
    thanks in advance

    I wasn't sure what is RecordStore but apparently it is MIDP's way of persisting data.
    As it shows, I have little knowledge of JavaME, so I don't know if that's a problem with the emulator or the usage of RecordStore within JavaFX or something else.
    Now, perhaps you can use the [javafx.io.Storage|http://java.sun.com/javafx/1.2/docs/api/javafx.io/javafx.io.Storage.html] class for persisting data, it is designed to work both in JavaME and on desktop.
    It might offer less features than RecordStore, though.

  • Problem with RecordStore

    Hi all!
    I am building my first cell phone application and starting with J2ME. I "finished" my implementation but my app is not working properly. I dont know if the data is really being saved on the RecordStore or if the data is not being loaded correctly.
    I have 3 classes: Interface, Data and DAOdata. I will put the main parts:
    //My Interface
    public class Interface extends MIDlet implements CommandListener {
    //In this part I save some data to DataBase
    formPagto.setCommandListener (new CommandListener() {
                public void commandAction(Command c, Displayable s) {
                       if(c == salvaDesp){
                            String tmp = txtVal.getString();
                            float val = Float.parseFloat(tmp);
                            DAOdadata dados = new DAOdata();
                            dados.carregaDados(mesAtual());
                            dados.saveData(val, option, mesAtual());
                            novoDisplay(mList);
                       if(c == cBack)
                            novoDisplay(mListSec);
    //Here I load data from RecordStore. The problem, is that only 0 comes out
    mListMes.setCommandListener (new CommandListener() {
                public void commandAction(Command c, Displayable s) {
                  if(c == cResumo){
                       int x = mListMes.getSelectedIndex();
           DAOdata dados = new DAOdata();
           Data VR;
           VR = dados.loadData(x);
       //In this place all I get is 0%. And this is the problem. I should get different values.
           StringItem alim = new StringItem("Food: ", FloatToString(VR.getFood())+"%");
           StringItem vest = new StringItem("Health: ", FloatToString(VR.getHealth())+"%");
            fromVis.append(alim);
           fromVis.append(vest);
         Display.getDisplay(this).setCurrent(fromVis);
                  else if(c == cBack)
                       novoDisplay(mList);
    //My Data class. It´s a bean
    public class Data {
         private float salary;
         private float food,healty,cars, groceries;
    //Setters
    public void setSalary(float val){
              salary = val;
    //Getters
    public float getSalary(){
      return salary;
    //Finally my DAO class
    public class DAOdata {
    private RecordStore rs = null;
    Data dados;
    int month;
    public void loadDataBase(){
              try
                rs = RecordStore.openRecordStore(PERFIL_DB, true);
             catch (Exception  e){
                  System.out.println("Problem loadDataBase()");
    //Load data from RecordStore
    public Data loadData(int month){
              try{
               byte[] data = rs.getRecord(month);
               DataInputStream is = new DataInputStream(new ByteArrayInputStream(data));
               dados.setFood(is.readFloat()); 
               dados.setHealth(is.readFloat());       
               dados.setCars(is.readFloat());
               dados.setGroceries(is.readFloat());
               is.close( );
              }catch(Exception e){
                        //Never get exceptions in here
                   e.printStackTrace();
              return dados;
    //Saving data to RecordStore.
    public void saveData(float val, String tipo, int month){
              if(tipo.equals("Food")){dados.setFood(val);}
              else if(tipo.equals("Health")){dados.setHealth(val);}
              else if(tipo.equals("Cars")){dados.setCars(val);}
              else if(tipo.equals("Groceries")){dados.setGroceries(val);}
              try{
               ByteArrayOutputStream baos = new ByteArrayOutputStream( );
               DataOutputStream os = new DataOutputStream(baos);
               os.writeFloat(dados.getFood());
               os.writeFloat(dados.getHealth());
               os.writeFloat(dados.getCars());
               os.writeFloat(dados.getGroceries());
               os.flush();
               os.close( );
               byte[] data = baos.toByteArray( );
              rs.setRecord(mes, data, 0, data.length); //I use setRecord since the data is already initialized
               rs.closeRecordStore();
              }catch(Exception e){
                        //Never get exceptions in here
                   e.printStackTrace();
    //In this method I populate the RecordStore for the First time. I call this method 12 times, one per month
    public void initRecordStore(int month){
              dados.setFood(0);
              dados.setHealth(0);
              dados.setCars(0);
              dados.setGroceries(0);
              try{
                    ByteArrayOutputStream baos = new ByteArrayOutputStream( );
                    DataOutputStream os = new DataOutputStream(baos);
                    os.writeFloat(dados.getFood());
                    os.writeFloat(dados.getHealth());
                    os.writeFloat(dados.getCars());
                    os.writeFloat(dados.getGroceries());
                    os.close( );
                    byte[] data = baos.toByteArray( );
                   int id = rs.addRecord(data, 0, data.length);
                   rs.closeRecordStore();
                   }catch(Exception e){
                        //Never get exceptions in here
                        e.printStackTrace();
         }So, all that I get are 0% as a result. I dont get any exceptions when I load or save data. I dont know how to solve it. Any help will be welcome.
    Thank you all

    Hi, thanks for your answer.
    Actually I have seen a lot of examples before using the RecordStore.
    Maybe my problem is the way I am using the loadData() to retrieve information to another class. I am trying in a different way.
    Anyway, I will check more examples.
    Thank you =)

  • Problem with RecordStore.deleteRecordStore

    since rms doesnt have a recordstorerename function i have to copy all records to a new recordstore and delete the old one.
    the problem is that i need to close the from recordstore twice or i get a
    recordstore is still open exception.
    anyway to fix this ?
    RecordStore from = RecordStore.openRecordStore("thestore", false);
    RecordStore to = RecordStore.openRecordStore(tb.getString(), true);
    for (int i=1;i<=from.getNumRecords();i++) {
    byte[] data = from.getRecord(i);
    to.addRecord(data,0,data.length);
    to.closeRecordStore();
    from.closeRecordStore();
    from.closeRecordStore();
    RecordStore.deleteRecordStore("thestore");

    Hello,
    I checked this with WTK 2.2, but as expected I got the Exception RecordStoreNotOpenException, if I try closing the record store twice times.
    I think you just opened the record store once before and forgot to close it. MIDP2 says: 'MIDlet needs to make a balanced number of close calls as open calls before the record store is closed. ' And this applies to one RecordStore only.
    So have a look at your code and check this.

  • Problem in RecordStore

    As we know that we have a method deleteRecord(int recordId) in RecordStore Class. it deletes the record ID associated with the record.
    So, when we delete a record, it deletes the record along with the recordID but does not rearrange the remaining records in the recordstore. we have to do it manually. i am using a logic to set the new recordID for the remaining records but it is not working well. So if you know how to solve this problem, please tell me....

    You cannot get the complete RDBMS kind of functionality incorporated in Java ME client since it is only a tiny foot-print provided to store bytes of information.
    Regarding your problem the record ID is treated as an primary key and once deleted cannot be retrieved back. Better to use setRecord() call instead.
    ~Mohan

  • RecordStore Syntax Problem

    Hello, I am having much difficulty getting my syntax correct in my classes. Here is what I am talking about. I am giving snipts.
    basically I am attempting to check for a record with parameter empid. I am having problems getting the syntax correct. I have another method that dumps the recordstore. I know the method works. I got it from the tips and tricks that Eric Giguere wrote. Any ideas or some direction would be extremely appreciative. I know that if I get a little direction I can go on it. I also have a command actions that control some other stuff like adding records, but for the life of me I can figure the syntax! Logically its simple, but actually coding it is becoming a difficult...
    public Form loginForm() {
    System.out.println("Inside Login Screen()");
    // Go ahead and open our RecordStore empWorkDB, or rather Try to open...
    try {
    System.out.println("Attempting to open RecordStore");
    rs = RecordStore.openRecordStore(db, true);
    System.out.println("RecordStore Opened " +db);
    // test var
    byte[] empid = new byte[100];
    // Lets check for the empid value in our RecordStore.
    dumpRecordStore(rs);
    System.out.println(rs);
    catch (Exception e) {loginForm.append("Error 2601: DB Failed Open"); }
    loginForm = new Form("Login");
    done = new Command("OK", Command.OK, 1);
    login = new TextField("Enter Employee ID:", "", 20, TextField.NUMERIC);
    loginForm.append(login);
    loginForm.addCommand(done);
    loginForm.addCommand(cancel);
    loginForm.addCommand(newemp);
    loginForm.setCommandListener(this);
    return loginForm;
    } // End loginForm()

    Please be specific what you want to do ..
    --Senthil                                                                                                                                                                                                               

  • Problems in recordstore

    Hi all,
    I am completely new to java/j2me. I am trying to write and read to and from a recordstore. The problems that i am facing are
    1. If I add both the exit and start command then then none of the command works.
    2. If I comment out the exit command line then probably the data gets written into the recordstore but while reading it I print them then it only displays the integer as 0 instead of the value that was assigned to it.
    In the code I have marked out the problems I am facing
    import javax.microedition.rms.*;
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import java.io.*;
    public class RecordStoreTest
    extends MIDlet implements CommandListener
    private Display display;
    private Alert alert;
    private Form form;
    private Command exit;
    private Command start;
    private RecordStore recordstore = null;
    private RecordEnumeration recordEnumeration = null;
    public RecordStoreTest()
    display = Display.getDisplay(this);
    exit = new Command("Exit", Command.SCREEN, 1);
    start = new Command("Start", Command.SCREEN, 1);
    form = new Form("Mixed Record");
    // If I uncomment the line below then none of the Commands work.
    //form.addCommand(exit);
    form.addCommand(start);
    form.setCommandListener(this);
    public void startApp()
    display.setCurrent(form);
    public void pauseApp()
    public void destroyApp( boolean unconditional )
    public void commandAction(Command command, Displayable displayable)
    if (command == exit)
    destroyApp(true);
    notifyDestroyed();
    else if (command == start)
    try
    recordstore = RecordStore.openRecordStore("myRecordStore", true);
    catch(Exception error)
    alert = new Alert("Error Creating", error.toString(), null, AlertType.WARNING);
    alert.setTimeout(Alert.FOREVER);
    display.setCurrent(alert);
    try
    byte[] outputRecord;
    String outputString[] = { "ABC", "XYZ", "PQRS" , "UVW", "OTHERS"};
    int outputno[] = {1234, 1567, 1890, 1345, 1789};
    int outputval[] = {5000, 6000, 7000, 8000, 9000};
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    DataOutputStream outputDataStream = new DataOutputStream(outputStream);
    for(int x=0; x<5; x++)
    outputDataStream.writeInt(outputno[x]);
    outputDataStream.writeUTF(outputString[x]);
    outputDataStream.writeInt(outputval[x]);
    outputDataStream.flush();
    outputRecord = outputStream.toByteArray();
    recordstore.addRecord(outputRecord, 0, outputRecord.length);
    outputStream.reset();
    outputStream.close();
    outputDataStream.close();
    catch(Exception error)
    alert = new Alert("Error Writing", error.toString(),null,AlertType.WARNING);
    alert.setTimeout(Alert.FOREVER);
    display.setCurrent(alert);
    try
    StringBuffer buffer = new StringBuffer();
    byte[] byteInputData = new byte[300];
    ByteArrayInputStream inputStream = new ByteArrayInputStream(byteInputData);
    DataInputStream inputDataStream = new DataInputStream(inputStream);
    recordEnumeration = recordstore.enumerateRecords(null,null,false);
    while(recordEnumeration.hasNextElement())
    recordstore.getRecord(recordEnumeration.nextRecordId());
    // this line prints 0 not the data 1234 written in the recordstore.
    System.out.println("Data 1 is : " + inputDataStream.readInt());
    buffer.append(inputDataStream.readInt());
    buffer.append(" ");
    buffer.append(inputDataStream.readUTF());
    buffer.append(" ");
    buffer.append(inputDataStream.readInt());
    buffer.append(" ");
    catch(Exception error)
    alert = new Alert("Error Reading", error.toString(),null,AlertType.WARNING);
    alert.setTimeout(Alert.FOREVER);
    display.setCurrent(alert);
    Thanks a lot
    Ayan

    Hi Ayen
    Your 1st Problem I can find no reason for, I tested using Sun WTK25 and on a Nokia 6680 And The Start and exit buttons both worked.
    2nd Problem, You were not reading the records into your byte variable.
    I have changed the code - and it works on wtk25 and nokia 6680
    import javax.microedition.rms.*;
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import java.io.*;
    public class RecordStoreTest
    extends MIDlet implements CommandListener
    private Display display;
    private Alert alert;
    private Form form;
    private Command exit;
    private Command start;
    private RecordStore recordstore = null;
    private RecordEnumeration recordEnumeration = null;
    public RecordStoreTest()
    display = Display.getDisplay(this);
    exit = new Command("Exit", Command.SCREEN, 1);
    start = new Command("Start", Command.SCREEN, 1);
    form = new Form("Mixed Record");
    // If I uncomment the line below then none of the Commands work.
    // I tested this using sun WTK 25 and a Nokia 6680 and it works correctly, what are you running the app on?
    form.addCommand(exit);
    form.addCommand(start);
    form.setCommandListener(this);
    public void startApp()
    display.setCurrent(form);
    public void pauseApp()
    public void destroyApp( boolean unconditional )
    public void commandAction(Command command, Displayable displayable)
    if (command == exit)
    destroyApp(true);
    notifyDestroyed();
    else if (command == start)
    try
    recordstore = RecordStore.openRecordStore("myRecordStore", true);
    catch(Exception error)
    alert = new Alert("Error Creating", error.toString(), null, AlertType.WARNING);
    alert.setTimeout(Alert.FOREVER);
    display.setCurrent(alert);
    try
    byte[] outputRecord;
    String outputString[] = { "ABC", "XYZ", "PQRS" , "UVW", "OTHERS"};
    int outputno[] = {1234, 1567, 1890, 1345, 1789};
    int outputval[] = {5000, 6000, 7000, 8000, 9000};
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    DataOutputStream outputDataStream = new DataOutputStream(outputStream);
    for(int x=0; x<5; x++)
    outputDataStream.writeInt(outputno[x]);
    outputDataStream.writeUTF(outputString[x]);
    outputDataStream.writeInt(outputval[x]);
    outputDataStream.flush();
    outputRecord = outputStream.toByteArray();
    recordstore.addRecord(outputRecord, 0, outputRecord.length);
    outputStream.reset();
    outputStream.close();
    outputDataStream.close();
    catch(Exception error)
    alert = new Alert("Error Writing", error.toString(),null,AlertType.WARNING);
    alert.setTimeout(Alert.FOREVER);
    display.setCurrent(alert);
    try
    //StringBuffer buffer = new StringBuffer();
    String sbuffer="";
    byte[] byteInputData = new byte[300];
    ByteArrayInputStream inputStream = new ByteArrayInputStream(byteInputData);
    DataInputStream inputDataStream = new DataInputStream(inputStream);
    recordEnumeration = recordstore.enumerateRecords(null,null,false);
    while(recordEnumeration.hasNextElement())
    //You did not get your data into the byte variable
    recordstore.getRecord(recordEnumeration.nextRecordId(),byteInputData,0);
    //System.out.println("Data 1 is : " + inputDataStream.readInt());
    StringBuffer buffer = new StringBuffer();
    buffer.append(inputDataStream.readInt());
    buffer.append(" ");
    buffer.append(inputDataStream.readUTF());
    buffer.append(" ");
    buffer.append(inputDataStream.readInt());
    buffer.append(" ");
    System.out.println("Buffer=" + buffer);
    sbuffer=buffer.toString();
    form.append(sbuffer.trim() + "\n");
    catch(Exception error)
    alert = new Alert("Error Reading", error.toString(),null,AlertType.WARNING);
    alert.setTimeout(Alert.FOREVER);
    display.setCurrent(alert);
    Hope it helps
    Regards
    Steve

  • Recordstore share problem

    the same package which is what i think means midlets in the same suite.Hi all..Can smone tell how do i share a recordstore between midlets in the same suite. I created two midlets 1)CreateRecord for storing records. 2)Getdata for retrieving records. i start with CreateRecord and close the record store in it after storing data but didnt delete the recordstore. Then i open the record store with the same name in getdata midlet and get an error exception IllegalAccessException.
    I have included both the midlets in
    Thanks in advance.

    Please be specific what you want to do ..
    --Senthil                                                                                                                                                                                                               

  • Mp3 and RecordStore Capable Emulator

    Currently I'm trying to develop an application that plays back mp3's. I am just wondering if there exists an emulator that can handle both, record sets and mp3 playback.
    WTK22 does a good job of handling recorcStores, but can not handle Mp3 playback.
    I did find a motorola emulator that handled mp3 playback, unfortunately it crashes as soon as I try and load information into the recordStore.
    If anyone knows of one, perhaps they could pass along the name, or even a link.
    Another question I do have about WTK22 is, is there any way of increasing the recordStore size, or is it stuck at 1MB . . . and what is the average size of a record store on a new phone these days?

    I wasn't sure what is RecordStore but apparently it is MIDP's way of persisting data.
    As it shows, I have little knowledge of JavaME, so I don't know if that's a problem with the emulator or the usage of RecordStore within JavaFX or something else.
    Now, perhaps you can use the [javafx.io.Storage|http://java.sun.com/javafx/1.2/docs/api/javafx.io/javafx.io.Storage.html] class for persisting data, it is designed to work both in JavaME and on desktop.
    It might offer less features than RecordStore, though.

  • Having problem with adding and reading dates to/from database !!!

    Hi
    I am new in J2ME
    I am trying to code a simple software.
    My problem is with dates.
    I have a datefield on my menu and the user will choose the date from here. By default, datefield shows todays date. But when I try to write that date to database using rms, date value transforms to java.util.Date@acfdb0fe.
    As I read from tutorials this is common problem of date class, so I tried to use calendar class.
    But with Calendar class I cannot let user to choose date from screen like DateField. datefield dowsn't work with calendar.
    later, I will use that date for sorting records
    Summary : I need a sample code that read date from screen (preferably with datefield), write it to recordstore. and then read it from recordstore asnd write to screen.
    I searching internet for a sample code through days.
    Please help me
    Thanks

    Hi,
    The best i would suggest is instead of storing the date as 19 Jan 2004 or something like this better store the date in milliseconds.
    DateField df = new DateField();
    Date d = df.getDate();
    long ms = d.getTime();
    store the value of ms in RMS. This is the commonly used way to store date in RMS for j2me.
    You can get back date using
    Date d = new Date(ms);
    DateField df = new DateField();
    df.setDate(d);
    Prabhu.

  • About workin with RecordStore

    i have been workin on an application for Palm OS which deals with a lot of database.the application is workin fine and the data also seems to be consistent. however the problem started when i started to work with conduit for tha application. can someone tell me about a better way to manipulate the data stored by the recordstore using java conduit.
    thank u !

    kAWT is built on top of kJava and only works with kJava (I am not sure if anyone has ported it to MIDP). kAWT has nothing to do with databases, it is only for GUI management similar to J2SE AWT. So if you want to use kJava, you can use kAWT for your GUI, but you do not have to. Also, if you use kJava, regaurdless of kAWT, you can use the Palm database - the two are not mutually exclusive.
    Now for MIDP. kAWT, as far as I know, has not been ported to MIDP. MIDP is a replacement for kJava, and it also runs on Cell phones. MIDP is somewhat OK for Palm, but really does not take full advantage of the Palm and the palm native GUI components. On this forum, there is better support for support for MIDP than kJava.
    If you are going to write an application for the Palm and only for the Palm, and it must be in Java, AND you need to take advantage of sophisticated Palm OS features, consider downloading and using IBM's J9 compiler (VAME). It opens up the full Palm OS. However, writing Palm applications is not as easy as MIDP or kJava, and will take longer to learn. The support for J9 is through the IBM VAME newsgroup.
    If your application is simple, and you do not need to use the IR port, serial port, access other databases other than your own, or need to have tight control over the user interface, go with MIDP. Download Forte and the wireless toolkit from Sun and follow the install directions, and read the PDF documents in the /doc directory.
    Also, there are a large number of postings in this forum about using MIDP on Palms and MIDP with the wireless toolkit and Forte. There are also people form Sun who monitor and reply to problems in this forum when they pertain to MIDP. kJava does not have this level of support.
    Once you have picked your development tools, and if you have further problems, lets resolve them one at a time. Post the actual error message as a new topic and people in the forum will take it from there.
    Don

  • Serious problem connecting from handset - Help!!!!!

    Hi all,
    I�ve developed an J2ME App. wich communicates with a remote web site (Tomcat server with Apache & MySQL server). The App. client side consist basically of a MIDlet wich handles the UI navigation & an support class wich do the real work calling the Servlet servicess and passing parameters to it. The Servlet queryes de MySQL DB. and return data to de client wich are showed in lists, forms, etc.
    My system works fine using the java WTK22, accessing the web site via internet but, when I try with my real "Sony Ericsson - K300a", nothig happens (no errors and data = 'null').
    Trying to capture errors, I can see that, when the execution is from the WTK22 the Servlet receives the input parameters and works fine. On the other hand, when I try from de K300a the Server log doen�t show nothig so, I suspect that the problem source is a connection problem.
    I�m not posting code here because the good WTK22 execution but, if somebody need it, I�ll post it also.
    Please, help me with this problem. A real proyect depends on it!!!!
    A lot of thaks in advance.

    Hi printisor,
    1)Finally I installed SonyEricsson emulator and ran my app.. Same problem (app. run fine from emulator but not from handset).
    2)Here I send code related with the connection aspect. Sorry by the length but is the minimun I can paste in order to be clear:
         * loadData:
         *      1)Construct String message depending on a received RecordStore.
         *     2)Obtains Connection & Data from Servlet.
         * NOTE: messages himself are: (public static final int MSJE_...... = 1) + �^�; etc
         public void loadData(RecordStore rStor){          
         //// Here discriminates message value ////
         try{
              String message = null;
              if(rStor == recStorCereales){
         message = CttesMensaje.MSJE_CARGAR_CEREALES + "^";
              } else {if(rStor == recStorAcciones){
                     message = CttesMensaje.MSJE_CARGAR_ACCIONES + "^";
                   } else {if(rStor == recStorTitulos){
                               message = CttesMensaje.MSJE_CARGAR_TITULOS + "^";
                        } else {if(rStor == recStorDivisas){
                                    message = CttesMensaje.MSJE_CARGAR_DIVISAS + "^";
         //// Here obtains Connection & Data     ////
              HttpConnection conn = null;
              DataInputStream in = null;
         String urlServlet = http://www.nasinibursatil.com.ar/rnasini/servlet/ServletNSN";
              conn = open(urlServlet, message);
              in = conn.openDataInputStream();
              String losRegs = in.readUTF();
              close(conn, in);
         } catch (Exception e) {}
         * open(String url, String mensaje) does the real work
         static HttpConnection open(String url, String strMens)
         throws IOException, ExcepcionAplicacion
              HttpConnection conn = open(url); // see the following method
              conn.setRequestMethod(HttpConnection.POST);
              DataOutputStream dos = null;
              strMens = strMens + '\n';
              try {
              dos = conn.openDataOutputStream();
              dos.write(strMens.getBytes());
              } finally {
              if (dos != null) {
                   dos.close();
    /// Reports an error if any ///
         if (conn.getResponseCode() == HttpConnection.HTTP_INTERNAL_ERROR){
         String razon = conn.getHeaderField("Reason-Phrase");
         if (razon == null) {
              razon = "Server Error";
         throw new ExcepcionAplicacion(Integer.parseInt(razon));
         checkCodigoRta(conn);
         return conn;
         * open(String url): open a connection to a URL, using a "Connector",
         * put some properties and returns a HttpConnection Object
         static HttpConnection open(String url)
                   throws IOException {
              HttpConnection conn = (HttpConnection) Connector.open(url);
              conn.setRequestProperty("User-Agent", System.getProperty("microedition.profiles"));
         return conn;
         * Obtains the RC and throws an error if isn�t HTTP_OK(200).
         static void checkCodigoRta(HttpConnection conn) throws IOException {
         int codigo = conn.getResponseCode();
              if (codigo != HttpConnection.HTTP_OK) {
              throw new IOException(codigo + "; " + conn.getResponseMessage());
         *      Close Connection & Streams.
         static void close(HttpConnection conn, InputStream in) {
              try{
                   if (in != null) {
                        in.close();
                   if (conn != null) {
                        conn.close();
              } catch (IOException ioe) {
                   System.out.println("Error: " + ioe);
    3) Going back to your previous questions about my connection modes (wap, http, etc) let me tell you that I�m not sure now wath I�m doing. The mater is that I live in Argentina and there are only three providers here.
    Today I was speaking with a provider representative (from PERSONAL) and he say me that the only mode that the three providers works here is using WAP/GPRS. I cannot beleave it!!!!. If so, It could be a desaster for me(and for J2ME here,also).
    I was searching the forums trying to find this kind of things and really there are a lor of people having problems like this. Some of them were resolved and the sollution was to put some settings in the phone such as "APN Settings" to bypass WAP mode. Now, my questions are:
    �May be it a sollution?
    �Is it possible to do it?
    �Some example?           
    Lot of THANKS.
    BlufsteinEJ.
    [email protected]

  • Problem with displaying a splash screen twice

    I have a splash screen that displays while I am reading data from the recordstore, I use the same sceen when I am writing data back to the record store when the application exits.
    The problem I am having is that the screen never appears the second time, I have tried to set it to null and then instantiate it again but it still does not appear. Can someone please give me some adivse as to why this might be happening. I am pretty sure it is some kind of race condition with the threads but I just cant seem to solve it. I am placing snipits of code below.
    public class NetTools extends MIDlet implements CommandListener
    public void startApp()
    isPaused = false;
    display = Display.getDisplay(this);
    splash = new Splash();
    splash.start();
    settings = new Settings(this);
    settings.start();
    display.setCurrent(splash);
    splash.StartTimer();
    splash.setMsg("Loading Settings...");
    settings.Load();
    splash.setMsg("Loading Main App...");
    splash.Dismiss();
    showMainScreen();
    splash = null;
    public void destroyApp(boolean unconditional)
    display = Display.getDisplay(this);
    splash = new Splash();
    splash.start();
    display.setCurrent(splash);
    splash.setMsg("Saving Settings...");
    //splash.Join();
    //splash.StartTimer();
    settings.Save();
    //splash.Dismiss();
    settings = null;
    splash = null;
    public class Settings implements Runnable
    public void Load()
    try
    thread.yield();
    public void Save()
    try
    thread.yield();
    public class Splash extends Canvas implements Runnable
    public void StartTimer()
    start_time = System.currentTimeMillis();
    repaint();
    serviceRepaints();
    public void Dismiss()
    while ((start_time+WAIT_TIME)>System.currentTimeMillis())
    repaint();
    I cannot seem to figure out how to make the thread for the splash overtake the UI thread in the destroyApp(), does anybody have any ideas.
    Sunny

    A grey box with the splash screen size is displayed.would indicate you have your "application which takes sometime to load" in the
    EDT, which will prevent painting until loading finishes
    use a separate thread to load the data
    http://java.sun.com/docs/books/tutorial/essential/threads/
    http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html
    http://java.sun.com/products/jfc/tsc/articles/threads/threads1.html

  • How to solve this? java.lang.IllegalArgumentException problem

    The midlet compliled successfully..
    Once run,
    I enter 3 different records...
    then after when I 'VIEW' for example I enter recordID: 1..
    by right, all the details about recordId : 1 would be listed out...somehow, this error pops up.
    java.lang.IllegalArgumentException
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.rms.*;
    * @author RyanLCC
    public class cdSeller extends MIDlet implements CommandListener{
    private Display display;
    private Form form;
    private Command add, view, update, delete, exit;
    private TextField rcdId, title, quantity, price, profit, director, publish, actors;
    private RecordStore rs;
    private Alert alert = new Alert("New Data Added !!!");
    private Alert alert1 = new Alert("Database Upated!!!");
    private Alert alert2 = new Alert("Record Deleted!!!");
    private Alert alert3 = new Alert("Looking Data!!!");
    public cdSeller()throws RecordStoreException{
    display = Display.getDisplay(this);
    exit = new Command("Exit", Command.EXIT, 1);
    add = new Command("Add",Command.SCREEN,2);
    update = new Command("Update",Command.SCREEN,2);
    delete = new Command("Delete",Command.SCREEN,2);
    view = new Command("View",Command.SCREEN,2);
    rcdId= new TextField("Record ID :","",5,TextField.NUMERIC);
    title= new TextField("Title :","",11,TextField.ANY);
    quantity= new TextField("Quantity :","",8,TextField.NUMERIC);
    price= new TextField("Retail price :","",8,TextField.ANY);
    profit= new TextField("Profit margin:","",8,TextField.ANY);
    director= new TextField("Director :","",11,TextField.ANY);
    publish= new TextField("Publisher :","",11,TextField.ANY);
    actors= new TextField("Actors :","",11,TextField.ANY);
    rs = RecordStore.openRecordStore("My CD Datbase Directory", true);
    form = new Form("My CD Database");
    form.append(rcdId);
    form.append(title);
    form.append(quantity);
    form.append(price);
    form.append(profit);
    form.append(director);
    form.append(publish);
    form.append(actors);
    form.addCommand(exit);
    form.addCommand(add);
    form.addCommand(update);
    form.addCommand(delete);
    form.addCommand(view);
    form.setCommandListener(this);
    public void startApp() {
    display.setCurrent(form);
    public void pauseApp() {
    public void destroyApp(boolean unconditional) {
    try {
    rs.closeRecordStore();
    } catch (RecordStoreException ex) {
    ex.printStackTrace();
    public void commandAction(Command c, Displayable d) {
    alert.setTimeout(3000);
    alert1.setTimeout(3000);
    String str;
    byte bytes[];
    int recordID;
    try{
    if(c==add){
    str = title.getString()+":"+quantity.getString()+
    ":"+price.getString()+":" +profit.getString()+
    ":"+director.getString()+":"+publish.getString ()+
    ":"+actors.getString();
    bytes=str.getBytes();
    recordID = rs.addRecord(bytes, 0, bytes.length);
    System.out.println("Record of ID:"+recordID+" is added");
    Display.getDisplay(this).setCurrent(alert);
    }else if(c==update){
    recordID = Integer.parseInt(rcdId.getString());
    str = title.getString()+":"+quantity.getString()+
    ":"+price.getString()+":" +profit.getString()+
    ":"+director.getString()+":"+publish.getString ()+
    ":"+actors.getString();
    bytes=str.getBytes();
    rs.setRecord(recordID, bytes, 0, bytes.length);
    Display.getDisplay(this).setCurrent(alert1);
    }else if(c == delete){
    recordID = Integer.parseInt(rcdId.getString());
    rs.deleteRecord(recordID);
    Display.getDisplay(this).setCurrent(alert2);
    }else if(c == view ){
    recordID = Integer.parseInt(rcdId.getString());
    bytes = new byte[rs.getRecordSize(recordID)];
    rs.getRecord(recordID,bytes,0);
    String str1 = new String(bytes);
    int index = str1.indexOf(":");
    title.setString(str1.substring(0));
    quantity.setString(str1.substring(1));
    price.setString(str1.substring(2));
    profit.setString(str1.substring(3));
    director.setString(str1.substring(4));
    publish.setString(str1.substring(5));
    actors.setString(str1.substring(6));
    }else if( c == exit){
    destroyApp(true);
    notifyDestroyed();
    }catch(Exception e){
    e.printStackTrace();
    }

    *To change this template, choose Tools | Templates*
    and open the template in the editor.
    *import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;*
    *import javax.microedition.rms.*;
    *@author RyanLCC*
    public class CdSeller extends MIDlet implements CommandListener{
        private Display display;
        private Form form;
        private Command add, view, update, delete, exit;
        private TextField rcdId, title, quantity, price, profit, director, publish, actors;
        private RecordStore rs;
        private Alert alert = new Alert("New Data Added !!!");
        private Alert alert1 = new Alert("Database Upated!!!");
        private Alert alert2 = new Alert("Record Deleted!!!");
        private Alert alert3 = new Alert("Looking Data!!!");
        public CdSeller()throws RecordStoreException{
        display = Display.getDisplay(this);
        exit = new Command("Exit", Command.EXIT, 1);
        add = new Command("Add",Command.SCREEN,2);
        update = new Command("Update",Command.SCREEN,2);
        delete = new Command("Delete",Command.SCREEN,2);
        view = new Command("View",Command.SCREEN,2);
        rcdId= new TextField("Record ID     :","",5,TextField.NUMERIC);
        title= new TextField("Title         :","",11,TextField.ANY);
        quantity= new TextField("Quantity   :","",8,TextField.ANY);
        price= new TextField("Retail price  :","",8,TextField.ANY);
        profit= new TextField("Profit margin:","",8,TextField.ANY);
        director= new TextField("Director   :","",11,TextField.ANY);
        publish= new TextField("Publisher   :","",11,TextField.ANY);
        actors= new TextField("Actors       :","",11,TextField.ANY);
        rs = RecordStore.openRecordStore("My CD Datbase Directory", true);
        form = new Form("My CD Database");
        form.append(rcdId);
        form.append(title);
        form.append(quantity);
        form.append(price);
        form.append(profit);
        form.append(director);
        form.append(publish);
        form.append(actors);
        form.addCommand(exit);
        form.addCommand(add);
        form.addCommand(update);
        form.addCommand(delete);
        form.addCommand(view);
        form.setCommandListener(this);
        public void startApp() {
            display.setCurrent(form);
        public void pauseApp() {
        public void destroyApp(boolean unconditional) {
            try {
                rs.closeRecordStore();
            } catch (RecordStoreException ex) {
                ex.printStackTrace();
        public void commandAction(Command c, Displayable d) {
            alert.setTimeout(3000);
            alert1.setTimeout(3000);
            String str;
            byte bytes[];
            int recordID;
            try{
                if(c==add){
                    str = title.getString()+":"+quantity.getString()+
                          ":"+price.getString()+":" +profit.getString()+
                          ":"+director.getString()+":"+publish.getString()+
                          ":"+actors.getString();+
    +                bytes=str.getBytes();+
    +                recordID = rs.addRecord(bytes, 0, bytes.length);+
    +                System.out.println("Record of ID:"+recordID+" is added");
                    Display.getDisplay(this).setCurrent(alert);
                }else if(c==update){
                    recordID = Integer.parseInt(rcdId.getString());
                    str = title.getString()+":"+quantity.getString()+
                          ":"+price.getString()+":" +profit.getString()+
                          ":"+director.getString()+":"+publish.getString()+
                          ":"+actors.getString();+
    +                bytes=str.getBytes();+
    +                rs.setRecord(recordID, bytes, 0, bytes.length);+
    +                System.out.println("Record of ID:"+recordID+" is updated");
                    Display.getDisplay(this).setCurrent(alert1);
                }else if(c == delete){
                    recordID = Integer.parseInt(rcdId.getString());
                    rs.deleteRecord(recordID);
                    System.out.println("Record of ID:"+recordID+" is deleted");
                    Display.getDisplay(this).setCurrent(alert2);
                }else if(c == view ){
                    recordID = Integer.parseInt(rcdId.getString());
                    bytes = new byte[rs.getRecordSize(recordID)];
                    rs.getRecord(recordID,bytes,0);
                    String str1 = new String(bytes);
                    int index = str1.indexOf(":");
                    title.setString(str1.substring(0));
                    quantity.setString(str1.substring(1));
                    price.setString(str1.substring(2));
                    profit.setString(str1.substring(3));
                    director.setString(str1.substring(4));
                    publish.setString(str1.substring(5));
                    actors.setString(str1.substring(6));
            }else if( c == exit){
                destroyApp(true);
                notifyDestroyed();
        }catch(Exception e){
            e.printStackTrace();
    Starting emulator in execution mode
    Installing suite from: http://127.0.0.1:59543/RecordStore.jad
    Record of ID:1 is added
    Record of ID:2 is added
    java.lang.IllegalArgumentException
    at javax.microedition.lcdui.TextField.setCharsImpl(), bci=79
    at javax.microedition.lcdui.TextField.setString(), bci=37
    at CdSeller.commandAction(CdSeller.java:120)
    at javax.microedition.lcdui.Display$ChameleonTunnel.callScreenListener(), bci=46
    at com.sun.midp.chameleon.layers.SoftButtonLayer.processCommand(), bci=74
    at com.sun.midp.chameleon.layers.SoftButtonLayer.commandSelected(), bci=11
    at com.sun.midp.chameleon.layers.MenuLayer.pointerInput(), bci=170
    at com.sun.midp.chameleon.CWindow.pointerInput(), bci=76
    at javax.microedition.lcdui.Display$DisplayEventConsumerImpl.handlePointerEvent(), bci=19
    at com.sun.midp.lcdui.DisplayEventListener.process(), bci=296
    at com.sun.midp.events.EventQueue.run(), bci=179
    at java.lang.Thread.run(Thread.java:619)
    javacall_lifecycle_state_changed() lifecycle: event is JAVACALL_LIFECYCLE_MIDLET_SHUTDOWNstatus is JAVACALL_OK
    I had tired to change the quantity= new TextField("Quantity   :","",8,TextField.ANY);+ but still giving me the same problem...
    Here again..Thankx alot..

Maybe you are looking for