转 tomcat 配置jndi
http://www.theserverside.com/discussions/thread.tss?thread_id=25459#135631
主要问题是tomcat控制台配置的jndi是在 conf的server.xml下的,该帖子建议把他配置在catalina下面的yourwebapp.xml下,tomcat就可以识别。
ps:防止帖子 被删
I was having the same problem . But the only difference is i'm using db2udb on windows. I spent nearly 10 hours to figure this out . It took so much time because i was reading lots of junk on the net and confusing. Finally i stick to the tomcat documentation.
The solution is very simple.
1) Remove the context element from your server.xml
2) create separate xml file with context element and copy the below code and name the file as contextpath ( in your case it is StrutsTest).
<context path="/StrutsTest" docBase="StrutsTest" debug="1" reloadable="true">
<Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_StrutsTest_log." suffix=".txt" timestamp="true"/>
<Resource name="jdbc/FieldProjDB" auth="Container" type="javax.sql.DataSource" />
<ResourceParams name="jdbc/FieldProjDB">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>user</name>
<value>lab</value>
</parameter>
<parameter>
<name>password</name>
<value>lab</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>net.sourceforge.jtds.jdbc.Driver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:jtds:sqlserver://192.xxx.xx.xx:1433/LabSeekDev;User=lab;Password=lab</value>
</parameter>
</ResourceParams>
</context>
3)modify the docbase attribute of context element in the above file .
docBase = absolute pathname to a web application .(according to tomcat documentation)
for example: docBase = c:\yourapp\web ( note web is a contextpath)
4)copy the file to $CATALINA_HOME/conf/[engine_name]/[host_name] directory .
5)start the tomcat server.
6)thats it.
7)your feedback is appreciated.