cancel
Showing results for 
Search instead for 
Did you mean: 

Configuring datasources with j2ee-engine.xml

Former Member
0 Kudos

We need to host the same application on the same j2ee-engine (one for training purposes and one for QA for example) .

What we tried to do and almost succeeded is to simply create a second EAR project and configure it to use a different URL for the web-modules. We also managed to use the <alt-dd> element in application.xml so that we can specify different web.xml and ejb.xml deployement descriptors than the default ones defined in the individual modules. In theory, this would allow us to reference different datasources for EAR #2 compared to EAR#1. The model breaks down however due to the fact that we apparently cannot specifiy alternatives for the web-j2ee-engine.xml and ejb-j2ee-engine.xml files. Since the binding between a resource reference and a JNDI name resides in these files we are in a dead-end! Does anybody now how to resolve this? In some App servers (Weblogic for example) we apparently can specify an alternative for both the "standard" deployement descriptor and the "engine specific" deployment descriptor. Is there something sikilar or equivalent in Netweaver 6.4?

Accepted Solutions (1)

Accepted Solutions (1)

Vlado
Advisor
Advisor
0 Kudos

Hi Laurent,

In NetWeaver 04, you cannot override the "engine specific" deployment descriptors like you do for the standard ones. However, you still have options to achieve your goal:

1) You can avoid the "binding between a resource reference and a JNDI name" in the *-j2ee-engine.xml deployment descriptors. If you setup your reference name to be the same as the actual JNDI name of the resource, you don't need the *-j2ee-engine.xml. For example, if you have defined in your data-sources.xml:


<data-source>
	<data-source-name>jdbc/MyDataSource</data-source-name>
</data-source>

you can then have in your ejb-jar.xml and/or web.xml:


<resource-ref>
	<res-ref-name>jdbc/MyDataSource</res-ref-name>
	<res-type>javax.sql.DataSource</res-type>
	<res-auth>Container</res-auth>
</resource-ref>

and that would be enough. The JNDI name will default to the <res-ref-name>.

2) If 1) is not possible for some reason, then you can setup references to both datasources in your alt-dd ejb-jar.xml and/or web.xml, but use only one of them in each of the scenarios. You can use environment entries (again defined in the alt-dd xml) to decide on which reference to use. If you need more help on this approach, please come back and I would be glad to answer your questions.

Hope it helps!

-Vladimir

Former Member
0 Kudos

Vladimir,

Thank you very much for a very clear, to the point and helpful answer. Your solution solved our problem and helped us make better or more appropriate use of the j2ee-engine jndi.

Regards

-Laurent

Answers (0)