Hi Michael,

there is a very fine example/explanation here:
http://www.openejb.org/faq_openejb-jar.html

Regards
Preben


Ueberbach, Michael wrote:

hello,

I'm using geronimo M5 and have a question about the deploying of an EJB 
application.
I already delpoyed a J2EE connector as a global connection to an existing Mysql 
database.
Also I deloyed a simple stateless session bean that may be part of a greater 
EJB application.
This session bean should retrieve data from the database directly (JDBC for 
reading).
I managed to do this while making a lookup to the datasource the following way:

(...)
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup("java:comp/env/MysqlDataSource");
(...)

Here "MysqlDataSource" is the name of the connection defined in the deployment 
plan for the above mentioned
connector:

(...)
<connectiondefinition-instance>
   <name>MysqlDataSource</name>
(-...)

Now I would like to replace the name of the connection by a logical name, let's 
say this way:

(...)
DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/DataSource");
(...)

Therefore a link between the alias "jdbc/DataSource" and the connection 
"MysqlDataSource" has to be
established elswhere.

I found an example of such a link in the following deployment plan

<web-app
       xmlns="http://geronimo.apache.org/xml/ns/web/jetty";
       xmlns:naming="http://geronimo.apache.org/xml/ns/naming";
       configId="PhoneBookWeb"
       parentId="MysqlDatabase"
       >
   <naming:resource-ref>
       <naming:ref-name>jdbc/DataSource</naming:ref-name>
       <naming:resource-link>MysqlDataSource</naming:resource-link>
   </naming:resource-ref>
</web-app>

But this is the plan for a web application and I want to deploy a simple EJB 
application. The
neccessary openejb-jar.xml does not allow such a link.
So where to put it?

Thanks a lot
Michael

Reply via email to