geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brianm709 <bmmer...@dstsystems.com>
Subject Accessing SQL Server datasource from EJB
Date Wed, 19 Dec 2007 18:05:36 GMT

I am new to Geronimo.  I started with the Very simple Entity EJB example
http://cwiki.apache.org/GMOxDOC20/very-simple-entity-ejb-example.html

Everything is working fine using derby as the DB.
My next step is to use a SQL Server database.
I configured a database pool named "myawddb2".  It connects successfully.

I followed the "Untested Instructions for using jta-datasource in
persistence.xml" at the bottom of the example

I added the myawddb2 dependency to my openejb-jar.xml

<openejb-jar
      xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.1" 
      xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.1" 
      xmlns:pkgen="http://www.openejb.org/xml/ns/pkgen-2.0" 
      xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1" 
      xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2">
   <sys:environment>
      <sys:moduleId>
         <sys:groupId>org.apache.geronimo.samples</sys:groupId>
         <sys:artifactId>MyPhonebookBean</sys:artifactId>
         <sys:version>1.0</sys:version>
         <sys:type>car</sys:type>
      </sys:moduleId>
     
      <sys:dependencies>
         <sys:dependency>
            <sys:groupId>console.dbpool</sys:groupId>
            <sys:artifactId>myawddb2</sys:artifactId>
            <sys:version>1.0</sys:version>
            <sys:type>rar</sys:type>
         </sys:dependency>
      </sys:dependencies>
      
   </sys:environment>
</openejb-jar>

I modified the persistence unit in my persistence.xml

<persistence   xmlns="http://java.sun.com/xml/ns/persistence"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="1.0"
            xsi:schemaLocation="http://java.sun.com/xml/ns/persistence 
            http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
  
   <persistence-unit name="myawddbPU">
      <description>Phone Book</description>
      <jta-datasource>myawddb2</jta-datasource>  
      <class>org.apache.geronimo.samples.myphonebookpak.PhoneBook</class>
      <properties>
         <property name="openjpa.jdbc.SynchronizeMappings" value="false" />
      </properties>
   </persistence-unit>  
</persistence>

The app deploys successfully.
When I test it I get the following exception:
11:44:42,532 ERROR [OpenEJB] The bean instances business method encountered
a system exception: A JDBC Driver or DataSource class name must be specified
in the ConnectionDriverName property.
<openjpa-1.0.0-r420667:568756 fatal user error>
org.apache.openjpa.persistence.ArgumentException: A JDBC Driver or
DataSource class name must be specified in the ConnectionDriverName
property.

I tried adding the openjpa.ConnectionDriverName property to my
persistence.xml file, although I think this should come from the datasource
I have already defined.  When I do this I get a "The connection URL is
null." error.

I am looking for any guidance that might help me through this issue.

Thanks.
Brian
-- 
View this message in context: http://www.nabble.com/Accessing-SQL-Server-datasource-from-EJB-tp14422136s134p14422136.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Mime
View raw message