Besides that @DataSourceDefinition, I do have a PersistenceUnit
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="clientes" transaction-type="JTA">
<jta-data-source>java:global/ClientesDS</jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
</properties>
</persistence-unit>
</persistence>
But I get:
DEPLOYMENTS MISSING DEPENDENCIES:
Deployment "persistence.unit:unitName=test.war#clientes" is missing the following dependencies:
Dependency "jboss.jca:name=global/ClientesDS,service=DataSourceBinding" (should be in state "Create", but is actually in state "** NOT FOUND Depends on 'jboss.jca:name=global/ClientesDS,service=DataSourceBinding' **")
DEPLOYMENTS IN ERROR:
Deployment "jboss.jca:name=global/ClientesDS,service=DataSourceBinding" is in error due to the following reason(s): ** NOT FOUND Depends on 'jboss.jca:name=global/ClientesDS,service=DataSourceBinding' **
And earlier in server.log I see
INFO [org.jboss.resource.connectionmanager.ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=internal/test/test/ClienteDAO/ClientesDS' to JNDI name 'java:internal/test/test/ClienteDAO/ClientesDS'
[]s, Fernando Lozano
---- Original Message ----
From: fernando@lozano.eti.br
To: "User development" <jboss-user@lists.jboss.org>
Sent: Ter, Out 11, 2011, 19:34 PM
Subject: [jboss-user] @DataSource not registed on the correct JNDI locaton
Hi there,
According to my understanding of
http://javahowto.blogspot.com/2010/04/datasourcedefinition-examples-in-javaee.html
and
http://java.sun.com/javaee/6/docs/api/javax/annotation/sql/DataSourceDefinition.html
The following annotation, which is part of a no-interface SLSB defined inside a test.war package:
@DataSourceDefinition(
name="java:global/ClientesDS",
className="org.hsqldb.jdbcDriver",
url="jdbc:hsqldb:file:/tmp/data/cliente",
user="sa", password="")
Should register "java:global/ClientesDS" on the application server JNDI three. But when I deploy under JBoss AS 6.1.0.Final, the DataSource is registed as "java:internal/test/test/ClienteDAO/ClientesDS"
Am I wrong or is JBoss AS violating the spec?
[]s, Fernando Lozano