• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

jboss, datasource naming and lookup error

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
here is the problem,
How do i bind a datasource in Jboss with jndi so that the clients can access them with or without EJbs??
----------------------
============================================================
i have a simple client as :
====================================
import java.sql.*;
import javax.sql.*;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import Converter;
import ConverterHome;
public class ConverterClient {
private static Connection conn=null;
public static void main(String[] args) {
try {
InitialContext initial = new InitialContext();
System.out.println("Got context");
Object objref = initial.lookup("converter/Converter");
System.out.println("Got reference");
ConverterHome home =
(ConverterHome)PortableRemoteObject.narrow(objref,
ConverterHome.class);
Converter currencyConverter = home.create();

DataSource ds = (DataSource)initial.lookup("java:comp/env/jdbc/mySQLDSname");
System.out.println("Got datasource.");

conn = ds.getConnection("dev_hospital","dev_hospital");
if(conn!=null){
System.out.println("Got Connection");
conn.close();
}else{
System.out.println("Unable to get connection.");
}

double amount = currencyConverter.dollarToYen(100.00);
System.out.println(String.valueOf(amount));
amount = currencyConverter.yenToEuro(100.00);
System.out.println(String.valueOf(amount));
currencyConverter.remove();
} catch (Exception ex) {
System.err.println("Error> ");
ex.printStackTrace();
}
}
}
=======
when i run this client it shows error as;
D:\tryouts\Converter>java -classpath ".;c:\jboss;c:\jboss\client\ejb.jar;c:\jbos
s\client\jboss-j2ee.jar;c:\jboss\client\jaas.jar;c:\jboss\client\jbosssx-client.
jar;c:\jboss\client\jboss-client.jar;c:\jboss\client\jnp-client.jar;C:\tomcat\li
b\servlet.jar" -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFac
tory -Djava.naming.provider.url=localhost:1099 -Djava.naming.factory.url.pkgs=o
rg.jboss.naming rg.jnp.interfaces -Djava.security.policy=c:\jboss\conf\hospital
.policy ConverterClient
Got context
Got reference
Error>
javax.naming.NameNotFoundException: jdbc not bound
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknow
n Source)
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:349)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:333)
at javax.naming.InitialContext.lookup(Unknown Source)
at ConverterClient.main(ConverterClient.java:26)
==========
please help
How do i bind a datasource in Jboss with jndi so that the clients can access them with or without EJbs??
thanks
sushil
####################################################################################################
i have jboss.jcml as:
==========================
<?xml version="1.0" encoding="UTF-8"?>
< !-- This is where you can add and configure your MBeans<br /> ATTENTION: The order of the listing here is the same order as<br /> the MBeans are loaded. Therefore if a MBean depends on another<br /> MBean to be loaded and started it has to be listed after all<br /> the MBeans it depends on.<br /> -->
<server>

< !-- Classloading -->
<mbean code="org.jboss.web.WebService" name="DefaultDomain:service=Webserver">
<attribute name="Port">8083</attribute>
</mbean>
< !-- JNDI -->
<mbean code="org.jboss.naming.NamingService" name="DefaultDomain:service=Naming">
<attribute name="Port">1099</attribute>
</mbean>
<mbean code="org.jboss.naming.JNDIView" name="DefaultDomain:service=JNDIView" />

