Re: Torque connection problem

2006-09-11 Thread Jim Caserta
Frank,

I have run into a similar situation. If you are sure
you have the correct jar files, and no older versions,
make sure your classLoader policy is Multiple in
your server configuration. If it is set to Single,
you can be holding onto older classes. 

When I changed muine to Multipe, it corrected the
issue.

Jim

--- Frank Nguyen [EMAIL PROTECTED] wrote:

 Hi,

   I have a nasty connection prob b/w my app and
 MySQL and couldn'f figure out after 2 days. It
 worked with a diff app before but not the latest
 one. I have a simple servlet app trying to insert a
 row into a table. I did have a Torque init servlet
 and set it in WEB-INF/web.xml to start at boot time
 (from the tom cat log file, it appeared that it
 never started !!) but it wasn't sure if that is the
 problem. I did have WEB-INF/classes/Torque.xml setup
 correctly (cloned from a working stocktrack app from
 Struts) w/ right user name and password. 
 
 Based on the following error, what else could it be
 the problem that I need to check ? 
   
 Thanks in advance,
 
 
 
 
 
 java.lang.NoSuchMethodError: 

org.apache.torque.Torque.getConnection(Ljava/lang/String;)Ljava/sql/Connection;
   at 

org.apache.torque.util.Transaction.beginOptional(Transaction.java:118)
   at 

org.apache.torque.util.Transaction.begin(Transaction.java:100)
   at 

com.youcaddy.torque.BaseClub.save(BaseClub.java:1319)
   at 

com.youcaddy.torque.BaseClub.save(BaseClub.java:1300)
   at
 com.youcaddy.core.AddClub.doPost(AddClub.java:102)  
 
 at

javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
   at 

javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
   at 

org.apache.tomcat.facade.ServletHandler.doSTMService(ServletHandler.java:513)
   
 at 

org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java:567)
   at

org.apache.tomcat.core.Handler.invoke(Handler.java:322)
   
 at

org.apache.tomcat.core.Handler.service(Handler.java:235)
   at 

org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:485)
   at
 

org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:917)
   at 

org.apache.tomcat.core.ContextManager.service(ContextManager.java:833)
   at 

org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10Interceptor.java:176)
   at 

org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:494)
   at 

org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:516)
   
 at java.lang.Thread.run(Thread.java:536)  
 
 
 
 
 Frank Nguyen
 (408) 836-6235 (Cell)


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: GetConnection

2006-09-11 Thread John Hauf

Hello,

thank you for your help. It seems that I have found a solution that 
works for my problem with the Postgis-geometry-datatype.
The solution was quite simple: I patched the 
com.workingdogs.village.Value-class and can now get access to the 
underlying object of each value in my records.


But I still have a small question: The datatype of my postgis-geometry 
is Types.OTHER and this datatype is returned as String from the 
om.workingdogs.village.Value-class. Is there any possibility to access 
the underlying objets of a record without patching the value class?
I tried with the dataset()-method in the Result-class, but the recordSet 
is always empty.


John






Greg Monroe wrote:

Hmm, did some code spelunking and found that the accessTo...
parameter in dbcp only works for BasicDataSources.  Torque's 
SharedPoolDataSourceFactory uses DBCP's SharedPoolDataSource
which does not support this option.  So the class of connection 
object you get will be: 


  org.apache.commons.dbcp.cpdsadapter.ConnectionImpl

and this doesn't allow access to the real connection.

That said, one thing to try is subclassing the PostGres JDBC
Driver class and overriding the connect method to add your
'geometries' type.  Then use this subclass in your Torque
settings.



Johannes Hauf said:

Thank you. I tried with your suggestion and I think this 
would work if the database wouldn't be Postgres.
In the postgres-jdbc driver, the typeMap-mechanism seems not 
to be implemented yet.


Has anyone another idea?

John

Greg Monroe wrote:
Can you use the standard Connection interface TypeMap support to do 
the same thing rather than the PostGres extension?  E.g.


Map map = conn.getTypeMap();
map.put(geometry, Pggeometry.class); conn.setTypeMap(map);



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]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Torque connection problem

