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:[EMAIL PROTECTED] > > 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: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
