db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Norbert Kunstek <norbertkuns...@web.de>
Subject RE: Torque using Tomcat
Date Fri, 23 Jun 2006 15:32:18 GMT
Hello,


I have all the required jar-files in the WEB-INF/lib directory (torque runtime + dbdriver).
My Torque.properties is in the WEB-INF directory.

I have the HelloServlet + the bank-classes in the WEB-INF/src directory.




Here the HelloServlet.java again:

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.torque.Torque;
import org.apache.torque.TorqueException;

import persistence.Bank;

public class HelloServlet extends HttpServlet {

 public void init() throws ServletException, UnavailableException 
 {
	 try
	 {
		 ServletContext ct = getServletContext();
		 PropertiesConfiguration config = new PropertiesConfiguration();
		 config.load(ct.getResourceAsStream("/WEB-INF/Torque.properties"));

		 Torque.init(config);
	 }
 	catch (ConfigurationException e) 
 	{
 		System.out.println("Configuration: Initialisierung fehlgeschlagen" + e); 
 	}
 	catch (TorqueException e) {
 			System.out.println("Init: Initialisierung fehlgeschlagen" + e);
    }
 }





 public void doGet( HttpServletRequest requ, HttpServletResponse resp ) throws ServletException,IOException

 {
	 try
	 {
		 Bank sparkasse = new Bank();
		 sparkasse.setBankId(111); sparkasse.setName("Apache");
		 sparkasse.setCity("Torque");

		 // CREATE
		 sparkasse.save();

	 }
	 catch (Exception e)
	 {
		 System.out.println("initializing of Torque failed" + e); }

	 	resp.setContentType( "text/html" );
	 	PrintWriter out = resp.getWriter();
	 	out.println( "" );
	 	out.println( "Servus," );
	 	out.println( "Torque!" );
	 	out.println( "" );
	 	out.close();
 	}
}




--> In the browser I get this message:

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling
this request.

exception

javax.servlet.ServletException: Servlet execution threw an exception

root cause

java.lang.ExceptionInInitializerError
	persistence.BaseBank.<clinit>(BaseBank.java:40)
	HelloServlet.doGet(HelloServlet.java:42)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


-------------> On the webserver I get this error message:

23.06.2006 17:24:03 org.apache.torque.util.BasePeer getMapBuilder
SCHWERWIEGEND: BasePeer.MapBuilder failed trying to instantiate: org.apache.torque.map.BankMapBuilder
java.lang.ClassNotFoundException: org.apache.torque.map.BankMapBuilder
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1340)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1189)
	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:1355)
	at persistence.BaseBankPeer.<clinit>(BaseBankPeer.java:78)
	at persistence.BaseBank.<clinit>(BaseBank.java:40)
	at HelloServlet.doGet(HelloServlet.java:42)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
	at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
	at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
	at java.lang.Thread.run(Thread.java:534)
23.06.2006 17:24:03 persistence.BaseBankPeer <clinit>
SCHWERWIEGEND: Could not initialize Peer
org.apache.torque.TorqueException: java.lang.ClassNotFoundException: org.apache.torque.map.BankMapBuilder
	at org.apache.torque.util.BasePeer.getMapBuilder(BasePeer.java:1389)
	at persistence.BaseBankPeer.<clinit>(BaseBankPeer.java:78)
	at persistence.BaseBank.<clinit>(BaseBank.java:40)
	at HelloServlet.doGet(HelloServlet.java:42)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
	at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
	at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
	at java.lang.Thread.run(Thread.java:534)
Caused by: java.lang.ClassNotFoundException: org.apache.torque.map.BankMapBuilder
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1340)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1189)
	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:1355)
	... 29 more





























> -----Urspr√ľngliche Nachricht-----
> Von: "Apache Torque Users List" <torque-user@db.apache.org>
> Gesendet: 23.06.06 15:53:46
> An: "Apache Torque Users List" <torque-user@db.apache.org>
> Betreff: RE: Torque using Tomcat


> Ok, lets start back at the beginning.  You say you're getting a 
> ClassNotFound Exception.  Exactly what is the text of the error
> you are getting, including all the Stacktrace info?  It's most 
> likely in one of the Tomcat logs.
> 
> Do you have ALL the Torque Runtime required jar files (not just
> torque*.jar) in a Tomcat library?  E.g., in the WEB-INF/lib or 
> shared/lib directories?
> 
> Another possible "class not found" cause is that your JDBC driver 
> class name is mistyped in the Torque.properties or that it's jar 
> file is not in one of the Tomcat libraries.
> 
> > -----Original Message-----
> > From: Norbert Kunstek [mailto:norbertkunstek@web.de] 
> > 
> > I've tried to use Torque within the Servlet but I receive 
> > always a ClassNotFound-Exception.
> > Maybe somebody could solve the Problem:
> > 
> > import java.io.*;
> > import javax.servlet.*;
> > import javax.servlet.http.*;
> > 
> > import org.apache.commons.configuration.ConfigurationException;
> > import org.apache.commons.configuration.PropertiesConfiguration;
> > import org.apache.torque.Bank;
> > import org.apache.torque.Torque;
> > import org.apache.torque.TorqueException;
> > 
> > //import org.apache.torque.Torque;
> > 
> > //import persistence.Bank;
> > 
> > 
> > public class HelloServlet extends HttpServlet {
> > 
> > public void init() throws ServletException, 
> > UnavailableException { try { ServletContext ct = 
> > getServletContext(); PropertiesConfiguration config = new 
> > PropertiesConfiguration();
> > 
> > config.load(ct.getResourceAsStream("/WEB-INF/Torque.properties"));
> > 
> > 
> > Torque.init(config);
> > }
> > catch (ConfigurationException e) {
> > System.out.println("Configuration: Initialisierung 
> > fehlgeschlagen" + e); } catch (TorqueException e) {
> > System.out.println("Init: Initialisierung fehlgeschlagen" + e); } }
> > 
> > 
> > 
> > 
> > 
> > public void doGet( HttpServletRequest requ, 
> > HttpServletResponse resp ) throws ServletException, 
> > IOException { try { Bank sparkasse = new Bank(); 
> > sparkasse.setBankId(111); sparkasse.setName("Apache"); 
> > sparkasse.setCity("Torque");
> > 
> > // CREATE
> > sparkasse.save();
> > 
> > }
> > catch (Exception e)
> > {
> > System.out.println("initializing of Torque failed" + e); }
> > 
> > resp.setContentType( "text/html" );
> > PrintWriter out = resp.getWriter();
> > out.println( "" );
> > out.println( "Servus," );
> > out.println( "Torque!" );
> > out.println( "" );
> > out.close();
> > }
> > 
> > 
> > }
> > ______________________________________________________________
> > Verschicken Sie romantische, coole und witzige Bilder per SMS!
> > Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> > For additional commands, e-mail: torque-user-help@db.apache.org
> > 
> > 
> 
> Duke CE Privacy Statement
> Please be advised that this e-mail and any files transmitted with it are confidential
communication or may otherwise be privileged or confidential and are intended solely for the
individual or entity to whom they are addressed.  If you are not the intended recipient you
may not rely on the contents of this email or any attachments, and we ask that you  please
not read, copy or retransmit this communication, but reply to the sender and destroy the email,
its contents, and all copies thereof immediately.  Any unauthorized dissemination, distribution
or copying of this communication is strictly prohibited.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
> 


______________________________________________________________________
XXL-Speicher, PC-Virenschutz, Spartarife & mehr: Nur im WEB.DE Club!		
Jetzt gratis testen! http://freemail.web.de/home/landingpad/?mc=021130


---------------------------------------------------------------------
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