for 2.1:
setup datasource in jboss.jcml  (RealDBName)
link coded name to real name in jboss.xml (resource-manager -
res-ref-name(CodedName) - jndi-name(RealDBName))
declare reference to coded name in ejb-jar.xml (resource-ref -
res-ref-name(CodedName))
lookup coded name in code (InitialContext.lookup(CodedName))

> -----Original Message-----
> From: oliver2, andy [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, March 01, 2001 10:43 AM
> To: '[EMAIL PROTECTED]'
> Subject: RE: [jBoss-User] Associate a jndi name to a datasource
> 
> 
>  I'm having a similar problem (only I'm using PostgreSQL)... 
> Only when I
> look it up
> it returns the hypersonic datasource and hence everything fails.  I'm
> figuring somehow
> its causing it to go to the "DefaultDS"
> 
> Could someone do a step by step with a postgres or oracle 
> example on how to
> setup the 
> resource-ref/etc?  I think I did it right but its hard with all the
> conflicting documentation.
> I'm using FEB-11 2.1 pre (currently).
> 
> -----Original Message-----
> From: Thierry Templier
> To: [EMAIL PROTECTED]
> Sent: 3/1/01 3:44 AM
> Subject: [jBoss-User] Associate a jndi name to a datasource
> 
> Hello,
> 
> I have the following xml config files:
> 
> 
> // jboss.conf
> 
> <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,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.logging.FileLogging" 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="../../tmp/">
> </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.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.jdbc.JdbcProvider"
> ARCHIVE="jboss.jar,idb.jar,hsql.jar" CODEBASE="../../lib/ext/">
> </MLET>
> 
> <MLET CODE = "org.jboss.web.WebService"
> 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.NamingService" ARCHIVE="jnpserver.jar"
> CODEBASE="../../lib/ext/">
> </MLET>
> 
> <MLET CODE = "org.jboss.tm.TransactionManagerService"
> ARCHIVE="jboss.jar,jta-spec1_0_1.jar" CODEBASE="../../lib/ext/">
> </MLET>
> 
> <MLET CODE = "org.jboss.security.JaasSecurityManagerService"
> ARCHIVE="jboss.jar" CODEBASE="../../lib/ext/">
> </MLET>
> 
> <MLET CODE = "org.jboss.security.SimpleRealmMappingService"
> ARCHIVE="jboss.jar" CODEBASE="../../lib/ext/">
> </MLET>
> 
> <MLET CODE = "org.jboss.security.EJBSecurityManagerService"
> ARCHIVE="jboss.jar" CODEBASE="../../lib/ext/">
> </MLET>
> 
> <MLET CODE="org.jboss.jdbc.XADataSourceLoader" ARCHIVE="jboss.jar"
> CODEBASE="../../lib/ext/">
>     <ARG TYPE="java.lang.String" VALUE="InstantDB">
>     <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="DefaultDS">
>     <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="JetEngineDB">
>     <ARG TYPE="java.lang.String"
> VALUE="org.jboss.minerva.xa.XADataSourceImpl">
> </MLET>
> 
> <MLET CODE = "org.jboss.ejb.ContainerFactory"
> ARCHIVE="jboss.jar,ejb.jar,jnp-client.jar,ejxeditor.jar,ejxjboss.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 = "org.jboss.jmx.server.RMIConnectorService"
> ARCHIVE="jboss.jar" CODEBASE="../../lib/ext/">
> </MLET>
> 
> <MLET CODE = "com.sun.jdmk.comm.HtmlAdaptorServer"
> ARCHIVE="jmxtools.jar" CODEBASE="../../lib/ext/"
> NAME="Adaptor:name=html">
> </MLET>
> 
> <MLET CODE = "org.jboss.configuration.ConfigurationService"
> ARCHIVE="jboss.jar,../xml.jar" CODEBASE="../../lib/ext/">
> </MLET>
> 
> <!-- 
>   -- The j2ee deployer can deploy jar,war and ear files.  Its 
> role is to
> 
>   -- split the archive and hand the parts (jars, wars) to the 
> relevant 
>   -- deployers
>   -- 
>   -- Arguments: #1: where the j2eedeployer should store its 
> config files
>   --            #2: the jar deployer: currently only ContainerFactory
>   --            #3: the war deployer: you can use tomcat
> (":service=EmbeddedTomcat")
>   --                or jetty (":service=Jetty")
>   --                See below to start these services
>   -->
> <MLET CODE = "org.jboss.deployment.J2eeDeployer"
> ARCHIVE="jboss.jar,../xml.jar" CODEBASE="../../lib/ext/">
>     <ARG TYPE="java.lang.String" VALUE="../tmp/deploy">
>     <ARG TYPE="java.lang.String" VALUE="EJB:service=ContainerFactory">
>     <ARG TYPE="java.lang.String" VALUE=":service=EmbeddedTomcat">
> </MLET>
> 
> 
> <!-- 
>   -- Uncomment this to add "Stand-alone Stack Tomcat support".  
>   -- This means that JSP and Servlets will work with EJB in different
> stacks and 
>   -- communicate through network invocation.  If you benchmark j2ee
> please use "integrated stack".
>   -- Also note that you cannot use the J2EE deployer with 
> Tomcat in this
> configuration.
>   -- Be sure to set your 'TOMCAT_HOME' environment variable before
> starting JBoss. 
>   -- Note: this reads the server.xml configuration file of Tomcat, you
> can't use the j2ee deployer
>   --
>   -- MLET CODE = "org.jboss.tomcat.TomcatService" ARCHIVE="jboss.jar"
> CODEBASE="../../lib/ext/">
>   -- /MLET>
>   -->
> 
> <!-- WARNING: only one of the tomcat services can be 
> configured, either
> "stand alone or integrated" -->
> 
> <!-- 
>   -- Uncomment this to add "Integrated Stack (fast) Tomcat support". 
>   -- This service allows you to integrate the stack of Tomcat 
> and jboss.
> 
>   -- Invocations are not going through network but pass 
> native pointers
> resulting in dramatic speed increases.
>   -- This service allows the J2EE deployer to add and remove Tomcat
> contexts dynamically
>   -- through JMX for you and in effect deploy EARs. Note that tomcat's
> server.xml file will not be processed: 
>   -- you can only use JMX to add contexts.  Use the J2EE deployer to
> deploy full EARs on this stack
>   -- Be sure to set your 'TOMCAT_HOME' environment variable before
> starting JBoss.
>   -- 
>   -- The ARG tag is the port to run tomcat on.
>   -- 
>   -- MLET CODE = "org.jboss.tomcat.EmbeddedTomcatService"
> ARCHIVE="jboss.jar" CODEBASE="../../lib/ext/">
>   -- ARG TYPE="int" VALUE=8080>
>   -- /MLET>
>   -->
> 
> <!-- 
>   -- Uncomment this to add Jetty support. 
>   -- This service allows you to add and remove Jetty contexts
> dynamically
>   -- through JMX.
>   -- Be sure to set your 'JETTY_HOME' environment variable before
> starting 
>   -- JBoss.
>   -- Replace the ARG tag to give Jetty's XML configuration file.  
>   -- You can use JBOSS_HOME/conf/default/jetty.xml
>   --
>   -- MLET CODE = "org.jboss.jetty.JettyService"
> ARCHIVE="jetty-service.jar" CODEBASE="../../lib/ext/">
>   -- ARG TYPE="java.lang.String"
> VALUE="file:/usr/jboss/conf/default/jetty.xml">
>   -- /MLET>
>   -->
> 
> <MLET CODE = "org.jboss.spydermq.SpyderMQService" ARCHIVE="jboss.jar"
> CODEBASE="../../lib/ext/">
> </MLET>
> 
> 
> 
> <!--
>   -- Add templth
>   -- Specifique Oracle
>   -->
> 
> <MLET CODE="org.jboss.jdbc.XADataSourceLoader" ARCHIVE="jboss.jar"
> CODEBASE="../lib/ext/">
>       <ARG TYPE="java.lang.String" VALUE="OracleDB">
>       <ARG TYPE="java.lang.String"
> VALUE="org.jboss.minerva.xa.XADataSourceImpl">
> </MLET>
> 
> 
> // jboss.xml
> 
> <?xml version="1.0" encoding="Cp1252"?>
> 
> <jboss>
>   <secure>false</secure>
>   <container-configurations />
> 
>   <resource-managers>
>     <resource-manager 
> res-class="org.jboss.ejb.deployment.JDBCResource">
>         <res-name>java:/OracleDB</res-name>
>         <res-jndi-name>OracleDB</res-jndi-name>
>     </resource-manager>
>   </resource-managers>
> 
>   <enterprise-beans>
>      <session>
>        <ejb-name>UserBean</ejb-name>
>        <jndi-name>auth/User</jndi-name>
>        <configuration-name></configuration-name>
>      </session>
>   </enterprise-beans>
> </jboss>
> 
> 
> // ejb-jar.xml
> 
> <ejb-jar>
>   <description>authuser application </description>
>   <display-name>User</display-name>
>   <enterprise-beans>
>    <entity>
>     <description>test username</description>
>     <ejb-name>UserBean</ejb-name>
>     <home>UserHome</home>
>     <remote>User</remote>
>     <ejb-class>UserBean</ejb-class>
>     <persistence-type>Container</persistence-type>
>     <prim-key-class>UserPK</prim-key-class>
>     <reentrant>False</reentrant>
>     <cmp-field><field-name>id</field-name></cmp-field>
>     <cmp-field><field-name>username</field-name></cmp-field>
>     <resource-ref>
>        <res-ref-name>java:/OracleDB</res-ref-name>
>        <res-type>javax.sql.DataSource</res-type>
>        <res-auth>Container</res-auth>
>     </resource-ref>
>    </entity>
>   </enterprise-beans> 
> </ejb-jar>
> 
> 
> // jboss.jcml
> 
> <?xml version="1.0"?>
> 
> <server>
>      <mbean name="Adaptor:name=html">
>        <attribute name="MaxActiveClientCount">10</attribute>
>        <attribute name="Parser" />
>        <attribute name="Port">8082</attribute>
>      </mbean>
>      <mbean name="DefaultDomain:service=MLet">
>        <attribute
> name="LibraryDirectory">C:\Thierry\jBoss-2.0_FINAL\bin</attribute>
>      </mbean>
>      <mbean name="DefaultDomain:service=TransactionManager">
>        <attribute name="TransactionTimeout">300</attribute>
>      </mbean>
>      <mbean name="DefaultDomain:service=Logging,type=Console">
>        <attribute name="Format">[{2}] {4}</attribute>
>      </mbean>
>      <mbean name="DefaultDomain:service=Webserver">
>        <attribute name="Port">8083</attribute>
>      </mbean>
>      <mbean 
> name="DefaultDomain:service=XADataSource,name=JetEngineDB">
>        <attribute name="Properties"></attribute>
>        <attribute name="URL">jdbc:odbc:archeo</attribute>
>        <attribute name="GCMinIdleTime">1200000</attribute>
>        <attribute name="JDBCUser">templ</attribute>
>        <attribute name="MaxSize">0</attribute>
>        <attribute name="Password">templ</attribute>
>        <attribute name="GCEnabled">false</attribute>
>        <attribute name="InvalidateOnError">false</attribute>
>        <attribute name="TimestampUsed">false</attribute>
>        <attribute name="Blocking">true</attribute>
>        <attribute name="GCInterval">120000</attribute>
>        <attribute name="IdleTimeout">1800000</attribute>
>        <attribute name="IdleTimeoutEnabled">false</attribute>
>        <attribute name="LoggingEnabled">false</attribute>
>        <attribute name="MaxIdleTimeoutPercent">1.0</attribute>
>        <attribute name="MinSize">0</attribute>
>      </mbean>
>      <mbean name="DefaultDomain:service=Logging,type=File">
>        <attribute name="Format">[{2}] {4}</attribute>
>        <attribute name="LogName">server</attribute>
>      </mbean>
>      <mbean name="DefaultDomain:service=XADataSource,name=InstantDB">
>        <attribute name="Properties"></attribute>
>        <attribute
> name="URL">jdbc:idb:../conf/default/instantdb.properties</attribute>
>        <attribute name="GCMinIdleTime">1200000</attribute>
>        <attribute name="JDBCUser" />
>        <attribute name="MaxSize">10</attribute>
>        <attribute name="Password" />
>        <attribute name="GCEnabled">false</attribute>
>        <attribute name="InvalidateOnError">false</attribute>
>        <attribute name="TimestampUsed">false</attribute>
>        <attribute name="Blocking">true</attribute>
>        <attribute name="GCInterval">120000</attribute>
>        <attribute name="IdleTimeout">1800000</attribute>
>        <attribute name="IdleTimeoutEnabled">false</attribute>
>        <attribute name="LoggingEnabled">false</attribute>
>        <attribute name="MaxIdleTimeoutPercent">1.0</attribute>
>        <attribute name="MinSize">0</attribute>
>      </mbean>
>      <mbean name="DefaultDomain:service=Hypersonic">
>        <attribute name="Port">1476</attribute>
>        <attribute name="Silent">true</attribute>
>        <attribute name="Database">default</attribute>
>        <attribute name="Trace">false</attribute>
>      </mbean>
>      <mbean name="DefaultDomain:service=XADataSource,name=OracleDB">
>        <attribute name="Properties"></attribute>
>        <attribute
> name="URL">jdbc:oracle:thin:@192.168.100.2:1521:ispb</attribute>
>        <attribute name="GCMinIdleTime">1200000</attribute>
>        <attribute name="JDBCUser">stage_master</attribute>
>        <attribute name="MaxSize">0</attribute>
>        <attribute name="Password">oracle</attribute>
>        <attribute name="GCEnabled">false</attribute>
>        <attribute name="InvalidateOnError">false</attribute>
>        <attribute name="TimestampUsed">false</attribute>
>        <attribute name="Blocking">true</attribute>
>        <attribute name="GCInterval">120000</attribute>
>        <attribute name="IdleTimeout">1800000</attribute>
>        <attribute name="IdleTimeoutEnabled">false</attribute>
>        <attribute name="LoggingEnabled">false</attribute>
>        <attribute name="MaxIdleTimeoutPercent">1.0</attribute>
>        <attribute name="MinSize">0</attribute>
>      </mbean>
>      <mbean name="DefaultDomain:service=XADataSource,name=DefaultDS">
>        <attribute name="Properties"></attribute>
>        <attribute
> name="URL">jdbc:HypersonicSQL:hsql://localhost:1476</attribute>
>        <attribute name="GCMinIdleTime">1200000</attribute>
>        <attribute name="JDBCUser">sa</attribute>
>        <attribute name="MaxSize">10</attribute>
>        <attribute name="Password" />
>        <attribute name="GCEnabled">false</attribute>
>        <attribute name="InvalidateOnError">false</attribute>
>        <attribute name="TimestampUsed">false</attribute>
>        <attribute name="Blocking">true</attribute>
>        <attribute name="GCInterval">120000</attribute>
>        <attribute name="IdleTimeout">1800000</attribute>
>        <attribute name="IdleTimeoutEnabled">false</attribute>
>        <attribute name="LoggingEnabled">false</attribute>
>        <attribute name="MaxIdleTimeoutPercent">1.0</attribute>
>        <attribute name="MinSize">0</attribute>
>      </mbean>
>      <mbean name="EJB:service=ContainerFactory">
>        <attribute name="VerifyDeployments">true</attribute>
>        <attribute name="MetricsEnabled">false</attribute>
>        <attribute name="VerifierVerbose">true</attribute>
>      </mbean>
>    </server>
> 
> 
> With this config I can't access to the datasource with the jndi name
> OracleDB in a client application ( process java with main ). Is anyone
> have already this problem?
> Thanks for your help.
> Templ
> 
> 
> --
> --------------------------------------------------------------
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> List Help?:          [EMAIL PROTECTED]
> 
> 
> --
> --------------------------------------------------------------
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> List Help?:          [EMAIL PROTECTED]
> 





---------------------------------------------------------------------
This message (including any attachments) contains confidential, proprietary
or privileged information intended for a specific purpose and individual(s),
and is protected by law.  If you receive this message in error, please
immediately delete it and all copies of it from your system, destroy any
hard copies of it and notify the sender.  Any unauthorized disclosure,
copying or distribution of any part of this message, or the taking of any
unauthorized action based on it, is strictly prohibited.


--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]

Reply via email to