You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by axiez <le...@gmail.com> on 2009/02/02 07:08:23 UTC
Unable to resolve reference "JtaDataSourceWrapper" in gbean
default/a1/1233553508187
I have a business interface, remotely accessible stateless session bean,
entity, and a client that will access from a different JVM. I tried to
deploy a1.jar but got error message specified in the subject.
META-INF/persistence.xml has the following entries
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="manager">
<jta-data-source>jdbc/h</jta-data-source>
<class>AccountNtt</class>
</persistence-unit>
</persistence>
where h is the data source created by me using console, AccountNtt is the
entity class, and manager is the EntityManager reference in stateless
session bean.
Stateless session bean code is:
import java.util.List;
import javax.ejb.Stateless;
import javax.ejb.Remote;
import javax.persistence.PersistenceContext;
import javax.persistence.EntityManager;
import javax.persistence.Query;
@Stateless
@Remote(Account.class)
public class AccountBean implements Account {
@PersistenceContext
private EntityManager manager;
public AccountNtt find(String accountNum) {
AccountNtt ac =
(AccountNtt)manager.find(AccountNtt.class,accountNum);
return ac;
}
public AccountNtt createAccount(String name, String accountType, String
accountNum) {
AccountNtt acNtt = new AccountNtt(name, accountType, accountNum);
manager.persist(acNtt);
return acNtt;
}
public int displayBalance(String accountNum) {
AccountNtt ac = (AccountNtt) manager.find(AccountNtt.class,
accountNum);
return ac.balance;
}
public List<AccountNtt> balanceGt5000() {
String ejbql = "SELECT a FROM AccountNtt a WHERE a.balance>5000";
Query query = manager.createQuery(ejbql);
List<AccountNtt> result = query.getResultList();
return result;
}
public AccountNtt first0() {
String ejbql = "SELECT a FROM AccountNtt a WHERE a.balance=0";
Query query = manager.createQuery(ejbql);
AccountNtt a = (AccountNtt) query.getSingleResult();
return a;
}
public void clearAllAccounts() {
String ejbql = "DELETE FROM AccountNtt a";
Query q = manager.createQuery(ejbql);
manager.getTransaction().begin();
q.executeUpdate();
manager.getTransaction().commit();
}
}
The error message is:
Error: Unable to distribute a1.jar: Unable to resolve reference
"JtaDataSourceWrapper" in gbean
default/a1/1233553508187/jar?EJBModule=default/a1/1233553508187/jar,J2EEApplication=null,PersistenceUnitModule=ejb.jar,j2eeType=PersistenceUnit,name=manager
to a gbean matching the pattern
[?name=jdbc/h#org.apache.geronimo.naming.ResourceSource] due to: No matches
for referencePatterns:
[?name=jdbc/h#org.apache.geronimo.naming.ResourceSource]
How can I make the data source work?
--
View this message in context: http://www.nabble.com/Unable-to-resolve-reference-%22JtaDataSourceWrapper%22-in-gbean-default-a1-1233553508187-tp21784636s134p21784636.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.
Re: Unable to resolve reference "JtaDataSourceWrapper" in gbean
default/a1/1233553508187
Posted by axiez <le...@gmail.com>.
geronimo-application.xml has the following entries
<?xml version="1.0" encoding="UTF-8"?>
<app:application
xmlns:app="http://geronimo.apache.org/xml/ns/j2ee/application-2.0"
xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2"
xmlns:sec="http://geronimo.apache.org/xml/ns/security-2.0"
application-name="a1">
<environment>
<moduleId>
<artifactId>a1</artifactId>
</moduleId>
<dependencies>
<dependency>
<groupId>console.dbpool</groupId>
<artifactId>h</artifactId>
</dependency>
</dependencies>
</environment>
<context-root>/a1</context-root>
<resource-ref>
<res-ref-name>jdbc/MyDataSource</res-ref-name>
<resource-link>h</resource-link>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</app:application>
where h is the datasource configured by me in console.
Entries in persistence.xml are:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="manager" transaction-type="JTA">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<jta-data-source>MyDataSource</jta-data-source>
<class>AccountNtt</class>
</persistence-unit>
</persistence>
where manager is the reference to EntityManager object in bean code.
AccountNtt is the entity class POJO that represents a table in database.
I still am getting the same error when trying to deploy the jar file. I
referred the documentation but have not made much progress.
axiez wrote:
>
> I have a business interface, remotely accessible stateless session bean,
> entity, and a client that will access from a different JVM. I tried to
> deploy a1.jar but got error message specified in the subject.
> META-INF/persistence.xml has the following entries
> <?xml version="1.0" encoding="UTF-8"?>
> <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence">
> <persistence-unit name="manager">
> <jta-data-source>jdbc/h</jta-data-source>
> <class>AccountNtt</class>
> </persistence-unit>
> </persistence>
> where h is the data source created by me using console, AccountNtt is the
> entity class, and manager is the EntityManager reference in stateless
> session bean.
> Stateless session bean code is:
> import java.util.List;
> import javax.ejb.Stateless;
> import javax.ejb.Remote;
> import javax.persistence.PersistenceContext;
> import javax.persistence.EntityManager;
> import javax.persistence.Query;
> @Stateless
> @Remote(Account.class)
> public class AccountBean implements Account {
> @PersistenceContext
> private EntityManager manager;
> public AccountNtt find(String accountNum) {
> AccountNtt ac =
> (AccountNtt)manager.find(AccountNtt.class,accountNum);
> return ac;
> }
> public AccountNtt createAccount(String name, String accountType,
> String accountNum) {
> AccountNtt acNtt = new AccountNtt(name, accountType, accountNum);
> manager.persist(acNtt);
> return acNtt;
> }
> public int displayBalance(String accountNum) {
> AccountNtt ac = (AccountNtt) manager.find(AccountNtt.class,
> accountNum);
> return ac.balance;
> }
> public List<AccountNtt> balanceGt5000() {
> String ejbql = "SELECT a FROM AccountNtt a WHERE a.balance>5000";
> Query query = manager.createQuery(ejbql);
> List<AccountNtt> result = query.getResultList();
> return result;
> }
> public AccountNtt first0() {
> String ejbql = "SELECT a FROM AccountNtt a WHERE a.balance=0";
> Query query = manager.createQuery(ejbql);
> AccountNtt a = (AccountNtt) query.getSingleResult();
> return a;
> }
> public void clearAllAccounts() {
> String ejbql = "DELETE FROM AccountNtt a";
> Query q = manager.createQuery(ejbql);
> manager.getTransaction().begin();
> q.executeUpdate();
> manager.getTransaction().commit();
> }
> }
> The error message is:
> Error: Unable to distribute a1.jar: Unable to resolve reference
> "JtaDataSourceWrapper" in gbean
> default/a1/1233553508187/jar?EJBModule=default/a1/1233553508187/jar,J2EEApplication=null,PersistenceUnitModule=ejb.jar,j2eeType=PersistenceUnit,name=manager
> to a gbean matching the pattern
> [?name=jdbc/h#org.apache.geronimo.naming.ResourceSource] due to: No
> matches for referencePatterns:
> [?name=jdbc/h#org.apache.geronimo.naming.ResourceSource]
> How can I make the data source work?
>
--
View this message in context: http://www.nabble.com/Unable-to-resolve-reference-%22JtaDataSourceWrapper%22-in-gbean-default-a1-1233553508187-tp21784636s134p21828387.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.
Re: Unable to resolve reference "JtaDataSourceWrapper" in gbean
default/a1/1233553508187
Posted by axiez <le...@gmail.com>.
I created a fresh database pool and copied the plan to the application
directory. Also included the tranql-connector.. file to application
directory. Included NoTxDatasource shown in console as non-jta-datasource in
persistence.xml and deployment was successful. To be verified with
clienttesting
axiez wrote:
>
> I have a business interface, remotely accessible stateless session bean,
> entity, and a client that will access from a different JVM. I tried to
> deploy a1.jar but got error message specified in the subject.
> META-INF/persistence.xml has the following entries
> <?xml version="1.0" encoding="UTF-8"?>
> <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence">
> <persistence-unit name="manager">
> <jta-data-source>jdbc/h</jta-data-source>
> <class>AccountNtt</class>
> </persistence-unit>
> </persistence>
> where h is the data source created by me using console, AccountNtt is the
> entity class, and manager is the EntityManager reference in stateless
> session bean.
> Stateless session bean code is:
> import java.util.List;
> import javax.ejb.Stateless;
> import javax.ejb.Remote;
> import javax.persistence.PersistenceContext;
> import javax.persistence.EntityManager;
> import javax.persistence.Query;
> @Stateless
> @Remote(Account.class)
> public class AccountBean implements Account {
> @PersistenceContext
> private EntityManager manager;
> public AccountNtt find(String accountNum) {
> AccountNtt ac =
> (AccountNtt)manager.find(AccountNtt.class,accountNum);
> return ac;
> }
> public AccountNtt createAccount(String name, String accountType,
> String accountNum) {
> AccountNtt acNtt = new AccountNtt(name, accountType, accountNum);
> manager.persist(acNtt);
> return acNtt;
> }
> public int displayBalance(String accountNum) {
> AccountNtt ac = (AccountNtt) manager.find(AccountNtt.class,
> accountNum);
> return ac.balance;
> }
> public List<AccountNtt> balanceGt5000() {
> String ejbql = "SELECT a FROM AccountNtt a WHERE a.balance>5000";
> Query query = manager.createQuery(ejbql);
> List<AccountNtt> result = query.getResultList();
> return result;
> }
> public AccountNtt first0() {
> String ejbql = "SELECT a FROM AccountNtt a WHERE a.balance=0";
> Query query = manager.createQuery(ejbql);
> AccountNtt a = (AccountNtt) query.getSingleResult();
> return a;
> }
> public void clearAllAccounts() {
> String ejbql = "DELETE FROM AccountNtt a";
> Query q = manager.createQuery(ejbql);
> manager.getTransaction().begin();
> q.executeUpdate();
> manager.getTransaction().commit();
> }
> }
> The error message is:
> Error: Unable to distribute a1.jar: Unable to resolve reference
> "JtaDataSourceWrapper" in gbean
> default/a1/1233553508187/jar?EJBModule=default/a1/1233553508187/jar,J2EEApplication=null,PersistenceUnitModule=ejb.jar,j2eeType=PersistenceUnit,name=manager
> to a gbean matching the pattern
> [?name=jdbc/h#org.apache.geronimo.naming.ResourceSource] due to: No
> matches for referencePatterns:
> [?name=jdbc/h#org.apache.geronimo.naming.ResourceSource]
> How can I make the data source work?
>
--
View this message in context: http://www.nabble.com/Unable-to-resolve-reference-%22JtaDataSourceWrapper%22-in-gbean-default-a1-1233553508187-tp21784636s134p21866282.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.
Re: Unable to resolve reference "JtaDataSourceWrapper" in gbean default/a1/1233553508187
Posted by David Jencks <da...@yahoo.com>.
You need to have a geronimo plan with the datasource listed as a
dependency.
hope this hint helps
david jencks
On Feb 1, 2009, at 10:08 PM, axiez wrote:
>
> I have a business interface, remotely accessible stateless session
> bean,
> entity, and a client that will access from a different JVM. I tried to
> deploy a1.jar but got error message specified in the subject.
> META-INF/persistence.xml has the following entries
> <?xml version="1.0" encoding="UTF-8"?>
> <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence
> ">
> <persistence-unit name="manager">
> <jta-data-source>jdbc/h</jta-data-source>
> <class>AccountNtt</class>
> </persistence-unit>
> </persistence>
> where h is the data source created by me using console, AccountNtt
> is the
> entity class, and manager is the EntityManager reference in stateless
> session bean.
> Stateless session bean code is:
> import java.util.List;
> import javax.ejb.Stateless;
> import javax.ejb.Remote;
> import javax.persistence.PersistenceContext;
> import javax.persistence.EntityManager;
> import javax.persistence.Query;
> @Stateless
> @Remote(Account.class)
> public class AccountBean implements Account {
> @PersistenceContext
> private EntityManager manager;
> public AccountNtt find(String accountNum) {
> AccountNtt ac =
> (AccountNtt)manager.find(AccountNtt.class,accountNum);
> return ac;
> }
> public AccountNtt createAccount(String name, String accountType,
> String
> accountNum) {
> AccountNtt acNtt = new AccountNtt(name, accountType,
> accountNum);
> manager.persist(acNtt);
> return acNtt;
> }
> public int displayBalance(String accountNum) {
> AccountNtt ac = (AccountNtt) manager.find(AccountNtt.class,
> accountNum);
> return ac.balance;
> }
> public List<AccountNtt> balanceGt5000() {
> String ejbql = "SELECT a FROM AccountNtt a WHERE
> a.balance>5000";
> Query query = manager.createQuery(ejbql);
> List<AccountNtt> result = query.getResultList();
> return result;
> }
> public AccountNtt first0() {
> String ejbql = "SELECT a FROM AccountNtt a WHERE a.balance=0";
> Query query = manager.createQuery(ejbql);
> AccountNtt a = (AccountNtt) query.getSingleResult();
> return a;
> }
> public void clearAllAccounts() {
> String ejbql = "DELETE FROM AccountNtt a";
> Query q = manager.createQuery(ejbql);
> manager.getTransaction().begin();
> q.executeUpdate();
> manager.getTransaction().commit();
> }
> }
> The error message is:
> Error: Unable to distribute a1.jar: Unable to resolve reference
> "JtaDataSourceWrapper" in gbean
> default/a1/1233553508187/jar?EJBModule=default/a1/1233553508187/
> jar
> ,J2EEApplication
> =
> null
> ,PersistenceUnitModule=ejb.jar,j2eeType=PersistenceUnit,name=manager
> to a gbean matching the pattern
> [?name=jdbc/h#org.apache.geronimo.naming.ResourceSource] due to: No
> matches
> for referencePatterns:
> [?name=jdbc/h#org.apache.geronimo.naming.ResourceSource]
> How can I make the data source work?
> --
> View this message in context: http://www.nabble.com/Unable-to-resolve-reference-%22JtaDataSourceWrapper%22-in-gbean-default-a1-1233553508187-tp21784636s134p21784636.html
> Sent from the Apache Geronimo - Users mailing list archive at
> Nabble.com.
>