配置自动生成mod_jk.conf把tomat的server.xml文件 [英] configuring tomat's server.xml file with auto generating mod_jk.conf

查看:615
本文介绍了配置自动生成mod_jk.conf把tomat的server.xml文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用阿帕奇(2.2.15)的tomcat6(6.0.24) CentOS的6.4 ,并想用与Tomcat服务器,通过添加自动生成mod_jk.conf文件的功能:

I am using apache (2.2.15) and tomcat6 (6.0.24) on CentOS 6.4 and would like to use the feature with tomcat server that generates the mod_jk.conf file automatically by adding:

<监听器的className =org.apache.jk.config.ApacheConfigworkersConfig =的/ usr /共享/的tomcat6 / conf目录/ JK / workers.propertiesmodJk =/ usr / lib目录/httpd/modules/mod_jk.so/>

在tomcat的server.xml文件之前刚< /发动机> 标记。它工作得很好,并产生mod_jk.conf文件给我。这里是产生mod_jk.conf的副本:

in tomcat's server.xml file just before </Engine> tag. It work just fine and generates the mod_jk.conf file for me. Here is a copy of the generated mod_jk.conf:

########## Auto generated on Thu Dec 05 08:32:05 PST 2013##########

<IfModule !mod_jk.c>
  LoadModule jk_module "/usr/lib/httpd/modules/mod_jk.so"
</IfModule>

JkWorkersFile "/usr/share/tomcat6/conf/jk/workers.properties"
JkLogFile "/usr/share/tomcat6/logs/mod_jk.log"

JkLogLevel emerg

