This content has been marked as final.
Show 6 replies
-
1. Re: Problem with @Resource and JBOSS
anders.hedstrom Apr 20, 2006 7:11 AM (in response to tamri)Try
@Resource(mappedName="java:<your-jndi-name>") protected DataSource ds;
-
2. Re: Problem with @Resource and JBOSS
tamri Apr 20, 2006 7:18 AM (in response to tamri)"anders.hedstrom" wrote:
Try@Resource(mappedName="java:<your-jndi-name>") protected DataSource ds;
I have tryed, bat it is error "mappedName not found" -
3. Re: Problem with @Resource and JBOSS
anders.hedstrom Apr 20, 2006 7:49 AM (in response to tamri)Are you sure your using the correct jndi name?
I'm using jboss-4.0.4.CR2 as well, and here's how I do it:
I got the following line in my -ds.xml file:<datasources> <local-tx-datasource> <jndi-name>jdbc/MyDS</jndi-name> ...
and I got the following code in my EJB;@Resource(mappedName="java:jdbc/MyDS") protected DataSource ds;
And it works fine... -
4. Re: Problem with @Resource and JBOSS
anders.hedstrom Apr 20, 2006 7:49 AM (in response to tamri)Are you sure your using the correct jndi name?
I'm using jboss-4.0.4.CR2 as well, and here's how I do it:
I got the following line in my -ds.xml file:<datasources> <local-tx-datasource> <jndi-name>jdbc/MyDS</jndi-name> ...
and I got the following code in my EJB;@Resource(mappedName="java:jdbc/MyDS") protected DataSource ds;
And it works fine... -
5. Re: Problem with @Resource and JBOSS
tamri Apr 20, 2006 8:47 AM (in response to tamri)I have so in -ds.xml
<local-tx-datasource>
<jndi-name>jdbc/MSSQLDS</jndi-name>
and
@Resource(mappedName="java:jdbc/MSSQLDS") protected DataSource ds;
you see it is the same, what you has written, bat I don't understand why is error on keywords "mappedName " -
6. Re: Problem with @Resource and JBOSS
holeinone Mar 26, 2007 11:01 AM (in response to tamri)instead of mappedName try just "name" for instance:
@Resource(name="java:/QueueConnectionFactory")
private javax.jms.QueueConnectionFactory connectionFactory;