A couple things.
- If you give an XA connection pool the name "postgres", it will be in
JNDI as "xa.postgres".
- However, your beans should not use this (since the pool probably would
have a different JNDI name on every app server you deployed it in). Your
beans need to name a fixed resource in ejb-jar.xml and use that (so it
will be the same across servers). Let's say you call the resource "MyDB".
- Then, you need to add a resource manager to jboss.xml for the beans,
with another name, say "DBManager", and tell it the pool's JNDI name
("xa.postgres").
- Finally, you need to add a resource link to each bean's entry in
jboss.xml that links the bean's resource name "MyDB" to the resource
manager "DBManager".
- The jboss.xml file should go in the JAR with your bean code and
ejb-jar.xml file. It is only required if you use resources (databsae,
e-mail, messaging, etc.), want to use a non-default JNDI name for your
beans, or want to really tweak the container. If you have many beans in
many JARs, you need one jboss.xml per JAR, just like ejb-jar.xml.
- Now your bean should look up "MyDB", which corresponds to the resource
manager "DBManager" which corresponds to the pool "xa.postgres" and all
should be well.
Aaron
http://www.jboss.org/minerva/minerva.htm#jboss
On Thu, 17 Aug 2000, Jubin Zawar wrote:
> Hi !
>
> Got this problem here, and I really dont find any error.
>
> This is the interesting code fragment in my bean :
> --------------------
> try {
> /* try to get a connection from the database pool
> named postgres */
> naming = new InitialContext();
> ds =
> (DataSource)naming.lookup("java:comp/env/postgres");
> con = ds.getConnection();
> st = con.createStatement();
> /* get the count of interesting records */
> rs=st.executeQuery("SELECT COUNT(question) FROM
> wapquizview WHERE (difficulty = " + level +");");
> --------------------
>
> executing this, I get : "progres not bound".
>
> heres what I entered into the jboss conf files :
>
> In jboss.conf (directory conf) :
> I entered this :
>
> <MLET CODE="org.jboss.jdbc.DataSourceImpl"
> ARCHIVE="jboss.jar,jdbc6.5-1.2.jar" CODEBASE="../lib/ext/">
> <ARG TYPE="java.lang.String" VALUE="postgres">
> <ARG TYPE="java.lang.String"
> VALUE="org.jboss.minerva.xa.XADataSourceImpl">
> </MLET>
>
> and the jdbc driver is reported to being loaded at the beginning of jboss
> startup.
>
> in jboss.jcml (directory conf):
> <mbean name="DefaultDomain:service=XADataSource,name=postgres">
> <attribute name="URL">jdbc:postgresql:wapdb</attribute>
> <attribute name="JDBCUser">onu</attribute>
> <attribute name="Password">onu</attribute>
> </mbean>
>
> in jboss.properties :
>
> # System properties
> # These will be loaded and set by jBoss
> #java.rmi.server.useLocalHostName=true
> #java.rmi.server.codebase=http://localhost:8080/
>
> jdbc.drivers=org.hsql.jdbcDriver,jdbc.idbDriver,postgresql.Driver
>
> the jdbc driver is loaded properly at jboss startup.
>
> As I didnt find any jboss.xml file in the whole dir structure, I think that
> I have to provide it ? In which directory ? I thaught the ejb-jar.xml file
> is enough ?
>
> As I was not sure, I finally created a jboss.xml file with only this
> content, in the directory conf :
>
> <mbean name="DefaultDomain:service=XADataSource,name=postgres">
> <attribute name="URL">jdbc:postgresql:wapdb</attribute>
> <attribute name="JDBCUser">onu</attribute>
> <attribute name="Password">onu</attribute>
> </mbean>
>
>
> So whats wrong ?
>
>
> Below is the entire jboss.conf file, if youre interested so far :)
> And theres another thing suspicious to me : jboss doesnt report to me having
> located the XADatasource on startup. The classes XADataSourceLoader and
> XADataSourceLoaderMBean are not in the /src/org/jboss/jdbc directory. Is
> this normal ? On a Windows NT version I installed previously, these files
> are there ?!
> Well..
>
> Thanks a lot so far, Jubin :)
>
>
>
>
> <MLET CODE = "org.jboss.logging.Logger" ARCHIVE="jboss.jar"
> CODEBASE="../lib/ext/">
> </MLET>
>
>
> <MLET CODE = "org.jboss.logging.ConsoleLogging" ARCHIVE="jboss.jar"
> CODEBASE="../lib/ext/">
> <ARG TYPE="java.lang.String" VALUE="Information,Debug,Warning,Error">
> <ARG TYPE="java.lang.String" VALUE="[{2}] {4}">
> </MLET>
>
> <MLET CODE = "org.jboss.util.ClassPathExtension" ARCHIVE="jboss.jar"
> CODEBASE="../lib/ext/">
> <ARG TYPE="java.lang.String" VALUE="../../log/">
> </MLET>
>
> <MLET CODE = "org.jboss.util.Info" ARCHIVE="jboss.jar"
> CODEBASE="../lib/ext/">
> </MLET>
>
> <MLET CODE = "org.jboss.util.ClassPathExtension" ARCHIVE="jboss.jar"
> CODEBASE="../lib/ext/">
> <ARG TYPE="java.lang.String" VALUE="./">
> </MLET>
>
> <MLET CODE = "org.jboss.util.ClassPathExtension" ARCHIVE="jboss.jar"
> CODEBASE="../lib/ext/">
> <ARG TYPE="java.lang.String" VALUE="../../db/">
> </MLET>
>
> <MLET CODE = "org.jboss.jdbc.JdbcProvider" ARCHIVE="jboss.jar"
> CODEBASE="../lib/ext/">
> </MLET>
>
> <MLET CODE = "org.jboss.web.WebProvider" ARCHIVE="jboss.jar,dynaserver.jar"
> CODEBASE="../lib/ext/">
> </MLET>
>
> <MLET CODE = "org.jboss.jdbc.HypersonicDatabase"
> ARCHIVE="jboss.jar,hsql.jar" CODEBASE="../lib/ext/">
> </MLET>
>
> <MLET CODE = "org.jboss.naming.NamingProvider" ARCHIVE="jnpserver.jar"
> CODEBASE="../lib/ext/">
> </MLET>
>
> <MLET CODE = "org.jboss.tm.TransactionManagerService" ARCHIVE="jboss.jar"
> CODEBASE="../lib/ext/">
> </MLET>
>
> <MLET CODE = "org.jboss.jdbc.DataSourceImpl" ARCHIVE="jboss.jar,idb.jar"
> CODEBASE="../lib/ext/">
> <ARG TYPE="java.lang.String"
> VALUE="jdbc:idb:../conf/instantdb.properties">
> <ARG TYPE="java.lang.String" VALUE="InstantDB">
> <ARG TYPE="java.lang.String" VALUE="jdbc.idbDriver">
> <ARG TYPE="java.lang.String" VALUE="">
> <ARG TYPE="java.lang.String" VALUE="">
> </MLET>
>
> <MLET CODE = "org.jboss.jdbc.DataSourceImpl" ARCHIVE="jboss.jar,hsql.jar"
> CODEBASE="../lib/ext/">
> <ARG TYPE="java.lang.String" VALUE="jdbc:HypersonicSQL:hsql://localhost">
> <ARG TYPE="java.lang.String" VALUE="Hypersonic">
> <ARG TYPE="java.lang.String" VALUE="org.hsql.jdbcDriver">
> <ARG TYPE="java.lang.String" VALUE="sa">
> <ARG TYPE="java.lang.String" VALUE="">
> </MLET>
>
> <MLET CODE = "org.jboss.ejb.ContainerFactory"
> ARCHIVE="jboss.jar,jnpserver.jar,jxjboss.jar" CODEBASE="../lib/ext/">
> </MLET>
>
> <MLET CODE = "org.jboss.ejb.AutoDeployer" ARCHIVE="jboss.jar">
> <ARG TYPE="java.lang.String" VALUE="../deploy/">
> </MLET>
>
> <MLET CODE = "org.jboss.jmx.server.JMXAdaptorService" ARCHIVE="jboss.jar"
> CODEBASE="../lib/ext/">
> </MLET>
>
> <MLET CODE = "com.sun.jdmk.comm.HtmlAdaptorServer" ARCHIVE="jmxtools.jar"
> CODEBASE="../lib/ext/" NAME="Adaptor:name=html,port=8082">
> </MLET>
>
> <MLET CODE="org.jboss.jdbc.DataSourceImpl"
> ARCHIVE="jboss.jar,jdbc6.5-1.2.jar" CODEBASE="../lib/ext/">
> <ARG TYPE="java.lang.String" VALUE="postgres">
> <ARG TYPE="java.lang.String"
> VALUE="org.jboss.minerva.xa.XADataSourceImpl">
> </MLET>
>
>
>
> --
> --------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> Problems?: [EMAIL PROTECTED]
>
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]