<VirtualHost localhost>
    ServerName localhost

    JkMount /CallOffice ajp13
    JkMount /CallOffice/* ajp13

    JkMount /Diag289 ajp13
    JkMount /Diag289/* ajp13
</VirtualHost>

问题是,我需要根据应用程序的tomcat 按IP或域名可访问并不能在我的应用程序在Tomcat通过Apache (HTTP GET:/ /serverIP/CallOffice/CallOffice.jsp)。据这里的文档:

The problem is that I need the apps under tomcat to be accessible by IP or DNS name and can't get at my apps under tomcat through apache (http://serverIP/CallOffice/CallOffice.jsp). According to the documentation here:

http://tomcat.apache.org/connectors-doc/webserver_howto/ apache.html

mod_jk.conf可以有一个虚拟主机的标签,如:

mod_jk.conf can have a VirtualHost tag like:

# All URL goes to tomcat except the one containing /home
<VirtualHost *:80> 

有关背景资料,在server.xml中下面生成&LT;虚拟主机本地主机&GT; 在mod_jk.conf标签时,它是自动生成的:

For background info, the following in server.xml generates the <VirtualHost localhost> tag in mod_jk.conf when it is auto-generated:

<Host name="localhost"  appBase="webapps" unpackWARs="true" autoDeploy="true"          xmlValidation="false" xmlNamespaceAware="false">

在这种配置下,你无法通过Apache Tomcat的访问应用程序,除非你使用本地主机服务器上。为了得到一个可行的配置,我要补充:

Under this configuration, you can't access tomcat apps through apache unless you're on the server using localhost. To get a configuration that works, I have to add:

&LT;主机名=*:80的appBase =web应用unpackWARs =真正的自动部署=真xmlValidation =假xmlNamespaceAware =false的&GT;

Tomcat的server.xml文件。这使得mod_jk.conf文件是这样的:

to tomcat's server.xml file. This makes the mod_jk.conf file look like this:

########## Auto generated on Thu Dec 05 08:38:52 PST 2013##########

<IfModule !mod_jk.c>
  LoadModule jk_module "/usr/lib/httpd/modules/mod_jk.so"
</IfModule>

JkWorkersFile "/usr/share/tomcat6/conf/jk/workers.properties"
JkLogFile "/usr/share/tomcat6/logs/mod_jk.log"

JkLogLevel emerg



<VirtualHost *:80>
    ServerName *

    JkMount /CallOffice ajp13
    JkMount /CallOffice/* ajp13

    JkMount /Diag289 ajp13
    JkMount /Diag289/* ajp13
</VirtualHost>

<VirtualHost localhost>
    ServerName localhost

    JkMount /CallOffice ajp13
    JkMount /CallOffice/* ajp13

    JkMount /Diag289 ajp13
    JkMount /Diag289/* ajp13
</VirtualHost>

此配置的作品,我可以得到我的应用(HTTP://serverIP/CallOffice/CallOffice.jsp)但是当我启动tomcat的我得到以下错误

This configuration works and I can get to my apps (http://serverIP/CallOffice/CallOffice.jsp) but when I start up tomcat I get the following error:

Dec 5, 2013 8:38:52 AM org.apache.catalina.core.StandardContext preRegisterJMX
INFO: Error registering ctx with jmx
StandardEngine[Catalina].StandardHost[*:80].StandardContext[/CallOffice] null
javax.management.MalformedObjectNameException: Invalid character ':' in value part of property
javax.management.MalformedObjectNameException: Invalid character ':' in value part of property

Dec 5, 2013 8:38:52 AM org.apache.catalina.core.StandardContext resourcesStart
SEVERE: Error starting static Resources
javax.management.MalformedObjectNameException: Invalid character ':' in value part of property at javax.management.ObjectName.construct(ObjectName.java:617)

Dec 5, 2013 8:38:52 AM org.apache.catalina.core.StandardContext start
SEVERE: Error in resourceStart()
Dec 5, 2013 8:38:52 AM org.apache.catalina.core.StandardContext registerJMX
INFO: Error registering wrapper with jmx
StandardEngine[Catalina].StandardHost[*:80].StandardContext[/CallOffice] null
javax.management.RuntimeOperationsException: Object name cannot be null
javax.management.RuntimeOperationsException: Object name cannot be null`

Tomcat的讨厌看到了 server.xml中的任何主机标签,在它有一个*。但是,这是需要我的部署,用户有时会使用IP地址来访问应用程序。我知道我可以只使用mod_jk.conf的静态版本,以获得我所需要的,但我想用一个自动生成mod_jk.conf文件,因为添加到tomcat的新的.war文件将在mod_jk.conf自动配置无不必更新静态mod_jk.conf文件。

Tomcat hates seeing any host tag in server.xml that has an '*' in it. But this is needed for my deployment where users sometimes use IP address to access the apps. I know I can just use a static version of mod_jk.conf to get what I need, but I would like to use an auto-generating mod_jk.conf file because new .war files added to tomcat will be configured automatically in mod_jk.conf without having to update a static mod_jk.conf file.

在这里的任何想法?即使我开始的时候得到Tomcat的日志文件中的错误,我的应用程序仍然work..Ignore tomcat的错误?或者去用静态mod_jk.conf文件,没有虚拟标签或&LT;虚拟主机*:80&GT; 来得到我想要的??

Any ideas here?? Even though I get the errors in Tomcat's log file when starting, my apps still work..Ignore tomcat's errors?? or go with a static mod_jk.conf file with no virtual tag or <VirtualHost *:80> to get what I want??

推荐答案

那么这里是你的答案 - 去一个静态mod_jk.conf文件。

Well here's your answer - go with a static mod_jk.conf file.

的Tomcat用户列表归档

考虑过这个ApacheConfig自动生成功能不被生产足够好,并且在Tomcat 7的,它除去tomcat的开发人员。 presumably这个问题太复杂,没有足够的高度重视。

The tomcat developers considered this ApacheConfig auto-generation functionality not to be good enough for production, and in tomcat 7, it was removed. Presumably the issue was too complex and not high enough priority.

这篇关于配置自动生成mod_jk.conf把tomat的server.xml文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