Datasource Lookup War Packaging vs EJB Jar Packaging

20 views
Skip to first unread message

Chege Kĩnũthia

unread,
Mar 4, 2023, 2:44:18 AM3/4/23
to WildFly
Hi,

I am moving my ejbs from war to en ejb jar, that is part of an ear.

Previously I could add the following extract in web.xml

   <resource-env-ref>
        <description>Postgres Datasource</description>
        <resource-env-ref-name>jdbc/mbote</resource-env-ref-name>
        <resource-env-ref-type>javax.sql.DataSource</resource-env-ref-type>
        <lookup-name>java:/mbote</lookup-name>
    </resource-env-ref>

And then use

@Resource(name= "jdbc/mbote")

in my ejb.

This doesn't seem to work in ejb jar. The default datasource is peaked instead. Is there a way to do a similar set up in ejb-jar.xml?

Chege.
Reply all
Reply to author
Forward
0 new messages