Beautyful. Now I feel stupid :)



Aaron Mulder wrote:

>         You mixed up the res-name and res-jndi-name in the jboss.xml
> resource-manager section.  Try swapping them.
>
> Aaron
>
> On Fri, 13 Oct 2000, Marko [iso-8859-1] �trukelj wrote:
> > Hi,
> >
> > Aaron:
> >
> > I've spent the last four hours trying to make it work like you suggested.
> > But it makes no difference if I put in jboss.xml or not.
> >
> > Maybe I'm not configuring and binding the resource-manager right.
> >
> > Here is what I do:
> >
> > jboss.xml
> > ======
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> >
> > <jboss>
> >   <resource-managers>
> >     <resource-manager>
> >       <res-name>dbpool</res-name>         <!-- declared in jboss.conf -->
> >       <res-jndi-name>pool2</res-jndi-name>      <!-- I make it up here to use it 
>further down -->
> >     </resource-manager>
> >   </resource-managers>
> >
> >   <enterprise-beans>
> >     <session>
> >       <ejb-name>myejb.MyStatelessSession</ejb-name>
> >       <resource-ref>
> >         <res-ref-name>myDB</res-ref-name>     <!-- in session bean I look it up 
>like this:
> > (DataSource)ctx.lookup("java:comp/env/myDB"); -->
> >         <resource-name>pool2</resource-name>    <!-- I defined this before -->
> >       </resource-ref>
> >     </session>
> >   </enterprise-beans>
> > </jboss>
> >
> >
> > In jboss.conf:
> >
> > <MLET CODE="org.jboss.jdbc.XADataSourceLoader" ARCHIVE="jboss.jar" 
>CODEBASE="../lib/ext/">
> >     <ARG TYPE="java.lang.String" VALUE="dbpool">
> >     <ARG TYPE="java.lang.String" VALUE="org.jboss.minerva.xa.XADataSourceImpl">
> > </MLET>
> >
> >
> > <MLET CODE="org.jboss.jdbc.XADataSourceLoader" ARCHIVE="jboss.jar" 
>CODEBASE="../lib/ext/">
> >     <ARG TYPE="java.lang.String" VALUE="IDB">
> >     <ARG TYPE="java.lang.String" VALUE="org.jboss.minerva.xa.XADataSourceImpl">
> > </MLET>
> >
> >
> > In jboss.jcml:
> >
> >      <mbean name="DefaultDomain:service=XADataSource,name=dbpool">
> >        <attribute name="URL">jdbc:idb:../conf/instantdb.properties</attribute>
> >         .....
> >      </mbean>
> >
> >      <mbean name="DefaultDomain:service=XADataSource,name=IDB">
> >        <attribute name="URL">jdbc:HypersonicSQL:hsql://localhost</attribute>
> >        .....
> >      </mbean>
> >
> >
> >
> > Did I do something wrong in jboss.xml? I definately put it in the jar and it 
>definately gets parsed.
> >
> > Thanks.
> >
> >     Marko Strukelj ([EMAIL PROTECTED])
> >
> >
> > Aaron Mulder wrote:
> >
> > >         Okay, you have a number of issues.
> > >
> > > 1) If you do not use a jboss.xml file in your EJB JAR, then any data
> > > source references get bound to the first database pool created.  That is
> > > why you are getting Hypersonic connections instead of InstantDB
> > > connections if you have several pools in jboss.conf and jboss.jcml.
> > >
> > > 2) If you declare a resource reference in your ejb-jar.xml with the name
> > > "jdbc/Foo", you must look it up in your bean under the name
> > > "java:comp/env/jdbc/Foo" not "jdbc/Foo".
> > >
> > > 3) What you really want to do is pick some constant name for the pool you
> > > declare in jboss.conf and jboss.jcml (say, Foo).  Then name the resource
> > > reference anything you want - "jdbc/BeanDatabase" or whatever.  Then
> > > create a jboss.xml and create a resource manager that refers to the pool
> > > you declared (Foo), with any name you want (say, Bar).  Then for each
> > > bean, add an entry that links the resource reference name from ejb-jar.xml
> > > (jdbc/BeanDatabase) to the resource manager (Bar).  You can have a number
> > > of different beans, all with different DB names according to the
> > > ejb-jar.xml file, but make them all refer to the same resource manager -
> > > or have them all refer to different ones.  Whatever.  But to finish the
> > > example, you now have "jdbc/BeanDatabase" (in ejb-jar.xml) linked to
> > > resource manager "Bar" (in jboss.xml), which refers to "Foo" (in
> > > jboss.xml), which was declared in jboss.conf and jboss.jcml.  If you leave
> > > out jboss.xml, then every resource reference is linked to the first
> > > database to be declared, no matter what the names are.
> > >
> > > Aaron
> > >
> >
> >


Reply via email to