Dr. watson Error In My ejbProgram

Discussions

EJB programming & troubleshooting: Dr. watson Error In My ejbProgram

  1. Dr. watson Error In My ejbProgram (6 messages)

    Hi everyone
    i am new to in Ejb field.
    i am getting an error(Dr. watson Error) in my code
    code is --->
    public void storeRow()throws SQLException
    {
     log("Store Row");
     String upStr="update Pages set sPageTitle =?,sPageCustomText=?, iNavBarNum=? , iNavBarPriority=?, sUrl=?,iEditable=? , iDeleteable =?, dPageModDate=? ,iPageStatus =? where iPageID= ?";
     PreparedStatement ps=con.prepareStatement(upStr);
     log("a con.ps");
     ps.setString(1,pageTitle);
     ps.setString(2,pageText);
     ps.setByte(3,navBarNum);
     ps.setByte(4,navBarPriority);
     ps.setString(5,url);
     ps.setByte(6,editable);
     ps.setByte(7, deleteable );
     ps.setTimestamp(8,pageModDate );
     ps.setByte(9,pageStatus);
     ps.setInt(10,this.Id);
     log("exe..ing ps.eup()");
     int r =ps.executeUpdate();
     log("a ps.eup()");

     if(ps!=null) ps.close();
     if(con!=null)con.close();
     if (r==0)
     throw new EJBException("Store Failed ");
    }
    I AM making connection thru a function getConnection
    and calling this getConnection in setEntityContext method
    I am closing connection in unsetEntitycontext
    No prob's in ejbcreate and ejbload
    can anyone help me to solve this problem
    thanx
    rajeev raj

    Threaded Messages (6)

  2. Dr. watson Error In My ejbProgram[ Go to top ]

    Hi: Rajeev. Being a Java developer you can(almost) not do anything that can cause you a Watson error, unless you are writing some JNI. So it has nothing to do with EJB. What kind of os(95, 98, NT, 2000), version of JDK and jdbc driver you are using. I bet either your JDK has some bug or your JDBC driver is crapping out on you.

    Thanks,
    RJ.
  3. Dr. watson Error In My ejbProgram[ Go to top ]

    Hi Rashid,
    thanx for reply
    i am using jdk1.3,jdbc.odbc.driver and Win NT as OS
    i think My Program is going outside of JVM Domain.
    that is why it is giving an Error(Dr. Watson) of NT.
    I don't think this is an Error of jdk or os.
    i think the way i am using Connection is not Correct.
    B'coz i am Creating Connection In setEntityCobntext.
    and Closing it in unsetEntityContext.In between I am using this Connection in various Module(functions).
    Can anyone Suggest Me that which is better way.
    (1)opening connection in each Function and after performing
       database Operation close this in function itself .(prob with this approach is if there are 50 function then i've to create 50 connection that'll take time)
    2)create only one connection and use it thru out the progarm
    (it'll take less time )
    bye
    rajeev


       
  4. Dr. watson Error In My ejbProgram[ Go to top ]

    Hi Rajeev,

    I think there is no flaw in your code. The reson for
    Dr. watson Error that you must be installed multile JVM's in your machine, so to avoid this problem
    start your weblogic server from command prompt using
    startWebLogic.cmd if you are using windows as OS or startWebLogic.sh for UNIX. This file is stored in your weblogic root folder. e.g. d:\weblogic\startWebLogic.cmd.

    Make proper changes in you startWebLogic.cmd file (e.g set JAVA_HOME=c:\jdk1.2) and then start server using this file. I am sure you will not get Dr. Watson Error.

    If still you have any problems please contact me.

    Cheers!!!
    sanjay_rathod at hotmail dot com
  5. Dr. watson Error In My ejbProgram[ Go to top ]

    Hi Rajeev,
       Please check out this article...

       https://theserverside.com/discussion/thread.jsp?thread_id=1990#6131

    thanks...hasan
    (ahamed at aztec dot soft dot net)
  6. Dr. watson Error In My ejbProgram[ Go to top ]

    Hi Rajeev
    I would like to make a few comments:
    1) You are getting the Dr Watson, probably, because of the jdbc odbc driver you are using. When using this driver the jdbc part hands over control (probably through JNI) to the ODBC driver. Since the ODBC driver in written in non-Java language (probably C), it is the culprit. One way to check it out is to write/run the same query using C/C++ and ODBC.

    2) It is a bad practice to get connections in the setEntityContext. As you know, entity beans (and stateless session beans are pooled). Therefore (beans which are in pool) are not doing real work, but, in this case, still holding the precious database connection. It is better to get a connection from the connection pool and return the connection after work has been finished.

    3) All the database related work (Select/Update) should be done only in ejbLoad/ejbStore. In your case, you should be manipulating only the instance variables of the class. Any changes to these instance variables are going to be reflected in the database once your ejbStore is called.

    Hope that helps.

    regards
    milind
    (milind_d at yahoo dot com)
  7. Well I have only one thing to say which we did like, in the connection we had not closed the Resultset during our CORBA implementaion and therefore it was killing our server with the Dr.Watson. In case you are having the resultset, try to close it.

    otherwise the reason can be multiple VM's in the same machine which i also encounter at times when i run my application.Nothing wrong with the code.JSWDK-1.0.1 server is also the same.Also I prefer you use the command prompt to start the server and try to stop the server when not in use.


    Prasath