< !-- Transactions -->
<mbean code="org.jboss.tm.TransactionManagerService" name="DefaultDomain:service=TransactionManager">
<attribute name="TransactionTimeout">300</attribute>
</mbean>
< !-- Security -->
< !-- Uncomment to enable the sample SRPVerifierStore service<br /> <mbean code="org.jboss.security.srp.SRPVerifierStoreService" name="Security:name=SRPVerifierStoreService"><br /> <attribute name="JndiName">SRPDefaultVerifierSource</attribute><br /> <attribute name="StoreFile">SRPVerifierStore.ser</attribute><br /> </mbean><br /> -->
< !-- Uncomment to enable the SRP login service<br /> <mbean code="org.jboss.security.srp.SRPService" name="service:name=SRPService"><br /> <attribute name="JndiName">SRPServerInterface</attribute><br /> <attribute name="VerifierSourceJndiName">SRPDefaultVerifierSource</attribute><br /> <attribute name="AuthenticationCacheJndiName">SRPAuthenticationCache</attribute><br /> <attribute name="ServerPort">10099</attribute><br /> </mbean><br /> -->
< !-- JAAS security manager and realm mapping -->
<mbean code="org.jboss.security.plugins.JaasSecurityManagerService" name="Security:name=JaasSecurityManager">
<attribute name="SecurityManagerClassName">org.jboss.security.plugins.JaasSecurityManager</attribute>
</mbean>
< !-- Uncomment to enable the XML implementation of the JAAS policy<br /> <mbean code="org.jboss.security.plugins.SecurityPolicyService" name="Security:name=SecurityPolicyService"><br /> <attribute name="JndiName">DefaultSecurityPolicy</attribute><br /> <attribute name="PolicyFile">sample_policy.xml</attribute><br /> </mbean><br /> -->
< !-- JDBC -->
<mbean code="org.jboss.jdbc.JdbcProvider" name="DefaultDomain:service=JdbcProvider">
<attribute name="Drivers">org.gjt.mm.mysql.Driver,oracle.jdbc.driver.OracleDriver</attribute>
</mbean>
< !--JDBC settings to use MySql added by sushil_kb -->

<mbean code="org.jboss.jdbc.XADataSourceLoader" name="DefaultDomain:service=XADataSource,name=mySQLDB">
<attribute name="DataSourceClass">org.opentools.minerva.jdbc.xa.wrapper.XADataSourceImpl</attribute>
<attribute name="PoolName">mySQLDS</attribute>
<attribute name="URL">jdbc:mysql://192.168.3.50/dbHospital</attribute>
<attribute name="JDBCUser">dev_hospital</attribute>
<attribute name="Password">dev_hospital</attribute>
</mbean>
< !-- end MySql settings by sushil_kb -->
<mbean code="org.jboss.jdbc.XADataSourceLoader" name="DefaultDomain:service=XADataSource,name=OracleDB">
<attribute name="PoolName">OracleDB</attribute>
<attribute name="DataSourceClass">org.opentools.minerva.jdbc.xa.wrapper.XADataSourceImpl</attribute>
<attribute name="URL">jdbc racle:thin:@csenet:1521:csedb</attribute>
<attribute name="JDBCUser">scott</attribute>
<attribute name="Password">tiger</attribute>
</mbean>

< !-- J2EE deployment -->
<mbean code="org.jboss.ejb.ContainerFactory" name=":service=ContainerFactory">
<attribute name="VerifyDeployments">true</attribute>
<attribute name="MetricsEnabled">false</attribute>
<attribute name="VerifierVerbose">true</attribute>
<attribute name="BeanCacheJMSMonitoringEnabled">false</attribute>
</mbean>
< !-- Uncomment to add embedded tomcat service -->
<mbean code="org.jboss.tomcat.EmbeddedTomcatServiceSX" name="DefaultDomain:service=EmbeddedTomcat" />

< !-- Uncomment and set file URL to add Jetty service (you can set config more than once)<br /> <mbean code="org.jboss.jetty.JettyService" name="DefaultDomain:service=Jetty"><br /> <attribute name="Configuration">file URL to jetty.xml e.g. file:/usr/local/jboss/dist/conf/default/jetty.xml</attribute><br /> </mbean><br /> -->
< !-- For Message Driven Beans -->
<mbean code="org.jbossmq.server.JBossMQService" name="DefaultDomain:service=JBossMQ" />
<mbean code="org.jboss.jms.jndi.JMSProviderLoader" name=":service=JMSProviderLoader,name=JBossMQProvider">
<attribute name="ProviderName">DefaultJMSProvider</attribute>
<attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JBossMQProvider</attribute>
</mbean>
<mbean code="org.jboss.jms.asf.ServerSessionPoolLoader" name=":service=ServerSessionPoolMBean,name=StdJMSPool">
<attribute name="PoolName">StdJMSPool</attribute>
<attribute name="PoolFactoryClass">org.jboss.jms.asf.StdServerSessionPoolFactory</attribute>
</mbean>