2006-09-11 Thread Frank Nguyen
Thanks, Tim. I am still debugging the problem :(  I am running Jarkata 3.1.1a, Torque 3.1 on Windows 2000. The irony of this problem is that I am running 2 webapps; mine and stocktrack (sample app from Struts book) Both are connecting to the same mysql, different databses, though. I also used the same setting for another old app using Struts. My old app and stocktrack worked, but not the new one (error attached). I tried to mimic as much as possible from the other 2 apps in term of config but no luck. The only major different b/w those 2 apps and new one is that old ones, I used Struts, but new one is just simple servlet. My %ant -f build-torque.xml sql/insert-sql/load-sql worked fine with MySQL. So, it must be the jarkata setting.Here is what I did. Please see if I've missed anything:- webapps/myproject/WEB-INF/web.xml to include a Torque init servlet, reading Torque.properties (below) at boot time and init. I checked
 jarkata log file. It started. (attached)  - webapps/myproject/WEB-INF/classes/Torque.properties (attached)   - webapps/myproject/WEB-INF/classes/com/myproject/core/TorqueInit.class (to start at boot time).But when I run my POST servlet to run a simple insert, I got the error (error file attached): It appeared that the servlet executed but failed in Torque, getConnection. What doesit mean NoSuchMethodError org.apache.torque.Torque.getConnection? I checked WEB-INF/lib andit has all the libs for Torque 3.1 there (Iused the same set of libsin torque 3.1gen I built for my app.What could be the problem ? Did I miss anything to set up the jarkata server ?THanks,Error: 500Location: /myproject/servlet/com.myproject.core.AddClubInternal Servlet Error:  java.lang.NoSuchMethodError:
 org.apache.torque.Torque.getConnection(Ljava/lang/String;)Ljava/sql/Connection;at org.apache.torque.util.Transaction.beginOptional(Transaction.java:118)at org.apache.torque.util.Transaction.begin(Transaction.java:100)at com.myproject.torque.BaseClub.save(BaseClub.java:1319)at com.myproject.torque.BaseClub.save(BaseClub.java:1300)at com.myproject.core.AddClub.doPost(AddClub.java:117)at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)at org.apache.tomcat.facade.ServletHandler.doSTMService(ServletHandler.java:513)at org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java:567)at org.apache.tomcat.core.Handler.invoke(Handler.java:322)at org.apache.tomcat.core.Handler.service(Handler.java:235)at
 org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:485)at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:917)at org.apache.tomcat.core.ContextManager.service(ContextManager.java:833)at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10Interceptor.java:176)at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:494)at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:516)at java.lang.Thread.run(Thread.java:536)Jim Caserta [EMAIL PROTECTED] wrote:  Frank,I have run into a similar situation. If you are sureyou have the correct jar files, and no older versions,make sure your classLoader policy is "Multiple" inyour server
 configuration. If it is set to "Single",you can be holding onto older classes. When I changed muine to Multipe, it corrected theissue.Jim--- Frank Nguyen <[EMAIL PROTECTED]>wrote: Hi,  I have a nasty connection prob b/w my app and MySQL and couldn'f figure out after 2 days. It worked with a diff app before but not the latest one. I have a simple servlet app trying to insert a row into a table. I did have a Torque init servlet and set it in WEB-INF/web.xml to start at boot time (from the tom cat log file, it appeared that it never started !!) but it wasn't sure if that is the problem. I did have WEB-INF/classes/Torque.xml setup correctly (cloned from a working stocktrack app from Struts) w/ right user name and password.   Based on the following error, what else could it be the problem that I need to
 check ?   Thanks in advance,  java.lang.NoSuchMethodError: org.apache.torque.Torque.getConnection(Ljava/lang/String;)Ljava/sql/Connection; at org.apache.torque.util.Transaction.beginOptional(Transaction.java:118) at org.apache.torque.util.Transaction.begin(Transaction.java:100) at com.youcaddy.torque.BaseClub.save(BaseClub.java:1319) at com.youcaddy.torque.BaseClub.save(BaseClub.java:1300) at com.youcaddy.core.AddClub.doPost(AddClub.java:102)   atjavax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.facade.ServletHandler.doSTMService(ServletHandler.java:513)  at
 org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java:567) atorg.apache.tomcat.core.Handler.invoke(Handler.java:322)  atorg.apache.tomcat.core.Handler.service(Handler.java:235) at