db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rankin Johnson" <rjohn...@jwortham.com>
Subject BasePeer.MapBuilder: ClassNotFoundException under Tomcat 5.0
Date Mon, 09 Aug 2004 21:53:03 GMT
Using Torque 3.1 I've generated the om & sql, and can connect from the ant script to a
remote Interbase server.
However when I try to create a simple jsp to insert a row, I get the above error.  The classes
are in the correct location, as far as I can see.  (I've modified the code below slightly
to shorten it, but it loads another class from the same classes hierarchy.)  The same jsp
page establishes an initial context, gets a JNDI reference and reads a table from the database
- all sucessfully.  Next, I init Torque - that works. Next I try to create an object, set
an attribute, & save it - that work up to the save.

The ClassLoader would have to be the default tomcat loader, so I can't see why it wouldn't
be able to find the class.  Suggestions?

The Jsp pg:

<%@ page import="java.sql.*, java.text.*,   org.apache.log4j.*,  
                 com.jwortham.ocip.*,
                com.jwortham.ocip.map.*,
                org.apache.log4j.*,
                javax.sql.DataSource,
                java.sql.Connection,
                java.sql.Statement,
                java.sql.ResultSet,
                java.sql.SQLException,
                org.apache.torque.Torque,
                org.apache.torque.map.*,
                org.apache.torque.util.Criteria,
                javax.naming.*"
%>
<%@ page session="true" %>
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<%!  // class variables
   String me = "output.jsp";
  Connection con = null;
  String query = " select * from CUSTOMER where CUSTOMER=\"003571\" ";
  ResultSet rst;
  Statement stmt;
  String[] colNames;
  String na1 = "init";
%>
<%!  public void log(String txt){System.out.println(txt);}
%>
<% 
  log(me + ":Start");
  String progress ="none";
  Logger log = cns.log;
  Context ctx = null;
  DataSource ds;
  Connection con2 = null;

  // be sure driver is loaded - probably unnessary here
  try {
     Class.forName("interbase.interclient.Driver");
  } catch (ClassNotFoundException e0) {
      e0.printStackTrace();
  }
  // next try to get jndi data connection
  try{
     Context iCtx = new InitialContext();
     if(iCtx == null ) throw new Exception("Boom - No Context");
     else log( "got an initial context!");
     ctx = (Context) iCtx.lookup("java:/comp/env");
     if(ctx == null )
          throw new Exception("Boom - No Environmental Context");
      else
          log("got an environmental context!");
      ds = (DataSource)ctx.lookup("jdbc/ConPool");
      if (ds != null) {
	log("got new DataSource");
        ((org.apache.commons.dbcp.BasicDataSource) ds).setUsername("SYSDBA");
	((org.apache.commons.dbcp.BasicDataSource)ds).setPassword("jlwcib");
        con = ds.getConnection();
        if(null != con) log(me+" got good connection");
        else log.info(me + " failed to get connection");
	stmt = con.createStatement();
	rst = stmt.executeQuery(query);
	log(me+": executed query ");
        if(rst.next()){
            log.info(me+": Sweet Success - got a row");
            na1  = rst.getString("NA_1"); 
            if(null == na1) na1 = "Null String";
        } else
	    log(me+": first() failed.");
      }
      log(me +" about to try initializing Torque");
      Torque.init("/Torque.properties");
      log(me +" done with initializing Torque");

      Roles gofer = new Roles();
      gofer.setId(1);
      gofer.setMyrole("gofer");
      gofer.setDescription("go fer stuff");
      log("created role & modified attribute");
      gofer.save();
      log.info(me +" created & modified a Role - 'gofer'.");
    }catch(Exception e) {
	log("Error: " + e.getMessage());
        e.printStackTrace();
    } finally{
      try{con.close();} catch(Exception e2){}
   }
  String didit = "probably";