< !-- Make sure you change EmbeddedTomcat to Jetty if you are using Jetty -->
<mbean code="org.jboss.deployment.J2eeDeployer" name="J2EE:service=J2eeDeployer">
<attribute name="DeployerName">Default</attribute>
<attribute name="JarDeployerName">:service=ContainerFactory</attribute>
<attribute name="WarDeployerName">:service=EmbeddedTomcat</attribute>
</mbean>
<mbean code="org.jboss.ejb.AutoDeployer" name="EJB:service=AutoDeployer">
<attribute name="Deployer">J2EE:service=J2eeDeployer</attribute>
<attribute name="URLs">../deploy</attribute>
</mbean>
< !-- J2EE connector architecture -->
<mbean code="org.jboss.resource.RARDeployer" name="JCA:service=RARDeployer">
</mbean>
< !-- Minerva no transaction connection manager factory.<br /> <br /> Use this for resource adapters that don't support <br /> transactions. -->
<mbean code="org.jboss.resource.ConnectionManagerFactoryLoader"<br /> name="JCA:service=ConnectionManagerFactoryLoader,name=MinervaNoTransCMFactory">
<attribute name="FactoryName">MinervaNoTransCMFactory</attribute>
<attribute name="FactoryClass">org.opentools.minerva.connector.jboss.MinervaNoTransCMFactory</attribute>
<attribute name="Properties"></attribute>
</mbean>
< !-- Minerva local transaction connection manager factory.<br /> <br /> Use this for resource adapters that support "local"<br /> transactions. -->
<mbean code="org.jboss.resource.ConnectionManagerFactoryLoader"<br /> name="JCA:service=ConnectionManagerFactoryLoader,name=MinervaSharedLocalCMFactory">
<attribute name="FactoryName">MinervaSharedLocalCMFactory</attribute>
<attribute name="FactoryClass">
org.opentools.minerva.connector.jboss.MinervaSharedLocalCMFactory
</attribute>
<attribute name="Properties"></attribute>
</mbean>
< !-- Minerva XA transaction connection manager factory<br /> <br /> Use this for resource adapters that support "xa"<br /> transactions. -->
<mbean code="org.jboss.resource.ConnectionManagerFactoryLoader"<br /> name="JCA:service=ConnectionManagerFactoryLoader,name=MinervaXACMFactory">
<attribute name="FactoryName">MinervaXACMFactory</attribute>
<attribute name="FactoryClass">
org.opentools.minerva.connector.jboss.MinervaXACMFactory
</attribute>
<attribute name="Properties"></attribute>
</mbean>
< !-- Example connection factory for the example "Black Box" resource<br /> adapter. This points at the same database as DefaultDS. -->

