db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Artur Z" <arte...@o2.pl>
Subject Re: Problems with order by in citerias
Date Tue, 03 Aug 2004 15:40:38 GMT
look into FAQ:
17. Why addAscendingOrderByColumn launch a NullPointerException ?
Answer: Torque has not been correctly initialized for the database. The
properties file need the key torque.database.db.adapter=mysql where db is
the database name and mysql the database adapter used by torque for
accessing the base.
-- Alexandre Gouze
Answer: Another error may be at the OM generation. The database name was not
specifed in then XML schema file. <database defaultIdMethod="idbroker"
name="databaseName">
-- Jorge Ortega







----- Original Message -----
From: "Ströhm, Thomas" <Thomas.Stroehm@NDSatcom.com>
To: <torque-user@db.apache.org>
Sent: Tuesday, August 03, 2004 2:11 PM
Subject: Problems with order by in citerias


Hello !
I've got the following problem:

I tried to put an orderColumn with addAscendingOrderByColumn(ColumnName)  to
an Criteria.
This even works.
But when i try to execut this Query with XXXPeer.doSelect(crit)
I get the following error:



-->>



org.apache.torque.TorqueException: java.lang.NullPointerException
        at
org.apache.torque.util.BasePeer.throwTorqueException(BasePeer.java:190)
        at org.apache.torque.util.BasePeer.doSelect(BasePeer.java:1328)
        at
com.ndsatcom.skyarcs.easymonitor.database.BaseRcstPeer.doSelectVillageRecord
s(BaseRcstPeer.java:537)
        at
com.ndsatcom.skyarcs.easymonitor.database.BaseRcstPeer.doSelectVillageRecord
s(BaseRcstPeer.java:505)
        at
com.ndsatcom.skyarcs.easymonitor.database.BaseRcstPeer.doSelect(BaseRcstPeer
.java:474)
        at
org.apache.jsp.defaultRoot.terminals_jsp._jspService(terminals_jsp.java:108)
        at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
        at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3
11)
        at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:284)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:204)
        at
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter
.java:305)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:233)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:204)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:257)
        at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:151)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
        at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContext
Valve.java:245)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:199)
        at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:151)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:184
)
        at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:151)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164
)
        at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:149)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:156)
        at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:151)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
        at
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206)
        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:833)
        at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne
ction(Http11Protocol.java:732)
        at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:619)
        at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:688)
        at java.lang.Thread.run(Thread.java:534)
Caused by: java.lang.NullPointerException
        at org.apache.torque.util.BasePeer.createQuery(BasePeer.java:1231)
        at
org.apache.torque.util.BasePeer.createQueryString(BasePeer.java:938)
        at org.apache.torque.util.BasePeer.doSelect(BasePeer.java:1345)
        at org.apache.torque.util.BasePeer.doSelect(BasePeer.java:1322)
        ... 37 more

<<--

Here are my torque properties:



# -------------------------------------------------------------------
# $Id: Torque.properties,v 1.11 2003/08/19 19:09:44 mpoeschl Exp $
#
# This is the configuration file for Torque.
#
# Note that strings containing "," (comma) characters must backslash
# escape the comma (i.e. '\,')
#
# -------------------------------------------------------------------

torque.applicationRoot = .

# -------------------------------------------------------------------
#
#  L O G G I N G
#
# -------------------------------------------------------------------
# We use Log4J for all Torque logging and we embed the log4j
# properties within our application configuration.
# -------------------------------------------------------------------

# This first category is required and the category
# must be named 'default'. This is used for all logging
# where an explicit category is not specified.

log4j.category.org.apache.torque = ALL, org.apache.torque
log4j.appender.org.apache.torque = org.apache.log4j.FileAppender
log4j.appender.org.apache.torque.file =
${torque.applicationRoot}/logs/torque.log
log4j.appender.org.apache.torque.layout = org.apache.log4j.PatternLayout
log4j.appender.org.apache.torque.layout.conversionPattern = %d [%t] %-5p
%c - %m%n
log4j.appender.org.apache.torque.append = false

# -------------------------------------------------------------------
#
#  D E F A U L T S
#
# -------------------------------------------------------------------
#
# These values kick in, if you don't explicitly override them in your
# various database settings. At the moment they're only used if you
# configure the TorqueDataSourceFactory of the Jdbc2PoolDataSourceFactory
# as your data source provider. It does not work with JNDI.
#
# The example is shown for TorqueDataSource.
#
# -------------------------------------------------------------------

# If > 0, then a monitoring thread is started for every pool to
# display the number of created, available and checked out connections
# The interval is in seconds.
torque.defaults.pool.logInterval = 0

# Time to wait for a connection to the databas in Seconds.
torque.defaults.pool.connectionWaitTimeout = 10

