db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Allgaier <allgai...@yahoo.com>
Subject NullPointerException using two database pools
Date Mon, 17 Nov 2008 18:28:39 GMT
I'm trying to create two separate connection pools and trying to have a query run against the
second connection pool.  I get a null pointer exception when I try to run the modified code.
 It seems to pick up the datasource properly, but I cannot figure out what is creating the
NPE.  Thanks in advance for your help.

Adam :-)

The code:
-------------------------------------------------
//old code, default pool, works fine:
Criteria criteria = new Criteria();

//new code, new pool, fails with NullPointerException (see below for more)
Criteria criteria = new Criteria("newpool");

//new code, a datasource pool that doesn't exist in torque, fails with java.lang.NullPointerException:

//There was no DataSourceFactory configuredfor the connection boguspool
Criteria criteria = new Criteria("boguspool");


Here's the Torque.properties:
-------------------------------------------------

application.root = .
torque.database.type = mysql
torque.database.default = originalpool

# the default pool:
torque.database.name = originalpool
torque.database.originalpool.adapter=mysql
torque.dsfactory.originalpool.connection.driver = com.mysql.jdbc.Driver
torque.dsfactory.originalpool.connection.url = jdbc:mysql://127.0.0.1/mydb
torque.dsfactory.originalpool.factory= org.apache.torque.dsfactory.SharedPoolDataSourceFactory
...

# the new pool
torque.database.newpool.adapter=mysql
torque.dsfactory.newpool.connection.driver = com.mysql.jdbc.Driver
torque.dsfactory.newpool.connection.url = jdbc:mysql://127.0.0.1/mydb
torque.dsfactory.newpool.factory= org.apache.torque.dsfactory.SharedPoolDataSourceFactory
...

Here's the detailed exception:
-------------------------------------------------
java.lang.NullPointerException

javax.servlet.ServletException: org.apache.torque.TorqueException
	at com.caucho.jsp.PageContextImpl.handlePageException(PageContextImpl.java:1210)
	at _jsp._searchresults3__jsp._jspService(_searchresults3__jsp.java:369)
	at com.caucho.jsp.JavaPage.service(JavaPage.java:61)
	at com.caucho.jsp.Page.pageservice(Page.java:578)
	at com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:195)
	at com.caucho.server.webapp.DispatchFilterChain.doFilter(DispatchFilterChain.java:97)
	at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:266)
	at com.caucho.server.webapp.RequestDispatcherImpl.include(RequestDispatcherImpl.java:494)
	at com.caucho.server.webapp.RequestDispatcherImpl.include(RequestDispatcherImpl.java:358)
	at com.caucho.jsp.PageContextImpl.include(PageContextImpl.java:1008)
	at _jsp._search__jsp._jspService(search.jsp:61)
	at com.caucho.jsp.JavaPage.service(JavaPage.java:61)
	at com.caucho.jsp.Page.pageservice(Page.java:578)
	at com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:195)
	at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:187)
	at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:266)
	at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:270)
	at com.caucho.server.port.TcpConnection.run(TcpConnection.java:678)
	at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:721)
	at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:643)
	at java.lang.Thread.run(Thread.java:619)
Caused by: org.apache.torque.TorqueException
	at org.apache.torque.util.BasePeer.throwTorqueException(BasePeer.java:236)
	at org.apache.torque.util.BasePeer.doSelect(BasePeer.java:1374)
	at com.rolera.kys.model.BaseItemWarehousePeer.doSelectJoinAccountWarehouse(BaseItemWarehousePeer.java:849)
	at com.rolera.kys.model.ItemWarehouse.getSearchResults(ItemWarehouse.java:591)
	at _jsp._searchresults3__jsp._jspService(searchresults3.jsp:38)
	at com.caucho.jsp.JavaPage.service(JavaPage.java:61)
	at com.caucho.jsp.Page.pageservice(Page.java:578)
	at com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:195)
	at com.caucho.server.webapp.DispatchFilterChain.doFilter(DispatchFilterChain.java:97)
	at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:266)
	at com.caucho.server.webapp.RequestDispatcherImpl.include(RequestDispatcherImpl.java:494)
	at com.caucho.server.webapp.RequestDispatcherImpl.include(RequestDispatcherImpl.java:358)
	at com.caucho.jsp.PageContextImpl.include(PageContextImpl.java:1008)
	at _jsp._search__jsp._jspService(search.jsp:61)
	at com.caucho.jsp.JavaPage.service(JavaPage.java:61)
	at com.caucho.jsp.Page.pageservice(Page.java:578)
	at com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:195)
	at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:187)
	at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:266)
	at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:270)
	at com.caucho.server.port.TcpConnection.run(TcpConnection.java:678)
	at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:721)
	at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:643)
	at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NullPointerException
	at org.apache.torque.util.BasePeer.createQuery(BasePeer.java:1267)
	at org.apache.torque.util.BasePeer.createQueryString(BasePeer.java:984)
	at org.apache.torque.util.BasePeer.doSelect(BasePeer.java:1391)
	at org.apache.torque.util.BasePeer.doSelect(BasePeer.java:1368)
	at com.rolera.kys.model.BaseItemWarehousePeer.doSelectJoinAccountWarehouse(BaseItemWarehousePeer.java:849)
	at com.rolera.kys.model.ItemWarehouse.getSearchResults(ItemWarehouse.java:591)
	at _jsp._searchresults3__jsp._jspService(searchresults3.jsp:38)
	at com.caucho.jsp.JavaPage.service(JavaPage.java:61)
	at com.caucho.jsp.Page.pageservice(Page.java:578)
	at com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:195)
	at com.caucho.server.webapp.DispatchFilterChain.doFilter(DispatchFilterChain.java:97)
	at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:266)
	at com.caucho.server.webapp.RequestDispatcherImpl.include(RequestDispatcherImpl.java:494)
	at com.caucho.server.webapp.RequestDispatcherImpl.include(RequestDispatcherImpl.java:358)
	at com.caucho.jsp.PageContextImpl.include(PageContextImpl.java:1008)
	at _jsp._search__jsp._jspService(search.jsp:61)
	at com.caucho.jsp.JavaPage.service(JavaPage.java:61)
	at com.caucho.jsp.Page.pageservice(Page.java:578)
	at com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:195)
	at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:187)
	at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:266)
	at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:270)
	at com.caucho.server.port.TcpConnection.run(TcpConnection.java:678)
	at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:721)
	at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:643)

at java.lang.Thread.run(Thread.java:619)



      

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message