< !--snippet removed to file jboss1backup and replaced by mySQLDS by sushil_kb -->
<mbean code="org.jboss.resource.ConnectionFactoryLoader"<br /> name="JCA:service=ConnectionFactoryLoader,name=BlackBoxDS">
<attribute name="FactoryName">BlackBoxDS</attribute>
<attribute name="RARDeployerName">JCA:service=RARDeployer</attribute>
<attribute name="ResourceAdapterName">Black Box LocalTx Adapter</attribute>
<attribute name="Properties">
ConnectionURL=jdbc:mysql://192.168.3.50/dbHospital
</attribute>
<attribute name="ConnectionManagerFactoryName">
MinervaSharedLocalCMFactory
</attribute>
< !-- See the documentation for the specific connection manager<br /> implementation you are using for the properties you can set -->
<attribute name="ConnectionManagerProperties">
# Pool type - uncomment to force, otherwise it is the default
#PoolConfiguration=per-factory
# Connection pooling properties - see
# org.opentools.minerva.pool.PoolParameters
MinSize=0
MaxSize=10
Blocking=true
GCEnabled=false
IdleTimeoutEnabled=false
InvalidateOnError=false
TrackLastUsed=false
GCIntervalMillis=120000
GCMinIdleMillis=1200000
IdleTimeoutMillis=1800000
MaxIdleTimeoutPercent=1.0
</attribute>
< !-- Principal mapping configuration -->
<attribute name="PrincipalMappingClass">
org.jboss.resource.security.ManyToOnePrincipalMapping
</attribute>
<attribute name="PrincipalMappingProperties">
userName=dev_hospital
password=dev_hospital
</attribute>
</mbean>
< !-- This is an example of using a resource adapter that supports XA<br /> transactions. The Black Box XA resource adapter requires an<br /> XADataSource to be in JNDI somewhere. JBoss doesn't include a<br /> database with an XA-compliant JDBC driver, so this will need to<br /> be configured to use whatever XADataSource implementation you<br /> have.<br /> <mbean code="org.jboss.jdbc.RawXADataSourceLoader"<br /> name="DefaultDomain:service=RawXADataSourceLoader,name=BlackBoxXADS"><br /> <attribute name="PoolName">BlackBoxXADS</attribute><br /> <attribute name="DataSourceClass"><br /> Put your XADataSource implementation class here<br /> </attribute><br /> <attribute name="Properties"></attribute><br /> </mbean><br /> <mbean code="org.jboss.resource.ConnectionFactoryLoader"<br /> name="JCA:service=ConnectionFactoryLoader,name=XABlackBoxDS"><br /> <attribute name="FactoryName">XABlackBoxDS</attribute><br /> <attribute name="RARDeployerName">JCA:service=RARDeployer</attribute><br /> <attribute name="ResourceAdapterName">Black Box XA Adapter</attribute><br /> <attribute name="Properties"><br /> XADataSourceName=java:/BlackBoxXADS<br /> </attribute><br /> <attribute name="ConnectionManagerFactoryName"><br /> MinervaXACMFactory<br /> </attribute><br /> <attribute name="ConnectionManagerProperties"><br /> # Pool type - uncomment to force, otherwise it is the default<br /> #PoolConfiguration=per-factory<br /> # Connection pooling properties - see<br /> # org.opentools.minerva.pool.PoolParameters<br /> MinSize=0<br /> MaxSize=10<br /> Blocking=true<br /> GCEnabled=false<br /> IdleTimeoutEnabled=false<br /> InvalidateOnError=false<br /> TrackLastUsed=false<br /> GCIntervalMillis=120000<br /> GCMinIdleMillis=1200000<br /> IdleTimeoutMillis=1800000<br /> MaxIdleTimeoutPercent=1.0<br /> </attribute><br /> <attribute name="PrincipalMappingClass"><br /> org.jboss.resource.security.ManyToOnePrincipalMapping<br /> </attribute><br /> <attribute name="PrincipalMappingProperties"><br /> userName=sa<br /> password=<br /> </attribute><br /> </mbean><br /> -->
< !-- JMX adaptors -->
<mbean code="org.jboss.jmx.server.JMXAdaptorService" name="Adaptor:name=RMI" />
<mbean code="org.jboss.jmx.server.RMIConnectorService" name="Connector:name=RMI" />
<mbean code="com.sun.jdmk.comm.HtmlAdaptorServer" name="Adaptor:name=html">
<attribute name="MaxActiveClientCount">10</attribute>
<attribute name="Parser" />
<attribute name="Port">8082</attribute>
</mbean>
< !-- Mail Connection Factory -->
<mbean code="org.jboss.mail.MailService" name=":service=Mail">
<attribute name="JNDIName">Mail</attribute>
<attribute name="ConfigurationFile">mail.properties</attribute>
<attribute name="User">user_id</attribute>
<attribute name="Password">password</attribute>
</mbean>
< !-- Uncomment to enable JMX monitoring of the bean cache<br /> <mbean code="org.jboss.monitor.BeanCacheMonitor" name="Monitor:name=BeanCacheMonitor"/><br /> -->
< !-- Add your custom MBeans here -->
</server>
===================================================================
i have jboss-auto.jcml as:
==========================
<?xml version="1.0" encoding="UTF-8"?>
<server><mbean code="org.jboss.logging.ConsoleLogging" name="DefaultDomain:service=Logging,type=Console"><attribute name="Format">[{2}] {4}</attribute>
</mbean>
<mbean code="org.jboss.jdbc.JdbcProvider" name="DefaultDomain:service=JdbcProvider"><attribute name="Drivers">org.gjt.mm.mysql.Driver,oracle.jdbc.driver.OracleDriver</attribute>
</mbean>
<mbean code="org.jboss.logging.FileLogging" name="DefaultDomain:service=Logging,type=File"><attribute name="Format">[{2}] {4}</attribute>
<attribute name="LogName">server</attribute>
</mbean>
<mbean code="org.jboss.naming.NamingService" name="DefaultDomain:service=Naming"><attribute name="Port">1099</attribute>
<attribute name="RmiPort">0</attribute>
<attribute name="ClientSocketFactory"></attribute>
<attribute name="ServerSocketFactory"></attribute>
</mbean>
<mbean code="org.jboss.util.ClassPathExtension" name="DefaultDomain:service=ClassPathExtension,name=../../db/"></mbean>
<mbean code="org.jboss.util.Shutdown" name="DefaultDomain:type=Shutdown"></mbean>
<mbean code="org.jboss.mail.MailService" name="DefaultDomain:service=Mail"></mbean>
<mbean code="org.jboss.deployment.J2eeDeployer" name="J2EE:service=J2eeDeployer"><attribute name="JarDeployerName">:service=ContainerFactory</attribute>
<attribute name="DeployerName">Default</attribute>
<attribute name="WarDeployerName">:service=EmbeddedTomcat</attribute>
</mbean>
<mbean code="org.jboss.configuration.ConfigurationService" name="DefaultDomain:service=Configuration"></mbean>
<mbean code="javax.management.MBeanServerDelegate" name="JMImplementation:type=MBeanServerDelegate"></mbean>
<mbean code="org.jbossmq.server.JBossMQService" name="DefaultDomain:service=JBossMQ"></mbean>
<mbean code="org.jboss.resource.ConnectionManagerFactoryLoader" name="JCA:service=ConnectionManagerFactoryLoader,name=MinervaSharedLocalCMFactory"><attribute name="Properties"></attribute>
<attribute name="FactoryName">MinervaSharedLocalCMFactory</attribute>
<attribute name="FactoryClass">org.opentools.minerva.connector.jboss.MinervaSharedLocalCMFactory</attribute>
<attribute name="TransactionManagerName">java:/TransactionManager</attribute>
</mbean>
<mbean code="org.jboss.util.ServiceControl" name="DefaultDomain:service=ServiceControl"></mbean>
<mbean code="org.jboss.jmx.server.JMXAdaptorService" name="Adaptor:name=RMI"></mbean>
<mbean code="org.jboss.resource.ConnectionManagerFactoryLoader" name="JCA:service=ConnectionManagerFactoryLoader,name=MinervaNoTransCMFactory"><attribute name="Properties"></attribute>
<attribute name="FactoryName">MinervaNoTransCMFactory</attribute>
<attribute name="FactoryClass">org.opentools.minerva.connector.jboss.MinervaNoTransCMFactory</attribute>
<attribute name="TransactionManagerName">java:/TransactionManager</attribute>
</mbean>
<mbean code="org.jboss.util.ClassPathExtension" name="DefaultDomain:service=ClassPathExtension,name=../../tmp/"></mbean>
<mbean code="org.jboss.resource.ConnectionManagerFactoryLoader" name="JCA:service=ConnectionManagerFactoryLoader,name=MinervaXACMFactory"><attribute name="Properties"></attribute>
<attribute name="FactoryName">MinervaXACMFactory</attribute>
<attribute name="FactoryClass">org.opentools.minerva.connector.jboss.MinervaXACMFactory</attribute>
<attribute name="TransactionManagerName">java:/TransactionManager</attribute>
</mbean>
<mbean code="org.jboss.web.WebService" name="DefaultDomain:service=Webserver"><attribute name="Port">8083</attribute>
</mbean>
<mbean code="org.jboss.util.ClassPathExtension" name="DefaultDomain:service=ClassPathExtension,name=./"></mbean>
<mbean code="org.jboss.util.ClassPathExtension" name="DefaultDomain:service=ClassPathExtension,name=../../log/"></mbean>
<mbean code="com.sun.jdmk.comm.HtmlAdaptorServer" name="Adaptor:name=html"><attribute name="MaxActiveClientCount">10</attribute>
<attribute name="Parser"></attribute>
<attribute name="Port">8082</attribute>
</mbean>
<mbean code="org.jboss.tm.TransactionManagerService" name="DefaultDomain:service=TransactionManager"><attribute name="TransactionTimeout">300</attribute>
</mbean>
<mbean code="org.jboss.util.Info" name="DefaultDomain:service=Info"></mbean>
<mbean code="org.jboss.naming.JNDIView" name="DefaultDomain:service=JNDIView"></mbean>
<mbean code="org.jboss.ejb.ContainerFactory" name="DefaultDomain:service=ContainerFactory"><attribute name="VerifyDeployments">true</attribute>
<attribute name="MetricsEnabled">false</attribute>
<attribute name="VerifierVerbose">true</attribute>
</mbean>
<mbean code="org.jboss.jmx.server.RMIConnectorService" name="Connector:name=RMI"></mbean>
<mbean code="org.jboss.tomcat.EmbeddedTomcatServiceSX" name="DefaultDomain:service=EmbeddedTomcat"><attribute name="ConfigFile"></attribute>
</mbean>
<mbean code="org.jboss.resource.RARDeployer" name="JCA:service=RARDeployer"></mbean>
<mbean code="org.jboss.ejb.AutoDeployer" name="EJB:service=AutoDeployer"><attribute name="Deployer">J2EE:service=J2eeDeployer</attribute>
<attribute name="URLs">../deploy</attribute>
</mbean>
<mbean code="org.jboss.jdbc.XADataSourceLoader" name="DefaultDomain:service=XADataSource,name=mySQLDSXA"><attribute name="Properties"></attribute>
<attribute name="URL">jdbc:mysql://192.168.3.50/dbHospital</attribute>
<attribute name="DataSourceClass">org.opentools.minerva.jdbc.xa.wrapper.XADataSourceImpl</attribute>
<attribute name="GCInterval">120000</attribute>
<attribute name="IdleTimeout">1800000</attribute>
<attribute name="InvalidateOnError">false</attribute>
<attribute name="LoggingEnabled">false</attribute>
<attribute name="MaxSize">10</attribute>
<attribute name="Password">dev_hospital</attribute>
<attribute name="TimestampUsed">false</attribute>
<attribute name="Blocking">true</attribute>
<attribute name="GCEnabled">false</attribute>
<attribute name="GCMinIdleTime">1200000</attribute>
<attribute name="IdleTimeoutEnabled">false</attribute>
<attribute name="JDBCUser">dev_hospital</attribute>
<attribute name="MaxIdleTimeoutPercent">1.0</attribute>
<attribute name="MinSize">0</attribute>
<attribute name="PoolName">mySQLDSpoolXA</attribute>
</mbean>
<mbean code="org.jboss.jms.asf.ServerSessionPoolLoader" name="DefaultDomain:service=ServerSessionPoolMBean,name=StdJMSPool"><attribute name="PoolName">StdJMSPool</attribute>
<attribute name="PoolFactoryClass">org.jboss.jms.asf.StdServerSessionPoolFactory</attribute>
</mbean>
<mbean code="org.jboss.jdbc.XADataSourceLoader" name="DefaultDomain:service=XADataSource,name=OracleDB"><attribute name="Properties"></attribute>
<attribute name="URL">jdbc racle:thin:@csenet:1521:csedb</attribute>
<attribute name="DataSourceClass">org.opentools.minerva.jdbc.xa.wrapper.XADataSourceImpl</attribute>
<attribute name="GCInterval">0</attribute>
<attribute name="IdleTimeout">0</attribute>
<attribute name="InvalidateOnError">false</attribute>
<attribute name="LoggingEnabled">false</attribute>
<attribute name="MaxSize">0</attribute>
<attribute name="Password">tiger</attribute>
<attribute name="TimestampUsed">false</attribute>
<attribute name="Blocking">false</attribute>
<attribute name="GCEnabled">false</attribute>
<attribute name="GCMinIdleTime">0</attribute>
<attribute name="IdleTimeoutEnabled">false</attribute>
<attribute name="JDBCUser">scott</attribute>
<attribute name="MaxIdleTimeoutPercent">0.0</attribute>
<attribute name="MinSize">0</attribute>
<attribute name="PoolName">OracleDB</attribute>
</mbean>
<mbean code="org.jboss.jms.jndi.JMSProviderLoader" name="DefaultDomain:service=JMSProviderLoader,name=JBossMQProvider"><attribute name="ProviderName">DefaultJMSProvider</attribute>
<attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JBossMQProvider</attribute>
<attribute name="ProviderUrl"></attribute>
</mbean>
<mbean code="org.jboss.util.ClassPathExtension" name="DefaultDomain:service=ClassPathExtension,name=Tomcat"></mbean>
<mbean code="org.jboss.jdbc.XADataSourceLoader" name="DefaultDomain:service=XADataSource,name=mySQLDB"><attribute name="Properties"></attribute>
<attribute name="URL">jdbc:mysql://192.168.3.50/dbHospital</attribute>
<attribute name="DataSourceClass">org.opentools.minerva.jdbc.xa.wrapper.XADataSourceImpl</attribute>
<attribute name="GCInterval">0</attribute>
<attribute name="IdleTimeout">0</attribute>
<attribute name="InvalidateOnError">false</attribute>
<attribute name="LoggingEnabled">false</attribute>
<attribute name="MaxSize">0</attribute>
<attribute name="Password">dev_hospital</attribute>
<attribute name="TimestampUsed">false</attribute>
<attribute name="Blocking">false</attribute>
<attribute name="GCEnabled">false</attribute>
<attribute name="GCMinIdleTime">0</attribute>
<attribute name="IdleTimeoutEnabled">false</attribute>
<attribute name="JDBCUser">dev_hospital</attribute>
<attribute name="MaxIdleTimeoutPercent">0.0</attribute>
<attribute name="MinSize">0</attribute>
<attribute name="PoolName">mySQLDS</attribute>
</mbean>
<mbean code="org.jboss.security.plugins.JaasSecurityManagerService" name="Security:name=JaasSecurityManager"><attribute name="SecurityManagerClassName">org.jboss.security.plugins.JaasSecurityManager</attribute>
<attribute name="AuthenticationCacheJndiName"></attribute>
<attribute name="SecurityProxyFactoryClassName">org.jboss.security.SubjectSecurityProxyFactory</attribute>
</mbean>
<mbean code="org.jboss.logging.Logger" name="DefaultDomain:service=Log"></mbean>
<mbean code="org.jboss.resource.ConnectionFactoryLoader" name="JCA:service=ConnectionFactoryLoader,name=BlackBoxDS"><attribute name="Properties">
ConnectionURL=jdbc:mysql://192.168.3.50/dbHospital
</attribute>
<attribute name="TransactionManagerName">java:/TransactionManager</attribute>
<attribute name="FactoryName">BlackBoxDS</attribute>
<attribute name="ConnectionManagerFactoryName">MinervaSharedLocalCMFactory</attribute>
<attribute name="PrincipalMappingClass">org.jboss.resource.security.ManyToOnePrincipalMapping</attribute>
<attribute name="RARDeployerName">JCA:service=RARDeployer</attribute>
<attribute name="ConnectionManagerProperties">
# Pool type - uncomment to force, otherwise it is the default
#PoolConfiguration=per-factory
# Connection pooling properties - see
# org.opentools.minerva.pool.PoolParameters
MinSize=0
MaxSize=10
Blocking=true
GCEnabled=false
IdleTimeoutEnabled=false
InvalidateOnError=false
TrackLastUsed=false
GCIntervalMillis=120000
GCMinIdleMillis=1200000
IdleTimeoutMillis=1800000
MaxIdleTimeoutPercent=1.0
</attribute>
<attribute name="PrincipalMappingProperties">
userName=dev_hospital
password=dev_hospital
</attribute>
<attribute name="ResourceAdapterName">Black Box LocalTx Adapter</attribute>
</mbean>
<mbean code="javax.management.loading.MLet" name="DefaultDomain:service=MLet"><attribute name="LibraryDirectory">C:\jboss\bin</attribute>
</mbean>
</server>
======================================
i have a simple session bean like
===================================
public class ConverterEJB implements SessionBean {

Connection connection = null;
public Connection getConn() throws Exception{
try{
InitialContext initialContext = new InitialContext();
System.out.println("Got context one.");
DataSource ds =
(DataSource)initialContext.lookup("java:comp/env/jdbc/mySQLDSname");
System.out.println("hello 4");
if(ds==null)
System.out.println("null datasource");
System.out.println("Got mySQLDS.");
connection = ds.getConnection("dev_hospital","dev_hospital");
System.out.println("Got connection.");
}catch(Exception et){
System.out.println("exception:" + et);
}
return connection;
}
===
and i have joss.xml as
========================
<?xml version="1.0" encoding="UTF-8"?>
<jboss>
<resource-managers>
<resource-manager res-class="org.jboss.ejb.deployment.JDBCResource">
<res-name>jdbc/mySQLDSsource</res-name>
<res-jndi-name>mySQLDS</res-jndi-name>
</resource-manager>
</resource-managers>
<enterprise-beans>
<session>
<ejb-name>Converter</ejb-name>
<jndi-name>converter/Converter</jndi-name>
<resource-ref>
<res-ref-name>jdbc/mySQLDSname</res-ref-name>
<jndi-name>jdbc/mySQLDSsource</jndi-name>
</resource-ref>
</session>
</enterprise-beans>
</jboss>
===================================
and ejb-jar.xml as
=======================================
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar>
<description>JBoss Currency Converter Application</description>
<display-name>Converter EJB</display-name>
<enterprise-beans>
<session>
<ejb-name>Converter</ejb-name>
<home>ConverterHome</home>
<remote>Converter</remote>
<ejb-class>ConverterEJB</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
<resource-ref>
<res-ref-name>jdbc/mySQLDSname</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

</session>
</enterprise-beans>
</ejb-jar>
 
reply
    Bookmark Topic Watch Topic
  • New Topic