[jboss-user] [JCA/JBoss] - Problem of accessing Oracle DS in JBOSS from a stand-alone J
guha_gourab
do-not-reply at jboss.com
Tue Mar 27 07:39:05 EDT 2007
Hello,
I am trying to access Oracle data source in Jboss from a stand-alone java program. For doing this I have done the following:
(1) Copied the oracle driver (classes12.jar) in server\default\lib directory of
JBOSS_HOME.
(2) Copied the oracle-ds.xml file from docs\examples\jca directory of JBOSS_HOME to
server\default\deploy of JBOSS_HOME.
In this file I have changed the connection URL.
(3) Next I have changed the default standardjaws.xml. I have changed the data source
name and its type-mapping to Oracle8.
(4) I have changed standardjbosscmp-jdbc.xml file also.
(5) I have put an entry in login-config.xml file also.
The code that I used to access the JNDI name for the data source is follows
public class JNDIServiceLocator
{
private static InitialContext intContex =null;
static
{
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY , "org.jnp.interfaces.NamingContextFactory");
env.put(Context.PROVIDER_URL , "jnp://localhost:1099");
env.put("java.naming.rmi.security.manager", "yes");
env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming");
try
{
intContex = new InitialContext(env);
System.out.println("Created the context ....");
}
catch(Exception e)
{
e.printStackTrace();
}
}
public static void main(String[] args)
{
try
{
intContex.lookup("java:/OracleDS");
}
catch (NamingException e)
{
e.printStackTrace();
}
}
}
Now I am getting the following exception
Created the context ....
javax.naming.NameNotFoundException: OracleDS not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:503)
at org.jnp.server.NamingServer.getObject(NamingServer.java:509)
at org.jnp.server.NamingServer.lookup(NamingServer.java:282)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:530)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:509)
at javax.naming.InitialContext.lookup(Unknown Source)
at JNDIServiceLocator.main(JNDIServiceLocator.java:33)
Can anybody give me any guide line regarding this problem.
Regards,
Gourab
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4031984#4031984
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4031984
More information about the jboss-user
mailing list