Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0004487 [Resin] minor always 04-07-11 19:47 04-27-11 11:35
Reporter reza View Status public  
Assigned To ferg
Priority normal Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 4.0.18 Product Version 4.0.17
  Product Build
Summary 0004487: Java EE 6 standard <data-source> XML element not supported.
Description Java EE 6 defines a standard <data-source> XML element. It can be defined in application.xml, web.xml or ejb-jar.xml. Here is the schema definition for the element:

<xsd:complexType name="data-sourceType">
  <xsd:annotation>
    <xsd:documentation>
      Configuration of a DataSource.
    </xsd:documentation>
  </xsd:annotation>
  <xsd:sequence>
    <xsd:element name="description" type="javaee:descriptionType" minOccurs="0">
      <xsd:annotation>
        <xsd:documentation>
          Description of this DataSource.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:element>
    <xsd:element name="name" type="javaee:jndi-nameType">
      <xsd:annotation>
        <xsd:documentation>
          The name element specifies the JNDI name of the
          data source being defined.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:element>
    <xsd:element name="class-name" type="javaee:fully-qualified-classType"
        minOccurs="0">
      <xsd:annotation>
        <xsd:documentation>
          DataSource, XADataSource or ConnectionPoolDataSource
          implementation class.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:element>
    <xsd:element name="server-name" type="javaee:string" minOccurs="0">
      <xsd:annotation>
        <xsd:documentation>
          Database server name.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:element>
    <xsd:element name="port-number" type="javaee:xsdIntegerType" minOccurs="0">
      <xsd:annotation>
        <xsd:documentation>
          Port number where a server is listening for requests.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:element>
    <xsd:element name="database-name" type="javaee:string" minOccurs="0">
      <xsd:annotation>
        <xsd:documentation>
          Name of a database on a server.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:element>
    <xsd:element name="url" type="javaee:jdbc-urlType" minOccurs="0">
      <xsd:annotation>
        <xsd:documentation>
          <![CDATA[[
          A JDBC URL. If the <code>url</code> property is specified along with
          other standard <code>DataSource</code> properties such as
          <code>serverName</code>, <code>databaseName</code> and
          <code>portNumber</code>, the more specific properties will take
          precedence and <code>url</code> will be ignored.
          ]]>
        </xsd:documentation>
      </xsd:annotation>
    </xsd:element>
    <xsd:element name="user" type="javaee:string" minOccurs="0">
      <xsd:annotation>
        <xsd:documentation>
          User name to use for connection authentication.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:element>
    <xsd:element name="password" type="javaee:string" minOccurs="0">
      <xsd:annotation>
        <xsd:documentation>
          Password to use for connection authentication.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:element>
    <xsd:element name="property" type="javaee:propertyType" minOccurs="0"
        maxOccurs="unbounded">
      <xsd:annotation>
        <xsd:documentation>
          JDBC DataSource property. This may be a vendor-specific property or a
          less commonly used DataSource property.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:element>
    <xsd:element name="login-timeout" type="javaee:xsdIntegerType"
        minOccurs="0">
      <xsd:annotation>
        <xsd:documentation>
          Sets the maximum time in seconds that this data source will wait
          while attempting to connect to a database.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:element>
    <xsd:element name="transactional" type="javaee:xsdBooleanType"
        minOccurs="0">
      <xsd:annotation>
        <xsd:documentation>
          Set to false if connections should not participate in transactions.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:element>
    <xsd:element name="isolation-level" type="javaee:isolation-levelType"
        minOccurs="0">
      <xsd:annotation>
        <xsd:documentation>
          Isolation level for connections.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:element>
    <xsd:element name="initial-pool-size" type="javaee:xsdIntegerType"
        minOccurs="0">
      <xsd:annotation>
        <xsd:documentation>
          Number of connections that should be created when a connection pool
          is initialized.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:element>
    <xsd:element name="max-pool-size" type="javaee:xsdIntegerType"
        minOccurs="0">
      <xsd:annotation>
        <xsd:documentation>
          Maximum number of connections that should be concurrently allocated
          for a connection pool.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:element>
    <xsd:element name="min-pool-size" type="javaee:xsdIntegerType"
        minOccurs="0">
      <xsd:annotation>
        <xsd:documentation>
          Minimum number of connections that should be concurrently allocated
          for a connection pool.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:element>
    <xsd:element name="max-idle-time" type="javaee:xsdIntegerType"
        minOccurs="0">
      <xsd:annotation>
        <xsd:documentation>
          The number of seconds that a physical connection should remain unused
          in the pool before the connection is closed for a connection pool.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:element>
    <xsd:element name="max-statements" type="javaee:xsdIntegerType"
        minOccurs="0">
      <xsd:annotation>
        <xsd:documentation>
          The total number of statements that a connection pool should keep
          open.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:element>
  </xsd:sequence>
  <xsd:attribute name="id" type="xsd:ID"/>
</xsd:complexType>

The <data-source> element can be used in application.xml like this:

<application>
  <display-name>...</display-name>
  <module>...</module>
  <data-source>
    <name>java:global/jdbc/MyDataSource</name>
    <class-name>org.apache.derby.jdbc.ClientXADataSource</class-name>
    <server-name>localhost</server-name>
    <port-number>1527</port-number>
    <database-name>testdb</database-name>
    <user>APP</user>
    <password>APP</password>
    <property>
      <name>connectionAttributes</name>
      <value>;create=true</value>
    </property>
  </data-source>
</application>

The <data-source> element can be used in web.xml like this:

<web-app>
  <display-name>...</display-name>
  <servlet>...</servlet>
  <servlet-mapping>...</servlet-mapping>
  <data-source>
    <name>java:app/jdbc/MyDataSource</name>
    <class-name>org.apache.derby.jdbc.ClientXADataSource</class-name>
    <server-name>localhost</server-name>
    <port-number>1527</port-number>
    <database-name>testdb</database-name>
    <user>APP</user>
    <password>APP</password>
    <property>
      <name>connectionAttributes</name>
      <value>;create=true</value>
    </property>
  </data-source>
</web-app>

The <data-source> element can be used in ejb-jar.xml like this:

<ejb-jar>
  <module-name>...</module-name>
  <enterprise-beans>...</enterprise-beans>
  <assembly-descriptor>...</assembly-descriptor>
  <data-source>
    <name>java:module/jdbc/MyDataSource</name>
    <class-name>org.apache.derby.jdbc.ClientXADataSource</class-name>
    <server-name>localhost</server-name>
    <port-number>1527</port-number>
    <database-name>testdb</database-name>
    <user>APP</user>
    <password>APP</password>
    <property>
      <name>connectionAttributes</name>
      <value>;create=true</value>
    </property>
  </data-source>
</ejb-jar>

It can be also used to define a data-source at an EJB level:

<ejb-jar>
  <module-name>...</module-name>
  <enterprise-beans>
    <session>
      <display-name>...</display-name>
      <ejb-name>...</ejb-name>
      <business-local>...</business-local>
      <ejb-class>...</ejb-class>
      <data-source>
        <name>java:module/jdbc/MyDataSource</name>
        <class-name>org.apache.derby.jdbc.ClientXADataSource</class-name>
        <server-name>localhost</server-name>
        <port-number>1527</port-number>
        <database-name>testdb</database-name>
        <user>APP</user>
        <password>APP</password>
        <property>
          <name>connectionAttributes</name>
          <value>;create=true</value>
        </property>
      </data-source>
    </session>
  </enterprise-beans>
</ejb-jar>

The corresponding persistence.xml will look like this:

<persistence>
  <persistence-unit name="my-persistence-unit" transaction-type="JTA">
    <jta-data-source>java:app/jdbc/MyDataSource</jta-data-source>
    <validation-mode>AUTO</validation-mode>
    <properties>
      <property name="eclipselink.ddl-generation" value="create-tables" />
      <property name="eclipselink.logging.level" value="INFO" />
    </properties>
  </persistence-unit>
</persistence>
Steps To Reproduce
Additional Information
Attached Files

- Relationships

- Notes
(0005214)
ferg
04-27-11 11:35

ioc/1283
 

- Issue History
Date Modified Username Field Change
04-07-11 19:47 reza New Issue
04-07-11 19:48 reza Summary Java EE 6 Standard <data-source> XML element not supported. => Java EE 6 standard <data-source> XML element not supported.
04-27-11 11:35 ferg Note Added: 0005214
04-27-11 11:35 ferg Assigned To  => ferg
04-27-11 11:35 ferg Status new => closed
04-27-11 11:35 ferg Resolution open => fixed
04-27-11 11:35 ferg Fixed in Version  => 4.0.18


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
29 total queries executed.
26 unique queries executed.
Powered by Mantis Bugtracker