当前位置: 代码迷 >> Java Web开发 >> tomcat布置有关问题,求高手,真的没分了,也没办法了
  详细解决方案

tomcat布置有关问题,求高手,真的没分了,也没办法了

热度:156   发布时间:2016-04-17 10:26:20.0
tomcat布置问题,求高手,真的没分了,也没办法了!
在eclipse里面运行正常,在tomcat里面发布的时候,遇到servlet调用数据库的时候就会出显问题。
异常信息为:
javax.naming.NameNotFoundException: Name tuji is not bound in this Context
  at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
  at org.apache.naming.SelectorContext.lookup(SelectorContext.java:152)
  at javax.naming.InitialContext.lookup(InitialContext.java:351)
  at mokuai.databeas.Mysql.getConnection(Mysql.java:26)
  at mokuai.databeas.Mysql.executeQuery(Mysql.java:38)
  at mokuai.servlet.tuji.Tuji.process(Tuji.java:120)
  at mokuai.servlet.tuji.Tuji.doPost(Tuji.java:48)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:290)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:233)
  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:191)
  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:127)
  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:102)
  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:109)
  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:291)
  at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:859)
  at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ss(Http11Protocol.java:602)
  at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:48
9)
  at java.lang.Thread.run(Thread.java:595)
关于数据库的操作是这样设计的:
String strDBlogo="jdbc/tuji"; //分别代表两个数据库  
String strDBlogo1="jdbc/ConnectionPool";

String str[][]=connsqlserver.executeQuery(sql,strDBlogo); //调用其中一个数据库



数据库配置文件

<Resource name="jdbc/ConnectionPool"  
auth="Container"  
  type="javax.sql.DataSource"  
  driverClassName="com.microsoft.jdbc.sqlserver.SQLServerDriver"  
  url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=TCDLogo"  
  username="sa"  
  password="23172153"  
  maxActive="50"  
  maxIdle="20"  
  maxWait="10000"  
  factort ="org.apache.commous.dbcp.BasicDataSourceFactory"
  />  
   
 <Resource name="jdbc/tuji"  
auth="Container"  
  type="javax.sql.DataSource"  
  driverClassName="com.microsoft.jdbc.sqlserver.SQLServerDriver"  
  url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=TCDTUJI"  
  相关解决方案