Skip to Content
avatar image
Former Member

OData error: Cannot load JDBC driver class

Hi all,

I was wondering if there is anyone who could help me with my problem. I am trying to create an OData Service on SMP3 fetching data from SQL Server. I followed Marvin Hoffmann's Blog, however, after the service deployment the data set access is giving me the following error:

<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">

<script id="tinyhippos-injected"/>

<code/>

<message xml:lang="en">

Cannot load JDBC driver class 'com.microsoft.sqlserver.jdbc.SQLServerDriver'

</message>

</error>

The sqljdbc4.jar library seems to have been deployed correctly from the pickup folder based on the “sqljdbc4.deploy.ok” file in the .state folder. I noticed the bundle has been marked there as “bundle-id=544”.

After inspection of the log I discovered following:

java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver from bundle 547

I tried to undeploy the library by deleting it from the server pickup folder but the file would not disappear from the \work\org.eclipse.virgo.nano.deployer\staging folder and the log contains following error:

org.eclipse.virgo.medic.eventlog.default##anonymous#fs-watcher###Hot un-deploy failed for file 'sqljdbc4.jar'.java.lang.NullPointerException: while trying to invoke the method java.lang.String.equals(java.lang.Object) of a null object returned from org.osgi.framework.Bundle.getSymbolicName()

Any idea what might be causing my issues? Not sure whether it is relevant here but note the different bundle ids. By the way, I checked the jar file and it does contain the referenced class under the path com.microsoft.sqlserver.jdbc.

Here is the log containing deployment first (14:11:06) then triggering the OData service request (14:14:53). - https://www.dropbox.com/l/LMKAvG1WtY1F8dLXq5Aboa

Many thanks,

Frank

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    Feb 14, 2014 at 02:54 PM

    Hi Frantisek Miksicek PTS,

    even if the deployment with the standard Microsoft JDBC Driver (sqljdbc4.jar) seems to be ok, when you are deploying it directly to SMP3, it won't work... If you have a look into the SMP3 server log you will find some errors.

    Similar to the Oracle case, you have to create an osgi enabled bundle wrapping the SQLServer JDBC driver.

    I wrote it down in a new blog post here:

    Integration Gateway and Microsoft SQL Server as data source

    Regards

    Marvin

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      You document is indeed super helpful! Just a note, by default, the following checkbox:

      Analyze library contents and add dependencies

      was unchecked. Since it wasn't highlighted via the red box you put in, I overlooked it. It wasn't until I saw the Oracle document that I noticed I had to check it. Just my $0.02. Thanks!

  • Jan 28, 2014 at 07:12 AM

    please confirm,

    While Generate and Deploy Integration Content, whatever service namespace you mentioned, it should match the security profile name you would have created in cockpit.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Jitendra,

      yes, I can confirm the namespace ("sap") I used before deploying it to the server is present in the administration cockpit as security profile.

  • avatar image
    Former Member
    Jul 02, 2014 at 11:50 AM

    Hi

    I am facing the same problem and I followed the instructions in Integration Gateway and Microsoft SQL Server as data source as well. But still I am getting the error "Cannot load JDBC driver class 'com.microsoft.sqlserver.jdbc.SQLServerDriver'"

    Server logs are showing following information

    "2014 07 02 15:41:39#+0530#ERROR#com.sap.gateway.core.ip.runtime.GatewayIPODataProcessor##anonymous#http-bio-8080-exec-4###readEntitySet() failed: service = sap/intgwtest2, entity set = CUSTOMER, content type = application/xml;charset=utf-8, message = org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'com.microsoft.sqlserver.jdbc.SQLServerDriver' |

    2014 07 02 15:41:39#+0530#ERROR#com.sap.gateway.core.ip.odata.ODataErrorCallbackImpl##anonymous#http-bio-8080-exec-4###handleError(): failed to serve request for URI http://localhost:8080/gateway/odata/sap/intgwtest2/CUSTOMER, message = Cannot load JDBC driver class 'com.microsoft.sqlserver.jdbc.SQLServerDriver' |

    "

    Pls help to resolve this issue.

    Thanks

    Prem Kumar K

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 05, 2014 at 12:33 PM

    Hi All

    Here is a workaround to fix the "Cannot load JDBC driver class 'com.microsoft.sqlserver.jdbc.SQLServerDriver'" issue.

    Follow the below steps.

    Step 1 : Create a SMPRun.bat file with the following steps

      net stop SAPSMP3Service

      

      taskkill /IM java.exe

      

      del C:\SAP\MobilePlatform3\Server\work\org.eclipse.virgo.nano.deployer\staging\com.microsoft.sqlserver.jdbc_1.0.0.jar

      

      del C:\SAP\MobilePlatform3\Server\pickup\.state\com.microsoft.sqlserver.jdbc_1.0.0.deploy.ok

      

      net start SAPSMP3Service

      

      pause

    Step 2 : Save the SMPRun.bat file

    Step 3: Right click SMPRun.bat file and Run the same. This will delete the existing jar file from staging folder and "com.microsoft.sqlserver.jdbc_1.0.0.deploy.ok" file from the .state folder

    Step 4: Now test your web service, That will work.

    Thanks & Regards,

    Prem Kumar K

    GoDBTech - SMP Mobility Team

    Add comment
    10|10000 characters needed characters exceeded