ClassCastException at pub.db.execSQL

webMethods Integration Server is ver 6.1
Oracle ver 8.1.7.x

Somebody in my dev team wrote a wm java service to piece together a sql statement depending on what information is available at run time.

I needed to search on a line number (VARCHAR2 in oracle table), so I mapped a String variable lineNumber to the service that builds the query.

Everything works fine until the execSQL step. I have stepped through the service and my lineNumber = 1. I have looked at the sql the java service builds and that looks ok.
"and line_number = ‘1’ "

I have copied the sql built from the service and pasted in an Oracle sql tool and the query runs fine.

But when wm execSQL runs, it errors with this ClassCastException
“java.lang.ClassCastException: java.lang.String
at pub.db.getConnection(db.java:965)
at pub.db.execSQL(db.java:396)”

Attached is screen print of pipeline and results just before I go to the service that builds the sql query and attempts to run it.
wm-ClassCastException-01.gif
wm-ClassCastException-02.gif
wm-ClassCastException-03.gif

Why are you not using JDBCAdapter wit IS6.1??

It shows that you are still with WmDB execSQL…Is you java service not converting the linenumber to string type?? This might be the reason you are getting Classcast exception. What is your JS code doing to prepare the sql query?? Also just make sure you pass the string datatype that DB query is expecting in the execSQL.My few cents…

HTH,
RMG

re: JDBCAdapter
The original code for our webMethods app was written way back using webMethods 3.x. As usual on these types of projects, you never have time to go back through legacy code and adjust it to take advantage of newer methods…

This ClassCastException only occurs when I run a smaller portion of the entire process using a “debug” sequence at the top of the flow whereby we populate the input to this portion of the service from the saved pipeline.

If I run this service all the way through from the beginning, no ClassCastException.

Just wondering if anybody knows why running a smaller portion of the code with saved pipeline data (should be the same data thats coming through when you run the whole thing…) would cause this?

Could be saved pipeline data is corrupted or datatypes are not stored properly in the saved xml,can you resave it again and test try??Well good to know it worked when you directly run the service with new inputs…

HTH,
RMG

Somebody had once told me that if you do not immediately drop all input variables used in a Java service that it can cause ClassCastExceptions and other problems like miscalculations.

So I went back and dropped all the variables thinking this was going to solve this problem.

But no, it still didn’t resolve it. Yes, it is good that at least it works when the entire service is run but it still bugs me that a saved pipeline would somehow have anything to do with this.

Just a head scratcher…:confused: