Error in CMP ORA-00928: missing SELECT keyword - Weblogic

This is a discussion on Error in CMP ORA-00928: missing SELECT keyword - Weblogic ; Hi, I am using WLS 8.1 and with CMP trying to insert records in oracle 8.1. But I am getting error as below. I hv not defined and finder method in the home interface except the default findByPrimaryKey(). javax.transaction.TransactionRolledbackException: EJB ...

+ Reply to Thread
Results 1 to 10 of 10

Thread: Error in CMP ORA-00928: missing SELECT keyword

  1. Error in CMP ORA-00928: missing SELECT keyword


    Hi,

    I am using WLS 8.1 and with CMP trying to insert records in oracle 8.1.

    But I am getting error as below.

    I hv not defined and finder method in the home interface except the default findByPrimaryKey().

    javax.transaction.TransactionRolledbackException: EJB Exception: : java.sql.SQLE
    xception: ORA-00928: missing SELECT keyword

    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBE rror.java:134)
    at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:2 89)
    at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:579)
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol .java:1894)
    at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TT C7Protocol.java:109
    4)
    at oracle.jdbc.driver.OracleStatement.executeNonQuery (OracleStatement.ja
    va:2132)
    at oracle.jdbc.driver.OracleStatement.doExecuteOther( OracleStatement.jav
    a:2015)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTi meout(OracleStateme
    nt.java:2877)
    at oracle.jdbc.driver.OraclePreparedStatement.execute Update(OraclePrepar
    edStatement.java:608)
    at weblogic.jdbc.wrapper.PreparedStatement.executeUpd ate(PreparedStateme
    nt.java:95)
    at weblogic.ejb20.manager.BaseEntityManager.executeIn sertStmt(BaseEntity
    Manager.java:546)
    at weblogic.ejb20.manager.BaseEntityManager.executeDB Operations(BaseEnti
    tyManager.java:435)
    at weblogic.ejb20.internal.TxManager$TxListener.execu teDBOperations(TxMa
    nager.java:596)
    at weblogic.ejb20.internal.TxManager$TxListener.execu teDBOperationsDrive
    r(TxManager.java:571)
    at weblogic.ejb20.internal.TxManager$TxListener.befor eCompletion(TxManag
    er.java:731)
    at weblogic.transaction.internal.ServerSCInfo.callBef oreCompletions(Serv
    erSCInfo.java:1010)
    at weblogic.transaction.internal.ServerSCInfo.startPr ePrepareAndChain(Se
    rverSCInfo.java:115)
    at weblogic.transaction.internal.ServerTransactionImp l.localPrePrepareAn
    dChain(ServerTransactionImpl.java:1142)
    at weblogic.transaction.internal.ServerTransactionImp l.globalPrePrepare(
    ServerTransactionImpl.java:1868)
    at weblogic.transaction.internal.ServerTransactionImp l.internalCommit(Se
    rverTransactionImpl.java:250)
    at weblogic.transaction.internal.ServerTransactionImp l.commit(ServerTran
    sactionImpl.java:221)
    at weblogic.ejb20.internal.BaseEJBHome.postHomeInvoke (BaseEJBHome.java:3
    93)
    at weblogic.ejb20.internal.EntityEJBHome.create(Entit yEJBHome.java:268)
    at gateway.GatewayUpdate_f6dwyt_HomeImpl.create(Gatew ayUpdate_f6dwyt_Hom
    eImpl.java:84)
    at gateway.LogBean.msg_update(LogBean.java:137)
    at gateway.LogBean.onMessage(LogBean.java:57)
    at weblogic.ejb20.internal.MDListener.execute(MDListe ner.java:382)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThrea d.java:197)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.ja va:170)

    In a nushell I am not using any finder methods in my client program.Still I am
    getting this error.

    Pl.advise.

    Regards,

    Ram


  2. Re: Error in CMP ORA-00928: missing SELECT keyword


    To begin diagnosing this, I think it's necessary to start by see exactly what:


    gateway.LogBean.msg_update(LogBean.java:137) at

    is trying to do.

    -thorick



  3. Re: Error in CMP ORA-00928: missing SELECT keyword


    Hi,

    LogBean is an MDB and in that from onMessage() I am calling another method msg_update().From
    this method I am calling CMP bean.Here only the error comes.

    The code snippet is :

    public void msg_update(String uname,String msgid,String msg,String org,String
    mno,String status)
    {
    try
    {
    System.out.println("Inside msg_update method --->");
    InitialContext ctx1 = null;
    Hashtable props1 = new Hashtable();
    props1.put(Context.INITIAL_CONTEXT_FACTORY,
    "weblogic.jndi.WLInitialContextFactory");
    props1.put(Context.PROVIDER_URL, "t3://localhost:7001");
    ctx1 = new InitialContext(props1);


    Msg_Update_Home home1 = (Msg_Update_Home) javax.rmi.PortableRemoteObject.narrow(ctx1.lookup("RemoteMsg_Update_Home"),
    Msg_Update_Home.class);
    Msg_Update hello1 = home1.create(uname,msgid,msg,org,mno,status);
    hello1.remove();
    }
    catch(javax.naming.NamingException ne)
    {
    System.out.println("Error 1 here --> "+ne);
    ne.printStackTrace();
    }
    catch{}
    catch{}

    Pl.advise.

    Regards,

    Ram


    "thorick" wrote:
    >
    >To begin diagnosing this, I think it's necessary to start by see exactly
    >what:
    >
    >
    >gateway.LogBean.msg_update(LogBean.java:137) at
    >
    >is trying to do.
    >
    >-thorick
    >
    >



  4. Re: Error in CMP ORA-00928: missing SELECT keyword


    Hi,

    Before digging any deeper, I just want to verify that
    what this method is doing is creating bean and then immediately removing
    the bean. So the net effect is that by the end of this block,
    there is no bean, is that correct ?

    -thorick


  5. Re: Error in CMP ORA-00928: missing SELECT keyword


    Hi,

    Yes.Using this method I am inserting the record in the oracle database.

    The CMP bean is used for this.

    Regards,

    Ram



    "thorick" wrote:
    >
    >Hi,
    >
    >Before digging any deeper, I just want to verify that
    >what this method is doing is creating bean and then immediately removing
    >the bean. So the net effect is that by the end of this block,
    >there is no bean, is that correct ?
    >
    >-thorick
    >



  6. Re: Error in CMP ORA-00928: missing SELECT keyword


    Hi,

    I guess that's what I don't understand. When this method completes
    successfully, there will be *no* record in the database.
    Is this what you intend ?

    -thorick



  7. Re: Error in CMP ORA-00928: missing SELECT keyword


    Hi,

    to make it more clear,I am showing below my MDB code (Logbean.java) from whose
    onMessage() I am calling one SLSB and CMP.

    package gateway;

    import javax.ejb.*;
    import javax.jms.*;
    import java.rmi.RemoteException;
    import java.util.Collection;
    import java.util.Hashtable;
    import java.util.Iterator;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.rmi.PortableRemoteObject;
    import gateway.Gateway_UC_Home;
    import gateway.Msg_Update_Home;
    import gateway.Msg_Update;


    public class LogBean implements MessageDrivenBean, MessageListener {

    protected MessageDrivenContext ctx;
    Msg_Update_Home home1 ;

    /**
    * Associates this Bean instance with a particular context.
    */
    public void setMessageDrivenContext(MessageDrivenContext ctx) {
    this.ctx = ctx;
    }

    /**
    * Initializes the bean
    */
    public void ejbCreate() {
    System.err.println("ejbCreate()");
    }

    /**
    * Our one business method
    */
    public void onMessage(Message msg) {

    TextMessage tm = (TextMessage) msg;

    try {
    String text = tm.getText();
    System.err.println("Received new message : " + text);
    }
    catch(JMSException e)
    {
    e.printStackTrace();
    }
    //call session bean -- to validate user details
    String ur = user_check("RAM","RAM");
    if(ur.equals("YES"))
    {
    msg_update("RAM","1001","test msg from ram","TRINITY","919884098458","FALSE");
    }

    //call CMP bean -- to store message details
    }

    public String user_check(String uname,String pwd)
    {
    String output="";
    try
    {

    System.out.println("Inside user_check method --->");
    InitialContext ctx = null;
    Hashtable props = new Hashtable();
    props.put(Context.INITIAL_CONTEXT_FACTORY,
    "weblogic.jndi.WLInitialContextFactory");
    props.put(Context.PROVIDER_URL, "t3://localhost:7001");
    ctx = new InitialContext(props);
    Gateway_UC_Home home = (Gateway_UC_Home) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("Gateway_UC_Home"),
    Gateway_UC_Home.class);
    Gateway_UC hello = home.create();
    String fin = hello.user_check(uname,pwd);
    System.out.println("Fin is --->"+fin);
    output=fin;
    hello.remove();
    }
    catch(javax.naming.NamingException ne)
    {
    System.out.println(ne);
    ne.printStackTrace();
    output="ERROR";
    }
    catch(java.rmi.RemoteException re)
    {
    System.out.println(re);
    re.printStackTrace();
    output="ERROR";
    }
    catch(javax.ejb.CreateException ce)
    {
    System.out.println(ce); ce.printStackTrace();
    output="ERROR";
    }
    catch(javax.ejb.RemoveException rem)
    {
    System.out.println(rem); rem.printStackTrace();
    output="ERROR";
    }
    return output;

    }

    public void msg_update(String uname,String msgid,String msg,String org,String
    mno,String status)
    {
    System.out.println("Inside msg_update method --->");
    try
    {
    home1 = lookupHome();
    }
    catch(Exception e)
    {
    System.out.println("Error 1 is here --> "+e);
    }
    Msg_Update mu;
    try
    {
    mu = createRec(uname,msgid,msg,org,mno,status);
    }
    catch(Exception e)
    {
    System.out.println("Error 2 is here --> "+e);
    }

    }

    /**
    * Create a new record with the given values
    */
    private Msg_Update createRec(String uname,String msgid,String msg,String org,String
    mno,String status)
    throws CreateException, RemoteException
    {
    Msg_Update mu = (Msg_Update)PortableRemoteObject.narrow(home1.crea te(uname,msgid,msg,org,mno,status),Msg_Update.clas s);

    System.out.println("Msg_Update successfully created");

    return mu;
    }

    /**
    * Look up the bean's home interface using JNDI.
    */
    public Msg_Update_Home lookupHome()
    throws NamingException
    {
    Context ctx = getInitialContext();

    try {
    Object home1 = (Msg_Update_Home) ctx.lookup("RemoteMsg_Update_Home");
    return (Msg_Update_Home) PortableRemoteObject.narrow(home1, Msg_Update_Home.class);

    }
    catch (NamingException ne)
    {
    System.out.println("The client was unable to lookup the EJBHome. Please
    make sure " +
    "that you have deployed the ejb with the JNDI name ");
    throw ne;
    }
    }

    /**
    * Get an initial context into the JNDI tree.
    */
    private Context getInitialContext() throws NamingException
    {

    try
    {
    InitialContext ctx1 = null;
    Hashtable props1 = new Hashtable();
    props1.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
    props1.put(Context.PROVIDER_URL, "t3://localhost:7001");
    ctx1 = new InitialContext(props1);
    return ctx1;
    }
    catch (NamingException ne)
    {
    System.out.println("We were unable to get a connection to the WebLogic server");
    System.out.println("Please make sure that the server is running.");
    throw ne;
    }
    }

    /**
    * Destroys the bean
    */
    public void ejbRemove() {
    System.err.println("ejbRemove()");
    }
    }

    Actually I hv to persist the information in the database.

    My Home interface for CMP looks like this,

    package gateway;

    import javax.ejb.*;
    import java.rmi.RemoteException;
    import java.util.Collection;

    public interface Msg_Update_Home extends EJBHome
    {

    Msg_Update create(String uname,String msgid,String msg,String org,String mno,String
    status) throws RemoteException,CreateException;

    public Msg_Update findByMsgid(String msgid) throws FinderException,CreateException,java.rmi.RemoteExc eption;

    public Msg_Update findByPrimaryKey(String key) throws javax.ejb.FinderException,java.rmi.RemoteException ;


    }

    Regards,

    Ram



    "thorick" wrote:
    >
    >Hi,
    >
    >I guess that's what I don't understand. When this method completes
    >successfully, there will be *no* record in the database.
    >Is this what you intend ?
    >
    >-thorick
    >
    >



  8. Re: Error in CMP ORA-00928: missing SELECT keyword


    Hi,

    OK, it now would be good to see what the SQL is that is being rejected.
    If you could boot the server with the flag:

    -Dweblogic.Debug=weblogic.JDBCSQL

    This will display all the SQL that is going through the server's JDBC layer.
    Isolate the SQL that causing the problem, it should help to see further what's
    happening here.

    -thorick


  9. Re: Error in CMP ORA-00928: missing SELECT keyword


    Hi,

    I tried it like this.

    startWebLogic -Dweblogic.Debug=weblogic.JDBCSQL

    It gives the same output as it was giving earlier.

    Error 2 is here --> javax.transaction.TransactionRolledbackException: EJB Exception:
    : java.sql.SQLException: ORA-00928: missing SELECT keyword

    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBE rror.java:134)
    at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:2 89)
    at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:579)
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol .java:1894)
    at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TT C7Protocol.java:1094)
    at oracle.jdbc.driver.OracleStatement.executeNonQuery (OracleStatement.java:2132)
    at oracle.jdbc.driver.OracleStatement.doExecuteOther( OracleStatement.java:2015)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTi meout(OracleStatement.java:2877)
    at oracle.jdbc.driver.OraclePreparedStatement.execute Update(OraclePreparedStatement.java:608)
    at weblogic.jdbc.wrapper.PreparedStatement.executeUpd ate(PreparedStatement.java:95)
    at weblogic.ejb20.manager.BaseEntityManager.executeIn sertStmt(BaseEntityManager.java:546)
    at weblogic.ejb20.manager.BaseEntityManager.executeDB Operations(BaseEntityManager.java:435)
    at weblogic.ejb20.internal.TxManager$TxListener.execu teDBOperations(TxManager.java:596)
    at weblogic.ejb20.internal.TxManager$TxListener.execu teDBOperationsDriver(TxManager.java:571)
    at weblogic.ejb20.internal.TxManager$TxListener.befor eCompletion(TxManager.java:731)
    at weblogic.transaction.internal.ServerSCInfo.callBef oreCompletions(ServerSCInfo.java:1010)
    at weblogic.transaction.internal.ServerSCInfo.startPr ePrepareAndChain(ServerSCInfo.java:115)
    at weblogic.transaction.internal.ServerTransactionImp l.localPrePrepareAndChain(ServerTransactionImpl.ja va:1142)
    at weblogic.transaction.internal.ServerTransactionImp l.globalPrePrepare(ServerTransactionImpl.java:1868 )
    at weblogic.transaction.internal.ServerTransactionImp l.internalCommit(ServerTransactionImpl.java:250)
    at weblogic.transaction.internal.ServerTransactionImp l.commit(ServerTransactionImpl.java:221)
    at weblogic.ejb20.internal.BaseEJBHome.postHomeInvoke (BaseEJBHome.java:393)
    at weblogic.ejb20.internal.EntityEJBHome.create(Entit yEJBHome.java:268)
    at gateway.GatewayUpdate_f6dwyt_HomeImpl.create(Gatew ayUpdate_f6dwyt_HomeImpl.java:85)
    at gateway.LogBean.createRec(LogBean.java:195)
    at gateway.LogBean.msg_update(LogBean.java:132)
    at gateway.LogBean.onMessage(LogBean.java:58)
    at weblogic.ejb20.internal.MDListener.execute(MDListe ner.java:382)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThrea d.java:197)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.ja va:170)
    --------------- nested within: ------------------

    Ram


    "thorick" wrote:
    >
    >Hi,
    >
    >OK, it now would be good to see what the SQL is that is being rejected.
    >If you could boot the server with the flag:
    >
    >-Dweblogic.Debug=weblogic.JDBCSQL
    >
    >This will display all the SQL that is going through the server's JDBC
    >layer.
    >Isolate the SQL that causing the problem, it should help to see further
    >what's
    >happening here.
    >
    >-thorick
    >



  10. Re: Error in CMP ORA-00928: missing SELECT keyword


    Hi,

    I have resolved the issue.

    By mistake I have given oracle default name as one of my field,which I subsequently
    changed.

    Thank you for your continuous help.

    Regards,

    Ram



    "Ram" wrote:
    >
    >Hi,
    >
    >I tried it like this.
    >
    >startWebLogic -Dweblogic.Debug=weblogic.JDBCSQL
    >
    >It gives the same output as it was giving earlier.
    >
    >Error 2 is here --> javax.transaction.TransactionRolledbackException:
    >EJB Exception:
    >: java.sql.SQLException: ORA-00928: missing SELECT keyword
    >
    > at oracle.jdbc.dbaccess.DBError.throwSqlException(DBE rror.java:134)
    > at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:2 89)
    > at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:579)
    > at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol .java:1894)
    > at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TT C7Protocol.java:1094)
    > at oracle.jdbc.driver.OracleStatement.executeNonQuery (OracleStatement.java:2132)
    > at oracle.jdbc.driver.OracleStatement.doExecuteOther( OracleStatement.java:2015)
    > at oracle.jdbc.driver.OracleStatement.doExecuteWithTi meout(OracleStatement.java:2877)
    > at oracle.jdbc.driver.OraclePreparedStatement.execute Update(OraclePreparedStatement.java:608)
    > at weblogic.jdbc.wrapper.PreparedStatement.executeUpd ate(PreparedStatement.java:95)
    > at weblogic.ejb20.manager.BaseEntityManager.executeIn sertStmt(BaseEntityManager.java:546)
    > at weblogic.ejb20.manager.BaseEntityManager.executeDB Operations(BaseEntityManager.java:435)
    > at weblogic.ejb20.internal.TxManager$TxListener.execu teDBOperations(TxManager.java:596)
    > at weblogic.ejb20.internal.TxManager$TxListener.execu teDBOperationsDriver(TxManager.java:571)
    > at weblogic.ejb20.internal.TxManager$TxListener.befor eCompletion(TxManager.java:731)
    > at weblogic.transaction.internal.ServerSCInfo.callBef oreCompletions(ServerSCInfo.java:1010)
    > at weblogic.transaction.internal.ServerSCInfo.startPr ePrepareAndChain(ServerSCInfo.java:115)
    > at weblogic.transaction.internal.ServerTransactionImp l.localPrePrepareAndChain(ServerTransactionImpl.ja va:1142)
    > at weblogic.transaction.internal.ServerTransactionImp l.globalPrePrepare(ServerTransactionImpl.java:1868 )
    > at weblogic.transaction.internal.ServerTransactionImp l.internalCommit(ServerTransactionImpl.java:250)
    > at weblogic.transaction.internal.ServerTransactionImp l.commit(ServerTransactionImpl.java:221)
    > at weblogic.ejb20.internal.BaseEJBHome.postHomeInvoke (BaseEJBHome.java:393)
    > at weblogic.ejb20.internal.EntityEJBHome.create(Entit yEJBHome.java:268)
    > at gateway.GatewayUpdate_f6dwyt_HomeImpl.create(Gatew ayUpdate_f6dwyt_HomeImpl.java:85)
    > at gateway.LogBean.createRec(LogBean.java:195)
    > at gateway.LogBean.msg_update(LogBean.java:132)
    > at gateway.LogBean.onMessage(LogBean.java:58)
    > at weblogic.ejb20.internal.MDListener.execute(MDListe ner.java:382)
    > at weblogic.kernel.ExecuteThread.execute(ExecuteThrea d.java:197)
    > at weblogic.kernel.ExecuteThread.run(ExecuteThread.ja va:170)
    >--------------- nested within: ------------------
    >
    >Ram
    >
    >
    >"thorick" wrote:
    >>
    >>Hi,
    >>
    >>OK, it now would be good to see what the SQL is that is being rejected.
    >>If you could boot the server with the flag:
    >>
    >>-Dweblogic.Debug=weblogic.JDBCSQL
    >>
    >>This will display all the SQL that is going through the server's JDBC
    >>layer.
    >>Isolate the SQL that causing the problem, it should help to see further
    >>what's
    >>happening here.
    >>
    >>-thorick
    >>

    >



+ Reply to Thread