Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2003
    Posts
    6

    Exclamation Unanswered: SQLJ tomcat issue..help solicited..

    Hi,
    I am new member to this community,so i may not be in tune with the jargon used here.i apologize for that..!!

    Now,I am trying to make a JSP which few checkboxes and the user needs to "check" in order to show his selection.It is like you opt for some stuff while shopping and leave the rest.Then the java bean related to this page will insert the user selection of checkbox(s) into a table (which has been already created beforehand).for this data-access i am using SQLJ instead of the orthodox JDBC.

    I am using oracle 9i and tomcat 4.1.2. and jdk1.4 in a Windows XP(home)OS.

    so when i complie my SQLJ file(which is also the bean in this case),shows no error.But when i try to view my JSP,then it shows the following error:

    Description erver encountered an internal error that prevented it from fullfilling its request.

    Exception:
    org.apache.jasper.JasperException : sqlj/runtime/ref/ConnectionContextImpl

    and so on....

    Now i have put all the SQLJ jar files (viz classes12.jar,translator.jar etc)into the TOMCAT_HOME/bin/ folder.But still its not working.

    I will be glad if someone can suggest me in this regard as i am in the midst of this ordeal.

    thanx in advance..!!!
    Jyoti.

  2. #2
    Join Date
    Feb 2003
    Location
    United Kingdom
    Posts
    6
    Hi,

    I think you might be putting your .jar files in the wrong place. I have done some development using tomcat before, and usually you have to put any.jar files that your application uses in a WEB-INF directory, which resides in the root directory of the application concext.

    Example:

    Say you have a context /chris (http://localhost:8081/chris) which resides at /home/chris/public_html

    You would need to put all .jar files used by any applications in that context in /home/chris/public_html/WEB-INF/ rather than in $TOMCAT_HOME/bin

    Hope this helps,

    Chris

  3. #3
    Join Date
    Mar 2003
    Posts
    6
    hi chris,

    thanx a lot for ur reply.
    i guess i figured that problem.i shud put the SQLJ library in the ~tomcat_home/common/lib folder.i was doing some thing wrong.

    but now i am getting another exception.can u help me with this??i guess it says something with the null pointer exception with the java bean.

    here are the files:

    BEAN FILE :

    /*@lineinfo:filename=ontologyBean*//*@lineinfo:user-code*//*@lineinfo:1^1*/package indusBeans;

    import java.io.*;
    import java.lang.*;
    import java.util.*;
    import java.sql.*;
    import oracle.sqlj.runtime.Oracle;
    import sqlj.runtime.ref.DefaultContext;

    public class ontologyBean
    {
    //submit button pressed will result in "yes"
    private String submit = null;
    //name of the ontology
    private String [] name = null;
    //id of the ontology
    private String [] id = null;
    //database connection context
    private DefaultContext dctx = null;


    //contents of the ontology name
    private ArrayList nameList = new ArrayList();
    //contents of the ontology id
    private ArrayList idList = new ArrayList();


    //constructor
    public ontologyBean()
    { }


    //method to set the submit variable

    public synchronized void setSubmit(String mySubmit)
    {
    submit = mySubmit;

    }


    //method to enter ontology names in an array list

    public synchronized void setName(String[] myName)
    {
    if (myName != null)
    {
    for(int i=0;i<myName.length;i++)
    {
    if((submit.startsWith("Submit")))
    {
    nameList.add(myName[i]);
    }
    }

    }//end of if

    }//end of setName

    //method to enter ontoloy id in an array list

    public synchronized void setId(String[] myId)
    {
    if(myId!=null)
    {
    for(int i=0;i<myId.length;i++)
    {
    if((submit.startsWith("Submit")))
    {
    idList.add(myId[i]);
    }
    }

    }
    }//end of setId


    //method for invoking other methods to perform database inserts

    public synchronized void insertData()
    {
    Insert(nameList,idList);
    }//end


    //mehtod to initialize database inserts

    public synchronized void Insert(ArrayList nameList,ArrayList idList)
    {
    if((nameList == null) || (idList == null))
    {
    try
    {
    //connect to the database

    String dbName = "jdbc racle:thin:@localhost:1521 rcl";
    String user = "indus";
    String password = "indus";

    dctx = Oracle.getConnection(dbName,user,password);

    DBInsert(nameList,idList);//call method for insert into database


    }//end of try
    catch (Exception e)
    {
    System.out.println("some error..!!!");
    }

    finally
    {
    try
    {
    dctx.close();//close the database connection
    }
    catch (Exception e) {}
    }//end of finally

    }

    }


    //actual database insert

    private void DBInsert(ArrayList nameList,ArrayList idList) throws SQLException
    {

    //insert each record into the table "ontologies"

    for(int i=0;i<nameList.size();i++)
    {
    /*@lineinfo:generated-code*//*@lineinfo:135^4*/

    // ************************************************** **********
    // #sql [dctx] { INSERT INTO
    // ONTOLOGIES(id,name)
    // VALUES(:idList.get(i),:nameList.get(i))
    //
    // };
    // ************************************************** **********

    {
    // declare temps
    oracle.jdbc.OraclePreparedStatement __sJT_st = null;
    sqlj.runtime.ref.DefaultContext __sJT_cc = dctx; if (__sJT_cc==null) sqlj.runtime.error.RuntimeRefErrors.raise_NULL_CON N_CTX();
    sqlj.runtime.ExecutionContext.OracleContext __sJT_ec = ((__sJT_cc.getExecutionContext()==null) ? sqlj.runtime.ExecutionContext.raiseNullExecCtx() : __sJT_cc.getExecutionContext().getOracleContext()) ;
    Object __sJT_0 = idList.get(i);
    Object __sJT_1 = nameList.get(i);
    __sJT_st = __sJT_ec.prepareOracleBatchableStatement(__sJT_cc, "0indusBeans.ontologyBean","INSERT INTO\n\t\t\t\t\tONTOLOGIES(id,name)\n\t\t\t\tVALUE S( :1 , :2 )");
    // set IN parameters
    __sJT_st.setObject(1,__sJT_0);
    __sJT_st.setObject(2,__sJT_1);
    // execute statement
    __sJT_ec.oracleExecuteBatchableUpdate();
    }


    // ************************************************** **********

    /*@lineinfo:user-code*//*@lineinfo:141^4*/ //end of #sql


    //commit the insertion
    /*@lineinfo:generated-code*//*@lineinfo:145^4*/

    // ************************************************** **********
    // #sql [dctx] { COMMIT
    // };
    // ************************************************** **********

    ((dctx.getExecutionContext()==null) ? sqlj.runtime.ExecutionContext.raiseNullExecCtx() : dctx.getExecutionContext().getOracleContext()).ora cleCommit(dctx);


    // ************************************************** **********

    /*@lineinfo:user-code*//*@lineinfo:148^4*/


    }//end of for loop

    }//end of DBInsert



    }/*@lineinfo:generated-code*/


    ERROR OUTPUT:


    Apache Tomcat/4.1.12 - Error reportHTTP Status 500 -

    type Exception report
    message
    description The server encountered an internal error () that prevented it from
    fulfilling this request.
    exception
    org.apache.jasper.JasperException
    at org.apache.jasper.runtime.JspRuntimeLibrary.intern alIntrospecthelper(JspRuntimeLibrary.java:274)
    at org.apache.jasper.runtime.JspRuntimeLibrary.intros pecthelper(JspRuntimeLibrary.java:220)
    at org.apache.jasper.runtime.JspRuntimeLibrary.intros pect(JspRuntimeLibrary.java:198)
    at org.apache.jsp.ontology_jsp._jspService(ontology_j sp.java:70)
    at org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:136)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:853)
    at org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:204)
    at org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:289)
    at org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:240)
    org.apache.catalina.core.StandardPipeline$Standard PipelineValveContexat.invokeNext(StandardPipeline. java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:995)
    at org.apache.catalina.core.StandardContext.invoke(St andardContext.java:2396)
    at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:180)
    at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:643)
    at org.apache.catalina.valves.ErrorDispatcherValve.in voke(ErrorDispatcherValve.java:170)
    at at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:995)
    at org.apache.coyote.tomcat4.CoyoteAdapter.service(Co yoteAdapter.java:223)
    at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:405)
    at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.processConnection(Http11Protocol.jav a:380)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(P oolTcpEndpoint.java:508)
    at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:533)
    at java.lang.Thread.run(Thread.java:536)
    root cause
    java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke
    at org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:240)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:853)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:260)
    at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:643)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:995)
    at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:643)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:995)
    at org.apache.catalina.core.StandardContext.invoke(St andardContext.java:2396)
    at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:180)
    at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:643)
    at org.apache.catalina.valves.ErrorDispatcherValve.in voke(ErrorDispatcherValve.java:170)
    at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:641)
    at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:172)
    at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:641)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:995)
    at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:174)
    at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:643)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:995)
    at org.apache.coyote.tomcat4.CoyoteAdapter.service(Co yoteAdapter.java:223)
    at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:405)
    at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.processConnection(Http11Protocol.jav a:380)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(P oolTcpEndpoint.java:508)
    at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:533)
    at java.lang.Thread.run(Thread.java:536)
    Caused by: java.lang.NullPointerException
    at indusBeans.ontologyBean.setName(ontologyBean.java: 50)
    ... 43 more

    Apache Tomcat/4.1.12

    help??

    jyoti.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •