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

ezanih do-not-reply at jboss.com
Thu Jan 8 00:13:27 EST 2009


Thank you so much, Jaikiran :-)

So am I right in my conclusion that if I call this portion of code directly from my standalone Java client :


  | 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");
  | 	        	 
  | java.sql.Connection conn;	        	
  | InitialContext ic = new InitialContext(p);
  | javax.sql.DataSource db = (javax.sql.DataSource) ic.lookup("java:OracleXE1_DS");
  | conn = db.getConnection();
  | 

to lookup a wrapper datasource from a JPA entity project saved in my JBoss AS using EntityManager, it would always give me a "XXX not bound" exception because the JBoss AS and the Java client are running on separate VMs ?

Would the solution be : to create an EJB3 to get the Java client to lookup the EJB3 instead - ctx.lookup("bean/local") - and then have the bean call the wrapper datasource - ctx.lookup("java:/DefaultDS") - assuming it would work because the EJB and the wrapper datasource are both managed by the JBoss AS container and so the java:/ namespace can be used because they are using the same VM (JBoss VM) ?

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

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



More information about the jboss-user mailing list