Apache 和 Tomcat 之间的集成 - mod_jk
Posted
技术标签:
【中文标题】Apache 和 Tomcat 之间的集成 - mod_jk【英文标题】:Integration between Apache and Tomcat - mod_jk 【发布时间】:2013-12-11 00:12:51 【问题描述】:无法启动服务器。未配置服务器实例。 (这是tomcat服务器告诉我的)
做 Apache 和 Tomcat 之间的集成任务我得到了 50%。我的意思是,我在配置后启动并运行了 Apache(因为当我加载浏览器时很好),但是当我启动 Tomcat 时出现错误,如下所示:
我的产品版本是:
Apache 2.2.25 (win32) Tomcat 7.0.47(宽 x86) mod_jk.so 1.2.37Apache httpd.conf:
LoadModule jk_module "C:\Program Files\Apache Software Foundation\Apache2.2\modules\mod_jk.so" JkWorkersFile "C:\Program Files\apache-tomcat-7.0.47\conf\workers.properties" JkLogFile "C:\Program Files\apache-tomcat-7.0.47\conf\from_apache_mod_jk.log" JkLogLevel 信息 JkLogStampFormat "[%a %b %d %H:%M:%S %Y]" 服务器名称 localhost JkMount /examples ajp13 JkMount /examples/* ajp13
Tomcat server.xml:
引擎>
转储文件:
Nov 25, 2013 11:35:24 PM org.apache.catalina.core.AprLifecycleListener init
Informações: Loaded APR based Apache Tomcat Native library 1.1.29 using APR version 1.4.8.
Nov 25, 2013 11:35:25 PM org.apache.catalina.core.AprLifecycleListener init
Informações: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
Nov 25, 2013 11:35:25 PM org.apache.tomcat.util.digester.Digester startElement
Grave: Begin event threw exception
java.lang.ClassNotFoundException: org.apache.jk.config.ApacheConfig
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:144)
at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1276)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1537)
at org.apache.catalina.startup.Catalina.load(Catalina.java:617)
at org.apache.catalina.startup.Catalina.load(Catalina.java:665)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:281)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:455)
Nov 25, 2013 11:35:25 PM org.apache.catalina.startup.Catalina load
Advertência: Catalina.start using conf/server.xml: Error at (141, 143) : org.apache.jk.config.ApacheConfig
Nov 25, 2013 11:35:25 PM org.apache.tomcat.util.digester.Digester startElement
Grave: Begin event threw exception
java.lang.ClassNotFoundException: org.apache.jk.config.ApacheConfig
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:144)
at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1276)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1537)
at org.apache.catalina.startup.Catalina.load(Catalina.java:617)
at org.apache.catalina.startup.Catalina.start(Catalina.java:679)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:456)
Nov 25, 2013 11:35:25 PM org.apache.catalina.startup.Catalina load
Advertência: Catalina.start using conf/server.xml: Error at (141, 143) : org.apache.jk.config.ApacheConfig
Nov 25, 2013 11:35:25 PM org.apache.catalina.startup.Catalina start
Grave: Cannot start server. Server instance is not configured.
【问题讨论】:
server.xml 是: 我的意思是,在寻找配置时,我看到了很多配置它的可能性。我更喜欢 apache 网站内的说明,但 Tomcat 无法加载。有人可以帮我吗? 我找到了这个解释的文件,但是我不明白。如何集成 Tomcat 7 和 Apache 2.2? faqcluster.com/question1875309190 【参考方案1】:下载tomcat-jk2.jar 文件,放到Tomcat 的lib 文件夹中。这样就可以解决你的问题了。 可以从here下载tomcat-jk2.jar。
【讨论】:
【参考方案2】:马科斯,
您阅读的那封邮件在 tomcat 用户邮件列表中。他们说ApacheConfig
类已从tomcat7 中删除,因此尝试在server.xml 中使用它配置侦听器会抛出ClassNotFoundException
。所以基本上你必须从你的server.xml
中删除Listener
配置。
如果你已经有一个'mod_jk.conf'文件,你必须把它放在Apache配置目录中——我不确定windows,但在linux中有一个'conf.d'或者有一个mods-available
目录(如果放在后者中,需要启用a2enmod
的模块)
如果您无法将其添加到主 Apache 配置文件的底部。
要在配置中添加什么,请查看configuring tomat's server.xml file with auto generating mod_jk.conf
【讨论】:
以上是关于Apache 和 Tomcat 之间的集成 - mod_jk的主要内容,如果未能解决你的问题,请参考以下文章
apache-maven-3.3.9集成apache-tomcat-7.0.72实现热部署配置细节
Jenkins +Maven+Tomcat+SVN +Apache项目持续集成构建