I'm testing some EJBs in both WebLogic and JBoss and worked around this
problem by putting a serverVendor variable into the deployment descriptor.
Here's how to do it:
ejb-jar.xml
<env-entry>
<env-entry-name>serverVendor</env-entry-name>
<env-entry-type>java.lang.Integer</env-entry-type>
<env-entry-value>2</env-entry-value>
</env-entry>
In EJBean class:
private DataSource ds;
private static final int JBOSS = 2;
private static final String DB_DATA_SOURCE = "jdbc/oraclePool";
private static final String JBOSS_DB_DATA_SOURCE =
"java:jdbc/oraclePool";
private int serverVendor;
In ejbCreate:
initCtx = new InitialContext();
Integer sv = (Integer)initCtx.lookup("java:/comp/env/serverVendor");
serverVendor = sv.intValue();
if (serverVendor == JBOSS)
ds = (javax.sql.DataSource)
initCtx.lookup(JBOSS_DB_DATA_SOURCE);
else
ds = (javax.sql.DataSource) initCtx.lookup(DB_DATA_SOURCE);
Voila, you've handled an EJB server difference with the deployment
descriptor (and this is why we have deployment descriptors). You don't have
to recompile the EJB when you run in WebLogic or JBoss. You just need to
redeploy it with a different deployment descriptor (you have to do that
anyway). This seems to be a pretty solid workaround. I'm using in EJBs that
I'm stress testing on WebLogic and JBoss (up to 1000 concurrent clients so
far).
-----Original Message-----
From: Scott M Stark [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 11, 2001 4:40 PM
To: [EMAIL PROTECTED]
Subject: Re: [JBoss-user] How to configure compatible DataSource JNDI
for WebLogic and JBoss
One issue though is that you cannot configure a resource without a java:
prefix
as a Deployer in JBoss right now. I have filed this as a bug 414854 on
sourceforge.
----- Original Message -----
From: "Toby Allsopp" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, April 11, 2001 12:38 PM
Subject: Re: [JBoss-user] How to configure compatible DataSource JNDI for
WebLogic and JBoss
> On Wed, Apr 11, 2001 at 05:27:28PM +0700, Nguyen Thanh Phong wrote:
> > Hi,
> >
> > I'm recently moving my beans from WebLogic to JBoss. I have some
problems to
> > create/configure a compatible DataSource JNDI so that I don't have to
modify
> > my ejb-jar.xml when I deploy my code on WL or JBoss.
> >
> > In WebLogic, my beans works if I create a DataSource with JNDI name
(e.g.)
> > SmartPool. In JBoss, however I have to put java:/SmartPool for the
> > DataSource's JNDI. If I prefix my DataSource JNDI on WL with java:/, it
> > complains can my bean no longer works.
> >
> > Please provide me with some helps. All comments are appreciated.
>
> Read the EJB spec, section 19.4.
>
> Toby.
>
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-user
>
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user