RE: [OT] getBlob() error in Tomcat

2004-04-06 Thread Summers, Bert W.
You need to cast the ResultSet to the Oracle specify ResultSet

-Original Message-
From: Kumar Abhay-CAK203C [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 06, 2004 11:01 AM
To: Tomcat Users List
Subject: [OT] getBlob() error in Tomcat
Importance: High


Hi,

Any idea why this error is coming in runtime?

Servlet) - FileDisplayServlet.doPost()
java.lang.AbstractMethodError:
oracle.jdbc.driver.OracleResultSetImpl.getBlob(Ljava/lang/String;)Ljava/sql/
Blob;
at
org.apache.commons.dbcp.DelegatingResultSet.getBlob(DelegatingResultSet.java
:318)
at
com.mot.iDEN.webapp.oes.servlet.FileDisplayServlet.readBlob(FileDisplayServl
et.java:169)

I am trying to display a image that is stored in a BLOB field in Oracle. I
am using connection pooling and classes12.jar

Servlet Code 



private void readBlob
(
HttpServletRequest request,
HttpServletResponse response,
long aFeatureId,
String aFileName,
String aUserId
)
throws SQLException,IOException
{
Connection conn = null;
ResultSet result = null;
PreparedStatement prepStmt = null;
java.io.InputStream in = null;
java.sql.Blob myBlob = null;
FileUploadFactory uploadFactory = new FileUploadFactory();

try
{
conn = config_.getEstimationConnection(false);
String sql = "";
sql =
"   SELECT "+
"   FILE_IMAGE "+
"   FROM "+
"   OES_FEATURE_DETAILS "+
"   WHERE "+
"   FEATURE_ID = "+aFeatureId;

log_.debug("SQL:==="+sql);
log_.debug("result=" + result);
prepStmt = conn.prepareStatement(sql);
result = prepStmt.executeQuery();
if (result != null && result.next())
{
//get the file ext
String strDocExt = "";
try
{
strDocExt =
uploadFactory.getFileType(aFileName, aUserId);
}
catch(Exception e)
{
log_.debug("Exception is"+e);
}
//get the file length
int intCountBytes = 0;
String strPrpValue = null;
//set the mimetype
ResourceBundle mimetype =
ResourceBundle.getBundle("mimes");
strPrpValue =
mimetype.getString(strDocExt.toLowerCase());
log_.debug("Value=" + strPrpValue);
if (strPrpValue != null)
{

response.setContentType(strPrpValue);

response.setHeader("Content-Disposition", "inline; filename=" + aFileName);
}
myBlob = result.getBlob("FILE_IMAGE");
//get the inputStream
in = myBlob.getBinaryStream();
/*Get the Output Stream*/
if (in != null)
{
generatePresentation(in, response);
in.close();
}
}
}
catch (SQLException sqle)
{
throw new
SQLException("FileDisplayServlet.readBlob", "" + sqle.getErrorCode());
}
catch (IOException io)
{
throw new
IOException("FileDisplayServlet.readBlob");
}
finally
{
try
{
if (result != null)
{
result.close();
}

RE: [OT] getBlob() error in Tomcat

2004-04-06 Thread Kumar Abhay-CAK203C
I will appreciate you if you can tell me how ?

Best Regards
Abhay Kumar

-Original Message-
From: Summers, Bert W. [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 06, 2004 1:05 PM
To: Tomcat Users List
Subject: RE: [OT] getBlob() error in Tomcat


You need to cast the ResultSet to the Oracle specify ResultSet

-Original Message-
From: Kumar Abhay-CAK203C [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 06, 2004 11:01 AM
To: Tomcat Users List
Subject: [OT] getBlob() error in Tomcat
Importance: High


Hi,

Any idea why this error is coming in runtime?

Servlet) - FileDisplayServlet.doPost()
java.lang.AbstractMethodError: 
oracle.jdbc.driver.OracleResultSetImpl.getBlob(Ljava/lang/String;)Ljava/sql/
Blob;
at org.apache.commons.dbcp.DelegatingResultSet.getBlob(DelegatingResultSet.java
:318)
at com.mot.iDEN.webapp.oes.servlet.FileDisplayServlet.readBlob(FileDisplayServl
et.java:169)

I am trying to display a image that is stored in a BLOB field in Oracle. I am using 
connection pooling and classes12.jar

Servlet Code 



private void readBlob
(
HttpServletRequest request,
HttpServletResponse response,
long aFeatureId,
String aFileName,
String aUserId
)
throws SQLException,IOException
{
Connection conn = null;
ResultSet result = null;
PreparedStatement prepStmt = null;
java.io.InputStream in = null;
java.sql.Blob myBlob = null;
FileUploadFactory uploadFactory = new FileUploadFactory();

try
{
conn = config_.getEstimationConnection(false);
String sql = "";
sql =
"   SELECT "+
"   FILE_IMAGE "+
"   FROM "+
"   OES_FEATURE_DETAILS "+
"   WHERE "+
"   FEATURE_ID = "+aFeatureId;

log_.debug("SQL:==="+sql);
log_.debug("result=" + result);
prepStmt = conn.prepareStatement(sql);
result = prepStmt.executeQuery();
if (result != null && result.next())
{
//get the file ext
String strDocExt = "";
try
{
strDocExt =
uploadFactory.getFileType(aFileName, aUserId);
}
catch(Exception e)
{
log_.debug("Exception is"+e);
}
//get the file length
int intCountBytes = 0;
String strPrpValue = null;
//set the mimetype
ResourceBundle mimetype = 
ResourceBundle.getBundle("mimes");
strPrpValue =
mimetype.getString(strDocExt.toLowerCase());
log_.debug("Value=" + strPrpValue);
if (strPrpValue != null)
{

response.setContentType(strPrpValue);

response.setHeader("Content-Disposition", "inline; filename=" + aFileName);
}
myBlob = result.getBlob("FILE_IMAGE");
//get the inputStream
in = myBlob.getBinaryStream();
/*Get the Output Stream*/
if (in != null)
{
generatePresentation(in, response);
in.close();
}
}
}
catch (SQLException sqle)
{
throw new
SQLException("FileDisplayServlet.readBlob", "" + sqle.getErrorCode());
}
catc

RE: [OT] getBlob() error in Tomcat

2004-04-06 Thread Mike Curwen
The javadoc for that error suggests:
"this error can only occur at run time if the definition of some class
has incompatibly changed since the currently executing method was last
compiled."
 
So is the version of classes12.jar that you used to compile the code,
the exact same version that is being used to run it ?
 
As for casting..

OracleResultSetClass foo = (OracleResultSetClass)result;

obviously, you'd need to replace 'OracleResultSetClass' with the actual
name of the class.


> -Original Message-
> From: Kumar Abhay-CAK203C [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, April 06, 2004 1:43 PM
> To: 'Tomcat Users List'
> Subject: RE: [OT] getBlob() error in Tomcat
> Importance: High
> 
> 
> I will appreciate you if you can tell me how ?
> 
> Best Regards
> Abhay Kumar
> 
> -Original Message-
> From: Summers, Bert W. [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, April 06, 2004 1:05 PM
> To: Tomcat Users List
> Subject: RE: [OT] getBlob() error in Tomcat
> 
> 
> You need to cast the ResultSet to the Oracle specify ResultSet
> 
> -Original Message-
> From: Kumar Abhay-CAK203C [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, April 06, 2004 11:01 AM
> To: Tomcat Users List
> Subject: [OT] getBlob() error in Tomcat
> Importance: High
> 
> 
> Hi,
> 
> Any idea why this error is coming in runtime?
> 
> Servlet) - FileDisplayServlet.doPost()
> java.lang.AbstractMethodError: 
> oracle.jdbc.driver.OracleResultSetImpl.getBlob(Ljava/lang/Stri
> ng;)Ljava/sql/
> Blob;
> at 
> org.apache.commons.dbcp.DelegatingResultSet.getBlob(Delegating
> ResultSet.java
> :318)
> at 
> com.mot.iDEN.webapp.oes.servlet.FileDisplayServlet.readBlob(Fi
> leDisplayServl
> et.java:169)
> 
> I am trying to display a image that is stored in a BLOB field 
> in Oracle. I am using connection pooling and classes12.jar
> 
> Servlet Code 
> --
> --
> --
> --
> 
>   private void readBlob
>   (
>   HttpServletRequest request,
>   HttpServletResponse response,
>   long aFeatureId,
>   String aFileName,
>   String aUserId
>   )
>   throws SQLException,IOException
>   {
>   Connection conn = null;
>   ResultSet result = null;
>   PreparedStatement prepStmt = null;
>   java.io.InputStream in = null;
>   java.sql.Blob myBlob = null;
>   FileUploadFactory uploadFactory = new 
> FileUploadFactory();
> 
>   try
>   {
>   conn = config_.getEstimationConnection(false);
>   String sql = "";
>   sql =
>   "   SELECT "+
>   "   FILE_IMAGE "+
>   "   FROM "+
>   "   OES_FEATURE_DETAILS "+
>   "   WHERE "+
>   "   FEATURE_ID = 
> "+aFeatureId;
> 
>   log_.debug("SQL:==="+sql);
>   log_.debug("result=" + result);
>   prepStmt = conn.prepareStatement(sql);
>   result = prepStmt.executeQuery();
>   if (result != null && result.next())
>   {
>   //get the file ext
>   String strDocExt = "";
>   try
>   {
>   strDocExt =
> uploadFactory.getFileType(aFileName, aUserId);
>   }
>   catch(Exception e)
>   {
>   log_.debug("Exception is"+e);
>   }
>   //get the file length
>   int intCountBytes = 0;
>   String strPrpValue = null;
>   //set the mimetype
>   ResourceBundle mimetype = 
> ResourceBundle.getBundle("mimes"

RE: [OT] getBlob() error in Tomcat

2004-04-06 Thread Kumar Abhay-CAK203C
My classpath is 

.;C:\Estimation;C:\Tomcat\common\lib\servlet.jar;C:\Tomcat\common\lib\mail.jar;C:\Tomcat\common\lib\activation.jar;C:\Tomcat\common\lib\jndi.jar;C:\Tomcat\common\lib\classes12.jar;C:\Tomcat\common\lib\commons-collections-3.0.jar;C:\Tomcat\common\lib\commons-dbcp-1.1.jar;C:\Tomcat\common\lib\commons-pool-1.1.jar;C:\Tomcat\common\lib\jdbc2_0-stdext.jar;C:\Tomcat\common\lib\ojdbc14.jar;C:\Tomcat\common\lib\classes111.jar;C:\Tomcat\common\lib\ocrs12.jar;

Best Regards
Abhay Kumar


-Original Message-
From: Mike Curwen [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 06, 2004 1:59 PM
To: 'Tomcat Users List'
Subject: RE: [OT] getBlob() error in Tomcat


The javadoc for that error suggests:
"this error can only occur at run time if the definition of some class has 
incompatibly changed since the currently executing method was last compiled."
 
So is the version of classes12.jar that you used to compile the code, the exact same 
version that is being used to run it ?
 
As for casting..

OracleResultSetClass foo = (OracleResultSetClass)result;

obviously, you'd need to replace 'OracleResultSetClass' with the actual name of the 
class.


> -Original Message-
> From: Kumar Abhay-CAK203C [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, April 06, 2004 1:43 PM
> To: 'Tomcat Users List'
> Subject: RE: [OT] getBlob() error in Tomcat
> Importance: High
> 
> 
> I will appreciate you if you can tell me how ?
> 
> Best Regards
> Abhay Kumar
> 
> -Original Message-
> From: Summers, Bert W. [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, April 06, 2004 1:05 PM
> To: Tomcat Users List
> Subject: RE: [OT] getBlob() error in Tomcat
> 
> 
> You need to cast the ResultSet to the Oracle specify ResultSet
> 
> -Original Message-
> From: Kumar Abhay-CAK203C [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, April 06, 2004 11:01 AM
> To: Tomcat Users List
> Subject: [OT] getBlob() error in Tomcat
> Importance: High
> 
> 
> Hi,
> 
> Any idea why this error is coming in runtime?
> 
> Servlet) - FileDisplayServlet.doPost()
> java.lang.AbstractMethodError:
> oracle.jdbc.driver.OracleResultSetImpl.getBlob(Ljava/lang/Stri
> ng;)Ljava/sql/
> Blob;
> at 
> org.apache.commons.dbcp.DelegatingResultSet.getBlob(Delegating
> ResultSet.java
> :318)
> at 
> com.mot.iDEN.webapp.oes.servlet.FileDisplayServlet.readBlob(Fi
> leDisplayServl
> et.java:169)
> 
> I am trying to display a image that is stored in a BLOB field
> in Oracle. I am using connection pooling and classes12.jar
> 
> Servlet Code
> --
> --
> --
> --
> 
>   private void readBlob
>   (
>   HttpServletRequest request,
>   HttpServletResponse response,
>   long aFeatureId,
>   String aFileName,
>   String aUserId
>   )
>   throws SQLException,IOException
>   {
>   Connection conn = null;
>   ResultSet result = null;
>   PreparedStatement prepStmt = null;
>   java.io.InputStream in = null;
>   java.sql.Blob myBlob = null;
>   FileUploadFactory uploadFactory = new 
> FileUploadFactory();
> 
>   try
>   {
>   conn = config_.getEstimationConnection(false);
>   String sql = "";
>   sql =
>   "   SELECT "+
>   "   FILE_IMAGE "+
>   "   FROM "+
>   "   OES_FEATURE_DETAILS "+
>   "   WHERE "+
>   "   FEATURE_ID = 
> "+aFeatureId;
> 
>   log_.debug("SQL:==="+sql);
>   log_.debug("result=" + result);
>   prepStmt = conn.prepareStatement(sql);
>   result = prepStmt.executeQuery();
>   if (result != null && result.next())
>   {
>   //get the file ext
>   String strDocExt = "";
>   try
>   {
>

RE: [OT] getBlob() error in Tomcat

2004-04-06 Thread Kumar Abhay-CAK203C
Thanks for the suggestions,

My question is how I can check that both the versions are same, I have classes12.jar 
in common/lib and that is set in system classpath. 
How to find the OracleResultSEt class to cast result?

Best Regards
Abhay Kumar

-Original Message-
From: Mike Curwen [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 06, 2004 1:59 PM
To: 'Tomcat Users List'
Subject: RE: [OT] getBlob() error in Tomcat


The javadoc for that error suggests:
"this error can only occur at run time if the definition of some class has 
incompatibly changed since the currently executing method was last compiled."
 
So is the version of classes12.jar that you used to compile the code, the exact same 
version that is being used to run it ?
 
As for casting..

OracleResultSetClass foo = (OracleResultSetClass)result;

obviously, you'd need to replace 'OracleResultSetClass' with the actual name of the 
class.


> -Original Message-
> From: Kumar Abhay-CAK203C [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, April 06, 2004 1:43 PM
> To: 'Tomcat Users List'
> Subject: RE: [OT] getBlob() error in Tomcat
> Importance: High
> 
> 
> I will appreciate you if you can tell me how ?
> 
> Best Regards
> Abhay Kumar
> 
> -Original Message-
> From: Summers, Bert W. [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, April 06, 2004 1:05 PM
> To: Tomcat Users List
> Subject: RE: [OT] getBlob() error in Tomcat
> 
> 
> You need to cast the ResultSet to the Oracle specify ResultSet
> 
> -Original Message-
> From: Kumar Abhay-CAK203C [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, April 06, 2004 11:01 AM
> To: Tomcat Users List
> Subject: [OT] getBlob() error in Tomcat
> Importance: High
> 
> 
> Hi,
> 
> Any idea why this error is coming in runtime?
> 
> Servlet) - FileDisplayServlet.doPost()
> java.lang.AbstractMethodError:
> oracle.jdbc.driver.OracleResultSetImpl.getBlob(Ljava/lang/Stri
> ng;)Ljava/sql/
> Blob;
> at 
> org.apache.commons.dbcp.DelegatingResultSet.getBlob(Delegating
> ResultSet.java
> :318)
> at 
> com.mot.iDEN.webapp.oes.servlet.FileDisplayServlet.readBlob(Fi
> leDisplayServl
> et.java:169)
> 
> I am trying to display a image that is stored in a BLOB field
> in Oracle. I am using connection pooling and classes12.jar
> 
> Servlet Code
> --
> --
> --
> --
> 
>   private void readBlob
>   (
>   HttpServletRequest request,
>   HttpServletResponse response,
>   long aFeatureId,
>   String aFileName,
>   String aUserId
>   )
>   throws SQLException,IOException
>   {
>   Connection conn = null;
>   ResultSet result = null;
>   PreparedStatement prepStmt = null;
>   java.io.InputStream in = null;
>   java.sql.Blob myBlob = null;
>   FileUploadFactory uploadFactory = new 
> FileUploadFactory();
> 
>   try
>   {
>   conn = config_.getEstimationConnection(false);
>   String sql = "";
>   sql =
>   "   SELECT "+
>   "   FILE_IMAGE "+
>   "   FROM "+
>   "   OES_FEATURE_DETAILS "+
>   "   WHERE "+
>   "   FEATURE_ID = 
> "+aFeatureId;
> 
>   log_.debug("SQL:==="+sql);
>   log_.debug("result=" + result);
>   prepStmt = conn.prepareStatement(sql);
>   result = prepStmt.executeQuery();
>   if (result != null && result.next())
>   {
>   //get the file ext
>   String strDocExt = "";
>   try
>   {
>   strDocExt =
> uploadFactory.getFileType(aFileName, aUserId);
>   }
>   catch(Exception e)
>   {
>   l

RE: [OT] getBlob() error in Tomcat

2004-04-06 Thread Summers, Bert W.
Unjar the classes12.jar file and look for it.
There should be some ResultSet class in there.

The jdbc class that come with Java do not implement the getBLOB method,
hence the abstract violation.
The Oracle driver in the case has the implemented method, of course you are
now tied to Oracle in your code.

-Original Message-
From: Kumar Abhay-CAK203C [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 06, 2004 12:15 PM
To: 'Tomcat Users List'
Subject: RE: [OT] getBlob() error in Tomcat
Importance: High


Thanks for the suggestions,

My question is how I can check that both the versions are same, I have
classes12.jar in common/lib and that is set in system classpath. 
How to find the OracleResultSEt class to cast result?

Best Regards
Abhay Kumar

-Original Message-
From: Mike Curwen [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 06, 2004 1:59 PM
To: 'Tomcat Users List'
Subject: RE: [OT] getBlob() error in Tomcat


The javadoc for that error suggests:
"this error can only occur at run time if the definition of some class has
incompatibly changed since the currently executing method was last
compiled."
 
So is the version of classes12.jar that you used to compile the code, the
exact same version that is being used to run it ?
 
As for casting..

OracleResultSetClass foo = (OracleResultSetClass)result;

obviously, you'd need to replace 'OracleResultSetClass' with the actual name
of the class.


> -Original Message-
> From: Kumar Abhay-CAK203C [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, April 06, 2004 1:43 PM
> To: 'Tomcat Users List'
> Subject: RE: [OT] getBlob() error in Tomcat
> Importance: High
> 
> 
> I will appreciate you if you can tell me how ?
> 
> Best Regards
> Abhay Kumar
> 
> -Original Message-
> From: Summers, Bert W. [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, April 06, 2004 1:05 PM
> To: Tomcat Users List
> Subject: RE: [OT] getBlob() error in Tomcat
> 
> 
> You need to cast the ResultSet to the Oracle specify ResultSet
> 
> -Original Message-
> From: Kumar Abhay-CAK203C [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, April 06, 2004 11:01 AM
> To: Tomcat Users List
> Subject: [OT] getBlob() error in Tomcat
> Importance: High
> 
> 
> Hi,
> 
> Any idea why this error is coming in runtime?
> 
> Servlet) - FileDisplayServlet.doPost()
> java.lang.AbstractMethodError: 
> oracle.jdbc.driver.OracleResultSetImpl.getBlob(Ljava/lang/Stri
> ng;)Ljava/sql/
> Blob;
> at
> org.apache.commons.dbcp.DelegatingResultSet.getBlob(Delegating
> ResultSet.java
> :318)
> at 
> com.mot.iDEN.webapp.oes.servlet.FileDisplayServlet.readBlob(Fi
> leDisplayServl
> et.java:169)
> 
> I am trying to display a image that is stored in a BLOB field in 
> Oracle. I am using connection pooling and classes12.jar
> 
> Servlet Code
> --
> --
> --
> --
> 
>   private void readBlob
>   (
>   HttpServletRequest request,
>   HttpServletResponse response,
>   long aFeatureId,
>   String aFileName,
>   String aUserId
>   )
>   throws SQLException,IOException
>   {
>   Connection conn = null;
>   ResultSet result = null;
>   PreparedStatement prepStmt = null;
>   java.io.InputStream in = null;
>   java.sql.Blob myBlob = null;
>   FileUploadFactory uploadFactory = new
> FileUploadFactory();
> 
>   try
>   {
>   conn = config_.getEstimationConnection(false);
>   String sql = "";
>   sql =
>   "   SELECT "+
>   "   FILE_IMAGE "+
>   "   FROM "+
>   "   OES_FEATURE_DETAILS "+
>   "   WHERE "+
>   "   FEATURE_ID = 
> "+aFeatureId;
> 
>   log_.debug("SQL:==="+sql);
>   log_.debug("result=" + result);
>   prepStmt = conn.prepareStatement(sql);
>   result = prepStmt.executeQuery();
>  

RE: [OT] getBlob() error in Tomcat

2004-04-06 Thread Kumar Abhay-CAK203C
Still not working 

I am using 
myBlob = ((OracleResultSet)result).getBLOB(1);

It is giving Class Cast Exception

Best Regards
Abhay Kumar

-Original Message-
From: Summers, Bert W. [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 06, 2004 2:35 PM
To: Tomcat Users List
Subject: RE: [OT] getBlob() error in Tomcat


Unjar the classes12.jar file and look for it.
There should be some ResultSet class in there.

The jdbc class that come with Java do not implement the getBLOB method, hence the 
abstract violation. The Oracle driver in the case has the implemented method, of 
course you are now tied to Oracle in your code.

-Original Message-
From: Kumar Abhay-CAK203C [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 06, 2004 12:15 PM
To: 'Tomcat Users List'
Subject: RE: [OT] getBlob() error in Tomcat
Importance: High


Thanks for the suggestions,

My question is how I can check that both the versions are same, I have classes12.jar 
in common/lib and that is set in system classpath. 
How to find the OracleResultSEt class to cast result?

Best Regards
Abhay Kumar

-Original Message-
From: Mike Curwen [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 06, 2004 1:59 PM
To: 'Tomcat Users List'
Subject: RE: [OT] getBlob() error in Tomcat


The javadoc for that error suggests:
"this error can only occur at run time if the definition of some class has 
incompatibly changed since the currently executing method was last compiled."
 
So is the version of classes12.jar that you used to compile the code, the exact same 
version that is being used to run it ?
 
As for casting..

OracleResultSetClass foo = (OracleResultSetClass)result;

obviously, you'd need to replace 'OracleResultSetClass' with the actual name of the 
class.


> -Original Message-
> From: Kumar Abhay-CAK203C [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, April 06, 2004 1:43 PM
> To: 'Tomcat Users List'
> Subject: RE: [OT] getBlob() error in Tomcat
> Importance: High
> 
> 
> I will appreciate you if you can tell me how ?
> 
> Best Regards
> Abhay Kumar
> 
> -Original Message-
> From: Summers, Bert W. [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, April 06, 2004 1:05 PM
> To: Tomcat Users List
> Subject: RE: [OT] getBlob() error in Tomcat
> 
> 
> You need to cast the ResultSet to the Oracle specify ResultSet
> 
> -Original Message-
> From: Kumar Abhay-CAK203C [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, April 06, 2004 11:01 AM
> To: Tomcat Users List
> Subject: [OT] getBlob() error in Tomcat
> Importance: High
> 
> 
> Hi,
> 
> Any idea why this error is coming in runtime?
> 
> Servlet) - FileDisplayServlet.doPost()
> java.lang.AbstractMethodError:
> oracle.jdbc.driver.OracleResultSetImpl.getBlob(Ljava/lang/Stri
> ng;)Ljava/sql/
> Blob;
> at
> org.apache.commons.dbcp.DelegatingResultSet.getBlob(Delegating
> ResultSet.java
> :318)
> at 
> com.mot.iDEN.webapp.oes.servlet.FileDisplayServlet.readBlob(Fi
> leDisplayServl
> et.java:169)
> 
> I am trying to display a image that is stored in a BLOB field in
> Oracle. I am using connection pooling and classes12.jar
> 
> Servlet Code
> --
> --
> --
> --
> 
>   private void readBlob
>   (
>   HttpServletRequest request,
>   HttpServletResponse response,
>   long aFeatureId,
>   String aFileName,
>   String aUserId
>   )
>   throws SQLException,IOException
>   {
>   Connection conn = null;
>   ResultSet result = null;
>   PreparedStatement prepStmt = null;
>   java.io.InputStream in = null;
>   java.sql.Blob myBlob = null;
>   FileUploadFactory uploadFactory = new
> FileUploadFactory();
> 
>   try
>   {
>   conn = config_.getEstimationConnection(false);
>   String sql = "";
>   sql =
>   "   SELECT "+
>   "   FILE_IMAGE "+
>   "   FROM "+
>   "   OES_FEATURE_DETAILS "+
>   "   WHERE "+
>   "   FEATURE_ID = 
> &

Re: [OT] getBlob() error in Tomcat

2004-04-06 Thread Robert Hall
Hi,

You can determine the actual Class of 'result' by doing:

String className = result.getClass().getName();

HTH,
Robert
Kumar Abhay-CAK203C wrote:

Still not working 

I am using 
myBlob = ((OracleResultSet)result).getBLOB(1);

It is giving Class Cast Exception

Best Regards
Abhay Kumar
-Original Message-
From: Summers, Bert W. [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 06, 2004 2:35 PM
To: Tomcat Users List
Subject: RE: [OT] getBlob() error in Tomcat

Unjar the classes12.jar file and look for it.
There should be some ResultSet class in there.
The jdbc class that come with Java do not implement the getBLOB method, hence the abstract violation. The Oracle driver in the case has the implemented method, of course you are now tied to Oracle in your code.

-Original Message-
From: Kumar Abhay-CAK203C [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 06, 2004 12:15 PM
To: 'Tomcat Users List'
Subject: RE: [OT] getBlob() error in Tomcat
Importance: High

Thanks for the suggestions,

My question is how I can check that both the versions are same, I have classes12.jar in common/lib and that is set in system classpath. 
How to find the OracleResultSEt class to cast result?

Best Regards
Abhay Kumar
-Original Message-
From: Mike Curwen [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 06, 2004 1:59 PM
To: 'Tomcat Users List'
Subject: RE: [OT] getBlob() error in Tomcat

The javadoc for that error suggests:
"this error can only occur at run time if the definition of some class has incompatibly 
changed since the currently executing method was last compiled."
So is the version of classes12.jar that you used to compile the code, the exact same version that is being used to run it ?

As for casting..

OracleResultSetClass foo = (OracleResultSetClass)result;

obviously, you'd need to replace 'OracleResultSetClass' with the actual name of the class.

 

-Original Message-
From: Kumar Abhay-CAK203C [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 06, 2004 1:43 PM
To: 'Tomcat Users List'
Subject: RE: [OT] getBlob() error in Tomcat
Importance: High
I will appreciate you if you can tell me how ?

Best Regards
Abhay Kumar
-Original Message-
From: Summers, Bert W. [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 06, 2004 1:05 PM
To: Tomcat Users List
Subject: RE: [OT] getBlob() error in Tomcat
You need to cast the ResultSet to the Oracle specify ResultSet

-Original Message-
From: Kumar Abhay-CAK203C [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 06, 2004 11:01 AM
To: Tomcat Users List
Subject: [OT] getBlob() error in Tomcat
Importance: High
Hi,

Any idea why this error is coming in runtime?

Servlet) - FileDisplayServlet.doPost()
java.lang.AbstractMethodError:
oracle.jdbc.driver.OracleResultSetImpl.getBlob(Ljava/lang/Stri
ng;)Ljava/sql/
Blob;
   at
org.apache.commons.dbcp.DelegatingResultSet.getBlob(Delegating
ResultSet.java
:318)
   at 
com.mot.iDEN.webapp.oes.servlet.FileDisplayServlet.readBlob(Fi
leDisplayServl
et.java:169)

I am trying to display a image that is stored in a BLOB field in
Oracle. I am using connection pooling and classes12.jar
Servlet Code
--
--
--
--

private void readBlob
(
HttpServletRequest request,
HttpServletResponse response,
long aFeatureId,
String aFileName,
String aUserId
)
throws SQLException,IOException
{
Connection conn = null;
ResultSet result = null;
PreparedStatement prepStmt = null;
java.io.InputStream in = null;
java.sql.Blob myBlob = null;
FileUploadFactory uploadFactory = new
FileUploadFactory();
		try
		{
			conn = config_.getEstimationConnection(false);
			String sql = "";
			sql =
"	SELECT "+
"		FILE_IMAGE "+
"	FROM "+
"		OES_FEATURE_DETAILS "+
"	WHERE "+
"		FEATURE_ID = 
"+aFeatureId;

			log_.debug("SQL:==="+sql);
			log_.debug("result=" + result);
			prepStmt = conn.prepareStatement(sql);
			result = prepStmt.executeQuery();
			if (result != null && result.next())
			{
//get the file ext
String strDocExt = "";
try
{
	strDocExt =
uploadFactory.getFileType(aFileName, aUserId);
}
catch(Exception e)
{
	log_.debug("Exception is"+e);
}
//get the file length
int intCountBytes = 0;
String strPrpValue = null;

RE: [OT] getBlob() error in Tomcat

2004-04-07 Thread Kumar Abhay-CAK203C
Hi 

I am using weblog.jar file as suggested by somebody in a forum, 
Can somebody tell me why I am getting Class Cast Error on RUNTIME? I am able to 
compile the code.

SerialOracleBlob cast1 =(SerialOracleBlob)result.getTheRealBlob("FILE_IMAGE"); // 
ERROR IS COMING on runtime
OracleTBlobImpl cast2 =(OracleTBlobImpl)cast1.getTheRealBlob();
myBlob = (oracle.sql.BLOB)cast2.getTheRealBlob();


ERROR:
java.lang.ClassCastException
at 
com.mot.iDEN.webapp.oes.servlet.FileDisplayServlet.readBlob(FileDisplayServlet.java:174)
at 
com.mot.iDEN.webapp.oes.servlet.FileDisplayServlet.action(FileDisplayServlet.java:90)

SerialOracleBlob.java is attached.

Best Regards
Abhay Kumar

-Original Message-
From: Robert Hall [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 06, 2004 7:06 PM
To: Tomcat Users List
Subject: Re: [OT] getBlob() error in Tomcat


Hi,

You can determine the actual Class of 'result' by doing:

String className = result.getClass().getName();

HTH,
Robert


Kumar Abhay-CAK203C wrote:

>Still not working
>
>I am using
>myBlob = ((OracleResultSet)result).getBLOB(1);
>
>It is giving Class Cast Exception
>
>Best Regards
>Abhay Kumar
>
>-Original Message-
>From: Summers, Bert W. [mailto:[EMAIL PROTECTED]
>Sent: Tuesday, April 06, 2004 2:35 PM
>To: Tomcat Users List
>Subject: RE: [OT] getBlob() error in Tomcat
>
>
>Unjar the classes12.jar file and look for it.
>There should be some ResultSet class in there.
>
>The jdbc class that come with Java do not implement the getBLOB method, 
>hence the abstract violation. The Oracle driver in the case has the 
>implemented method, of course you are now tied to Oracle in your code.
>
>-Original Message-
>From: Kumar Abhay-CAK203C [mailto:[EMAIL PROTECTED]
>Sent: Tuesday, April 06, 2004 12:15 PM
>To: 'Tomcat Users List'
>Subject: RE: [OT] getBlob() error in Tomcat
>Importance: High
>
>
>Thanks for the suggestions,
>
>My question is how I can check that both the versions are same, I have 
>classes12.jar in common/lib and that is set in system classpath.
>How to find the OracleResultSEt class to cast result?
>
>Best Regards
>Abhay Kumar
>
>-Original Message-----
>From: Mike Curwen [mailto:[EMAIL PROTECTED]
>Sent: Tuesday, April 06, 2004 1:59 PM
>To: 'Tomcat Users List'
>Subject: RE: [OT] getBlob() error in Tomcat
>
>
>The javadoc for that error suggests:
>"this error can only occur at run time if the definition of some class 
>has incompatibly changed since the currently executing method was last compiled."
> 
>So is the version of classes12.jar that you used to compile the code, 
>the exact same version that is being used to run it ?
> 
>As for casting..
>
>OracleResultSetClass foo = (OracleResultSetClass)result;
>
>obviously, you'd need to replace 'OracleResultSetClass' with the actual 
>name of the class.
>
>
>  
>
>>-Original Message-
>>From: Kumar Abhay-CAK203C [mailto:[EMAIL PROTECTED]
>>Sent: Tuesday, April 06, 2004 1:43 PM
>>To: 'Tomcat Users List'
>>Subject: RE: [OT] getBlob() error in Tomcat
>>Importance: High
>>
>>
>>I will appreciate you if you can tell me how ?
>>
>>Best Regards
>>Abhay Kumar
>>
>>-Original Message-
>>From: Summers, Bert W. [mailto:[EMAIL PROTECTED]
>>Sent: Tuesday, April 06, 2004 1:05 PM
>>To: Tomcat Users List
>>Subject: RE: [OT] getBlob() error in Tomcat
>>
>>
>>You need to cast the ResultSet to the Oracle specify ResultSet
>>
>>-Original Message-
>>From: Kumar Abhay-CAK203C [mailto:[EMAIL PROTECTED]
>>Sent: Tuesday, April 06, 2004 11:01 AM
>>To: Tomcat Users List
>>Subject: [OT] getBlob() error in Tomcat
>>Importance: High
>>
>>
>>Hi,
>>
>>Any idea why this error is coming in runtime?
>>
>>Servlet) - FileDisplayServlet.doPost()
>>java.lang.AbstractMethodError: 
>>oracle.jdbc.driver.OracleResultSetImpl.getBlob(Ljava/lang/Stri
>>ng;)Ljava/sql/
>>Blob;
>>at 
>>org.apache.commons.dbcp.DelegatingResultSet.getBlob(Delegating
>>ResultSet.java
>>:318)
>>at
>>com.mot.iDEN.webapp.oes.servlet.FileDisplayServlet.readBlob(Fi
>>leDisplayServl
>>et.java:169)
>>
>>I am trying to display a image that is stored in a BLOB field in 
>>Oracle. I am using connection pooling and classes12.jar
>>
>>Servlet Code
>>--
>>--
>>--
>>--

RE: [OT] getBlob() error in Tomcat

2004-04-08 Thread Shapira, Yoav

Hi,
Attachments in most forms are removed by the list server, so yours
didn't make it (at least on my mail reader).

>I am using weblog.jar file as suggested by somebody in a forum,
>Can somebody tell me why I am getting Class Cast Error on RUNTIME? I am
>able to compile the code.

Why don't you ask "somebody in a forum" ?

Use the obj.getClass().getName() approach shown by someone else to see
what the class actually is before you cast it.  Many cast errors can't
be caught at compile time.  This is why we have unit tests: write them
and use them regularly.

Yoav Shapira




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


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