# Maximum number of connections cached in a database definition. Note
# that, if you have multiple database definitions which access the
# same database URL, they don't share the connections but you have
# multiple pools and each has this maximum number. So if you have a
# connection licensed database engine, you must multiply this number by
# the number of times you use a specific database URL.
torque.defaults.pool.defaultMaxConnections = 80

# Lifetime of a connection in the pool. Defaults to one hour
torque.defaults.pool.maxExpiryTime = 3600

# Sets the driver for the data sources.
torque.defaults.connection.driver = orcale.jdbc.driver.OracleDriver

# Sets the URL for the datasources
torque.defaults.connection.url = jdbc:oracle:thin:@pc1027:1521:skyarcs

# Sets login and password for the data sources.
torque.defaults.connection.user = xxxx
torque.defaults.connection.password = xxxx

# -------------------------------------------------------------------
#
#  T O R Q U E  P R O P E R T I E S
#
# -------------------------------------------------------------------
# These are your database settings. Look in the
# org.apache.torque.pool.* packages for more information.
#
# The parameters to connect to the default database.  You MUST
# configure these properly.
# -------------------------------------------------------------------

torque.database.default=skyarcs
torque.database.skyarcs.adapter=oracle

## Using torque's old pool
## this implementation is deprecated and has some known bugs!!!!
## you should use commons-dbcp
#torque.dsfactory.bookstore.factory=org.apache.torque.dsfactory.TorqueDataSo
urceFactory
#torque.dsfactory.bookstore.pool.defaultMaxConnections=10
#torque.dsfactory.bookstore.pool.maxExpiryTime=3600
#torque.dsfactory.bookstore.pool.connectionWaitTimeout=10
#torque.dsfactory.bookstore.connection.driver = org.gjt.mm.mysql.Driver
#torque.dsfactory.bookstore.connection.url =
jdbc:mysql://localhost:3306/torque
#torque.dsfactory.bookstore.connection.user = user
#torque.dsfactory.bookstore.connection.password = password

## Using commons-dbcp
torque.dsfactory.skyarcs.factory=org.apache.torque.dsfactory.SharedPoolDataS
ourceFactory
torque.dsfactory.skyarcs.pool.defaultMaxActive=10
torque.dsfactory.skyarcs.pool.testOnBorrow=true
torque.dsfactory.skyarcs.pool.validationQuery=SELECT 1
torque.dsfactory.skyarcs.connection.driver = oracle.jdbc.driver.OracleDriver
torque.dsfactory.skyarcs.connection.url =
jdbc:oracle:thin:@pc1027:1521:skyarcs
torque.dsfactory.skyarcs.connection.user = xxxxx
torque.dsfactory.skyarcs.connection.password = nmdxxxxxb




## Using jndi
#torque.dsfactory.bookstore.factory=org.apache.torque.dsfactory.JndiDataSour
ceFactory
#torque.dsfactory.bookstore.jndi.path=jdbc/bookstore
#torque.dsfactory.bookstore.jndi.java.naming.factory.initial =
org.apache.naming.java.javaURLContextFactory
#torque.dsfactory.bookstore.jndi.java.naming.factory.url.pkgs =
org.apache.naming

#torque.dsfactory.bookstore.datasource.classname=org.apache.torque.pool.Torq
ueClassicDataSource
#torque.dsfactory.bookstore.datasource.dataSourceName=jdbc/DBbookstore
#torque.dsfactory.bookstore.datasource.jndiEnvironment.java.naming.factory.i
nitial = org.apache.naming.java.javaURLContextFactory
#torque.dsfactory.bookstore.datasource.jndiEnvironment.java.naming.factory.u
rl.pkgs = org.apache.naming
#torque.dsfactory.bookstore.datasource.defaultMaxConnections=10

## ConnectionPoolDataSource
#torque.dsfactory.bookstore.factory=org.apache.torque.dsfactory.JndiDataSour
ceFactory
#torque.dsfactory.bookstore.jndi.path=jdbc/DBbookstore
#torque.dsfactory.bookstore.jndi.java.naming.factory.initial =
org.apache.naming.java.javaURLContextFactory
#torque.dsfactory.bookstore.jndi.java.naming.factory.url.pkgs =
org.apache.naming
#torque.dsfactory.bookstore.datasource.classname=org.apache.commons.dbcp.cpd
sadapter.DriverAdapterCPDS
#torque.dsfactory.bookstore.datasource.driver = org.gjt.mm.mysql.Driver
#torque.dsfactory.bookstore.datasource.url =
jdbc:mysql://localhost:3306/torque
#torque.dsfactory.bookstore.datasource.user = user
#torque.dsfactory.bookstore.datasource.password = password

# Determines if the quantity column of the IDBroker's id_table should
# be increased automatically if requests for ids reaches a high
# volume.

torque.idbroker.cleverquantity=true

# Determines whether the managers cache instances of the business objects.
# And also whether the MethodResultCache will really cache results.

torque.manager.useCache = true


Can anybody hel me ??
--
Thomas Ströhm


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



---------------------------------------------------------------------
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