On Tue, Dec 02, 2003 at 02:23:21AM +0200, ListMan wrote:
> I don't get much out of the exception except stack trace:
>
> Entity.executeUpdate: java.lang.ClassCastException
> java.lang.ClassCastException
> at com.like.entity.Entity.executeUpdate(Entity.java:180)
> at com.like.entity.Document.save(Document.java:686)
> at
> org.apache.jsp.DocumentEditView$jsp._jspService(DocumentEditView$jsp.java:181)
> ...
Can you print stmt.getClass() just before the cast then? (usually you'll get
the concrete class name in the exception, not sure why it's not there in
this case).
> >Alternatively it may be a classloading difference between the two machines
> >-- the cast will fail if your code and the JDBC code use versions of
> >org.postgresql.PGStatement loaded by different classloaders.
>
> ALL code is running locally in my environment in single JVM. Only thing
> changed between tests is pgsql server address and jdbc-driver.
Doesn't matter how many JVMs are involved, you can get classloader-related
casting problems in a single JVM as soon as you have >1 classloader
involved. The safest thing to do is make sure that there are no copies of
PGStatement.class anywhere outside the postgresql driver jar (I'm guessing
that Tomcat includes the driver in a parent classloader of the app? If not
you may need to shift that class up to a common parent of the driver and
app..)
-O