aspose file tools*
The moose likes JBoss/WildFly and the fly likes Problems in binding Oracle database through JNDI in JBoss to my application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Problems in binding Oracle database through JNDI in JBoss to my application" Watch "Problems in binding Oracle database through JNDI in JBoss to my application" New topic
Author

Problems in binding Oracle database through JNDI in JBoss to my application

Guy Roth
Ranch Hand

Joined: Aug 09, 2009
Posts: 74
Hi,

I am trying to configure Oracle datasource in JBoess.
1. I created the file oracle-ds.xml with the content:
<?xml version="1.0" encoding="UTF-8"?>

2. updated in the lib the relevant jar with the jdbc driver.
3. define in my application a datasource by:

the result:
in case connection="bilby" I get:
javax.naming.NameNotFoundException: bilby not bound
and in case connection="java:bilby" I get: null object

even though JBoss print in its output the line:
18:37:56,560 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=bilby' to JNDI name 'java:bilby'

and I also can see this datasource defined in the JMX web-console (Started with state=3)

Why can't I get the datasource that I defined? perhaps there is a security issue that doesn't allow application recieve java resource automatically and I still need to cofigure something else to allow it?

See also (here)
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2503
    
    8

I have moved this thread to our JBoss forum.


OCUP UML fundamental and ITIL foundation
youtube channel
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5836
    
    7

Is you application a stand-alone app or is it an app deployed to JBoss AS?

If deployed to JBoss AS, the name "java"bilby" should return the data source. There is nothing else that you need to do; in fact, once the name appears in JNDI ther is no way to restrict any app from accessing it. I assume that no messages appear in the log ate the time of the lookup.


JBoss In Action
Guy Roth
Ranch Hand

Joined: Aug 09, 2009
Posts: 74
I discovered the source to my problem:
I am running my application on JBoss server 4.2.3.GA and use JBoss cache 3.1 as part of the application deployment.
It seems that the jar to support JBoss cahce that are part of my WEB-INF/lib are in conflict with the jar of JBoss AS

I looked at this article that discusses JBoss class-loading and my question is:

Is it possible to isolate only selected packages from my application so that the will load utility classes first from server/default/lib while the rest of the classes from my application will use same utility classes but look for them first from the application's archive?
So I could use different version of the same utility classes in the same application?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problems in binding Oracle database through JNDI in JBoss to my application