Hi, > I've successfully gone through the Torque tutorial, > and now I'm > trying to get com.kazmier.Bookstore to work in the > Tomcat Servlet > Container as a servlet. > > I. THINGS I'VE DONE SO FAR: > > 1. Made class Bookstore extend HttpServlet, > replacing main() with doGet(), > and System.out with PrintWriter instance; > 2. Make a hardcoded, absolute path reference to > Torque.properites > within class Bookstore: > Torque.init(abs.path.Torque.properties); > 3. Copied the jar files in $TORQUE-3.0-B3/lib to > $TOMCAT/lib > 4. Created the following directories: > > $TOMCAT/webapps/bookstore/WEB-INF/lib/bookstore.jar > $TOMCAT/webapps/bookstore/WEB-INF/web.xml > where bookstore.jar is the contents of > $TORQUE-3.0-B3/bin/classes. > 5. The contents of Torque.properties are: > > torque.dsfactory.myDatabase.factory=\ > > org.apache.torque.dsfactory.Jdbc2PoolDataSourceFactory > > torque.dsfactory.myDatabase.pool.defaultMaxActive=10 > > torque.dsfactory.myDatabase.pool.testOnBorrow=true > > torque.dsfactory.myDatabase.pool.validationQuery=SELECT > 1 > torque.dsfactory.myDatabase.connection.driver = > org.gjt.mm.mysql.Driver > torque.dsfactory.myDatabase.connection.url =\ > jdbc:mysql://localhost:12345/myDatabase > torque.dsfactory.penguin.connection.user = > adminuser > torque.dsfactory.penguin.connection.password = > adminpass > > 6. My browser URL is pointing to: > > > http://localhost:12345/myProject/servlet/Bookstore > > II. THE RESULT OF ABOVE: > > I keep on getting this exception: > java.lang.NullPointerException > at > com.kazmier.om.BasePublisher.save(BasePublisher.java:444) > at > com.kazmier.BookstoreServlet.doGet(BookstoreServlet.java:40) > > Using the |catalina.sh debug| option, the ACTUAL > exception is being thrown > at > org.apache.torque.util.BasePeer.getMapBuilder:2088. > Here is a piece of > the source code: > > 2076 try > 2077 { > 2078 MapBuilder mb = (MapBuilder) > mapBuilders.get(name); > 2079 // Use the 'double-check > pattern' for syncing > 2080 // caching of the MapBuilder. > 2081 if (mb == null) > 2082 { > 2083 synchronized (mapBuilders) > 2084 { > 2085 mb = (MapBuilder) > mapBuilders.get(name); > 2086 if (mb == null) > 2087 { > 2088 => mb=(MapBuilder) > Class.forName(name).newInstance(); > 2089 // Cache the > MapBuilder before it is built. > 2090 > mapBuilders.put(name, mb); > 2091 } > 2092 } > 2093 } > 2094 > > III. FINAL SUMMARY: > > Why can't a Bookstore servlet access a MapBuilder > instance?
__________________________________________________ Do You Yahoo!? HotJobs - Search Thousands of New Jobs http://www.hotjobs.com -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