%>
<html>
<body>
<h1>Next</h1>
<table cellspacing="20" >
  <tr>
    <td>&nbsp;Table Name&nbsp;</td><td>&nbsp; Ind Col Name &nbsp;</td>
    <td>Index Value</td><td>Col Wanted</td><td>Value</td>
  </tr>  
  <tr>
    <td><%= request.getParameter("table-name") %></td>
    <td><%= request.getParameter("col-name") %></td>
    <td><%= request.getParameter("value") %></td>
    <td><%= request.getParameter("datacol") %></td>
    <td><%= na1 %></td>
  </tr>
</table>

<hr>
<center><h3>Go Get Subsidiaries</h3></center>
<form method="get" action="/report/fileget.jsp">
     <input type="submit" value="Back" align="middle">
</form>
<hr>
<!-- hhmts start --> Last modified: Fri Jan  2 09:21:30 CST 2004 <!-- hhmts end -->
</body>
</html>

And the log:

ContextListener: attributeAdded('com.sun.faces.ConfigBase', 'com.sun.faces.config.ConfigBase@5db5ae')
 .... < other init msgs removed > ........

INFO [http8080-Processor4] servlet.JspServlet (service:235) - 		 datacol = NA_1
INFO [http8080-Processor4] servlet.JspServlet (service:235) - 		 col-name = customer
INFO [http8080-Processor4] servlet.JspServlet (service:235) - 		 value = 068895
INFO [http8080-Processor4] servlet.JspServlet (service:235) - 		 table-name = customer
output.jsp:Start
INFO [http8080-Processor4] Trash (_jspService:115) - got an initial context!
INFO [http8080-Processor4] Trash (_jspService:120) - got an environmental context!
INFO [http8080-Processor4] Trash (_jspService:123) - got new DataSource
INFO [http8080-Processor4] Trash (_jspService:127) - output.jsp got good connection
INFO [http8080-Processor4] Trash (_jspService:130) - output.jsp.get(): created Statement 
INFO [http8080-Processor4] Trash (_jspService:131) - output.jsp.get(): sql is  select * from
CUSTOMER where CUSTOMER="003571" 
INFO [http8080-Processor4] Trash (_jspService:133) - output.jsp.get(): executed query 
INFO [http8080-Processor4] Trash (_jspService:135) - output.jsp: Sweet Success - got a row
INFO [http8080-Processor4] Trash (_jspService:141) - output.jsp about to try initializing
Torque
INFO [http8080-Processor4] Trash (_jspService:143) - output.jsp done with initializing Torque
INFO [http8080-Processor4] Trash (_jspService:143) - output.jsp created role & modified
attribute
ERROR [http8080-Processor4] util.BasePeer (getMapBuilder:2145) - BasePeer.MapBuilder failed
trying to instantiate: com.jwortham.ocip.map.AddrtypesMapBuilder
java.lang.ClassNotFoundException: com.jwortham.ocip.map.AddrtypesMapBuilder
	at org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader.java:891)
	at org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader.java:756)
	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:141)
	at org.apache.torque.util.BasePeer.getMapBuilder(BasePeer.java:2107)
	at com.jwortham.ocip.BaseAddrtypesPeer.<clinit>(BaseAddrtypesPeer.java:77)
	at com.jwortham.ocip.BaseAddrtypes.<clinit>(BaseAddrtypes.java:36)
	at org.apache.jsp.output_jsp._jspService(output_jsp.java:144)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:320)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:293)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:286)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:258)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
	at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:256)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:210)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:196)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:175)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
	at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:407)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:577)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:974)
	at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:207)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:647)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:499)
	at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:575)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:649)
	at java.lang.Thread.run(Thread.java:534)
ERROR [http8080-Processor4] util.BasePeer (getMapBuilder:2145) - BasePeer.MapBuilder failed
trying to instantiate: com.jwortham.ocip.map.AddrtypesMapBuilder
java.lang.ClassNotFoundException: com.jwortham.ocip.map.AddrtypesMapBuilder

  ... follow - on errors  omitted.

Any help or suggestions would be greatly appreciated.

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message