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" <[email protected]> > Gesendet: 23.06.06 12:23:22 > An: "Apache Torque Users List" <[email protected]> > 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" <[email protected]> > > > Gesendet: 22.06.06 15:49:37 > > > An: Apache Torque Users List <[email protected]> > > > 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 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
