aspose file tools*
The moose likes JBoss/WildFly and the fly likes Returning null DataSource object in JBoss 4.0.3 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Returning null DataSource object in JBoss 4.0.3" Watch "Returning null DataSource object in JBoss 4.0.3" New topic
Author

Returning null DataSource object in JBoss 4.0.3

Kshitija Ambulgekar
Greenhorn

Joined: Aug 27, 2006
Posts: 24
Hi All,

I am trying to make the datasource connection in the application and deploying it on JBoss 4.0.3

try{
Context ctx = new InitialContext();
DataSource dataSource = (DataSource)ctx.lookup("java:/OracleDS);
}

But it is returning null DataSource object.

The same thing is working properly in JBoss 4.0.2.
Can somebody help on this?
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10288
    
168

Where are you doing this lookup? Is it from a servlet or some standalone client or some other place? Also, did you check the JNDI view to see whether the OracleDS jndi name exists?


[My Blog] [JavaRanch Journal]
Kshitija Ambulgekar
Greenhorn

Joined: Aug 27, 2006
Posts: 24
I am doing the lookup from the java file present in my application. OracleDS jndi name is present in JNDI view.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Originally posted by Kshitija Ambulgekar:
I am doing the lookup from the java file present in my application. OracleDS jndi name is present in JNDI view.


DataSource is not a remote object so you will not be able to do a remote lookup.


Groovy
Kshitija Ambulgekar
Greenhorn

Joined: Aug 27, 2006
Posts: 24
Hi Pradip,

Thanks for your reply. Could you please explian your point? I could not understand what you are saying.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Originally posted by Kshitija Ambulgekar:
Hi Pradip,

Thanks for your reply. Could you please explian your point? I could not understand what you are saying.


The reason you are getting null is because DataSource does not support remote access. You can use DataSource if your client is in the same VM.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17260
    
    6

And you wouldn't even want it to have remote access because then you'd be having a client access the database directly, which defeats the whole purpose of your server, and such.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Returning null DataSource object in JBoss 4.0.3