This content has been marked as final.
Show 4 replies
-
1. Re: Always getting not bound naming exceptions
ezanih Jan 7, 2009 12:15 AM (in response to ezanih)It also doesn't work if I use this :
//BiddingTestBeanRemote bidder = (BiddingTestBeanRemote) ctx.lookup("ejb/BiddingTestBean"); BiddingTestBeanRemote bidder = (BiddingTestBeanRemote) PortableRemoteObject.narrow (ctx.lookup("ejb/BiddingTestBean"), BiddingTestBeanRemote.class);
or this://BiddingTestBeanRemote bidder = (BiddingTestBeanRemote) ctx.lookup("pc:comp/env/ejb/BiddingTestBean"); BiddingTestBeanRemote bidder = (BiddingTestBeanRemote) PortableRemoteObject.narrow (ctx.lookup("pc:comp/env/ejb/BiddingTestBean"), BiddingTestBeanRemote.class);
Any idea what possible errors I am making? -
2. Re: Always getting not bound naming exceptions
ezanih Jan 7, 2009 1:01 AM (in response to ezanih)For everyone to share, there is this EXCELLENT blog (Oct 2007) from Jaikiran Pai on initial context JNDI naming convention for JBoss AS and how to name the context properly from the lookup code.
It certainly helped to solve my problem and I'm sure a lot of yours.
Here's the link:
http://jaitechwriteups.blogspot.com/search?updated-min=2007-01-01T00:00:00-08:00&updated-max=2008-01-01T00:00:00-08:00&max-results=3
One interesting point I noted is that because wrapper datasources are bound using the java: namespace, they cannot be accessed from a standalone Java client because this client runs in a different JVM from the JBoss server.
So you cannot use :InitialContext ic = new InitialContext(); javax.sql.DataSource db = (javax.sql.DataSource) ic.lookup("java:OracleXE1_DS");
from a standalone client. What should you do to access that datasource ? (i.e. how to transfer the datasource from the java namespace to the glbal jndi namespace) ?
Many thanks, Jaikiran! :-)[/url] -
3. Re: Always getting not bound naming exceptions
jaikiran Jan 7, 2009 3:49 AM (in response to ezanih)"ezanih" wrote:
What should you do to access that datasource ?
You can set the use-java-context to false in the -ds.xml. See this for details http://www.jboss.org/community/docs/DOC-9880
P.S: Glad to know the blog helped :) -
4. Re: Always getting not bound naming exceptions
ezanih Jan 7, 2009 9:13 PM (in response to ezanih)Agreed, Jaikiran! Thanks !
Example code (for everyone) :-<datasources> <local-tx-datasource> <jndi-name>OracleXE1_DS</jndi-name> <use-java-context>false</use-java-context> <connection-url>jdbc:oracle:thin:system/system@localhost:1521:XE</connection-url> <driver-class>oracle.jdbc.driver.OracleDriver</driver-class> <user-name>system</user-name> <password>system</password> <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name> <metadata> <type-mapping>Oracle10g</type-mapping> </metadata> </local-tx-datasource> </datasources>
P.S. This is for oracle-ds.xml for my Oracle DB. Change the paras accordingly for the db you are using. :-)