History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: QUARTZ-538
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: James House
Reporter: Eric Sachse
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Quartz Scheduler

WebLogicOracleDelegate throws java.lang.NoSuchMethodException: weblogic.jdbc.base.BaseBlob.putBytes(long, [B)

Created: 29/Nov/06 01:10 PM   Updated: 19/Apr/07 10:59 AM
Component/s: Job Stores
Affects Version/s: 1.6, 1.5.2
Fix Version/s: 1.6.1

File Attachments: 1. Text File QUARTZ-538.patch (1 kb)
2. Java Source File WeblogicOracleDelegate.java (4 kb)

Environment: Weblogic 8.1 SP2, Oracle 9.2.0.6.0 Enterprise Edition, weblogic.jdbc.oracle.OracleDriver JDBC driver class


 Description  « Hide
The WebLogicOracleDelegate throws a java.lang.NoSuchMethodException because it cannot find a method called putBytes(long, byte[]) on the weblogic.jdbc.base.BaseBlob class. This is Weblogic 8.1 SP2, and I am using the weblogic.jdbc.oracle.OracleDriver JDBC driver class.

There is a method called setBytes(long, byte[]) in the weblogic.jdbc.base.BaseBlob class.

I changed the method writeDataToBlob() in WebLogicOracleDelegate.java to this code that tries setBytes(long, byte[]) if puttBytes(long, byte[]) does not exist, and the changes worked in my local environment

/**
     * Check for the Weblogic Blob wrapper, and handle accordingly...
     */
    protected Blob writeDataToBlob(ResultSet rs, int column, byte[] data) throws SQLException {
        Blob blob = rs.getBlob(column);

if (blob == null)
            throw new SQLException("Driver's Blob representation is null!");

// handle thin driver's blob
        if (blob instanceof weblogic.jdbc.vendor.oracle.OracleThinBlob) {
            ((weblogic.jdbc.vendor.oracle.OracleThinBlob) blob).putBytes(1, data);
            return blob;
        }
        // (more slowly) handle blob for wrappers of other variations of
        // drivers...
        else if (blob.getClass().getPackage().getName().startsWith("weblogic.")) {
            try {
                // try to find putBytes method...
                Method m = blob.getClass().getMethod("putBytes", new Class[] { long.class, byte[].class });
                m.invoke(blob, new Object[] { new Long(1), data });
            } catch (Exception e) {
                try {
                    // Added this logic to the original code from OpenSymphony
                    // putBytes method does not exist. Try setBytes
                    Method m = blob.getClass().getMethod("setBytes", new Class[] { long.class, byte[].class });
                    m.invoke(blob, new Object[] { new Long(1), data });
                } catch (Exception e2) {
                    throw new SQLException("Unable to find putBytes(long,byte[]) or setBytes(long,byte[]) methods on blob: " + e2);
                }
            }
            return blob;
        } else {
            return super.writeDataToBlob(rs, column, data);
        }
    }


Here is a stack trace of the error.

org.quartz.JobPersistenceException: Couldn't store job: Unable to find putBytes(
long,byte[]) method on blob: java.lang.NoSuchMethodException: weblogic.jdbc.base
.BaseBlob.putBytes(long, [B) [See nested exception: java.sql.SQLException: Unabl
e to find putBytes(long,byte[]) method on blob: java.lang.NoSuchMethodException:
 weblogic.jdbc.base.BaseBlob.putBytes(long, [B)]
        at org.quartz.impl.jdbcjobstore.JobStoreSupport.storeJob(JobStoreSupport
.java:857)
        at org.quartz.impl.jdbcjobstore.JobStoreTX.storeJob(JobStoreTX.java:210)
        at org.quartz.core.QuartzScheduler.addJob(QuartzScheduler.java:687)
        at org.quartz.impl.StdScheduler.addJob(StdScheduler.java:261)
        at com.pwc.us.mw.common.startup.QuartzListener.contextInitialized(Quartz
Listener.java:100)
        at weblogic.servlet.internal.WebAppServletContext$FireContextListenerAct
ion.run(WebAppServletContext.java:6415)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:317)
        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
118)
        at weblogic.servlet.internal.WebAppServletContext.notifyCreated(WebAppSe
rvletContext.java:1678)
        at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAp
pServletContext.java:3178)
        at weblogic.servlet.internal.WebAppServletContext.setStarted(WebAppServl
etContext.java:5647)
        at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:869)
        at weblogic.j2ee.J2EEApplicationContainer.start(J2EEApplicationContainer
.java:2022)
        at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContai
ner.java:2063)
        at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.
