db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert S. Sfeir" <rob...@codepuccino.com>
Subject PlatformDefaultImpl in RC5 throwing ClassCastException
Date Fri, 30 Jan 2004 23:52:46 GMT
I've hit a bug in RC5, which looks like it's been reported and fixed, so 
I checked out the code form CVS, made my build and ran the code and am 
still getting the exception.  I'm running this with Oracle using their 
oracle 1.4 jdbc driver.  (If there is a temporary workaround please let 
me know, this is a show stopper thanks)  I'd fix it but I'm lost as to 
why it's doing this exactly, the values that are being passed are 
correct (int, String, int)

The code causing it:  (checkedBrowsers is a String[])

            final PersistenceBroker broker = 
PersistenceBrokerFactory.defaultPersistenceBroker();
            final Criteria crit = new Criteria();
            crit.addIn( "browserID", Arrays.asList( checkedBrowsers ) );
            crit.addOrderBy( "browserName" , true);
            broker.beginTransaction();
            final Query query = QueryFactory.newQuery( 
BrowserBean.class, crit );
            broker.getCollectionByQuery( query );  <------  THIS CALL HERE
            broker.commitTransaction();

Seems after stepping around the code that the following code block is 
where things start to fail, and is throwing the RuntimeException.
(RsIterator.java line 204)
try
        {
            
setRsAndStmt(queryObject.performQuery(broker.serviceJdbcAccess())); 
<----  This one here
            /*
             * TODO: how does prefetchRelationships handle QueryBySQL 
instances? Is
             * it ok to pass query object?
             */
            prefetchRelationships(queryObject.getQuery());
            if (logger.isDebugEnabled())
            {
                logger.debug("RsIterator[" + queryObject + "] initialized");
            }
        }
        catch (RuntimeException e)
        {
            autoReleaseDbResources();
            throw e;
        }

The actual culprit it seems, for bizarre reasons is:
(PlatformDefaultImpl  line 255)
public void setObjectForStatement(PreparedStatement ps, int index, 
Object value, int sqlType)
            throws SQLException
    {
        if ((value instanceof String) && (sqlType == Types.LONGVARCHAR))
        {
            String s = (String) value;
            ps.setCharacterStream(index, new StringReader(s), s.length());
        }
        else
        {
            ps.setObject(index, value, sqlType); <--- Poops out right here
        }
    }

My full exception:
java.lang.ClassCastException
    at 
oracle.jdbc.driver.OraclePreparedStatement.setObject(OraclePreparedStatement.java:2804)
    at 
oracle.jdbc.driver.OraclePreparedStatement.setObject(OraclePreparedStatement.java:2905)
    at 
org.apache.ojb.broker.platforms.PlatformDefaultImpl.setObjectForStatement(PlatformDefaultImpl.java:265)
    at 
org.apache.ojb.broker.platforms.PlatformOracleImpl.setObjectForStatement(PlatformOracleImpl.java:171)
    at 
org.apache.ojb.broker.accesslayer.StatementManager.bindStatementValue(StatementManager.java:255)
    at 
org.apache.ojb.broker.accesslayer.StatementManager.bindStatement(StatementManager.java:358)
    at 
org.apache.ojb.broker.accesslayer.StatementManager.bindSelectionCriteria(StatementManager.java:455)
    at 
org.apache.ojb.broker.accesslayer.StatementManager.bindStatement(StatementManager.java:427)
    at 
org.apache.ojb.broker.accesslayer.StatementManager.bindStatement(StatementManager.java:400)
    at 
org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(JdbcAccessImpl.java:317)
    at 
org.apache.ojb.broker.accesslayer.RsQueryObject.performQuery(RsQueryObject.java:113)
    at 
org.apache.ojb.broker.accesslayer.RsIterator.<init>(RsIterator.java:211)
    at 
org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(RsIteratorFactoryImpl.java:97)
    at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(PersistenceBrokerImpl.java:1606)
    at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(PersistenceBrokerImpl.java:1119)
    at 
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryReferenceBroker.java:143)
    at 
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryReferenceBroker.java:242)
    at 
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryReferenceBroker.java:262)
    at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1002)
    at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(DelegatingPersistenceBroker.java:322)
    at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(DelegatingPersistenceBroker.java:322)
    at 
com.codepuccino.tracker.sql.ojb.BrowserDAOImpl.selectForBatch(BrowserDAOImpl.java:151)
    at 
com.codepuccino.tracker.actions.BrowserAction.edit(BrowserAction.java:106)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at 
org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
    at 
org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:216)
    at 
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
    at 
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
    at 
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)
    at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
    at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
    at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
    at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
    at 
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:245)
    at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:199)
    at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
    at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
    at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:195)
    at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
    at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
    at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
    at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
    at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
    at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
    at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
    at 
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:211)
    at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:805)
    at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:696)
    at 
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:605)
    at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:677)
    at java.lang.Thread.run(Thread.java:534)

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message