This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 84405 - Unable to deploy app using MS SQLServer drivers - ClassCastException
Summary: Unable to deploy app using MS SQLServer drivers - ClassCastException
Status: RESOLVED FIXED
Alias: None
Product: serverplugins
Classification: Unclassified
Component: Sun Appserver 9 (show other bugs)
Version: 5.x
Hardware: All All
: P2 blocker (vote)
Assignee: Nitya Doraisamy
URL:
Keywords:
: 84406 84407 (view as bug list)
Depends on: 84391
Blocks:
  Show dependency tree
 
Reported: 2006-09-07 05:48 UTC by _ jimdavidson
Modified: 2006-09-14 20:27 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ jimdavidson 2006-09-07 05:48:09 UTC
Using JS Creator Shortfin, running on
netbeans-5_5-daily-bin-200609040000-ide-4_Sep_2006_0000:

Use Drivers -> New Driver to add MS SQLServer Driver (sqljdbc.jar).
Driver class is: com.microsoft.sqlserver.jdbc.SQLServerDriver

Add new connection using the driver.
Note that URL isn't filled in, and must be provided manually.
URL looks like:
jdbc:sqlserver://hostname:1433;DatabaseName=dbname;selectMethod=cursor

Click OK.  DB tables are visible in the Explorer.  Drag a table onto the form,
and drop onto a component (e.g., dropdown or table).

Make sure the driver jar has been copied to the AppServer lib directory, and
deploy to the AppServer.  

Error appears in browser: 500.  Server log shows the following:

RAR5111 : Error casting to javax.sql.Datasource :{0}
java.lang.ClassCastException: com.microsoft.sqlserver.jdbc.SQLServerDriver
        at
com.sun.gjc.spi.DSManagedConnectionFactory.createManagedConnection(DSManagedConnectionFactory.java:83)
        at
com.sun.enterprise.resource.LocalTxConnectorAllocator.createResource(LocalTxConnectorAllocator.java:56)
        at
com.sun.enterprise.resource.AbstractResourcePool.createResourceAndAddToPool(AbstractResourcePool.java:1263)
        at
com.sun.enterprise.resource.AbstractResourcePool.createResources(AbstractResourcePool.java:596)
        at
com.sun.enterprise.resource.AbstractResourcePool.initPool(AbstractResourcePool.java:186)
        at
com.sun.enterprise.resource.AbstractResourcePool.internalGetResource(AbstractResourcePool.java:362)
        at
com.sun.enterprise.resource.AbstractResourcePool.getResource(AbstractResourcePool.java:289)
        at
com.sun.enterprise.resource.PoolManagerImpl.getResourceFromPool(PoolManagerImpl.java:248)
        at
com.sun.enterprise.resource.PoolManagerImpl.getResource(PoolManagerImpl.java:174)
        at
com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.java:312)
        at
com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:222)
        at
com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:152)
        at
com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:145)
        at com.sun.gjc.spi.DataSource.getConnection(DataSource.java:93)
        at
com.sun.sql.rowset.internal.CachedRowSetXReader.connect(CachedRowSetXReader.java:365)
        at
com.sun.sql.rowset.internal.CachedRowSetXReader.readData(CachedRowSetXReader.java:130)

This may be related to Bug #84391, or maybe not.  Error message is different,
but symptoms are similar.

Also note that Bug #84404 describes some design-time problems with MS drivers on
Mac OS.  This may or may not be related to that.
Comment 1 _ jimdavidson 2006-09-07 06:25:22 UTC
*** Issue 84407 has been marked as a duplicate of this issue. ***
Comment 2 _ jimdavidson 2006-09-07 06:25:56 UTC
*** Issue 84406 has been marked as a duplicate of this issue. ***
Comment 3 Nitya Doraisamy 2006-09-11 20:18:32 UTC
Not sure if this is caused by the plugin. I don't think it is related to #84391.
We will need to get the resource working on the server, using the admin console. 

Could you attach the app or the resource to the issue to help debug.
Comment 4 _ jimdavidson 2006-09-11 20:34:38 UTC
I tested again this morning, and could not reproduce the issue.  

No data were retrieved, apparently due to a problem in the MS driver, but there
was no Exception raised.

This may or may not be affected by #84391.  Why don't I wait until that is
fixed, and try again to reproduce it.  In the meantime, I'll try to narrow down
what went wrong with the driver on this morning's test.  
Comment 5 _ jimdavidson 2006-09-12 21:52:39 UTC
I tried it again today, and was able to reproduce the bug.

The problem is that the Connection Pool is misconfigured.  The Datasource
Classname property is set to: "com.microsoft.sqlserver.jdbc.SQLServerDriver",
whereas it should be: "com.microsoft.sqlserver.jdbc.SQLServerDataSource".

I don't know whether this happens every time.  I have seen it in several
different cases.  It's a definite bug.

Manually editing the property in the Connection Pool (and then redeploying)
fixes the problem.
Comment 6 Nitya Doraisamy 2006-09-14 20:27:11 UTC
Fixed as part of fix for 84391