-
1. Re: Difference between 'java: Namespace' and 'Global JNDI Na
jaikiran Apr 19, 2007 7:23 AM (in response to kooudy)The java: namespace can be accessed only by the clients which are within the same JVM as the application server. The global JNDI namespace is accessible for all clients (remote and local clients) even if they are not in the same JVM as the application server.
-
2. Re: Difference between 'java: Namespace' and 'Global JNDI Na
kooudy Apr 19, 2007 1:15 PM (in response to kooudy)OK,
but, I have datasource within java namespace and I am not able to get this one (within JBoss JVM) until I move it in global namespace, as I have mentoined.
Thank you -
3. Re: Difference between 'java: Namespace' and 'Global JNDI Na
jaikiran Apr 23, 2007 2:21 AM (in response to kooudy)Can you post the -ds.xml contents and also the code from where you are looking up the datasource? Where does this lookup code belong - servlet/jsp?
-
4. Re: Difference between 'java: Namespace' and 'Global JNDI Na
kooudy Apr 24, 2007 5:48 AM (in response to kooudy)Sorry, I am late, but no email notification have received
<xa-datasource> <jndi-name>project</jndi-name> <use-java-context>false</use-java-context> <track-connection-by-tx/> <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class> <xa-datasource-property name="ServerName">localhost</xa-datasource-property> <xa-datasource-property name="PortNumber">5432</xa-datasource-property> <xa-datasource-property name="DatabaseName">test</xa-datasource-property> <xa-datasource-property name="User">abc</xa-datasource-property> <xa-datasource-property name="Password">cba</xa-datasource-property> </xa-datasource>
Getting datasource (from Stateless EJB 3.0):Context ctx = new InitialContext(); DataSource ds = (DataSource) ctx.lookup("project");
Without<use-java-context>false</use-java-context><track-connection-by-tx/>
I am not able to get DS.
thanks -
5. Re: Difference between 'java: Namespace' and 'Global JNDI Na
jaikiran Apr 25, 2007 3:55 AM (in response to kooudy)There should not be any problems accessing the datasource from that bean. Can you post the exception that you are seeing?
-
6. Re: Difference between 'java: Namespace' and 'Global JNDI Na
kooudy Apr 27, 2007 10:46 AM (in response to kooudy)By using java context:
16:40:16,964 ERROR [NewProject] project not bound com.test.ProjectException: project not bound at com.test.Project.getConnection(Project.java:208) at com.test.Project.getNextID(Project.java:177) at com.test.Project.create(Project.java:99)
Project DS is present in jndi namespace:java: Namespace +- jaas (class: javax.naming.Context) | +- HsqlDbRealm (class: org.jboss.security.plugins.SecurityDomainContext) | +- jbossmq (class: org.jboss.security.plugins.SecurityDomainContext) | +- JmsXARealm (class: org.jboss.security.plugins.SecurityDomainContext) +- TransactionPropagationContextImporter (class: org.jboss.tm.TransactionPropagationContextImporter) +- JmsXA (class: org.jboss.resource.adapter.jms.JmsConnectionFactoryImpl) +- comp.ejb3 (class: javax.naming.Context) | NonContext: null +- worksheet (class: javax.sql.DataSource) +- project (class: javax.sql.DataSource) +- JBossCorbaNaming (class: org.omg.CosNaming.NamingContextExt)
-
7. Re: Difference between 'java: Namespace' and 'Global JNDI Na
jaikiran May 2, 2007 10:37 AM (in response to kooudy)I went back and looked at the code that you posted:
Context ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup("project");
This should be:Context ctx = new InitialContext(); DataSource ds = (DataSource) ctx.lookup("java:/project");
And with this lookup code, you need not have the <use-java-context> attribute in the ds.xml. -
8. Re: Difference between 'java: Namespace' and 'Global JNDI Na
kooudy May 4, 2007 7:58 AM (in response to kooudy)It seems that it works :)
thanks -
9. Re: Difference between 'java: Namespace' and 'Global JNDI Na
sirji Jun 6, 2007 8:35 AM (in response to kooudy)
How can we lookup remote JMS queue/topic or JMS connection factory? Can we use "<use-java-context>" there as well? -
10. Re: Difference between 'java: Namespace' and 'Global JNDI Na
jaikiran Jun 6, 2007 12:36 PM (in response to kooudy)How can we lookup remote JMS queue/topic
queue/topic are bound in the Global JNDI and will be available to remote client. You have any code, where you are not able to do this? -
11. Re: Difference between 'java: Namespace' and 'Global JNDI Na
jaikiran Jun 6, 2007 12:38 PM (in response to kooudy)As far as the ConnectionFactory is concerned, even that is available in the Global JNDI namespace under the name "ConnectionFactory".
This chapter might help, it has some JMS examples on JBoss:
http://docs.jboss.com/jbossas/admindevel326/html/ch6.chapt.html