activateContainer(SlaveDeployer.java:2592)
        at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.doCommit(
SlaveDeployer.java:2515)
        at weblogic.management.deploy.slave.SlaveDeployer$Task.commit(SlaveDeplo
yer.java:2317)
        at weblogic.management.deploy.slave.SlaveDeployer.commitUpdate(SlaveDepl
oyer.java:608)
        at weblogic.drs.internal.SlaveCallbackHandler$2.execute(SlaveCallbackHan
dler.java:35)
        at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
        at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
* Nested Exception (Underlying Cause) ---------------
java.sql.SQLException: Unable to find putBytes(long,byte[]) method on blob: java
.lang.NoSuchMethodException: weblogic.jdbc.base.BaseBlob.putBytes(long, [B)
        at org.quartz.impl.jdbcjobstore.oracle.weblogic.WebLogicOracleDelegate.w
riteDataToBlob(WebLogicOracleDelegate.java:94)
        at org.quartz.impl.jdbcjobstore.oracle.OracleDelegate.insertJobDetail(Or
acleDelegate.java:204)
        at org.quartz.impl.jdbcjobstore.JobStoreSupport.storeJob(JobStoreSupport
.java:851)
        at org.quartz.impl.jdbcjobstore.JobStoreTX.storeJob(JobStoreTX.java:210)
        at org.quartz.core.QuartzScheduler.addJob(QuartzScheduler.java:687)
        at org.quartz.impl.StdScheduler.addJob(StdScheduler.java:261)
        at com.pwc.us.mw.common.startup.QuartzListener.contextInitialized(Quartz
Listener.java:100)
        at weblogic.servlet.internal.WebAppServletContext$FireContextListenerAct
ion.run(WebAppServletContext.java:6415)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:317)
        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
118)
        at weblogic.servlet.internal.WebAppServletContext.notifyCreated(WebAppSe
rvletContext.java:1678)
        at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAp
pServletContext.java:3178)
        at weblogic.servlet.internal.WebAppServletContext.setStarted(WebAppServl
etContext.java:5647)
        at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:869)
        at weblogic.j2ee.J2EEApplicationContainer.start(J2EEApplicationContainer
.java:2022)
        at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContai
ner.java:2063)
        at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.
activateContainer(SlaveDeployer.java:2592)
        at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.doCommit(
SlaveDeployer.java:2515)
        at weblogic.management.deploy.slave.SlaveDeployer$Task.commit(SlaveDeplo
yer.java:2317)
        at weblogic.management.deploy.slave.SlaveDeployer.commitUpdate(SlaveDepl
oyer.java:608)
        at weblogic.drs.internal.SlaveCallbackHandler$2.execute(SlaveCallbackHan
dler.java:35)
        at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
        at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)



 All   Comments   Change History      Sort Order:
Eric Sachse - [29/Nov/06 01:15 PM ]
This is the source code I changed that works in my local configuration. That set up uses Weblogic 8.1 SP2 and the weblogic.jdbc.oracle.OracleDriver JDBC driver.

Henri Yandell - [09/Mar/07 04:26 PM ]
Turning Eric's attachment into a patch.

Henri Yandell - [18/Apr/07 08:53 AM ]
Pain in the arse trying to confirm this. The method isn't listed on the unsupported method list:

http://edocs.bea.com/wls/docs81/oracle/API_joci.html#1162621

Hopefully I can find the right jar and download that.

Eric Sachse - [18/Apr/07 09:06 AM ]
The jar is the wlbase.jar. It exists in the weblogic home\weblogic81\server\lib directory. It is a part of the standard weblogic 8.1.x install.

Henri Yandell - [18/Apr/07 10:02 AM ]
Thanks Eric - that's my other approach, to download Weblogic 8.1 and install it somewhere. Damn website has been giving me errors on login for days now.

We should have it somewhere in the office when I get back there next week.

Henri Yandell - [19/Apr/07 10:59 AM ]

By looking at Weblogic 8.1 SP5 I can confirm that the BaseBlob class lacks the putBytes method and does have the setBytes method.

On the 1.6 branch:

 svn ci -m "Applying Eric Sachse's fix for Weblogic 8.1's BaseBlob class as per QUARTZ-538" src/
Sending src/weblogic/org/quartz/impl/jdbcjobstore/oracle/weblogic/WebLogicOracleDelegate.java
Transmitting file data .
Committed revision 697.

and on trunk:

svn ci -m "Applying Eric Sachse's fix for Weblogic 8.1's BaseBlob class as per QUARTZ-538" src/
Sending src/weblogic/org/quartz/impl/jdbcjobstore/oracle/weblogic/WebLogicOracleDelegate.java
Transmitting file data .
Committed revision 698.