Results 1 to 2 of 2

Thread: Cannot find class [javax.sql.DataSource] when exposing Datasource as a Service

  1. #1
    Join Date
    May 2009
    Posts
    7

    Default Cannot find class [javax.sql.DataSource] when exposing Datasource as a Service

    I'm trying out dm Server, and have built a basic app that has three bundles, a datasource bundle, a model bundle, and a web bundle to access the model. The datasource bundle has no code, only the spring configurations and the MANIFEST importing required packages/bundles.

    Code:
    <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" lazy-init="false">
    		<property name="driverClass" value="org.postgresql.Driver"/> 
    		<property name="jdbcUrl" value="jdbc:postgresql://localhost/springdemo"/> 
    		<property name="user" value="myuser"/> 
    		<property name="password" value="password"/>
    </bean> 
    
    <osgi:service id="osgiDataSource" ref="dataSource" interface="javax.sql.DataSource"/>
    When I install this bundle through the console I get the following:
    Code:
    Artifact Console: 'Deployment Error 'Error creating bean with name 
    'org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean#0': 
    Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: 
    Failed to convert property value of type 'java.util.LinkedHashSet' to required type 'java.lang.Class[]' 
    for property 'interfaces'; nested exception is java.lang.IllegalArgumentException: Cannot find class 
    [javax.sql.DataSource]''
    If I comment out the line exposing the datasource as a service it has no errors. Whats going on here?

  2. #2
    Join Date
    Oct 2008
    Posts
    493

    Default

    Have you imported the javax.sql package into your bundle?
    Andy Wilkinson
    SpringSource

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •