This is a discussion on Oracle JDeveloper 10g Configuring MySQL DataSources with OC4J and JDeveloper within the Oracle Miscellaneous forums, part of the Oracle Database category; --> I'm trying to run through http://www.oracle.com/technology/pro...and_oc4j3.html as a first time attempt at installing JDeveloper and working with JNDI and ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I'm trying to run through http://www.oracle.com/technology/pro...and_oc4j3.html as a first time attempt at installing JDeveloper and working with JNDI and MySQL, but I'm running into problems with this paper. Firstly, the paper tells me to setup <data-source> entries in the data-sources.xml file (point 2 in the paper); then it tells me to edit the WEB-INF/web.xml to add <resource-ref> items (point 3). Now - I am probably missing something - but where is the link between these two entries... my Java is told to lookup "java:comp/env/jdbc/OraBlogsDS" which it probably finds in the <resource-ref> (web.xml) file but then how does it jump to the <data-source> entries that tell the code how and where to connect to my MySQL database? Secondly, when I run my (slightly modified) code - I get the following error message when the code attempts the lookup... code-line : DataSource ds = (DataSource) ctx.lookup("java:comp/env/resource-ref-name-entry"); code-line-error: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial The Oracle paper fails to tell me about any other requirements such as an application resource file, etc. Can anyone assist in either of these two points. Many Thanks, Alan |
| |||
| nomorezpam3@hotmail.com (Alan) wrote in message news:<84f54f12.0408050502.7e8031c3@posting.google. com>... > I'm trying to run through > http://www.oracle.com/technology/pro...and_oc4j3.html > as a first time attempt at installing JDeveloper and working with JNDI > and MySQL, but I'm running into problems with this paper. > > Firstly, the paper tells me to setup <data-source> entries in the > data-sources.xml file (point 2 in the paper); then it tells me to edit > the WEB-INF/web.xml to add <resource-ref> items (point 3). Now - I am > probably missing something - but where is the link between these two > entries... my Java is told to lookup "java:comp/env/jdbc/OraBlogsDS" > which it probably finds in the <resource-ref> (web.xml) file but then > how does it jump to the <data-source> entries that tell the code how > and where to connect to my MySQL database? > > Secondly, when I run my (slightly modified) code - I get the following > error message when the code attempts the lookup... > > code-line : DataSource ds = (DataSource) > ctx.lookup("java:comp/env/resource-ref-name-entry"); > > code-line-error: javax.naming.NoInitialContextException: Need to > specify class name in environment or system property, or as an applet > parameter, or in an application resource file: > java.naming.factory.initial > > > The Oracle paper fails to tell me about any other requirements such as > an application resource file, etc. > > Can anyone assist in either of these two points. > Many Thanks, > > Alan After about 4 hours I seem to have resolved this problem by adding a jndi.properties file to my classpath with the entry "java.naming.factory.initial=com.sun.jndi.fscontex t.RefFSContextFactory" and downloading the File System Context jar (from http://java.sun.com/products/jndi/downloads/index.html and then adding the fscontext.jar and providerutil.jar files into the classpath). But I still can't get the environment to work as I still don't quite understand the first part of my problem - and hence I'm getting a javax.naming.NameNotFoundException: java:comp/env/resource-ref-name-entry exception when I run now. Anyone? Thanks Alan |