This week's book giveaway is in the JDBC forum.
We're giving away four copies of Make it so: Java DB Connections & Transactions and have Marcho Behler on-line!
See this thread for details.
The moose likes JBoss/WildFly and the fly likes OracleDS not Bound in JBOSS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "OracleDS not Bound in JBOSS" Watch "OracleDS not Bound in JBOSS" New topic

OracleDS not Bound in JBOSS

Sowjanya Venkiteela

Joined: Nov 25, 2009
Posts: 17
Dear All,

I want to establish the connection to Database.My Application server is JBOSS.

My Client code is as follows:

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Properties;

import javax.naming.*;
import javax.sql.DataSource;

import oracle.jdbc.pool.OracleDataSource;

class SC_Connection {

static Connection con = null;
public static Connection getConnection()
Properties properties=new Properties();
properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
properties.setProperty(Context.URL_PKG_PREFIXES, "org.jnp.interfacesrg.jboss.naming");
properties.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099");
Context ctx = new InitialContext(properties);

DataSource ds= (DataSource)ctx.lookup("OracleDS");
con = ds.getConnection();
System.out.println("connection opened >>>> " + con);
catch(Exception e) {

return con;

public static void closeConnection()
System.out.println("Connection closed");
}catch(Exception e){}
public static void main(String str[])


I pasted my oracle-ds.xml in server/default/deploy.




But when I run the program I am getting the following exception:

javax.naming.NameNotFoundException: OracleDS not bound
at org.jnp.server.NamingServer.getBinding(
at org.jnp.server.NamingServer.getBinding(
at org.jnp.server.NamingServer.getObject(
at org.jnp.server.NamingServer.lookup(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$ Source)
at Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$ Source)
at Source)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(
at org.jnp.interfaces.NamingContext.lookup(
at javax.naming.InitialContext.lookup(Unknown Source)

Help appreciated,
Thanks in Advance.

Jaikiran Pai

Joined: Jul 20, 2005
Posts: 10441

Moving to JBoss forum

[My Blog] [JavaRanch Journal]
Jaikiran Pai

Joined: Jul 20, 2005
Posts: 10441

See this
I agree. Here's the link:
subject: OracleDS not Bound in JBOSS
jQuery in Action, 3rd edition