[Resin-interest] config question on 4.0

2011-11-01 Thread Riccardo Cohen
Hello
I'm migrating an application from resin v3.2.1 to v4.0.13.
In the old conf there were 2 database tags pointing to 2 different db 
servers, each with a different jndi-name

Now in v4, @Named is replaced with @Inject, but there is no attribute to 
set the jndi-name :

before :

   @Named(realty/jdbc) public DataSource m_datasource;// high priority
   @Named(realty/jdbclow) public DataSource m_datasourcelow;// low 
priority

after :

   @Inject public DataSource m_datasource;// high priority
   @Inject public DataSource m_datasourcelow;// low priority


I've googled and searched the doc, and did not find any way to tell 
resin to use the good jndi-name.
Is there any way to do so ?
Thanks a lot.

-- 
Riccardo Cohen
Architecte du Logiciel
http://www.architectedulogiciel.fr
BP 77536
37075 Tours Cedex 2
+33 (0)6.09.83.64.49
Membre du réseau http://www.reflexe-conseil-centre.org


___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


Re: [Resin-interest] config question on 4.0

2011-11-01 Thread Scott Ferguson
On 11/01/2011 09:19 AM, Riccardo Cohen wrote:
 Hello
 I'm migrating an application from resin v3.2.1 to v4.0.13.
 In the old conf there were 2database  tags pointing to 2 different db
 servers, each with a differentjndi-name

 Now in v4, @Named is replaced with @Inject, but there is no attribute to
 set the jndi-name :

 before :

 @Named(realty/jdbc) public DataSource m_datasource;// high priority
 @Named(realty/jdbclow) public DataSource m_datasourcelow;// low
 priority

 after :

 @Inject public DataSource m_datasource;// high priority
 @Inject public DataSource m_datasourcelow;// low priority


 I've googled and searched the doc, and did not find any way to tell
 resin to use the good jndi-name.
 Is there any way to do so ?

Well, there are a few things.

First, you always need an @Inject. If you have a @Named, you need 
something like:

   @Inject @Named(reality/jdbc) public DataSource m_datasource;

Second, @Named isn't the same as jndi; it's a CDI name not a JNDI name. 
I did just check, and Resin's database jndi-name=... does 
automatically set a @Named as well as the JNDI, but that's specific to 
database

More generally, you could use a ee:Named=foo

database ee:Named=foo xmlns:ee=urn:java:ee

The Named attribute is the same as @Named (the urn:java:ee is a search 
path like a classpath, which includes javax.inject.*, which is the 
package of javax.inject.Named.)

-- Scott

 Thanks a lot.




___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


Re: [Resin-interest] config question on 4.0

2011-11-01 Thread Riccardo Cohen
thanks a lot for your quick answer. The syntax with ee

database ee:Named=realty/jdbclow xmlns:ee=urn:java:ee

did not seems to work :

ee:Named=realty/jdbc is an unexpected attribute in database.

but keeping jndi-name works
Thanks a lot


On 01/11/11 17:27, Scott Ferguson wrote:
 On 11/01/2011 09:19 AM, Riccardo Cohen wrote:
 Hello
 I'm migrating an application from resin v3.2.1 to v4.0.13.
 In the old conf there were 2database   tags pointing to 2 different db
 servers, each with a differentjndi-name

 Now in v4, @Named is replaced with @Inject, but there is no attribute to
 set the jndi-name :

 before :

  @Named(realty/jdbc) public DataSource m_datasource;// high priority
  @Named(realty/jdbclow) public DataSource m_datasourcelow;// low
 priority

 after :

  @Inject public DataSource m_datasource;// high priority
  @Inject public DataSource m_datasourcelow;// low priority


 I've googled and searched the doc, and did not find any way to tell
 resin to use the good jndi-name.
 Is there any way to do so ?

 Well, there are a few things.

 First, you always need an @Inject. If you have a @Named, you need
 something like:

 @Inject @Named(reality/jdbc) public DataSource m_datasource;

 Second, @Named isn't the same as jndi; it's a CDI name not a JNDI name.
 I did just check, and Resin'sdatabase jndi-name=...  does
 automatically set a @Named as well as the JNDI, but that's specific to
 database

 More generally, you could use a ee:Named=foo

 database ee:Named=foo xmlns:ee=urn:java:ee

 The Named attribute is the same as @Named (the urn:java:ee is a search
 path like a classpath, which includes javax.inject.*, which is the
 package of javax.inject.Named.)

 -- Scott

 Thanks a lot.




 ___
 resin-interest mailing list
 resin-interest@caucho.com
 http://maillist.caucho.com/mailman/listinfo/resin-interest


-- 
Riccardo Cohen
Architecte du Logiciel
http://www.architectedulogiciel.fr
BP 77536
37075 Tours Cedex 2
+33 (0)6.09.83.64.49
Membre du réseau http://www.reflexe-conseil-centre.org


___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest