YES, the problem's SOLVED. Many thanks to Alvaro !. The problem was indeed 
duplication of torque jar files under WEB-INF/lib. I had torque-3.0-b2.jar,  
torque-3.1.jar, and torque-gen-3.1.jar (I lazily copied them from my dev env; 
torque-3.1/lib to my deploy area; torque-3.1/web/WEB-INF/lib and they built 
into jar file). After I removed all and keep only torque-3.1.jar, it worked 
like a champ
  

Alvaro Coronel <[EMAIL PROTECTED]> wrote:
  I once saw this kind of weird problem (nosuchmethod when you _know_ the class 
and method are there. It was due to a repeated .jar file in different folders. 
They were the same version, but the JVM got utterly confused. Removing the 
unnecessary one solved the problem. It wasn't anything related to Torque 
though...

Have you checked Tomcat's other lib folders?

Regards,
Álvaro Coronel.

Frank Nguyen wrote: 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 does it mean NoSuchMethodError 
org.apache.torque.Torque.getConnection? I checked WEB-INF/lib and it has all 
the libs for Torque 3.1 there (I used the same set of libs in torque 3.1 gen I 
built for my app. What could be the problem ? Did I miss anything to set up the 
jarkata server ?

THanks,

Error: 500
Location: /myproject/servlet/com.myproject.core.AddClub
Internal 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 wrote:
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 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]




Frank Nguyen
(408) 836-6235 (Cell)



torque-init
com.myproject.core.TorqueInit


torque-init-file


WEB-INF/classes/Torque.properties


1


package com.myproject.core;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
import java.io.IOException;
import org.apache.torque.Torque;
import com.myproject.torque.*;

public class TorqueInit extends HttpServlet {
boolean initted = false;

public void init() {
System.out.println("TorqueInit.init() executed");
String prefix = getServletContext().getRealPath("/");
System.out.println("TorqueInit.init(): prefix=" + prefix);
String file = getInitParameter("torque-init-file");
System.out.println("TorqueInit.init(): file=" + file);
if (initted == false) {
try {
Torque.init(prefix+file);
System.out.println("TorqueInit.init() completed");
}
catch (Exception ex) {
System.out.println("TorqueInit.init() failed");
System.out.println(ex);
}
}
initted = true;
}

}
Error: 500
Location: /myproject/servlet/com.myproject.core.AddClub
Internal 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)


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


---------------------------------
How low will we go? Check out Yahoo! Messenger’s low PC-to-Phone call rates.


Frank Nguyen
(408) 836-6235 (Cell)

Reply via email to