RE: Torque using Tomcat
Hmm, the full error message indicates that something is really strange in your Generated Torque classes. Your Bank class looks like it was generated in the persistance package but it's trying to call org.apache.torque.map.BankMapBuilder. The BankMapBuilder class is a generated class that should be under the persistance package (default would be persistance.map) In a previous message, it seemed like you generated your classes into the org.apache.torque package. Do you still have code from this bad package choice hanging around? I suggest you go back the Torque class generation step; clear out all the generated java files in the org.apache.torque and persistent directories (and sub directories); make sure your schema file has a new date on it; and regenerate/re-compile everything. Then use ALL the classes / packages under the persistance directory in your web app. > -Original Message- > From: Norbert Kunstek [mailto:[EMAIL PROTECTED] > Sent: Friday, June 23, 2006 11:32 AM > To: Apache Torque Users List > Subject: RE: Torque using Tomcat > > > 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(WebappC > lassLoader.java:1340) > at > org.apache.catalina.loader.WebappClassLoader.loadClass(WebappC > lassLoader.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.(BaseBankPeer.java:78) > at persistence.BaseBank.(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.internalDoFilt > er(ApplicationFilterChain.java:252) > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(Appli > cationFilterChain.java:173) > at > org.apache.catalina.core.StandardWrapperValve.invoke(StandardW > rapperValve.java:214) > at > org.apache.catalina.core.StandardValveContext.invokeNext(Stand > ardValveContext.java:104) > at > org.apache.catalina.core.StandardPipeline.invoke(StandardPipel > ine.java:520) > at > org.apache.catalina.core.StandardContextValve.invokeInternal(S > tandardContextValve.java:198) > at > org.apache.catalina.core.StandardContextValve.invoke(StandardC > ontextValve.java:152) > at > org.apache.catalina.core.StandardValveContext.invokeNext(Stand > ardValveContext.java:104) > at > org.apache.catalina.core.StandardPipeline.invoke(StandardPipel > ine.java:520) > at > org.apache.catalina.core.StandardHostValve.invoke(StandardHost > Valve.java:137) > at > org.apache.catalina.core.StandardValveContext.invokeNext(Stand > ardValveContext.java:104) > at > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReport > Valve.java:118) > at > org.apache.catalina.core.StandardValveContext.invokeNext(Stand > ardValveContext.java:102) > at > org.apache.catalina.core.StandardPipeline.invoke(StandardPipel > ine.java:520) > at > org.apache.catalina.core.StandardEngineValve.invoke(StandardEn > gineValve.java:109) > at > org.apache.catalina.core.StandardValveContext.invokeNext(Stand > ardValveContext.java:104) > at > org.apache.catalina.core.StandardPipeline.invoke(StandardPipel > ine.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(Http11Process > or.java:799) > at > org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandle r.processConnection(Http11Protocol.java:705) > at > org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoi > nt.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 > 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.(BaseBankPeer.java:78) > at persistence.BaseBank.(BaseBank.java:40) > at HelloServlet.doGet(HelloServlet.java:42) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) > at javax.servlet.http.HttpServlet.servic
Re: Torque using Tomcat
Shouldn't your classes be in WEB-INF/classes not WEB-INF/src? Joe On 23/06/06, Norbert Kunstek <[EMAIL PROTECTED]> wrote: 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.
RE: Torque using Tomcat
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.(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.(BaseBankPeer.java:78) at persistence.BaseBank.(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(Standa
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:[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]
Re: Torque using Tomcat
No, sorry! It's still not working! Maybe somebody can give me short HowTo! It doesn't have to be this example. > -Ursprüngliche Nachricht- > Von: "Apache Torque Users List" > Gesendet: 23.06.06 12:23:22 > An: "Apache Torque Users List" > Betreff: Re: Torque using Tomcat > Try initializing Torque with an absolute path. To get the absolute path, > you can prepend the webroot directory to your relative path. You can get > the webroot directory from the servlet container, e.g. > > String webroot; > { > // always use slashes, no backslashes > webroot = > config.getServletContext().getRealPath("/").replace('\\','/'); > // Make sure path ends with a slash > if (!webroot.endsWith("/")) > { > webroot = webroot + "/"; > } > } > > Thomas > > Norbert Kunstek <[EMAIL PROTECTED]> schrieb am 23.06.2006 11:59:47: > > > Thank you! > > > > But that's not the problem. It can't find the Torque.properties!!! > > > > > > > > > -Ursprüngliche Nachricht- > > > Von: "Apache Torque Users List" > > > Gesendet: 22.06.06 15:49:37 > > > An: Apache Torque Users List > > > Betreff: Re: Torque using Tomcat > > > > > > > Hi, I think the problem can be with your: > > > import org.apache.torque.Bank > > > where Bank is a generated class by Torque, so I doubt it has been > > > generated in the org.apache.torque package. > > > > > > Norbert Kunstek wrote: > > > > > > >Hello, > > > > > > > >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] > > > > > > > > > > > > > > > > > > > > > > > > > - > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > __ > > 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] > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > __ Erweitern Sie FreeMail zu einem noch leistungsstärkeren E-Mail-Postfach! Mehr Infos unter http://freemail.web.de/home/landingpad/?mc=021131 --
Re: Torque using Tomcat
Try initializing Torque with an absolute path. To get the absolute path, you can prepend the webroot directory to your relative path. You can get the webroot directory from the servlet container, e.g. String webroot; { // always use slashes, no backslashes webroot = config.getServletContext().getRealPath("/").replace('\\','/'); // Make sure path ends with a slash if (!webroot.endsWith("/")) { webroot = webroot + "/"; } } Thomas Norbert Kunstek <[EMAIL PROTECTED]> schrieb am 23.06.2006 11:59:47: > Thank you! > > But that's not the problem. It can't find the Torque.properties!!! > > > > > -Ursprüngliche Nachricht- > > Von: "Apache Torque Users List" > > Gesendet: 22.06.06 15:49:37 > > An: Apache Torque Users List > > Betreff: Re: Torque using Tomcat > > > > Hi, I think the problem can be with your: > > import org.apache.torque.Bank > > where Bank is a generated class by Torque, so I doubt it has been > > generated in the org.apache.torque package. > > > > Norbert Kunstek wrote: > > > > >Hello, > > > > > >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] > > > > > > > > > > > > > > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > __ > 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] > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Torque using Tomcat
We explicitly laod the properties file and pass the Configuration into Torque.init by using PropertiesConfiguration files. See Apache commons Configuration. I sure there's more details of how to load and debug the file loading there. It's most likely looking in your current directory. Joe On 23/06/06, Norbert Kunstek <[EMAIL PROTECTED]> wrote: Thank you! But that's not the problem. It can't find the Torque.properties!!! > -Ursprüngliche Nachricht- > Von: "Apache Torque Users List" > Gesendet: 22.06.06 15:49:37 > An: Apache Torque Users List > Betreff: Re: Torque using Tomcat > Hi, I think the problem can be with your: > import org.apache.torque.Bank > where Bank is a generated class by Torque, so I doubt it has been > generated in the org.apache.torque package. > > Norbert Kunstek wrote: > > >Hello, > > > >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] > > > > > > > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > __ 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]
Re: Torque using Tomcat
Thank you! But that's not the problem. It can't find the Torque.properties!!! > -Ursprüngliche Nachricht- > Von: "Apache Torque Users List" > Gesendet: 22.06.06 15:49:37 > An: Apache Torque Users List > Betreff: Re: Torque using Tomcat > Hi, I think the problem can be with your: > import org.apache.torque.Bank > where Bank is a generated class by Torque, so I doubt it has been > generated in the org.apache.torque package. > > Norbert Kunstek wrote: > > >Hello, > > > >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] > > > > > > > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > __ 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]