Torque using Tomcat
I'm using Torque 3.1.1 with Tomcat 5.0.28 and MySQL. In a Tomcat context.xml file I've defined a JNDI DataSource and in torque.prorperties the JndiDataSourceFactory factory is being used. The webapp works fine until the webapp is realoaded. The first database access after a reload gives this stack trace: Caused by: java.lang.NullPointerException: There was no DataSourceFactory configured for the connection my_om at org.apache.torque.TorqueInstance.getConnection(TorqueInstance.java:711) at org.apache.torque.Torque.getConnection(Torque.java:268) at org.apache.torque.util.Transaction.beginOptional(Transaction.java:80) at org.apache.torque.util.BasePeer.doSelect(BasePeer.java:1195) Any ideas? Thanks, Sean -- --- M. Sean Gilligan: 831-466-9788 x11 --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Torque using Tomcat
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]
Re: Torque using Tomcat
"M. Sean Gilligan" <[EMAIL PROTECTED]> writes: >I'm using Torque 3.1.1 with Tomcat 5.0.28 and MySQL. In a Tomcat context.xml >file I've defined a JNDI DataSource and in torque.prorperties the >JndiDataSourceFactory factory is being used. The webapp works fine until the >webapp is realoaded. The first database access after a reload gives this >stack trace: I remember this from a dim and distant past. It was some serialization issue. Can you please look into your catalina.out and maybe look into the list archives? Regards Henning >Caused by: java.lang.NullPointerException: There was no DataSourceFactory >configured for the connection my_om >at > org.apache.torque.TorqueInstance.getConnection(TorqueInstance.java:711) >at org.apache.torque.Torque.getConnection(Torque.java:268) >at > org.apache.torque.util.Transaction.beginOptional(Transaction.java:80) >at org.apache.torque.util.BasePeer.doSelect(BasePeer.java:1195) >Any ideas? >Thanks, >Sean >-- >--- >M. Sean Gilligan: 831-466-9788 x11 >--- >- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] -- Dipl.-Inf. (Univ.) Henning P. Schmiedehausen INTERMETA GmbH [EMAIL PROTECTED]+49 9131 50 654 0 http://www.intermeta.de/ RedHat Certified Engineer -- Jakarta Turbine Development -- hero for hire Linux, Java, perl, Solaris -- Consulting, Training, Development What is more important to you... [ ] Product Security or [ ] Quality of Sales and Marketing Support -- actual question from a Microsoft customer survey - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Torque using Tomcat
>"M. Sean Gilligan" <[EMAIL PROTECTED]> writes: > >>I'm using Torque 3.1.1 with Tomcat 5.0.28 and MySQL. In a Tomcat context.xml >>file I've defined a JNDI DataSource and in torque.prorperties the >>JndiDataSourceFactory factory is being used. The webapp works fine until the >>webapp is realoaded. The first database access after a reload gives this >>stack trace: > >I remember this from a dim and distant past. It was some serialization >issue. Can you please look into your catalina.out and maybe look into the >list archives? Hi Henning. Thanks for your response. What do you mean by a "serialization issue"? I looked through the list archives (in a Eudora folder) very carefully (back to Oct 2002, when I started lurking) and found may issues involving the same error message, but most of them involved configuration issues. (Everything works for me unless I reload the webapp.) Didn't find anything other than the NullPointerException (java.lang.NullPointerException: There was no DataSourceFactory configured for the connection my_om) in the logs, either. I had originally defined the DataSource in the Tomcat . Last night I tried in the section and got the same error. I'll try to put together a simplified test case if you think that it is worthwhile. Thanks, again. Sean -- --- M. Sean Gilligan: 831-466-9788 x11 Catalla Systems, Inc. : http://www.vblogcentral.com --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Torque using Tomcat
Hi all, I got the same problem too. I deployed my app in JBoss with Tomcat. Torque is being used in my Session Bean. Each time I redeploy the app, Torque will fail. Then, instead of just redeploying the app, I have to restart JBoss all over again. Haven't got any clue either. I've been searching for the solution but I can't find any. Could anybody in the list give me some idea? Thanks. On Thu, 16 Dec 2004 12:24:10 -0800, "M. Sean Gilligan" <[EMAIL PROTECTED]> said: > >"M. Sean Gilligan" <[EMAIL PROTECTED]> writes: > > > >>I'm using Torque 3.1.1 with Tomcat 5.0.28 and MySQL. In a Tomcat > >>context.xml file I've defined a JNDI DataSource and in torque.prorperties > >>the JndiDataSourceFactory factory is being used. The webapp works fine > >>until the webapp is realoaded. The first database access after a reload > >>gives this stack trace: > > > >I remember this from a dim and distant past. It was some serialization > >issue. Can you please look into your catalina.out and maybe look into the > >list archives? > > Hi Henning. > > Thanks for your response. > > What do you mean by a "serialization issue"? > > I looked through the list archives (in a Eudora folder) very carefully > (back to Oct 2002, when I started lurking) and found may issues involving > the same error message, but most of them involved configuration issues. > (Everything works for me unless I reload the webapp.) > > Didn't find anything other than the NullPointerException > (java.lang.NullPointerException: There was no DataSourceFactory > configured for the connection my_om) in the logs, either. > > I had originally defined the DataSource in the Tomcat . Last > night I tried in the section and got the same > error. > > I'll try to put together a simplified test case if you think that it is > worthwhile. > > Thanks, again. > > Sean > > > -- > --- > M. Sean Gilligan: 831-466-9788 x11 > Catalla Systems, Inc. : http://www.vblogcentral.com > --- > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > - Mujahid Malaysia "Kembalikan Keagungan Islam" - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Torque using Tomcat
"M. Sean Gilligan" <[EMAIL PROTECTED]> writes: >>"M. Sean Gilligan" <[EMAIL PROTECTED]> writes: >> >>>I'm using Torque 3.1.1 with Tomcat 5.0.28 and MySQL. In a Tomcat >>>context.xml file I've defined a JNDI DataSource and in torque.prorperties >>>the JndiDataSourceFactory factory is being used. The webapp works fine >>>until the webapp is realoaded. The first database access after a reload >>>gives this stack trace: >> >>I remember this from a dim and distant past. It was some serialization >>issue. Can you please look into your catalina.out and maybe look into the >>list archives? >Hi Henning. >Thanks for your response. >What do you mean by a "serialization issue"? Your container probably tries to save the existing session on a restart (because reloading your webapp is nothing but a restart of your application) and falls over its feets. When it comes up again, its session information is incomplete and you get strange errors. Try the following thing. I assume now, that you use Tomcat5: - open your tomcat/conf/server.xml file - look for the element for your application. - if you don't have one, you must create one. The result should look like this: Important is the 'pathname=""' Stop Tomcat. Nuke the contents of the work/ and the temp/ directory. Start again. See if the problem vanishes. If yes, you have a serialization issue with Torque. Regards Henning >I looked through the list archives (in a Eudora folder) very carefully (back >to Oct 2002, when I started lurking) and found may issues involving the same >error message, but most of them involved configuration issues. (Everything >works for me unless I reload the webapp.) >Didn't find anything other than the NullPointerException >(java.lang.NullPointerException: There was no DataSourceFactory configured for >the connection my_om) in the logs, either. >I had originally defined the DataSource in the Tomcat . Last night I >tried in the section and got the same error. >I'll try to put together a simplified test case if you think that it is >worthwhile. >Thanks, again. >Sean >-- >--- >M. Sean Gilligan: 831-466-9788 x11 >Catalla Systems, Inc. : http://www.vblogcentral.com >--- >- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] -- Dipl.-Inf. (Univ.) Henning P. Schmiedehausen INTERMETA GmbH [EMAIL PROTECTED]+49 9131 50 654 0 http://www.intermeta.de/ RedHat Certified Engineer -- Jakarta Turbine Development -- hero for hire Linux, Java, perl, Solaris -- Consulting, Training, Development What is more important to you... [ ] Product Security or [ ] Quality of Sales and Marketing Support -- actual question from a Microsoft customer survey - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Torque using Tomcat
Hi Henning, Thanks again for your help. (I got sidetracked for a few days.) >"M. Sean Gilligan" <[EMAIL PROTECTED]> writes: > >>>"M. Sean Gilligan" <[EMAIL PROTECTED]> writes: >>> I'm using Torque 3.1.1 with Tomcat 5.0.28 and MySQL. In a Tomcat context.xml file I've defined a JNDI DataSource and in torque.prorperties the JndiDataSourceFactory factory is being used. The webapp works fine until the webapp is realoaded. The first database access after a reload gives this stack trace: >>> >>>I remember this from a dim and distant past. It was some serialization >>>issue. Can you please look into your catalina.out and maybe look into the >>>list archives? > >>Hi Henning. > >>Thanks for your response. > >>What do you mean by a "serialization issue"? > >Your container probably tries to save the existing session on a >restart (because reloading your webapp is nothing but a restart of >your application) and falls over its feets. When it comes up again, >its session information is incomplete and you get strange errors. What would Torque have to do with the Http session? I don't understand the connection here. > >Try the following thing. I assume now, that you use Tomcat5: > >- open your tomcat/conf/server.xml file > >- look for the element for your application. > >- if you don't have one, you must create one. The result should look like > this: > > > distributable="false" pathname="" /> > > >Important is the 'pathname=""' > >Stop Tomcat. Nuke the contents of the work/ and the temp/ >directory. Start again. See if the problem vanishes. If yes, you have >a serialization issue with Torque. I did what you said and the problem did not go away. To be clear: the problem is fixed by a restart of Tomcat and only occurs when you reload the webapp after it has been loaded once. I followed your instructions (which included a restart of Tomcat) tried to login once and it worked, the restarted the webapp and tried to login again and got the same stack trace. One variation from your procedure is that I'm not editing server.xml but specifying a Context.xml in the Tomcat ANT task. The version I just tested is like this: url jdbc:mysql://localhost/mysqldb username xxx password xxx driverClassName org.gjt.mm.mysql.Driver maxWait 5000 maxActive 4 maxIdle 2 url jdbc:postgresql: pgdb username xxx password xxx driverClassName org.postgresql.Driver maxWait 5000 maxActive 4 maxIdle 2 Any further information and/or suggestions would be greatly appreciated. Thanks, Sean -- --- M. Sean Gilligan: 831-466-9788 x11 Catalla Systems, Inc. : http://www.vblogcentral.com --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Torque using Tomcat
Hi, I can confirm the behaviour Sean's having. I've been seeing it since we upgraded to torque 3.1.1. which uses commons-configuration-1.0. I think what happens is that when torque initialises it tries to find your datasource through JNDI which you have configured in Torque.properties, and after it also tries to initialise a datasource and bind it to your context which you actually have not configured in your properties file. Previously the commons-configuration package would give a null object when no subconfiguration for the datasource was found in the properties file, but since 1.0 it returns an empty subconfiguration object (which is not null), and that is what 'breaks' the code. The second time you load your app this causes an NameAlreadyBoundException, causing torque initialisation to fail. Ive recompiled torque source with a small patch in the JndiDataSourceFactory and this solves the problem. Recompiling Torque 3.1.1 with and older version of commons-configuration also does the trick. I have also found an elaborate post on the same problem in the archives: http://nagoya.apache.org/eyebrowse/ReadMsg?listName=torque- [EMAIL PROTECTED]&msgId=1440765 Hope this helps, Grtz Wieger On Wed, 2004-12-22 at 18:30 -0800, M. Sean Gilligan wrote: > Hi Henning, > > Thanks again for your help. (I got sidetracked for a few days.) > > >"M. Sean Gilligan" <[EMAIL PROTECTED]> writes: > > > >>>"M. Sean Gilligan" <[EMAIL PROTECTED]> writes: > >>> > I'm using Torque 3.1.1 with Tomcat 5.0.28 and MySQL. In a Tomcat > context.xml file I've defined a JNDI DataSource and in torque.prorperties > the JndiDataSourceFactory factory is being used. The webapp works fine > until the webapp is realoaded. The first database access after a reload > gives this stack trace: > >>> > >>>I remember this from a dim and distant past. It was some serialization > >>>issue. Can you please look into your catalina.out and maybe look into the > >>>list archives? > > > >>Hi Henning. > > > >>Thanks for your response. > > > >>What do you mean by a "serialization issue"? > > > >Your container probably tries to save the existing session on a > >restart (because reloading your webapp is nothing but a restart of > >your application) and falls over its feets. When it comes up again, > >its session information is incomplete and you get strange errors. > > What would Torque have to do with the Http session? I don't understand the > connection here. > > > > >Try the following thing. I assume now, that you use Tomcat5: > > > >- open your tomcat/conf/server.xml file > > > >- look for the element for your application. > > > >- if you don't have one, you must create one. The result should look like > > this: > > > > > >>distributable="false" pathname="" /> > > > > > >Important is the 'pathname=""' > > > >Stop Tomcat. Nuke the contents of the work/ and the temp/ > >directory. Start again. See if the problem vanishes. If yes, you have > >a serialization issue with Torque. > > I did what you said and the problem did not go away. To be clear: the > problem is fixed by a restart of Tomcat and only occurs when you reload the > webapp after it has been loaded once. I followed your instructions (which > included a restart of Tomcat) tried to login once and it worked, the > restarted the webapp and tried to login again and got the same stack trace. > > One variation from your procedure is that I'm not editing server.xml but > specifying a Context.xml in the Tomcat ANT task. > > The version I just tested is like this: > > > > distributable="false" pathname="" /> > > > > > url > jdbc:mysql://localhost/mysqldb > > > username > xxx > > > password > xxx > > > driverClassName > org.gjt.mm.mysql.Driver > > > maxWait > 5000 > > > maxActive > 4 > > > maxIdle > 2 > > > > > url > jdbc:postgresql: pgdb > > > username > xxx > > > password > xxx > > > driverClassName > org.postgresql.Driver > > > maxWait > 5000 > > > maxActive > 4 > > > maxIdle > 2 > > > > > Any further information and/or suggestions would be greatly appreciated. > Thanks, > > Sean > -- Us Media B.V. Stadhouderskade 115 1073 AX Amsterdam t: +31 (0)20 428 68 68 f: +31 (0)20 470 69 05 www.usmedia.nl - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Torque using Tomcat
Hi, Do you think your change in JndiDataSourceFactory is general enough to be included in future releases of Torque ? If yes, can you please open a ticket in Scarab http://nagoya.apache.org/scarab/issues open a bug report and attach your patch ? Thanks a lot, Thomas "Wieger Uffink [Us Media]" <[EMAIL PROTECTED]> schrieb am 23.12.2004 10:40:34: > Hi, > > I can confirm the behaviour Sean's having. I've been seeing it since we > upgraded to torque 3.1.1. which uses commons-configuration-1.0. > > I think what happens is that when torque initialises it tries to find > your datasource through JNDI which you have configured in > Torque.properties, and after it also tries to initialise a datasource > and bind it to your context which you actually have not configured in > your properties file. > Previously the commons-configuration package would give a null object > when no subconfiguration for the datasource was found in the properties > file, but since 1.0 it returns an empty subconfiguration object (which > is not null), and that is what 'breaks' the code. > The second time you load your app this causes an > NameAlreadyBoundException, causing torque initialisation to fail. > > Ive recompiled torque source with a small patch in the > JndiDataSourceFactory and this solves the problem. > > Recompiling Torque 3.1.1 with and older version of commons-configuration > also does the trick. > > I have also found an elaborate post on the same problem in the archives: > http://nagoya.apache.org/eyebrowse/ReadMsg?listName=torque- > [EMAIL PROTECTED]&msgId=1440765 > > Hope this helps, > > Grtz > Wieger > > On Wed, 2004-12-22 at 18:30 -0800, M. Sean Gilligan wrote: > > Hi Henning, > > > > Thanks again for your help. (I got sidetracked for a few days.) > > > > >"M. Sean Gilligan" <[EMAIL PROTECTED]> writes: > > > > > >>>"M. Sean Gilligan" <[EMAIL PROTECTED]> writes: > > >>> > > I'm using Torque 3.1.1 with Tomcat 5.0.28 and MySQL. In a > Tomcat context.xml file I've defined a JNDI DataSource and in > torque.prorperties the JndiDataSourceFactory factory is being used. > The webapp works fine until the webapp is realoaded. The first > database access after a reload gives this stack trace: > > >>> > > >>>I remember this from a dim and distant past. It was some serialization > > >>>issue. Can you please look into your catalina.out and maybe look into the > > >>>list archives? > > > > > >>Hi Henning. > > > > > >>Thanks for your response. > > > > > >>What do you mean by a "serialization issue"? > > > > > >Your container probably tries to save the existing session on a > > >restart (because reloading your webapp is nothing but a restart of > > >your application) and falls over its feets. When it comes up again, > > >its session information is incomplete and you get strange errors. > > > > What would Torque have to do with the Http session? I don't > understand the connection here. > > > > > > > >Try the following thing. I assume now, that you use Tomcat5: > > > > > >- open your tomcat/conf/server.xml file > > > > > >- look for the element for your application. > > > > > >- if you don't have one, you must create one. The result should look like > > > this: > > > > > > > > >> >distributable="false" pathname="" /> > > > > > > > > >Important is the 'pathname=""' > > > > > >Stop Tomcat. Nuke the contents of the work/ and the temp/ > > >directory. Start again. See if the problem vanishes. If yes, you have > > >a serialization issue with Torque. > > > > I did what you said and the problem did not go away. To be clear: > the problem is fixed by a restart of Tomcat and only occurs when you > reload the webapp after it has been loaded once. I followed your > instructions (which included a restart of Tomcat) tried to login > once and it worked, the restarted the webapp and tried to login > again and got the same stack trace. > > > > One variation from your procedure is that I'm not editing server. > xml but specifying a Context.xml in the Tomcat ANT task. > > > > The version I just tested is like this: > > > > > > > >>distributable="false" pathname="" /> > > > > > > > > > > url > > jdbc:mysql://localhost/mysqldb > > > > > > username > > xxx > > > > > > password > > xxx > > > > > > driverClassName > > org.gjt.mm.mysql.Driver > > > > > > maxWait > > 5000 > > > > > > maxActive > > 4 > > > > > > maxIdle > > 2 > > > > > > > > > > url > > jdbc:postgresql: pgdb > > > > > > username > > xxx > > > > > > password > > xxx > > > > > > driverClassName > > org.postgresql.Driver > > > > > > maxWait > > 5000 > > > > > > maxActive > > 4 > > > > > > maxIdle > > 2 > > > > > > > >
Re: Torque using Tomcat
"M. Sean Gilligan" <[EMAIL PROTECTED]> writes: >Hi Henning, >Thanks again for your help. (I got sidetracked for a few days.) Hi, no prob. I remember this from a dim and distant past. It was some serialization issue. Can you please look into your catalina.out and maybe look into the list archives? >> >>>Hi Henning. >> >>>Thanks for your response. >> >>>What do you mean by a "serialization issue"? >> >>Your container probably tries to save the existing session on a >>restart (because reloading your webapp is nothing but a restart of >>your application) and falls over its feets. When it comes up again, >>its session information is incomplete and you get strange errors. >What would Torque have to do with the Http session? I don't understand the >connection here. The container serializes the state of your application. Which means, that it might serialize the state of the MapBuilders, connection factories and so on. As I said, I remember this dimly so I wasn't sure that this is the same issue. >> >>Try the following thing. I assume now, that you use Tomcat5: >> >>- open your tomcat/conf/server.xml file >> >>- look for the element for your application. >> >>- if you don't have one, you must create one. The result should look like >> this: >> >> >> >distributable="false" pathname="" /> >> >> >>Important is the 'pathname=""' >> >>Stop Tomcat. Nuke the contents of the work/ and the temp/ >>directory. Start again. See if the problem vanishes. If yes, you have >>a serialization issue with Torque. >I did what you said and the problem did not go away. To be clear: the problem >is fixed by a restart of Tomcat and only occurs when you reload the webapp >after it has been loaded once. I followed your instructions (which included a >restart of Tomcat) tried to login once and it worked, the restarted the webapp >and tried to login again and got the same stack trace. Ok. So it does not seem to be this. At this point, a debugger might be your best friend to find the root cause of this problem. >Any further information and/or suggestions would be greatly appreciated. >Thanks, I have no immediate ideas; opening a bug report so this won't be forgotten might be a good thing, though. Regards Henning - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Torque using Tomcat
"Wieger Uffink [Us Media]" <[EMAIL PROTECTED]> writes: >Ive recompiled torque source with a small patch in the >JndiDataSourceFactory and this solves the problem. Cool. Where is this patch? :-) Regards Henning - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Torque using Tomcat
>"Wieger Uffink [Us Media]" <[EMAIL PROTECTED]> writes: > >>Ive recompiled torque source with a small patch in the >>JndiDataSourceFactory and this solves the problem. > >Cool. Where is this patch? :-) I'm not sure if he used the exact same patch as in this message: http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]&msgId=1440765 but, I put the patch into my local CVS tree and cleaned up the code formatting/tabs to get this diff: $ cvs diff JndiDataSourceFactory.java Index: JndiDataSourceFactory.java === RCS file: /home/cvspublic/jakarta-turbine-torque/src/java/org/apache/torque/dsfactory/JndiDataSourceFactory.java,v retrieving revision 1.7 diff -u -r1.7 JndiDataSourceFactory.java --- JndiDataSourceFactory.java 22 Feb 2004 06:18:52 - 1.7 +++ JndiDataSourceFactory.java 29 Dec 2004 09:10:29 - @@ -158,7 +158,7 @@ Configuration c = configuration.subset("datasource"); try { -if (c != null) +if (c != null && !c.isEmpty()) { Object ds = null; Iterator i = c.getKeys(); I plan on trying out a build tomorrow. My CVS tree has the latest code, but I should probably build a patched version based on the TORQUE_3_1_1 tag if I want to put this into "production", right? Cheers, Sean -- --- M. Sean Gilligan: 831-466-9788 x11 vBlog Central : http://www.vblogcentral.com --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Torque using Tomcat
"M. Sean Gilligan" <[EMAIL PROTECTED]> schrieb am 29.12.2004 10:19:57: > [...] > > > I plan on trying out a build tomorrow. My CVS tree has the latest > code, but I should probably build a patched version based on the > TORQUE_3_1_1 tag if I want to put this into "production", right? > If you are content with 3.1.1 so far, this is exactly how you should proceed. There have been sone largish changes in the 3.1 branch since the 3.1.1 release, and though I believe personally that the current state of the TORQUE_3_1_BRANCH in CVS is ok except for one small template, these changes have not yet been widely tested and therefore it should be safer for you to patch the release. No need to use CVS though, there is also a source package for 3.1.1 available ;-) Please tell us if the patch worked for you, so it can be changed in CVS too. Thanks, Thomas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Torque using Tomcat
"M. Sean Gilligan" <[EMAIL PROTECTED]> writes: I took a good look at the JndiDataSourceFactory and this patch just plasters over (there is also a good NPE chance in there) I reworked the config logic a bit, please try out, this should be better now. [] > I plan on trying out a build tomorrow. My CVS tree has the latest > code, but I should probably build a patched version based on the > TORQUE_3_1_1 tag if I want to put this into "production", right? I would prefer having you test the TORQUE_3_1_BRANCH HEAD by doing cvs -d :pserver:[EMAIL PROTECTED]:/home/cvspublic checkout -r TORQUE_3_1_BRANCH db-torque and compiling it, but if you are stuck to a released version due to QA reasons, simply take the released 3.1.1 version and replace the JndiDataSourceFactory.java file. Regards Henning -- Dipl.-Inf. (Univ.) Henning P. Schmiedehausen INTERMETA GmbH [EMAIL PROTECTED]+49 9131 50 654 0 http://www.intermeta.de/ RedHat Certified Engineer -- Jakarta Turbine Development -- hero for hire Linux, Java, perl, Solaris -- Consulting, Training, Development What is more important to you... [ ] Product Security or [ ] Quality of Sales and Marketing Support -- actual question from a Microsoft customer survey - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Torque using Tomcat
>"M. Sean Gilligan" <[EMAIL PROTECTED]> writes: > >I took a good look at the JndiDataSourceFactory and this patch just >plasters over What are the consequences of a patch that just "plasters over"? >(there is also a good NPE chance in there) I'm sorry, I'm not familiar with the acronym NPE, what does "NPE" mean? >I would prefer having you test the TORQUE_3_1_BRANCH HEAD by doing > >cvs -d :pserver:[EMAIL PROTECTED]:/home/cvspublic checkout -r >TORQUE_3_1_BRANCH db-torque > >and compiling it, I did this and it fixed the problem, but... > but if you are stuck to a released version due to QA >reasons, simply take the released 3.1.1 version and replace the >JndiDataSourceFactory.java file. I really do want to use a QA'ed release for my alpha/beta/production release, so I also tried copying JndiDataSourceFactory.java into the 3.1.1 directory tree and am unable to do a build: java:compile: [echo] Compiling to /Users/sean/netcvs/jakarta/db-torque-3-1-1-patched/target/classes [javac] Compiling 69 source files to /Users/sean/netcvs/jakarta/db-torque-3-1-1-patched/target/classes /Users/sean/netcvs/jakarta/db-torque-3-1-1-patched/src/java/org/apache/torque/dsfactory/JndiDataSourceFactory.java:99: cannot resolve symbol symbol : method initialize (org.apache.commons.configuration.Configuration) location: class org.apache.torque.dsfactory.AbstractDataSourceFactory super.initialize(configuration); ^ Note: Some input files use or override a deprecated API. Note: Recompile with -deprecation for details. 1 error Any suggestions on what to do with the 3.1.1 tree? I'm going to try the "plasters over" patch for now... Thanks, Sean -- --- M. Sean Gilligan: 831-466-9788 x11 Catalla Systems, Inc. : http://www.vblogcentral.com --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Torque using Tomcat
> >Any suggestions on what to do with the 3.1.1 tree? I'm going to try the >"plasters over" patch for now... The "plaster patch" on the 3.1.1 release seems to solve my immediate problem, but I don't know what other problems might be lurking. -- Sean -- --- M. Sean Gilligan: 831-466-9788 x11 Catalla Systems, Inc. : http://www.vblogcentral.com --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Torque using Tomcat
> I really do want to use a QA'ed release for my alpha/beta/production > release, so I also tried copying JndiDataSourceFactory.java into the > 3.1.1 directory tree and am unable to do a build: > > java:compile: > [echo] Compiling to /Users/sean/netcvs/jakarta/db-torque-3-1-1- > patched/target/classes > [javac] Compiling 69 source files to > /Users/sean/netcvs/jakarta/db-torque-3-1-1-patched/target/classes > /Users/sean/netcvs/jakarta/db-torque-3-1-1- > patched/src/java/org/apache/torque/dsfactory/JndiDataSourceFactory. > java:99: cannot resolve symbol > symbol : method initialize (org.apache.commons.configuration.Configuration) > location: class org.apache.torque.dsfactory.AbstractDataSourceFactory > super.initialize(configuration); > ^ > Note: Some input files use or override a deprecated API. > Note: Recompile with -deprecation for details. > 1 error > > Any suggestions on what to do with the 3.1.1 tree? If you want to use JndiDataSourceFactory from the 3.1.1 tree, you also need the AbstractDataSourceFactory class and probably the other DataSourceFactories from the 3.1.1 tree. Maybe there are other dependencies in there, but I do not know the code well enough to tell without trying. If patching the 3.1.1 file with the change you found in the mail archives works, this should be fine. Thomas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Torque using Tomcat
"M. Sean Gilligan" <[EMAIL PROTECTED]> writes: Hi, >>"M. Sean Gilligan" <[EMAIL PROTECTED]> writes: >> >>I took a good look at the JndiDataSourceFactory and this patch just >>plasters over >What are the consequences of a patch that just "plasters over"? That one just made sure that the config loop was not run when the object was empty. The deeper problem is, that the loop _should_ be run when it is empty, but should have no effect (which it had, because after the loop, but inside the if (c == null) statement, the datasource was blindingly initialized. I cleaned the code to make sure that this does not happen. "Plastering over" in my personal speaking means that you simply add "if (xxx == null)" or "if (foo.isEmpty())" tests to a code logic without solving the inherent problems with the control flow. In this case, it was possible to add a null DataSource object which is a bad thing in itself. And it does not matter, _how_ we got there but that the program logic allows it. >>(there is also a good NPE chance in there) >I'm sorry, I'm not familiar with the acronym NPE, what does "NPE" mean? NullPointerException. :-) >>I would prefer having you test the TORQUE_3_1_BRANCH HEAD by doing >> >>cvs -d :pserver:[EMAIL PROTECTED]:/home/cvspublic checkout -r >>TORQUE_3_1_BRANCH db-torque >> >>and compiling it, >I did this and it fixed the problem, but... >> but if you are stuck to a released version due to QA >>reasons, simply take the released 3.1.1 version and replace the >>JndiDataSourceFactory.java file. >I really do want to use a QA'ed release for my alpha/beta/production release, >so I also tried copying JndiDataSourceFactory.java into the 3.1.1 directory >tree and am unable to do a build: Yep, now that you say it: You will probably need all the contents of the dsfactory package because the inheritance of the DataSource factories changed. For a released version, I do plan to put out 3.1.2 early next year (which means probably around end of January), depending on how much issues will crop up and what the other developers think. [...] >Any suggestions on what to do with the 3.1.1 tree? I'm going to try the >"plasters over" patch for now... I didn't mean to use "plaster over" as a derogatory term. I was just stating a fact. Sorry if you felt offended. Regards Henning -- Dipl.-Inf. (Univ.) Henning P. Schmiedehausen INTERMETA GmbH [EMAIL PROTECTED]+49 9131 50 654 0 http://www.intermeta.de/ RedHat Certified Engineer -- Jakarta Turbine Development -- hero for hire Linux, Java, perl, Solaris -- Consulting, Training, Development What is more important to you... [ ] Product Security or [ ] Quality of Sales and Marketing Support -- actual question from a Microsoft customer survey - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Torque using Tomcat
Hi, This is a late reply to this Tomcat problem. But I have no problems using Torque 3.1 (or 3.1.1 not sure) with Tomcat 4.x. The main application in which I do development is a jar file when it is started in Tomcat. If I make some changes, to the java files, I recompile and create a jar file and simply overwrite the jar file that Tomcat is using. When I do this, within a span of 10 secs, Tomcat realizes that the jar file has changed and restarts itself. Torque is reinitialized and everything works without a problem except the fact that the session before the restart is no more there. I don't need the session to exist between restarts, so it's not an issue for me. I can give more details on how I configure this if anyone is interested. Btw, yes I use a JNDI datasource that is provided by Tomcat. Thanks, Sarav On Thu, 2004-12-30 at 08:33 +, Henning P. Schmiedehausen wrote: > "M. Sean Gilligan" <[EMAIL PROTECTED]> writes: > > Hi, > > > >>"M. Sean Gilligan" <[EMAIL PROTECTED]> writes: > >> > >>I took a good look at the JndiDataSourceFactory and this patch just > >>plasters over > > >What are the consequences of a patch that just "plasters over"? > > That one just made sure that the config loop was not run when the > object was empty. The deeper problem is, that the loop _should_ be run > when it is empty, but should have no effect (which it had, because > after the loop, but inside the if (c == null) statement, the > datasource was blindingly initialized. > > I cleaned the code to make sure that this does not happen. "Plastering > over" in my personal speaking means that you simply add "if (xxx == > null)" or "if (foo.isEmpty())" tests to a code logic without solving > the inherent problems with the control flow. In this case, it was > possible to add a null DataSource object which is a bad thing in > itself. And it does not matter, _how_ we got there but that the > program logic allows it. > > >>(there is also a good NPE chance in there) > > >I'm sorry, I'm not familiar with the acronym NPE, what does "NPE" mean? > > NullPointerException. :-) > > >>I would prefer having you test the TORQUE_3_1_BRANCH HEAD by doing > >> > >>cvs -d :pserver:[EMAIL PROTECTED]:/home/cvspublic checkout -r > >>TORQUE_3_1_BRANCH db-torque > >> > >>and compiling it, > > >I did this and it fixed the problem, but... > > >> but if you are stuck to a released version due to QA > >>reasons, simply take the released 3.1.1 version and replace the > >>JndiDataSourceFactory.java file. > > >I really do want to use a QA'ed release for my alpha/beta/production > >release, so I also tried copying JndiDataSourceFactory.java into the 3.1.1 > >directory tree and am unable to do a build: > > Yep, now that you say it: You will probably need all the contents of > the dsfactory package because the inheritance of the DataSource > factories changed. > > For a released version, I do plan to put out 3.1.2 early next year > (which means probably around end of January), depending on how much > issues will crop up and what the other developers think. > > [...] > > >Any suggestions on what to do with the 3.1.1 tree? I'm going to try the > >"plasters over" patch for now... > > I didn't mean to use "plaster over" as a derogatory term. I was just > stating a fact. Sorry if you felt offended. > > Regards > Henning > -- Saravana Krishnan <[EMAIL PROTECTED]> - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Torque using Tomcat
I have exactly the same issue, that the session does not persist over a restart, except that I am *not* using JNDI. >From the Tomcat logs I can see that there is a serialisation issue associated with the application restart. The sessions used to persist but some changes in the application have caused it not longer to do so. Therefore, for me at least, I am fairly sure that this is an application issue and not a Torque/Struts/Tomcat issue. On 31-Dec-2004 Saravana Krishnan wrote: > Hi, > > This is a late reply to this Tomcat problem. But I have no problems > using Torque 3.1 (or 3.1.1 not sure) with Tomcat 4.x. The main > application in which I do development is a jar file when it is started > in Tomcat. If I make some changes, to the java files, I recompile and > create a jar file and simply overwrite the jar file that Tomcat is > using. When I do this, within a span of 10 secs, Tomcat realizes that > the jar file has changed and restarts itself. Torque is reinitialized > and everything works without a problem except the fact that the session > before the restart is no more there. I don't need the session to exist > between restarts, so it's not an issue for me. I can give more details > on how I configure this if anyone is interested. Btw, yes I use a JNDI > datasource that is provided by Tomcat. > > Thanks, > Sarav > > On Thu, 2004-12-30 at 08:33 +, Henning P. Schmiedehausen wrote: >> "M. Sean Gilligan" <[EMAIL PROTECTED]> writes: >> >> Hi, >> >> >> >>"M. Sean Gilligan" <[EMAIL PROTECTED]> writes: >> >> >> >>I took a good look at the JndiDataSourceFactory and this patch just >> >>plasters over >> >> >What are the consequences of a patch that just "plasters over"? >> >> That one just made sure that the config loop was not run when the >> object was empty. The deeper problem is, that the loop _should_ be run >> when it is empty, but should have no effect (which it had, because >> after the loop, but inside the if (c == null) statement, the >> datasource was blindingly initialized. >> >> I cleaned the code to make sure that this does not happen. "Plastering >> over" in my personal speaking means that you simply add "if (xxx == >> null)" or "if (foo.isEmpty())" tests to a code logic without solving >> the inherent problems with the control flow. In this case, it was >> possible to add a null DataSource object which is a bad thing in >> itself. And it does not matter, _how_ we got there but that the >> program logic allows it. >> >> >>(there is also a good NPE chance in there) >> >> >I'm sorry, I'm not familiar with the acronym NPE, what does "NPE" mean? >> >> NullPointerException. :-) >> >> >>I would prefer having you test the TORQUE_3_1_BRANCH HEAD by doing >> >> >> >>cvs -d :pserver:[EMAIL PROTECTED]:/home/cvspublic checkout -r >> >>TORQUE_3_1_BRANCH db-torque >> >> >> >>and compiling it, >> >> >I did this and it fixed the problem, but... >> >> >> but if you are stuck to a released version due to QA >> >>reasons, simply take the released 3.1.1 version and replace the >> >>JndiDataSourceFactory.java file. >> >> >I really do want to use a QA'ed release for my alpha/beta/production >> >release, so I also tried copying JndiDataSourceFactory.java into the 3.1.1 >> >directory tree and am unable to do a build: >> >> Yep, now that you say it: You will probably need all the contents of >> the dsfactory package because the inheritance of the DataSource >> factories changed. >> >> For a released version, I do plan to put out 3.1.2 early next year >> (which means probably around end of January), depending on how much >> issues will crop up and what the other developers think. >> >> [...] >> >> >Any suggestions on what to do with the 3.1.1 tree? I'm going to try the >> >"plasters over" patch for now... >> >> I didn't mean to use "plaster over" as a derogatory term. I was just >> stating a fact. Sorry if you felt offended. >> >> Regards >> Henning >> > -- > Saravana Krishnan <[EMAIL PROTECTED]> > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- Lead us not into temptation; we can find our own way. Raphael Mankin -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
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]
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]
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
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
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(); > > > >} > > > > > > > > > > > >} > > > >__
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
dValveContext.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 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.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" > Gesendet: 23.06.06 15:53:46 > An: "Apache Torque Users List" > 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., i
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
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 > or