apache2.0.54和tomcat5.5.9的整合

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/championmajian/article/details/590620

 

看了有n多教程终于在公元200621下午337把这个困扰两天的问题搞定,此时想起了老罗说过的一个故事,描述了一个大家都经历过但未必留意的一个现象,说出来一听大家都会觉得很有道理:说两个炒股票的人谈话,当旁边有外行的时候两个人说一些股票的行话,什么‘潜力股’,‘黑马股’‘纳斯达克’,搞的旁边人一头雾水,觉得此二人高深无比,看着别人茫然的表情二人自然猥琐的笑了,当外行人一走他们也没那么多行话术语了。在实际的很多行业我想也会有不少这些现象,古人云闻道有先后,但是先闻道者似乎更希望后来者走一些弯路,费一些周折来体现一下自己的高手价值,能用通俗易懂的语言讲述一个问题的人太少了,在整合apachetomcat服务器的时候发现搜索到的教程几乎一摸一样,不光是一些bloger,就连一些大型网站,都是抄来抄去,而且都是那篇说的含糊不清的文章。在此一并bs一下。

说一下为什么用apache+tomcat,tomcat单独就可以解释jsp,但是解释html的能力弱,加apache整合应该是不错的服务器环境。

 

     下面说一下我的配置方法:

我用的基本都是所需软件的最新版本

jdk-1_5_0_06-windows-i586-p.exe

jakarta-tomcat-5.5.9.zip(解压缩就ok了)

apache_2.0.54-win32-x86-no_ssl.msi

mod_jk_1.2.6_2.0.50.dll

重点提一下这个下载地址:网上很多教程里提到的地址都是错的,或者直接说去apache.org下载,还不如说去网上下载呢,这个是我自己找到并成功下载的地址:                                           http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.6/

 

安装没什么技巧下面贴出来我的环境变量

CATALINA_BASED:/tomcat

CATALINA_HOMED:/tomcat

tomcat_homeD:/tomcat

java_homeD:/program files/Java/jdk1.5.0_06

class_path.;d:/program files/Java/jdk1.5.0_06/lib/dt.jar;D:/program files/Java/jdk1.5.0_06/lib/tools.jar;%CATALINA_HOME%/common/lib/servlet-api.jar;

 

到这tomcatapache应该都可以单独启动了。

由于我事前装过oracleapache的默认端口80被占用了,装apache的时候不成功,先把oracleoraclehomehttpserver90服务停掉,然后安装就可以了,用的时候启动apache2tomcat的默认端口8080 也被占用了,我的解决方案是改tomcat端口:找到tomcat下的conf文件夹,下面有server.xml找到这里:

<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->

    <Connector port="这里随便写一个端口,我写的是8088,这年头干什么事图吉利" maxHttpHeaderSize="8192"

               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"

               enableLookups="false" redirectPort="8443" acceptCount="100"

               connectionTimeout="20000" disableUploadTimeout="true" />

    <!-- Note : To disable connection timeouts, set connectionTimeout value

     to 0 -->

然后:关闭tomcatapache,配置文件修改都需要重启服务,这是我吃了很多亏之后的一点经验吧。

修改apache下的httpd.conf,找到"DirectoryIndex",在index.html的后面添加index.jsp并保存,注意相互之间应有空格,这一步目的是在访问到一个目录时,解释index.jsp这个文件,跟iis中设置defalt一样。

最后设置ApacheTomcat之间的连接,

下面一段是从网上找的,路径根据本机环境改一下就可以了

