<soapbox>
Every vendor has their own way of glueing the pieces together, most
(that I have experience with, anyway) use XML. For example,
Vendor
GLUE
-----------------------------------------
JBoss
jboss.xml + jboss-web.xml
Sun (J2EE SDK) sun-j2ee-ri.xml
BEA
weblogic-ejb-jar.xml
ATG
dynamoJ2EESpecifier.xml
Decoupling is good, but comes at the cost of needing this extra glue.
If you want an enterprise app that will deploy unchanged on each of the
above platforms, just include a copy of each of the "glue" files above
in your app. The extra files will be ignored if you're not deploying on
those platforms.
Personally, I vote for the extra glue, since it's really very little
work to create and maintain them. The benefits far outweigh where we
were a few years ago.
</soapbox>
Just my 2 cents...
David
--
Oliver Henlich wrote:
> Hi!
>
> There seem to be so many postings about this stuff and all the solutions
> seem to involve the use of jboss.xml. The documentation says "Note that
> this file [jboss.xml] is almost NEVER required by JBoss."
>
> I would really like to be able to access the DataSource as all the books
> and tutorials describe (without the use of a vendor specific conf
> file)...as below:
>
> InitialContext ic = new InitialContext();
> DataSource ds = (DataSource) ic.lookup("java:comp/env/jdbc/TWANG_DS");
>
> I've got this to work but only with an extra level of indirection by
> using jboss.xml. There must be a way to avoid this and still be able to
> access the datasource using the format
> "java:comp/env/jdbc/DATASOURCE_NAME".
>
> I would really appreciate any advice/suggestions/solutions.
> Cheers
> oliver
>
> Here are the relevant bits in the config/code files:
>
> DAO.java
> --------
> ...
> try
> {
> InitialContext ic = new InitialContext();
> dbDataSource = (DataSource) ic.lookup("java:comp/env/jdbc/TWANG_DS");
> }
> catch (NamingException ne)
> {
> //error
> }
> ...
>
> ejb-jar.xml
> -----------
> ...
> <resource-ref>
> <description>DataSource for the STRUM database</description>
> <res-ref-name>jdbc/TWANG_DS</res-ref-name>
> <res-type>javax.sql.DataSource</res-type>
> <res-auth>Container</res-auth>
> </resource-ref>
> ...
>
> jboss.xml
> ---------
> ...
> <resource-managers>
> <resource-manager>
> <res-name>jdbc/TWANG_DS</res-name> <!-- DB name used in your EJB -->
> <res-jndi-name>java:/STRUM</res-jndi-name>
> </resource-manager>
> </resource-managers>
> ...
>
> jboss.jcml
> ----------
> ...
> <mbean code="org.jboss.jdbc.JdbcProvider"
> name="DefaultDomain:service=JdbcProvider">
> <attribute
>
>name="Drivers">COM.cloudscape.core.RmiJdbcDriver,sun.jdbc.odbc.JdbcOdbcDriver</attribute>
>
>
> </mbean>
>
> <mbean code="org.jboss.jdbc.XADataSourceLoader"
> name="DefaultDomain:service=XADataSource,name=STRUM">
> <attribute
>
>name="DataSourceClass">org.opentools.minerva.jdbc.xa.wrapper.XADataSourceImpl</attribute>
>
>
> <attribute name="PoolName">STRUM</attribute>
> <attribute
> name="URL">jdbc:cloudscape:rmi://localhost:1088/STRUM</attribute>
> <attribute name="JDBCUser"></attribute>
> <attribute name="Password"></attribute>
> </mbean>
> ...
>
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>
>
> _______________________________________________
> 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