aspose file tools*
The moose likes JBoss/WildFly and the fly likes Problem in lookup datasource Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Problem in lookup datasource" Watch "Problem in lookup datasource" New topic
Author

Problem in lookup datasource

Bala Gangadhar
Ranch Hand

Joined: Oct 07, 2008
Posts: 82
    
    1
Hi all,
I have deployed a datasource in JBoss server with look up name as "myds/OrcleDS"
And i am able to get the intial context.
on context when i call ctx.lookup("myds/OrcleDS");

I am getting error
javax.naming.NameNotFoundException: myds not bound

Its not taking the "myds/OracleDS" instead taking "myds" only...

how can i resolve this one...


Thanks in advance..
Bala.
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2499
    
    8

I have moved this post to our JBoss forum. It is about setting up JNDI resources in JBoss, and consuming them in jour application.

Regards, Jan


OCUP UML fundamental and ITIL foundation
youtube channel
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10101
    
164

How have you configured and deployed your datasource. The JNDI names are hierarchical. The naming parser splits it on the "/" character. So the error message first tries to find the myDS name in the global jndi namespace. On not finding it, it does not move forward. So the problem really is that your datasource either isn't correctly configured or you are using the wrong jndi name.

Where is the client code, looking up the datasource located? Is it in the same JVM as where the datasource is deployed?

[My Blog] [JavaRanch Journal]
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5827
    
    7

Most like, you want to look the datasource up using:

ctx.lookup("java:myds/OrcleDS");

but we won't know for sure until you provide the information Jaikiran asked for.


JBoss In Action
Bala Gangadhar
Ranch Hand

Joined: Oct 07, 2008
Posts: 82
    
    1
Hi,
Thanks a lot for your reply....

Here is my client code.. .which is running on other machine.



And I have configured the DS in JBoss using fallwing xml file placed in <JBOSS_HOME>/Server/default/deploy


I am able to use this datasource through another application (using hibernate) which is deployed in same JBoss server.
But unable to obtain the datasource from remote machine look up.
Even i chaged it from "myds/OracleDS" to "java:myds/OracleDS" still getting the same error:
javax.naming.NameNotFoundException: myds not bound

Please let me know if you need more info...

Thanks,
Bala.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10101
    
164

See this
Bala Gangadhar
Ranch Hand

Joined: Oct 07, 2008
Posts: 82
    
    1
Adding <use-java-context>false</use-java-context> to the DS solved my problem. Thanks a lot.
And as there mentioned this as antipartterns .
There is an implementation of this in JBoss4. I would not recommend this anti-pattern.
. I got my Architect to agree not use this concept of exposing DS for removte jvm.

Regards,
Bala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem in lookup datasource