Apache遇到jsp文件时,在后台将其交由Tomcat去处理:打开C:/Apache2/conf/httpd.conf,在最后加入下面这段代码并保存。
############################# Using mod_jk2.dll to redirect dynamic calls to Tomcat 
##
装载模块,用于处理连接
LoadModule jk_module modules/mod_jk-2.0.43.dll 
##
设置模块的工作文件,下面将会对workers.properties进行详细说明
JkWorkersFile "C:/Tomcat4/conf/workers.properties"
##
设置模块工作的日志文件,Tocmat启动时会自建
JkLogFile "C:/Tomcat4/logs/mod_jk2.log"   
##
Apache支持对servlet, jsp 传送,用以Tomcat解析
JkMount /servlet/* ajp13 
JkMount /*.jsp ajp13 
5.2. 
增加workers.properties
C:/Apache2/conf下新建一个文件workers.properties 注意文件后缀。
其内容如下:
##
mod_jk模块知道Tomcat
workers.tomcat_home=c:/Tomcat4
##
mod_jk模块知道j2sdk 
workers.java_home=c:/j2sdk1.4.1   
##
路径分隔符,即注意:c:/Tomcat4
ps=##
模块版本,现有ajp14,不要修改
worker.list=ajp13
##
联接端口。可参见 tomcat 的设置文件:c:/tomcat4/conf/erver.xml中的:Define a Coyote/JK2 AJP 1.3 Connector on port 8009
worker.ajp13.port=8009            
##Tomcat
所在的主机的地址。
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
worker.ajp13.lbfactor=1 

最后整合测试:
(1)
启动ApacheTomcat。注:启动的顺序无关。
(2)
在地址栏中输入http://localhost:8088/  ,若与上面的测试相同,则Tomcat重新配置后正常!
(3)
在地址栏中输入http://localhost/ index.jsp,若与http://localhost:8088/ 的结果相同,搞定。

下面请对自己说:我tm真是天才!

 

展开阅读全文

为什么?为什么?为什么用apache2.0.54和tomcat5.0.28使用mod_jk无法整合

12-14

在整合apache2.0.54和tomcat5.0.28时从网上下载了mod_jk-1.2.14-apache-2.0.54 然后将它复制到Apache2/modules里面,并且把文件名改为mod_jk.so,在conf/目录里面增加了mod_jk.conf 里面的内容是:rn# Load mod_jk modulernLoadModule jk_module modules/mod_jk.sorn# Where to find workers.propertiesrnJkWorkersFile conf/workers.propertiesrn# Where to put jk logsrnJkLogFile logs/mod_jk.logrn# Set the jk log level [debug/error/info]rnJkLogLevel inforn# Select the log formatrnJkLogStampFormat "[%a %b %d %H:%M:%S %Y] "rn# JkOptions indicate to send SSL KEY SIZE,rnJkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectoriesrn# JkRequestLogFormat set the request formatrnJkRequestLogFormat "%W %V %T"rn# Send servlet for context /examples to worker named ajp13rn#JkMount /servlet/* ajp13rn# Send JSPs for context /examples to worker named ajp13rnJkMount /*.jsp ajp13rnrn然后又在httpd.conf中加入了 include "D:/Apache/Apache2/conf/mod_jk.conf"rnrn又在/conf目录下写了work.properties文件 内容为rnworker.list=ajp13rnworker.ajp13.port=8009rnworker.ajp13.host=localhost #本机,若上面的主机不为localhost ,做相应的修改rnworker.ajp13.type=ajp13 #类型rnworker.ajp13.lbfactor=1 #代理数,不用修改rnrnrn然后在启动apache的时候就启动不了,我完全按照书上的操作步骤来的,不知道为什么,各位大虾帮忙啊!!!!!!rn已经郁闷了一个下午了... 论坛

tomcat5.5.9在IIS6.0下怎么配置呀?

06-29

各位大哥帮小弟一个忙??rn环境:windows servers 2003 + tomcat5.5.9 + iis6.0rn我按照方法如下配置:rnrn// 开始rntomcat5.5.9和IIS5.0配置总结 rn经过一天的反复调试才把这个搞定,网上的说明文档很多,好象不太明晰还,决定写个自己的总结rnIIS-5.0rnTomcat-5.5.9rnJK插件,目前IIS 最新版isapi_redirect-1.2.14.dll,下载的位置也总变,这是目前最新的,http://www.apache.org/dist/jakarta/...rs/jk/binaries/rn关于插件的说明:最开始是JK,然后apache推出改进的JK2插件,现在JK2不再进行维护,且把其中的优点移植到JK中,继续JK的开发,主要是JK配置方便吧rnrn步骤: rn将 JK插件(isapi_redirect.dll 文件)拷贝到 %CATALINA_HOME%\bin目录下rn在JK插件同目录下,新建“isapi_redirect.properties”文件(一定要相同目录,就不用写注册表了),内容如下:rn# Configuration file for the Jakarta ISAPI Redirectorrnrn# The path to the ISAPI Redirector Extension, relative to the websitern# This must be in a virtual directory with execute privilegesrnextension_uri=/mediaAsset/isapi_redirect.dllrnrn# Full path to the log file for the ISAPI Redirectorrnlog_file=d:\Infomedia\devMerp\jakarta-tomcat-5.5.9\logs\isapi_redirect.logrnrn# Log level (debug, info, warn, error or trace)rnlog_level=infornrn# Full path to the workers.properties filernworker_file=d:\Infomedia\devMerp\jakarta-tomcat-5.5.9\conf\workers.propertiesrnrn# Full path to the uriworkermap.properties filernworker_mount_file=d:\Infomedia\devMerp\jakarta-tomcat-5.5.9\conf\uriworkermap.propertiesrnrnrn在%CATALINA_HOME%/conf 目录下修改这两个文件“workers.properties”和“uriworkermap.properties”rn对于“workers.properties”最简单的办法是将conf目录里的“workers.properties”重命名为“workers.properties.template”,将“workers.properties.minimal”重命名为“workers.properties”rnuriworkermap.properties 内容如下:rn/你的jsp工程目录/*=ajp13w // 工程目录可以有多个;ajp13w是“workers.properties”中配置的worker.list=ajp13wrnrnrn然后打开“我的电脑->控制面板->管理工具->Internet服务管理器”,在具体的服务器中的“默认web网站”,在其上点右键选“属性”,在弹出的页框里选择“ISAPI筛选器”,点“添加”,筛选器名称填tomcat(可任意命名),可执行文件中填入你的isapi_redirect.dll的绝对路径。“确定”后点“确定”关闭属性页。rnrn再在“默认web网站”上右键,选择“新建”->“虚拟目录”,别名填jakarta,下一步,路径选为你的isapi_redirect.dll存放的目录,下一步,权限中记得把“执行”那项打勾,好了,完成。rn// 结束rnrn在ISAPI中出现了绿色箭头,优先级为“未知”rnrn结果是我在万维网上不能访问。rn但是,我把hosts的ip指向服务器时,可以访问我的网站。rn使我十分不解,望那位大哥大姐帮我解答???rn  rn 论坛

Tomcat5.5.9处理页面错误的问题

07-25

我在一个文件NewBookHandler.jsp中设置errorPage为ExceptionHandler.jsp,然后将ExceptionHandler.jsp的isErrorPage设置为true。按道理NewBookHandler.jsp出错时将导向ExceptionHandler.jsp,但是,我发现只要ExceptionHandler.jsp中存在<% page isErrorPage="true" %>,则必定会出现HTTP 500内部服务器错误。调试跟踪了一下,发现ExceptionHandler得代码正常执行完了,中间没有出现异常。请问是否是tomcat本身的BUG啊?rnrn================================ NewBookHandler.jsp ==============================rn<%@ page contentType="text/html;charset=gb2312" %>rn<%@ page errorPage="ExceptionHandler.jsp" %>rn<%@ page import="java.sql.*" %>rnrnrnrn 提示rnrnrn<% rn String id = request.getParameter("id");rn String name = request.getParameter("name");rn String sPrice = request.getParameter("price");rn String desc = request.getParameter("desc");rn rn if(id == null || id.trim().length() == 0) rn throw new Exception("请输入编号!");rn rn if(name == null || name.trim().length() == 0) rn throw new Exception("请输入书名!");rn rn if(sPrice == null || sPrice.trim().length() == 0) rn throw new Exception("请输入价格!");rn rn int price = 0;rn try rn price = Integer.parseInt(sPrice);rn catch(NumberFormatException e) rn throw new Exception("价格应该为数字!");rn rn if(price <=0) rn throw new Exception("价格应该大于0!");rn rn rn Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");rn Connection conn = null;rn PreparedStatement ps = null;rn try rn conn = DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=TestDB"rn , "sa"rn , null);rn // 重要: 尽量用参数化的SQLrn String sql = "INSERT INTO T_Book(FID, FName, FPrice, FDesc) VALUES(?, ?, ?, ?)";rn ps = conn.prepareStatement(sql);rn ps.setString(1, id);rn ps.setString(2, name);rn ps.setInt(3, price);rn ps.setString(4, desc);rn System.out.println(ps.executeUpdate() + " records inserted");rn catch(Exception e) rn throw new Exception("插入失败" );rn finally // 非常重要:无论成功失败都必须释放语句rn if(ps != null) rn ps.close();rn rn if(conn != null) rn conn.close();rn rn rn%>rn添加成功!rnrnrnrn============================= ExceptionHandler.jsp ===============================rn<%@ page contentType="text/html;charset=gb2312" %>rn<%@ page isErrorPage="true" %>rnrnrnrn 错误 rnrnrn <%= exception.getMessage() %>rn rnrnrn 论坛

NETBEANS5.0自带的TOMCAT5.5.9启动出现错误

02-19

严重: Error starting static Resourcesrnjava.lang.IllegalArgumentException: Document base E:\JAVA\Tomcat 6.0.14\webapps\pcjxc\build\web does not exist or is not a readable directoryrn at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:140)rn at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:3754)rn at org.apache.catalina.core.StandardContext.start(StandardContext.java:3925)rn at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)rn at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)rn at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)rn at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:589)rn at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:536)rn at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:471)rn at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1102)rn at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)rn at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1020)rn at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)rn at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)rn at org.apache.catalina.core.StandardService.start(StandardService.java:450)rn at org.apache.catalina.core.StandardServer.start(StandardServer.java:683)rn at org.apache.catalina.startup.Catalina.start(Catalina.java:537)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271)rn at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)rn2008-2-19 11:32:34 org.apache.catalina.core.StandardContext startrn严重: Error in resourceStart()rn2008-2-19 11:32:34 org.apache.catalina.core.StandardContext startrn严重: Error getConfiguredrn2008-2-19 11:32:34 org.apache.catalina.core.StandardContext startrn严重: Context [/pcjxc] startup failed due to previous errorsrn2008-2-19 11:32:34 org.apache.catalina.core.StandardContext stoprn信息: Container org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/pcjxc] has not been startedrn2008-2-19 11:32:34 org.apache.catalina.core.StandardContext resourcesStartrn严重: Error starting static Resourcesrnjava.lang.IllegalArgumentException: Document base E:\JAVA\Tomcat 6.0.14\webapps\TomcatServletExample\build\web does not exist or is not a readable directoryrn at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:140)rn at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:3754)rn at org.apache.catalina.core.StandardContext.start(StandardContext.java:3925)rn at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)rn at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)rn at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)rn at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:589)rn at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:536)rn at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:471)rn at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1102)rn at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)rn at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1020)rn at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)rn at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)rn at org.apache.catalina.core.StandardService.start(StandardService.java:450)rn at org.apache.catalina.core.StandardServer.start(StandardServer.java:683)rn at org.apache.catalina.startup.Catalina.start(Catalina.java:537)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271)rn at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)rn2008-2-19 11:32:34 org.apache.catalina.core.StandardContext startrn严重: Error in resourceStart()rn2008-2-19 11:32:34 org.apache.catalina.core.StandardContext startrn严重: Error getConfiguredrn2008-2-19 11:32:34 org.apache.catalina.core.StandardContext startrn严重: Context [] startup failed due to previous errorsrnrnPS:E:\JAVA\Tomcat 6.0.14 我已删除了的。rn 论坛

tomcat5.5.9中数据源配置中出现的问题

05-31

在server.xml中的之前添加如下rnrn rnrn用tomcat5.exe启动服务器时一闪而过,去掉中的内容,服务器可以正常启动。在myeclipse中启动tomact出现如下错误提示:rn2008-5-31 16:39:09 org.apache.coyote.http11.Http11Protocol initrn信息: Initializing Coyote HTTP/1.1 on http-8080rn2008-5-31 16:39:09 org.apache.catalina.startup.Catalina loadrn信息: Initialization processed in 1500 msrn2008-5-31 16:39:09 org.apache.catalina.mbeans.ServerLifecycleListener createMBeansrn严重: createMBeans: Throwablernjava.lang.NullPointerExceptionrn at org.apache.catalina.mbeans.MBeanUtils.createObjectName(MBeanUtils.java:1079)rn at org.apache.catalina.mbeans.MBeanUtils.createMBean(MBeanUtils.java:496)rn at org.apache.catalina.mbeans.ServerLifecycleListener.createMBeans(ServerLifecycleListener.java:569)rn at org.apache.catalina.mbeans.ServerLifecycleListener.createMBeans(ServerLifecycleListener.java:365)rn at org.apache.catalina.mbeans.ServerLifecycleListener.createMBeans(ServerLifecycleListener.java:534)rn at org.apache.catalina.mbeans.ServerLifecycleListener.createMBeans(ServerLifecycleListener.java:497)rn at org.apache.catalina.mbeans.ServerLifecycleListener.createMBeans(ServerLifecycleListener.java:659)rn at org.apache.catalina.mbeans.ServerLifecycleListener.createMBeans(ServerLifecycleListener.java:627)rn at org.apache.catalina.mbeans.ServerLifecycleListener.createMBeans(ServerLifecycleListener.java:277)rn at org.apache.catalina.mbeans.ServerLifecycleListener.lifecycleEvent(ServerLifecycleListener.java:128)rn at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)rn at org.apache.catalina.core.StandardServer.start(StandardServer.java:676)rn at org.apache.catalina.startup.Catalina.start(Catalina.java:537)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271)rn at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)rn2008-5-31 16:39:09 org.apache.catalina.core.StandardService startrn信息: Starting service Catalinarn2008-5-31 16:39:09 org.apache.catalina.core.StandardEngine startrn信息: Starting Servlet Engine: Apache Tomcat/5.5.9rn2008-5-31 16:39:10 org.apache.catalina.core.StandardHost startrn信息: XML validation disabledrnjava.lang.reflect.InvocationTargetExceptionrn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271)rn at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)rnCaused by: java.lang.NullPointerExceptionrn at java.util.Hashtable.put(Hashtable.java:394)rn at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:3741)rn at org.apache.catalina.core.StandardContext.start(StandardContext.java:3925)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)rn at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)rn at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)rn at org.apache.catalina.core.StandardService.start(StandardService.java:450)rn at org.apache.catalina.core.StandardServer.start(StandardServer.java:683)rn at org.apache.catalina.startup.Catalina.start(Catalina.java:537)rn ... 6 morern急需高手指点!!!!!!!!!!!!!! 论坛

apache2.0.54 tomcat5.0.28 使用mod_jk连接器无法连接问题,急!!!!!!!!

12-14

在整合apache2.0.54和tomcat5.0.28时从网上下载了mod_jk-1.2.14-apache-2.0.54 然后将它复制到Apache2/modules里面,并且把文件名改为mod_jk.so,在conf/目录里面增加了mod_jk.conf 里面的内容是:rn# Load mod_jk modulernLoadModule jk_module modules/mod_jk.sorn# Where to find workers.propertiesrnJkWorkersFile conf/workers.propertiesrn# Where to put jk logsrnJkLogFile logs/mod_jk.logrn# Set the jk log level [debug/error/info]rnJkLogLevel inforn# Select the log formatrnJkLogStampFormat "[%a %b %d %H:%M:%S %Y] "rn# JkOptions indicate to send SSL KEY SIZE,rnJkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectoriesrn# JkRequestLogFormat set the request formatrnJkRequestLogFormat "%W %V %T"rn# Send servlet for context /examples to worker named ajp13rn#JkMount /servlet/* ajp13rn# Send JSPs for context /examples to worker named ajp13rnJkMount /*.jsp ajp13rnrn然后又在httpd.conf中加入了 include "D:/Apache/Apache2/conf/mod_jk.conf"rnrn又在/conf目录下写了work.properties文件 内容为rnworker.list=ajp13rnworker.ajp13.port=8009rnworker.ajp13.host=localhost #本机,若上面的主机不为localhost ,做相应的修改rnworker.ajp13.type=ajp13 #类型rnworker.ajp13.lbfactor=1 #代理数,不用修改rnrnrn然后在启动apache的时候就启动不了,我完全按照书上的操作步骤来的,不知道为什么,各位大虾帮忙啊!!!!!!rn已经郁闷了一个下午了...rnrnrn我用Test configuration 看到如下的错误:rnsyntax error on line 2 of D:/Apache/Apache2/conf/mod_jk.conf:rncannot load D:/Apache/Apache2/modules/mod_jk.so into serverrnrn刚才看了LOGS中的内容,没看出什么东西来logs/error中的内容如下:rn[Thu Dec 14 14:14:11 2006] [notice] Apache/2.0.54 (Win32) configured -- resuming normal operationsrn[Thu Dec 14 14:14:11 2006] [notice] Server built: Apr 16 2005 14:25:31rn[Thu Dec 14 14:14:11 2006] [notice] Parent: Created child process 3564rn[Thu Dec 14 14:14:11 2006] [notice] Child 3564: Child process is runningrn[Thu Dec 14 14:14:11 2006] [notice] Child 3564: Acquired the start mutex.rn[Thu Dec 14 14:14:11 2006] [notice] Child 3564: Starting 250 worker threads.rn[Thu Dec 14 14:19:37 2006] [notice] Parent: Received shutdown signal -- Shutting down the server.rn[Thu Dec 14 14:19:37 2006] [notice] Child 3564: Exit event signaled. Child process is ending.rn[Thu Dec 14 14:19:38 2006] [notice] Child 3564: Released the start mutexrn[Thu Dec 14 14:19:39 2006] [notice] Child 3564: Waiting for 250 worker threads to exit.rn[Thu Dec 14 14:19:39 2006] [notice] Child 3564: All worker threads have exited.rn[Thu Dec 14 14:19:39 2006] [notice] Child 3564: Child process is exitingrn[Thu Dec 14 14:19:39 2006] [notice] Parent: Child process exited successfully.rn[Thu Dec 14 14:42:40 2006] [notice] Apache/2.0.54 (Win32) configured -- resuming normal operationsrn[Thu Dec 14 14:42:40 2006] [notice] Server built: Apr 16 2005 14:25:31rn[Thu Dec 14 14:42:40 2006] [notice] Parent: Created child process 2288rn[Thu Dec 14 14:42:40 2006] [notice] Child 2288: Child process is runningrn[Thu Dec 14 14:42:40 2006] [notice] Child 2288: Acquired the start mutex.rn[Thu Dec 14 14:42:40 2006] [notice] Child 2288: Starting 250 worker threads.rn[Thu Dec 14 14:44:00 2006] [notice] Parent: Received shutdown signal -- Shutting down the server.rn[Thu Dec 14 14:44:00 2006] [notice] Child 2288: Exit event signaled. Child process is ending.rn[Thu Dec 14 14:44:01 2006] [notice] Child 2288: Released the start mutexrn[Thu Dec 14 14:44:02 2006] [notice] Child 2288: Waiting for 250 worker threads to exit.rn[Thu Dec 14 14:44:02 2006] [notice] Child 2288: All worker threads have exited.rn[Thu Dec 14 14:44:02 2006] [notice] Child 2288: Child process is exitingrn[Thu Dec 14 14:44:02 2006] [notice] Parent: Child process exited successfully.rn[Thu Dec 14 15:02:40 2006] [notice] Apache/2.0.54 (Win32) configured -- resuming normal operationsrn[Thu Dec 14 15:02:41 2006] [notice] Server built: Apr 16 2005 14:25:31rn[Thu Dec 14 15:02:41 2006] [notice] Parent: Created child process 2232rn[Thu Dec 14 15:02:41 2006] [notice] Child 2232: Child process is runningrn[Thu Dec 14 15:02:41 2006] [notice] Child 2232: Acquired the start mutex.rn[Thu Dec 14 15:02:41 2006] [notice] Child 2232: Starting 250 worker threads.rn[Thu Dec 14 15:02:54 2006] [notice] Parent: Received shutdown signal -- Shutting down the server.rn[Thu Dec 14 15:02:54 2006] [notice] Child 2232: Exit event signaled. Child process is ending.rn[Thu Dec 14 15:02:55 2006] [notice] Child 2232: Released the start mutexrn[Thu Dec 14 15:02:56 2006] [notice] Child 2232: Waiting for 250 worker threads to exit.rn[Thu Dec 14 15:02:56 2006] [notice] Child 2232: All worker threads have exited.rn[Thu Dec 14 15:02:56 2006] [notice] Child 2232: Child process is exitingrn[Thu Dec 14 15:02:56 2006] [notice] Parent: Child process exited successfully.rn[Thu Dec 14 15:24:56 2006] [notice] Apache/2.0.54 (Win32) configured -- resuming normal operationsrn[Thu Dec 14 15:24:56 2006] [notice] Server built: Apr 16 2005 14:25:31rn[Thu Dec 14 15:24:56 2006] [notice] Parent: Created child process 3656rn[Thu Dec 14 15:24:56 2006] [notice] Child 3656: Child process is runningrn[Thu Dec 14 15:24:56 2006] [notice] Child 3656: Acquired the start mutex.rn[Thu Dec 14 15:24:57 2006] [notice] Child 3656: Starting 250 worker threads.rn[Thu Dec 14 15:27:01 2006] [notice] Parent: Received restart signal -- Restarting the server.rn[Thu Dec 14 15:27:01 2006] [notice] Child 3656: Exit event signaled. Child process is ending.rn[Thu Dec 14 15:27:01 2006] [notice] Apache/2.0.54 (Win32) configured -- resuming normal operationsrn[Thu Dec 14 15:27:01 2006] [notice] Server built: Apr 16 2005 14:25:31rn[Thu Dec 14 15:27:01 2006] [notice] Parent: Created child process 3356rn[Thu Dec 14 15:27:01 2006] [notice] Child 3356: Child process is runningrn[Thu Dec 14 15:27:02 2006] [notice] Child 3356: Acquired the start mutex.rn[Thu Dec 14 15:27:02 2006] [notice] Child 3656: Released the start mutexrn[Thu Dec 14 15:27:02 2006] [notice] Child 3356: Starting 250 worker threads.rn[Thu Dec 14 15:27:03 2006] [notice] Child 3656: Waiting for 250 worker threads to exit.rn[Thu Dec 14 15:27:03 2006] [notice] Child 3656: All worker threads have exited.rn[Thu Dec 14 15:27:03 2006] [notice] Child 3656: Child process is exitingrn[Thu Dec 14 15:29:18 2006] [error] [client 127.0.0.1] File does not exist: D:/Apache/Apache2/htdocs/jsp-examplesrn[Thu Dec 14 15:31:05 2006] [error] [client 127.0.0.1] File does not exist: D:/Apache/Apache2/htdocs/jsp-examplesrn[Thu Dec 14 15:31:10 2006] [error] [client 127.0.0.1] File does not exist: D:/Apache/Apache2/htdocs/jsp-examplesrn[Thu Dec 14 15:31:13 2006] [notice] Parent: Received restart signal -- Restarting the server.rn[Thu Dec 14 15:31:13 2006] [notice] Child 3356: Exit event signaled. Child process is ending.rn[Thu Dec 14 15:31:13 2006] [warn] (OS 995)由于线程退出或应用程序请求,已放弃 I/O 操作。 : winnt_accept: Asynchronous AcceptEx failed.rn[Thu Dec 14 15:31:14 2006] [notice] Child 3356: Released the start mutexrn[Thu Dec 14 15:31:15 2006] [notice] Child 3356: Waiting for 250 worker threads to exit.rn[Thu Dec 14 15:31:28 2006] [notice] Child 3356: All worker threads have exited.rn[Thu Dec 14 15:31:28 2006] [notice] Child 3356: Child process is exiting 论坛

关于TOMCAT5.0.28和TOMCAT5.5.9究竟有多少不同?求达人搞定

05-19

我找了段验证码程序如下rnImage.javarnrn/**rn * @author newrn * rn * TODO To change the template for this generated type comment go to Window -rn * Preferences - Java - Code Style - Code Templatesrn */rnimport java.awt.*;rnimport java.awt.image.*;rnimport java.util.*;rnrnpublic class Image rnrn public String sRand = "";rnrn public Color getRandColor(int fc, int bc) //给定范围获得随机颜色rn Random random = new Random();rn if (fc > 255)rn fc = 255;rn if (bc > 255)rn bc = 255;rn int r = fc + random.nextInt(bc - fc);rn int g = fc + random.nextInt(bc - fc);rn int b = fc + random.nextInt(bc - fc);rn return new Color(r, g, b);rn rnrn public BufferedImage creatImage() rnrn // 在内存中创建图象rn int width = 60, height = 20;rn BufferedImage image = new BufferedImage(width, height,rn BufferedImage.TYPE_INT_RGB);rnrn // 获取图形上下文rn Graphics g = image.getGraphics();rnrn //生成随机类rn Random random = new Random();rnrn // 设定背景色rn g.setColor(getRandColor(200, 250));rn g.fillRect(0, 0, width, height);rnrn //设定字体rn g.setFont(new Font("Times New Roman", Font.PLAIN, 18));rnrn //画边框rn //g.setColor(new Color());rn //g.drawRect(0,0,width-1,height-1);rnrn // 随机产生155条干扰线,使图象中的认证码不易被其它程序探测到rn g.setColor(getRandColor(160, 200));rn for (int i = 0; i < 155; i++) rn int x = random.nextInt(width);rn int y = random.nextInt(height);rn int xl = random.nextInt(12);rn int yl = random.nextInt(12);rn g.drawLine(x, y, x + xl, y + yl);rn rnrn // 取随机产生的认证码(4位数字)rn //String rand = request.getParameter("rand");rn //rand = rand.substring(0,rand.indexOf("."));rnrn for (int i = 0; i < 4; i++) rn String rand = String.valueOf(random.nextInt(10));rn sRand += rand;rn // 将认证码显示到图象中rn g.setColor(new Color(20 + random.nextInt(110), 20 + randomrn .nextInt(110), 20 + random.nextInt(110)));//调用函数出来的颜色相同,可能是因为种子太接近,所以只能直接生成rn g.drawString(rand, 13 * i + 6, 16);rn rn // 图象生效rn g.dispose();rn return image;rn rnrnrn-----------------------------------------------------------------------rnimagestest.jsprnrn<%@ page contentType="image/jpeg" import="javax.imageio.*" %>rnrnrnrnrn rn 无标题文档rnrnrnrnrn<%rn//设置页面不缓存rnresponse.setHeader("Pragma","No-cache");rnresponse.setHeader("Cache-Control","no-cache");rnresponse.setDateHeader("Expires", 0);rnrn// 将认证码存入SESSIONrnsession.setAttribute("rand",image.sRand);rnrn// 输出图象到页面rnImageIO.write(image.creatImage(), "JPEG", response.getOutputStream());rnrnrn%> rnrnrnrn-----------------------------------------------------------------------rn该程序在tomcat5.0下运行很正常,没有报错rn但是在tomcat5.5下报如下错误rn2007-05-19 09:41:15 [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/MedicalWebSite].[jsp]]-[ERROR]:260 - Servlet.service() for servlet jsp threw exceptionrnjava.lang.IllegalStateException: getOutputStream() has already been called for this responsern at org.apache.catalina.connector.Response.getWriter(Response.java:596)rn at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:186)rn at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:124)rn at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:117)rn at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:191)rn at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:115)rn at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:75)rn at org.apache.jsp.imagestest_jsp._jspService(org.apache.jsp.imagestest_jsp:89)rn at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rn at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)rn at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)rn at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)rn at filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:170)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)rn at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)rn at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)rn at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)rn at java.lang.Thread.run(Unknown Source)rnrn虽然报错,图片还是能显示的.rn试了N次都是,我查了下TOMCAT5.5和TOMCAT5.0确实在包结构方面有改动.希望达人帮我看下这个错误如何解决. 论坛

没有更多推荐了,返回首页