You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by James Gartner <Ja...@moodys.com> on 2012/03/09 23:43:51 UTC

deploying a database source as service in Karaf 2.2.5

Folks, I have a basic datasource-sybase.xml file: 

<?xml version="1.0" encoding="UTF-8"?> 
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">    
        <bean id="dataSource" class="com.sybase.jdbc3.jdbc.SybXADataSource">      
                <property name="url"
value="jdbc:sybase:Tds:machine:port/dbname"/>      
                <property name="user" value="nnnn"/>      
                <property name="password" value="nnnn"/>  
        </bean>    

        <service interface="javax.sql.DataSource" ref="dataSource">    
                <service-properties>            
                        <entry key="osgi.jndi.service.name"
value="jdbc/sybase"/>    
                </service-properties>  
        </service>
</blueprint>  
(the machine/port/dbname/nnnn values are filled out correctly when I deploy) 
When I put this into the deploy folder, I see in the log that: 

2012-03-09 13:34:30,486 | ERROR | rint Extender: 2 | BlueprintContainerImpl          
| container.BlueprintContainerImpl  358 | 9 - 
org.apache.aries.blueprint - 0.3.1 | Unable to start blueprint container for
bundle datasource-sybase.xml 
org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to
find property descriptor url on class com.sybase.jdbc3.jdbc.SybXADataSource 
        at
