[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Re: Could not find datasource message in client JPA although

ezanih do-not-reply at jboss.com
Fri Jan 2 05:43:58 EST 2009


Ok...I think I'm getting very close to resolving this...please help me.

This is some new info I found.

The first part:

I've changed my InitialContext code from :


  | 	        	Properties p = new Properties();
  | 	            p.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
  | 	            p.put("java.naming.provider.url", "jnp://localhost:1099");
  | 	            p.put("java.naming.factory.url.pkgs", "org.jboss.naming.client");
  | 	            p.put("j2ee.clientName", "OracleXE1_DS");
  | 	           
  | 
  | 	        	
  | 	            InitialContext ctx = new InitialContext();
  | 

to 


  | 	        	Properties p = new Properties();
  | 	            p.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
  | 	            p.put("java.naming.provider.url", "jnp://localhost:1099");
  | 	            p.put("java.naming.factory.url.pkgs", "org.jboss.naming.client");
  | 	            p.put("j2ee.clientName", "OracleXE1_DS");
  | 	           
  | 
  | 	        	
  | 	            InitialContext ctx = new InitialContext(p);
  | 


The second part (probably the most important) :-

I learnt that jboss-client.xml is very important  and should be included in META-INF (together with application-client.xml) and it allows the client to be binded using the naming services.

So my client module (or Eclipse project) is named BiddingClient and my client class is named BidClient.java.

So is the contents of my jboss-config.xml file below correct and the way I am calling it (see below) ?

jboss-client.xml:

  | <?xml version='1.0' encoding='UTF-8' ?>
  | 
  | <!DOCTYPE jboss-client PUBLIC
  | "-//JBoss//DTD Application Client 3.2//EN"
  | "http://www.jboss.org/j2ee/dtd/jboss-client_3_2.dtd">
  | 
  | <jboss-client>
  | <jndi-name>BiddingClient</jndi-name>
  | </jboss-client>
  | 

application-client.xml:

  | <?xml version="1.0" encoding="UTF-8"?>
  | 
  | <application-client xmlns="http://java.sun.com/xml/ns/j2ee"
  |           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  |           xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
  |           http://java.sun.com/xml/ns/j2ee/application-client_1_4.xsd"
  |           version="1.4">
  | 
  |   <display-name>BiddingClientApp</display-name>
  | 
  | </application-client>
  | 


and the portion of the code in my BidClient.java that looks up the client JNDI name after getting the initial context is :-


  | InitialContext ctx = new InitialContext(p);
  | Object obj = ctx.lookup("java:BiddingClient");
  | 

Is this correct ?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4199190#4199190

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4199190



More information about the jboss-user mailing list