I have the following problem:
I have two servers, one runs JBoss 3.2.5 and one Tomcat 4.1.30.
I configured the datasource in JBoss copying the oracle-ds.xml into the deploy
directory and adapting it to my oracle instance.
The drivers (classes12.zip) are in the lib directory.
Now, I want to get a datasource from the tomcat machine via JNDI
| try {
| Properties pf = new Properties();
| File jndiPF = new File("jndi.properties");
|
| InputStream is = (InputStream)new FileInputStream(jndiPF);
|
| pf.load(is);
| System.out.println("Property file loaded");
| System.out.println("Working on: " +
pf.getProperty("java.naming.provider.url"));
|
| Context ctx = new InitialContext(pf);
| System.out.println("Context created");
|
| NamingEnumeration ne = ctx.list("java:" + args[0]);
|
| while (ne.hasMore()) {
| Object el = ne.next();
| System.out.println(" - " + el.toString());
| }
|
| DataSource ds = (DataSource)ctx.lookup("java:/jdbc/OracleDS");
| System.out.println("Datasource retrived");
|
|
| } catch (Exception e) {
| System.out.println("Error: " + e.getMessage());
| }
|
| }
|
the jndi.properties file is the following
| java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
|
| java.naming.provider.url=jnp\://appsEJB01\:1099
|
| java.namin.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
| #The jnp socket factory class
| jnp.socketFactory=org.jnp.interfaces.TimedSocketFactory
| #The TimedSocketFacory connection time out in milliseconds (0 == blocking)
| jnp.timeout=0
| #The TimedSocketFactory read timeout in milliseconds (0 == blocking)
| jnp.sotimeout=0
|
|
the loop on the initial context (java:/) show the following entries:
- HAILConnectionFactory: javax.naming.LinkRef
- jmx: org.jnp.interfaces.NamingContext
- HTTPXAConnectionFactory: org.jboss.mq.SpyXAConnectionFactory
- ConnectionFactory: org.jboss.mq.SpyConnectionFactory
- UserTransactionSessionFactory: $Proxy12
- HTTPConnectionFactory: org.jboss.mq.SpyConnectionFactory
- XAConnectionFactory: org.jboss.mq.SpyXAConnectionFactory
- invokers: org.jnp.interfaces.NamingContext
- UserTransaction: org.jboss.tm.usertx.client.ClientUserTransaction
- UILXAConnectionFactory: javax.naming.LinkRef
- HAILXAConnectionFactory: javax.naming.LinkRef
- UIL2XAConnectionFactory: javax.naming.LinkRef
- queue: org.jnp.interfaces.NamingContext
- topic: org.jnp.interfaces.NamingContext
- console: org.jnp.interfaces.NamingContext
- UIL2ConnectionFactory: javax.naming.LinkRef
- UILConnectionFactory: javax.naming.LinkRef
- UUIDKeyGeneratorFactory:
org.jboss.ejb.plugins.keygenerator.uuid.UUIDKeyGeneratorFactory
but when I try to get the datasource I configured it says:
jdbc not bound
Looking in the FAQs (Creating a JDBC datasource) I found this phrase:
. . . DataSource wrappers are bound under the java:/ prefix since they are not usable
outside of the server VM.
so if the JNDI datasources are available only if my code is running in the same VM I
have to work only with the embedded version of tomcat ? why have I to specify a
provider URL if it work only on the same host ? I'm missing something ?
How can I configure a pool available via JNDI from remote VMs ?
thanks in advance
MG
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3844810#3844810
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3844810
-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user