• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Returning null DataSource object in JBoss 4.0.3

 
Kshitija Ambulgekar
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Kshitija Ambulgekar
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Kshitija Ambulgekar
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Pradip,

Thanks for your reply. Could you please explian your point? I could not understand what you are saying.
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic