Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Java stored procedure NoClassDefFoundError

Ramesh RFeb 5 2010 — edited Oct 15 2014
Hi All,
I have a webservice client created using Jdeveloper.
When tried to run the client in JDeveloper its running fine.
I have loaded the entire java class files into the Database.
I created a wrapper function in oracle and tried to invoke the webservice client its showing the Error
ORA- 298532: Java call terminated by uncaught java exception
java.lang.NoClassDefFoundError
I found in the user_objects and the class is available with 'VALID' status
What would be possible cause

Adding the update,
I have loaded all the required jar files also in to the database.
Actually i can able to connect to other webservices too, but not to a single webservice only...
The trace for the error is
>>
java.lang.NoClassDefFoundError
at HTTPClient.HTTPClientSSLFactory.class$(HTTPClientSSLFactory.java:68)
at HTTPClient.HTTPClientSSLFactory.<clinit>(HTTPClientSSLFactory.java:69)
>> at HTTPClient.HTTPConnection.getSSL(HTTPConnection.java:4080)
>> at HTTPClient.HTTPConnection.getSSLSocket(HTTPConnection.java:4126)
>> at HTTPClient.HTTPConnection.doConnect(HTTPConnection.java:3972)
>> at HTTPClient.HTTPConnection.sendRequest(HTTPConnection.java:3007)
>> at HTTPClient.HTTPConnection.handleRequest(HTTPConnection.java:2846)
>> at HTTPClient.HTTPConnection.setupRequest(HTTPConnection.java:2638)
>> at HTTPClient.HTTPConnection.Post(HTTPConnection.java:1110)
>> at oracle.soap.transport.http.OracleSOAPHTTPConnection.post(OracleSOAPHTTPConnection.java:904)
>> at oracle.soap.transport.http.OracleSOAPHTTPConnection.send(OracleSOAPHTTPConnection.java:713)
>> at org.apache.soap.messaging.Message.send(Message.java:125)
>>

Thanks,
Ramesh.R

Edited by: Ramesh_R on Feb 5, 2010 9:43 AM

Edited by: Ramesh_R on Feb 5, 2010 10:48 PM

Comments

_AZ_

i think i should elaborate that I do expect to receive only one row ( from the select). Anything more (or less) should be deemed an error.

Answer

Well, with the code you have above you *will* get an error: TypeError: 'NoneType' object is not iterable. The reason for that is that fetchone() returns None if there are no rows left to fetch. That error isn't too helpful, though. You will need to do something along these lines:

row = cursor.fetchone()

if row is None:

   raise Exception("Hey, only one row was returned!")

tim, val = row

You will want to replace the Exception message with something a bit more meaningful, of course!

Marked as Answer by _AZ_ · Sep 27 2020
_AZ_

thank you @Anthony . Is there a better approach that i should.could use ( vs fetchone or overall ) ?

You're welcome. That approach works and is reasoanble. If you want to check for too many rows as well, you can do fetchall() which will return an array and check the length of the array instead. If you're worried about getting back too many rows with fetchall() you can also use fetchmany(2) which will tell you if there are 0, 1, or 2 rows available.

1 - 4
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Mar 5 2010
Added on Feb 5 2010
0 comments
1,758 views