Not quite... This is a J2EE standard, so you can see it in the J2EE specifications. What's app server specific is how it is set up.
Tomcat has a very rudimentary JNDI server and very rudimentary configuration - they add the prefix automatically for any datasource definition. This is not so on other more fully functional app servers. In any case, you should always declare data sources as a resource reference in web.xml or ejb-jar.xml. Then the java:comp/env prefix will work on every app server. Jeff Butler On 12/21/06, Yee, Richard K CTR DMDC <[EMAIL PROTECTED]> wrote:
It is in the Tomcat documentation. This is an appserver-specific issue. Some appservers don't require the java:comp/env prefix (ie. Oracle oc4j). -Richard -----Original Message----- *From:* Armeanu, Christian [mailto:[EMAIL PROTECTED] *Sent:* Thursday, December 21, 2006 9:21 AM *To:* [email protected] *Subject:* RE: JNDI NameNotFoundException with Tomcat 5.5 Did the trick! Thanks. Where can I find the info about this prefix? Thanks, Chris ------------------------------ *From:* Jeff Butler [mailto:[EMAIL PROTECTED] *Sent:* Wednesday, December 20, 2006 4:58 PM *To:* [email protected] *Subject:* Re: JNDI NameNotFoundException with Tomcat 5.5 Try this: <dataSource type="JNDI"> <property name="DataSource" value= "java:comp/env/jdbc/EIS" /> </dataSource Jeff Butler On 12/20/06, *Armeanu, Christian* <[EMAIL PROTECTED]> wrote: Hi, I'd like to use tomcat JNDI as the datasource for my application and don't seem to be able to find the right configuration. Have tried everything I could think of: sqlMapConfig contains the following section: ... <transactionManager type="JDBC" > <dataSource type= "JNDI"> <property name= "DBJndiContext" value="jdbc/EIS" /> </dataSource> </transactionManager> ... context.xml: <?xml version="1.0" encoding="UTF-8"?> <Context docBase="eis" debug= "5" path="" reloadable= "true"> <Resource name= "jdbc/EIS" auth="Container" type= " javax.sql.DataSource" maxActive= "100" maxIdle="30" maxWait= "1000" username= "webuser" password="somepwd" driverClassName= "net.sourceforge.jtds.jdbc.Driver" url= "jdbc:jtds:sqlserver://localhost:1433/EIS" /> </Context> Where am I wrong? Here's the end of the stack trace: Caused by: *java.lang.RuntimeException *: Error parsing XPath '/sqlMapConfig/transactionManager/dataSource/end()'. Cause: * com.ibatis.sqlmap.client.SqlMapException*: There was an error configuring JndiDataSourceDaoTransactionPool. Cause: * javax.naming.NameNotFoundException* : Name jdbc is not bound in this Context at com.ibatis.common.xml.NodeletParser.processNodelet(* NodeletParser.java:113*) at com.ibatis.common.xml.NodeletParser.process(* NodeletParser.java :95*) at com.ibatis.common.xml.NodeletParser.process(* NodeletParser.java :92*) at com.ibatis.common.xml.NodeletParser.process(* NodeletParser.java :92*) at com.ibatis.common.xml.NodeletParser.parse(* NodeletParser.java:62 *) at com.ibatis.common.xml.NodeletParser.parse(* NodeletParser.java:50 *) ... 41 more Caused by: *com.ibatis.sqlmap.client.SqlMapException *: There was an error configuring JndiDataSourceDaoTransactionPool. Cause: * javax.naming.NameNotFoundException*: Name jdbc is not bound in this Context at com.ibatis.sqlmap.engine.datasource.JndiDataSourceFactory.initialize(* JndiDataSourceFactory.java:60*) at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser$9.process (* SqlMapConfigParser.java:318*) at com.ibatis.common.xml.NodeletParser.processNodelet(* NodeletParser.java:111*) ... 46 more Caused by: *javax.naming.NameNotFoundException *: Name jdbc is not bound in this Context at org.apache.naming.NamingContext.lookup(* NamingContext.java:769*) at org.apache.naming.NamingContext.lookup(* NamingContext.java:139*) at org.apache.naming.NamingContext.lookup(* NamingContext.java:780*) at org.apache.naming.NamingContext.lookup(* NamingContext.java:139*) at org.apache.naming.NamingContext.lookup(* NamingContext.java:780*) at org.apache.naming.NamingContext.lookup(* NamingContext.java:152*) at org.apache.naming.SelectorContext.lookup(* SelectorContext.java :136*) at javax.naming.InitialContext.lookup(Unknown Source) at com.ibatis.sqlmap.engine.datasource.JndiDataSourceFactory.initialize(* JndiDataSourceFactory.java:48*) ... 48 more Thanks, Chris
