启动tomcat6.0时遇到:
2012-5-14 22:17:09 org.apache.catalina.core.AprLifecycleListener init
信息: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\jdk1.6.0_10\bin;D:\tomcat6.0\bin
2012-5-14 22:17:09 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
2012-5-14 22:17:09 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 568 ms
2012-5-14 22:17:10 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2012-5-14 22:17:10 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.14
2012-5-14 22:17:10 org.apache.catalina.core.NamingContextListener addResource
警告: Failed to register in JMX: javax.naming.NamingException: Could not create resource factory instance [Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory]
2012-5-14 22:17:10 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: contextInitialized()
2012-5-14 22:17:10 org.apache.catalina.core.ApplicationContext log
信息: SessionListener: contextInitialized()
2012-5-14 22:17:11 com.sun.faces.config.ConfigureListener$WebXmlProcessor scanForFacesServlet
警告: Unable to process deployment descriptor for context 'null'
2012-5-14 22:17:11 com.sun.faces.config.ConfigureListener contextInitialized
信息: Initializing Sun's JavaServer Faces implementation (1.2_04-b07-FCS) for context '/Shopping.myeclipse.bak'
2012-5-14 22:17:12 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8080
2012-5-14 22:17:12 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
2012-5-14 22:17:12 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/47 config=null
2012-5-14 22:17:12 org.apache.catalina.startup.Catalina start
信息: Server startup in 2138 ms
这两处警告是什么呀?谁能帮帮我看看我的代码呢?在web.xml中的配置和在tomcat6.0中server的配置如下:
<servlet>
<servlet-name>getEmps</servlet-name>
<servlet-class>servlet.getEmps</servlet-class>
</servlet> <servlet-mapping>
<servlet-name>getEmps</servlet-name>
<url-pattern>/getEmps</url-pattern>
</servlet-mapping>
<resource-ref>
<res-ref-name>jdbc/sqlserver</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>server如下:
<Context path="/newlinkpool" docBase="E:\WebWorkSpace\L8_shangji\WebRoot"
reloadable="true">
<Resource
name="jdbc/sqlserver"
type="javax.sql.DataSource"
auth="Container"
maxActive="100"
maxIdle="30"
maxWait="100000"
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
url="jdbc:sqlserver://localhost:1433;databasename=emp"
username="sa"
password="618722125"/>
</Context>jsp代码:
<form action="getEmps" method="post">
<table width="242" border="1" align="center" cellspacing="0">
<tr>
<td height="32" colspan="2" align="center">
<span class="STYLE1">请选择你心中的优秀学员</span>
</td>
</tr>
<tr>
<td height="31" colspan="2" align="center">
<input type="button" value="全选" onclick="quanxuan(true)" />
<input type="button" value="全不选" onclick="quanxuan(false)" />
</td>
</tr>
<%
List<emp> list=(List<emp>)request.getAttribute("list");
if(list!=null){
for(emp e:list){
%>
<tr>
<td align=right><input name="num" type="checkbox" vlaue="<%=e.getId() %>"/></td>
<td><%=e.getEname() %></td>
</tr>
<%
}
}
%>
<tr>
<td colspan="2" align="center">
<input type="submit" value="提交" />
<input type="reset" value="取消" /> </td>
</tr>
</table>
</form>servlet中的代码:
response.setContentType("text/html;charset=GB18030");
request.setCharacterEncoding("GB18030");
empDAO ed=new empDAO();
String[] num=request.getParameterValues("num");
if(num!=null &&!num.equals("")){
try {
ed.updateEmp(num);
} catch (Exception e) {
e.printStackTrace();
}
List<emp> list=ed.getEmp();
request.setAttribute("list", list);
request.getRequestDispatcher("showCount.jsp").forward(request, response);
}else{
List<emp> list=ed.getEmp();
request.setAttribute("list", list);
request.getRequestDispatcher("showEmp.jsp").forward(request, response);
}empDao中的代码:
private Connection conn;
private PreparedStatement ps;
private ResultSet rs;
//显示所有人
public List<emp> getEmp(){
List<emp> list=new ArrayList<emp>();
String sql="select * from vote";
try {
try {
conn=DBManager.getConn();
} catch (Exception e1) {
e1.printStackTrace();
}
ps=conn.prepareStatement(sql);
rs=ps.executeQuery();
while(rs!=null && rs.next()){
int id=rs.getInt("id");
String ename=rs.getString("ename");
int ecount=rs.getInt("ecount");
emp e=new emp(id,ename,ecount);
list.add(e);
}
} catch (SQLException e) {
e.printStackTrace();
}
return list;
}
//根据id进行修改
public void updateEmp(String[] e)throws Exception{
String sql="update vote set ecount=ecount+1 where id=?";
for(int i=0;i<e.length;i++){
conn=DBManager.getConn();
int eid=Integer.parseInt(e[i]);
ps=conn.prepareStatement(sql);
ps.setInt(1, eid);
}
}DBManager代码:
public static Connection getConn()throws Exception{
//(1)得到当前文的上下文对象
Context context=new InitialContext();
//(2)得到java运行环境的上下文对象
Context c=(Context)context.lookup("java:comp/env");
//(3)得到连接池的数据源头
DataSource ds=(DataSource)c.lookup("jdbc/sqlserver");
//(4)通过数据源得到连接对象
return ds.getConnection();
}
2012-5-14 22:17:09 org.apache.catalina.core.AprLifecycleListener init
信息: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\jdk1.6.0_10\bin;D:\tomcat6.0\bin
2012-5-14 22:17:09 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
2012-5-14 22:17:09 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 568 ms
2012-5-14 22:17:10 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2012-5-14 22:17:10 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.14
2012-5-14 22:17:10 org.apache.catalina.core.NamingContextListener addResource
警告: Failed to register in JMX: javax.naming.NamingException: Could not create resource factory instance [Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory]
2012-5-14 22:17:10 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: contextInitialized()
2012-5-14 22:17:10 org.apache.catalina.core.ApplicationContext log
信息: SessionListener: contextInitialized()
2012-5-14 22:17:11 com.sun.faces.config.ConfigureListener$WebXmlProcessor scanForFacesServlet
警告: Unable to process deployment descriptor for context 'null'
2012-5-14 22:17:11 com.sun.faces.config.ConfigureListener contextInitialized
信息: Initializing Sun's JavaServer Faces implementation (1.2_04-b07-FCS) for context '/Shopping.myeclipse.bak'
2012-5-14 22:17:12 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8080
2012-5-14 22:17:12 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
2012-5-14 22:17:12 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/47 config=null
2012-5-14 22:17:12 org.apache.catalina.startup.Catalina start
信息: Server startup in 2138 ms
这两处警告是什么呀?谁能帮帮我看看我的代码呢?在web.xml中的配置和在tomcat6.0中server的配置如下:
<servlet>
<servlet-name>getEmps</servlet-name>
<servlet-class>servlet.getEmps</servlet-class>
</servlet> <servlet-mapping>
<servlet-name>getEmps</servlet-name>
<url-pattern>/getEmps</url-pattern>
</servlet-mapping>
<resource-ref>
<res-ref-name>jdbc/sqlserver</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>server如下:
<Context path="/newlinkpool" docBase="E:\WebWorkSpace\L8_shangji\WebRoot"
reloadable="true">
<Resource
name="jdbc/sqlserver"
type="javax.sql.DataSource"
auth="Container"
maxActive="100"
maxIdle="30"
maxWait="100000"
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
url="jdbc:sqlserver://localhost:1433;databasename=emp"
username="sa"
password="618722125"/>
</Context>jsp代码:
<form action="getEmps" method="post">
<table width="242" border="1" align="center" cellspacing="0">
<tr>
<td height="32" colspan="2" align="center">
<span class="STYLE1">请选择你心中的优秀学员</span>
</td>
</tr>
<tr>
<td height="31" colspan="2" align="center">
<input type="button" value="全选" onclick="quanxuan(true)" />
<input type="button" value="全不选" onclick="quanxuan(false)" />
</td>
</tr>
<%
List<emp> list=(List<emp>)request.getAttribute("list");
if(list!=null){
for(emp e:list){
%>
<tr>
<td align=right><input name="num" type="checkbox" vlaue="<%=e.getId() %>"/></td>
<td><%=e.getEname() %></td>
</tr>
<%
}
}
%>
<tr>
<td colspan="2" align="center">
<input type="submit" value="提交" />
<input type="reset" value="取消" /> </td>
</tr>
</table>
</form>servlet中的代码:
response.setContentType("text/html;charset=GB18030");
request.setCharacterEncoding("GB18030");
empDAO ed=new empDAO();
String[] num=request.getParameterValues("num");
if(num!=null &&!num.equals("")){
try {
ed.updateEmp(num);
} catch (Exception e) {
e.printStackTrace();
}
List<emp> list=ed.getEmp();
request.setAttribute("list", list);
request.getRequestDispatcher("showCount.jsp").forward(request, response);
}else{
List<emp> list=ed.getEmp();
request.setAttribute("list", list);
request.getRequestDispatcher("showEmp.jsp").forward(request, response);
}empDao中的代码:
private Connection conn;
private PreparedStatement ps;
private ResultSet rs;
//显示所有人
public List<emp> getEmp(){
List<emp> list=new ArrayList<emp>();
String sql="select * from vote";
try {
try {
conn=DBManager.getConn();
} catch (Exception e1) {
e1.printStackTrace();
}
ps=conn.prepareStatement(sql);
rs=ps.executeQuery();
while(rs!=null && rs.next()){
int id=rs.getInt("id");
String ename=rs.getString("ename");
int ecount=rs.getInt("ecount");
emp e=new emp(id,ename,ecount);
list.add(e);
}
} catch (SQLException e) {
e.printStackTrace();
}
return list;
}
//根据id进行修改
public void updateEmp(String[] e)throws Exception{
String sql="update vote set ecount=ecount+1 where id=?";
for(int i=0;i<e.length;i++){
conn=DBManager.getConn();
int eid=Integer.parseInt(e[i]);
ps=conn.prepareStatement(sql);
ps.setInt(1, eid);
}
}DBManager代码:
public static Connection getConn()throws Exception{
//(1)得到当前文的上下文对象
Context context=new InitialContext();
//(2)得到java运行环境的上下文对象
Context c=(Context)context.lookup("java:comp/env");
//(3)得到连接池的数据源头
DataSource ds=(DataSource)c.lookup("jdbc/sqlserver");
//(4)通过数据源得到连接对象
return ds.getConnection();
}
解决方案 »
- 哪位大侠帮忙看看这里面的代码有没有错误?
- .HTML文件打开后可以用js使其最小化到托盘吗?
- 菜鸟请教这个FLASH幻灯为什么在FIREFOX下不显示
- windows mobile 6.1 里的 ie6 支持javascript里的那些事件?
- 如何在Javascript判断一个对象(文本框)是否获得焦点?
- 谁用过NetMeeting的CallTo()函数呀,急!在线等。没用过也来看看呀。
- 如何利用JavaScript查找网页中指定的文字
- (请教高手)怎么把打开的窗口去掉右上角的那三个按钮?
- 怎样判断一个对象是不是存在呢?
- 求大神
- 求教js函数问题
- jquery操作IFRAME的问题 急啊,大家帮帮忙
Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory]从新下个TOMCAT试试