org.apache.aries.blueprint.container.BeanRecipe.getPropertyDescriptor(BeanRecipe.java:820)[9:org.apache.aries.blueprint:0 
... 
... 
I've been unable to find any reference to what might be causing this -- any
pointers to help me determine the issues here??  Am I missing something in
my xml file?   I did the install of the com.sybase.jconn/6.0.5 via the: 
install -s wrap:mvn:com/sybase/jconn/6.0.5 and I DID get a bundle installed. 

Any/all help appreciated!  



--
View this message in context: http://karaf.922171.n3.nabble.com/deploying-a-database-source-as-service-in-Karaf-2-2-5-tp3814097p3814097.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: deploying a database source as service in Karaf 2.2.5

Posted by James Gartner <Ja...@moodys.com>.
Thanks -- that did the trick. I saw that command just as I typed it on all of
the websites I found it on including the Karaf documentation (perhaps that
should be updated) -- I tried a number of variations, but never thought to
escape the !
Thanks

--
View this message in context: http://karaf.922171.n3.nabble.com/deploying-a-database-source-as-service-in-Karaf-2-2-5-tp3814097p3835795.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: deploying a database source as service in Karaf 2.2.5

Posted by Andreas Pieber <an...@gmail.com>.
Try a \ in front of the !

Kind regards Andreas

Send from my mobile. Please excuse the brevity and/or possible auto
correction errors.
On Mar 16, 2012 9:42 PM, "James Gartner" <Ja...@moodys.com> wrote:

> Thanks Christian -- I did get it to work with some help from Matt Madhavan
> --
> it was a configuration item I needed to add in the
> org.ops4j.pax.url.mvn.cfg
> file for updating the repositories for NEXUS.
>
> I still do have some issues though when trying to run certain commands,
> sepcifically:
>
> osgi:install
> wrap:mvn:http://download.java.net/maven/2!net.java.dev.jna/jna/3.1.0
>
>
> I get the following error:
>
> Error executing command: !net.java.dev.jna/jna/3.1.0: event not found
>
> This command is directly from the Karaf dev guide on colorizing the command
> line, but I can't seem to get this to work.  Any ideas folks?
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/deploying-a-database-source-as-service-in-Karaf-2-2-5-tp3814097p3833115.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

Re: deploying a database source as service in Karaf 2.2.5

Posted by James Gartner <Ja...@moodys.com>.
Thanks Christian -- I did get it to work with some help from Matt Madhavan --
it was a configuration item I needed to add in the org.ops4j.pax.url.mvn.cfg
file for updating the repositories for NEXUS.

I still do have some issues though when trying to run certain commands,
sepcifically:

osgi:install
wrap:mvn:http://download.java.net/maven/2!net.java.dev.jna/jna/3.1.0


I get the following error:

Error executing command: !net.java.dev.jna/jna/3.1.0: event not found

This command is directly from the Karaf dev guide on colorizing the command
line, but I can't seem to get this to work.  Any ideas folks?

--
View this message in context: http://karaf.922171.n3.nabble.com/deploying-a-database-source-as-service-in-Karaf-2-2-5-tp3814097p3833115.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: deploying a database source as service in Karaf 2.2.5

Posted by Christian Müller <ch...@gmail.com>.
It works for me without a proxy configuration (I removed my
.m2/repositories/org/apache/servicemix/bundles/org.apache.servicemix.bundles.commons-dbcp
directory before):

Christian-Muellers-MacBook-Pro:bin cmueller$ ./karaf
        __ __                  ____
       / //_/____ __________ _/ __/
      / ,<  / __ `/ ___/ __ `/ /_
     / /| |/ /_/ / /  / /_/ / __/
    /_/ |_|\__,_/_/   \__,_/_/

  Apache Karaf (2.2.5)

Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or 'osgi:shutdown' to shutdown Karaf.

karaf@root> osgi:install
mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-dbcp/1.4_1
Bundle ID: 49

Best,
Christian

On Mon, Mar 12, 2012 at 2:10 AM, James Gartner <Ja...@moodys.com>wrote:

> Thanks Christian -- I didn't realize the paste I did had truncated the
> line.
> I actually did run:
>
> karaf@root> osgi:install
>
> mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-dbcp/1.4_1
> java.lang.RuntimeException: URL
>
> [mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-dbcp/1.4_1]
> could not be re
> solved.
> karaf@root>
>
> Seems like something here isn't setup correctly between maven and karaf --
> I
> have used maven to dl stuff from past our proxy for project builds, but
> karaf doesn't seem to be able to do that, so not sure where the breakdown
> is
> happening here.
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/deploying-a-database-source-as-service-in-Karaf-2-2-5-tp3814097p3818126.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

Re: deploying a database source as service in Karaf 2.2.5

Posted by James Gartner <Ja...@moodys.com>.
Thanks Christian -- I didn't realize the paste I did had truncated the line.
I actually did run:

karaf@root> osgi:install
mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-dbcp/1.4_1
java.lang.RuntimeException: URL
[mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-dbcp/1.4_1]
could not be re
solved.
karaf@root>

Seems like something here isn't setup correctly between maven and karaf -- I
have used maven to dl stuff from past our proxy for project builds, but
karaf doesn't seem to be able to do that, so not sure where the breakdown is
happening here.

--
View this message in context: http://karaf.922171.n3.nabble.com/deploying-a-database-source-as-service-in-Karaf-2-2-5-tp3814097p3818126.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: deploying a database source as service in Karaf 2.2.5

Posted by Christian Müller <ch...@gmail.com>.
Run: osgi:install
mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-dbcp/1.4_1

Best,
Christian

On Sun, Mar 11, 2012 at 4:15 AM, James Gartner <Ja...@moodys.com>wrote:

> Thanks David, according to what I found on SyBooks Online:
> "Connection libraries and XA resource libraries for Windows (CR #399593)
> The
> XA resource library for JDBC database driver should be
> com.sybase.jdbc3.jdbc.SybXADataSource."
> and
> "The value for the Driver property (DLL or Class Name) to configure the
> connection cache should be com.sybase.jdbc3.jdbc.SybXADataSource.
> "
> so I was presuming that it would implement this.
> Also, I tried the non-XA class "com.sybase.jdbc3.jdbc.SybDriver" which
> gives
> the same results.
>
> Looks like I may have found part of the fix:
>
> <bean id="xaDataSource" destroy-method="close"
> class="org.apache.commons.dbcp.BasicDataSource">
>        <property name="driverClassName"
> value="com.sybase.jdbc3.jdbc.SybXADataSource"/>
>        <property name="url"  value="jdbc:sybase:Tds:machine:port/dbname"/>
>         <property name="user" value="nnnn"/>
>                <property name="password" value="nnnn"/>
>        <property name="defaultTransactionIsolation" value="2"/>
>    </bean>
>
> Now I'm getting that:
> ERROR: Bundle datasource-sybase.xml [84] Error starting
>
> blueprint:file:/C:/JavaApps/apache-karaf-2.2.5/apache-karaf-2.2.5/deploy/dat
> asource-sybase.xml (org.osgi.framework.BundleException: Unresolved
> constraint in bundle datasource-sybase.xml [84]: Unable to resolv
> e 84.3: missing requirement [84.3] package;
> (package=org.apache.commons.dbcp))
> org.osgi.framework.BundleException: Unresolved constraint in bundle
> datasource-sybase.xml [84]: Unable to resolve 84.3: missing requ
> irement [84.3] package; (package=org.apache.commons.dbcp)
>
> I tried to do the:
> karaf@root> osgi:install
> mvn:org.apache.servicemix.bundles.commons-dbcp/1.4_1
> ^C
> java.lang.RuntimeException: URL
> [mvn:org.apache.servicemix.bundles.commons-dbcp/1.4_1] could not be
> resolved.
> so it looks like something is up with my maven settings, but at least I got
> past the original error.
> If anyone has any ideas as to why I can't resolve the url here, I'd
> appreciate it (I haven't worked much with maven, so still trying to get
> everything setup correctly -- I may just install the jar/pom manually in my
> m2 repository).
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/deploying-a-database-source-as-service-in-Karaf-2-2-5-tp3814097p3816086.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

Re: deploying a database source as service in Karaf 2.2.5

Posted by James Gartner <Ja...@moodys.com>.
Thanks David, according to what I found on SyBooks Online:
"Connection libraries and XA resource libraries for Windows (CR #399593) The
XA resource library for JDBC database driver should be
com.sybase.jdbc3.jdbc.SybXADataSource."
and
"The value for the Driver property (DLL or Class Name) to configure the
connection cache should be com.sybase.jdbc3.jdbc.SybXADataSource.
"
so I was presuming that it would implement this.
Also, I tried the non-XA class "com.sybase.jdbc3.jdbc.SybDriver" which gives
the same results.

Looks like I may have found part of the fix:

<bean id="xaDataSource" destroy-method="close"
class="org.apache.commons.dbcp.BasicDataSource">
        <property name="driverClassName"
value="com.sybase.jdbc3.jdbc.SybXADataSource"/>
        <property name="url"  value="jdbc:sybase:Tds:machine:port/dbname"/>       
         <property name="user" value="nnnn"/>       
                <property name="password" value="nnnn"/>   
        <property name="defaultTransactionIsolation" value="2"/>
    </bean>

Now I'm getting that:
ERROR: Bundle datasource-sybase.xml [84] Error starting
blueprint:file:/C:/JavaApps/apache-karaf-2.2.5/apache-karaf-2.2.5/deploy/dat
asource-sybase.xml (org.osgi.framework.BundleException: Unresolved
constraint in bundle datasource-sybase.xml [84]: Unable to resolv
e 84.3: missing requirement [84.3] package;
(package=org.apache.commons.dbcp))
org.osgi.framework.BundleException: Unresolved constraint in bundle
datasource-sybase.xml [84]: Unable to resolve 84.3: missing requ
irement [84.3] package; (package=org.apache.commons.dbcp)

I tried to do the:
karaf@root> osgi:install
mvn:org.apache.servicemix.bundles.commons-dbcp/1.4_1
^C
java.lang.RuntimeException: URL
[mvn:org.apache.servicemix.bundles.commons-dbcp/1.4_1] could not be
resolved.
so it looks like something is up with my maven settings, but at least I got
past the original error. 
If anyone has any ideas as to why I can't resolve the url here, I'd
appreciate it (I haven't worked much with maven, so still trying to get
everything setup correctly -- I may just install the jar/pom manually in my
m2 repository).

--
View this message in context: http://karaf.922171.n3.nabble.com/deploying-a-database-source-as-service-in-Karaf-2-2-5-tp3814097p3816086.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: deploying a database source as service in Karaf 2.2.5

Posted by David Jencks <da...@yahoo.com>.
Is there a setUrl method on the object (not e.g. setURL).  

Also, are you sure the SybXADataSource implements Datasource?  XADatasource certainly doesn't.

hope this helps
david jencks

On Mar 9, 2012, at 2:43 PM, James Gartner wrote:

> Folks, I have a basic datasource-sybase.xml file: 
> 
> <?xml version="1.0" encoding="UTF-8"?> 
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">    
>        <bean id="dataSource" class="com.sybase.jdbc3.jdbc.SybXADataSource">      
>                <property name="url"
> value="jdbc:sybase:Tds:machine:port/dbname"/>      
>                <property name="user" value="nnnn"/>      
>                <property name="password" value="nnnn"/>  
>        </bean>    
> 
>        <service interface="javax.sql.DataSource" ref="dataSource">    
>                <service-properties>            
>                        <entry key="osgi.jndi.service.name"
> value="jdbc/sybase"/>    
>                </service-properties>  
>        </service>
> </blueprint>  
> (the machine/port/dbname/nnnn values are filled out correctly when I deploy) 
> When I put this into the deploy folder, I see in the log that: 
> 
> 2012-03-09 13:34:30,486 | ERROR | rint Extender: 2 | BlueprintContainerImpl          
> | container.BlueprintContainerImpl  358 | 9 - 
> org.apache.aries.blueprint - 0.3.1 | Unable to start blueprint container for
> bundle datasource-sybase.xml 
> org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to
> find property descriptor url on class com.sybase.jdbc3.jdbc.SybXADataSource 
>        at
> org.apache.aries.blueprint.container.BeanRecipe.getPropertyDescriptor(BeanRecipe.java:820)[9:org.apache.aries.blueprint:0 
> ... 
> ... 
> I've been unable to find any reference to what might be causing this -- any
> pointers to help me determine the issues here??  Am I missing something in
> my xml file?   I did the install of the com.sybase.jconn/6.0.5 via the: 
> install -s wrap:mvn:com/sybase/jconn/6.0.5 and I DID get a bundle installed. 
> 
> Any/all help appreciated!  
> 
> 
> 
> --
> View this message in context: http://karaf.922171.n3.nabble.com/deploying-a-database-source-as-service-in-Karaf-2-2-5-tp3814097p3814097.html
> Sent from the Karaf - User mailing list archive at Nabble.com.