tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Clive Luk" <cl...@ilanet.net.au>
Subject RE: Virtual host and mod_jk2 connector setup questions
Date Tue, 02 Sep 2003 07:16:29 GMT
Hi all tomcat guru,

After mess around. I found out what the problem was. it was the web.xml. all
the <servlet> tags has to place before the <servlet-mapping> tags. I assume
that the tags in web.xml has to be put in a certain order.

But another problem.

I can access all the *.jsp file with no problem with the virutal host i
setup (e.g. www.domain.com/test.jsp). But I can access to my test
servlet(e.g. www.domain.com/HelloWorld). it comes up page not found.

here is my web.xml under

/web/domain.com/htdocs/WEB-INF

here is my webapp directory structure

/web/domain.com/htdocs (have all the *.jsp files)
/web/domain.com/htdocs/WEB-INF
/web/domain.com/htdocs/WEB-INF/classes (all the *.classes)

web.xml sits under /web/domain.com/htdocs/WEB-INF

Could any one please let me know where did I do wrong?

================web.xml===================

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
    <display-name>Test webapp</display-name>
    <description>
        Test webapp
    </description>

    <servlet>
        <servlet-name>HelloWorld</servlet-name>
        <servlet-class>HelloWorld</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>HelloWorld</servlet-name>
        <url-pattern>/HelloWorld</url-pattern>
    </servlet-mapping>
</web-app>

Cheers,
Clive

-----Original Message-----
From: Clive Luk [mailto:clive@ilanet.net.au]
Sent: Tuesday, September 02, 2003 2:56 PM
To: Tomcat Users List
Subject: Virtual host and mod_jk2 connector setup questions


HI all,

I am only newbie to tomcat. I really need help on setting up tomcat 4.1.27
with mod_jk2 connector with a virtual host on apache 2.0.47. I have digged
through the mail-list and the jarkata doco page. still no help.

Here are my configuration files and the output of the catalina.out file.
When i get rid of the <HOST> section in the server.xml it doesn't come up
any error on the catalina.out file.

1. Am I on the right track of setting up virtual host on apache and tomcat?
2. Would that be a problem when I compile the connector and apache myself?

SPECs.

REDHAT 9.0
j2sdk1.4.2
jakarta-tomcat-4.1.27(binary)

apache2.0.47
(./configure --enable-so --enable-ssl --with-ssl=/usr/local/ssl --enable-vho
st-alias)

jakarta-tomcat-connectors-4.1.27-src
(./configure --with-apxs2=/usr/local/apache2/bin/apxs \
--with-tomcat41=/usr/local/tomcat\
--with-java-home=/usr/local/java \
--with-apache2-lib=/usr/local/apache2/lib \
--with-apr-lib=/usr/local/apache2/lib \
--with-jni)

THANKS in advance.

=================catalina.out================

Sep 2, 2003 2:31:24 PM org.apache.commons.modeler.Registry loadRegistry
INFO: Loading registry information
Sep 2, 2003 2:31:24 PM org.apache.commons.modeler.Registry getRegistry
INFO: Creating new Registry instance
Sep 2, 2003 2:31:30 PM org.apache.commons.modeler.Registry getServer
INFO: Creating MBeanServer
Sep 2, 2003 2:31:37 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on port 8080
Starting service Tomcat-Standalone
Apache Tomcat/4.1.27
Sep 2, 2003 2:31:43 PM org.apache.commons.digester.Digester error
SEVERE: Parse Error at line 42 column 11: The content of element type
"web-app" must match
"(icon?,display-name?,description?,distributable?,context-param*,filter*,fil
ter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mappin
g*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,se
curity-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-loca
l-ref*)".
org.xml.sax.SAXParseException: The content of element type "web-app" must
match
"(icon?,display-name?,description?,distributable?,context-param*,filter*,fil
ter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mappin
g*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,se
curity-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-loca
l-ref*)".
        at
org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown
Source)
        at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
Source)
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
Source)
        at
org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
        at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown
Source)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown
Source)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatc
her.dispatch(Unknown Source)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
        at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.commons.digester.Digester.parse(Digester.java:1548)
        at
org.apache.catalina.startup.ContextConfig.applicationConfig(ContextConfig.ja
va:282)
        at
org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:639)
        at
org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:
243)
        at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppor
t.java:166)
        at
org.apache.catalina.core.StandardContext.start(StandardContext.java:3568)
        at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
        at
org.apache.catalina.core.StandardHost.start(StandardHost.java:738)
        at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
        at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
        at
org.apache.catalina.core.StandardService.start(StandardService.java:497)
        at
org.apache.catalina.core.StandardServer.start(StandardServer.java:2190)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:512)
        at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
        at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
Sep 2, 2003 2:31:55 PM org.apache.struts.util.PropertyMessageResources
<init>


=============httpd.conf====================

LoadModule jk2_module modules/mod_jk2.so

<IfModule mod_jk2.c>
    JkSet config.file /usr/local/apache2/conf/workers2.properties
</ifModule>

<SNIP>

<VirtualHost www.domain.com>
    ServerName www.domain.com
    ServerAlias www.domain.com
    DocumentRoot "/web/www.domain.com/htdocs"
    CustomLog logs/www.domain.com-access_log combined
    ErrorLog logs/www.domain.com-error_log

    DirectoryIndex index.jsp index.html

#   JkSet  uri:www.domain.com/*.jsp.group  ajp13:localhost:8009

#   <Location "/*.jsp">
#       JkUriSet worker ajp13:localhost:8009
#   </Location>

    <Location /WEB-INF/>
        Order Allow,Deny
    </Location>
</VirtualHost>

=================workers2.properties============
[logger]
level=DEBUG

[config:]
file=${serverRoot}/conf/workers2.properties
debug=0
debugEnv=0

[uriMap:]
info=Maps the requests. Options: debug
debug=0

# Alternate file logger
[logger.file:0]
level=DEBUG
file=${serverRoot}/logs/jk2.log

[shm:]
info=Scoreboard. Required for reconfiguration and status with multiprocess
servers
file=${serverRoot}/logs/jk2.shm
size=1000000
debug=0
disabled=0

[workerEnv:]
info=Global server options
timing=1
debug=0
# Default Native Logger (apache2 or win32 )
# can be overriden to a file logger, useful
# when tracing win32 related issues
#logger=logger.file:0

[lb:lb]
info=Default load balancer.
debug=0

[lb:lb_1]
info=A second load balancer.
debug=0

[channel.socket:localhost:8009]
info=Ajp13 forwarding over socket
port=8009
host=127.0.0.1
debug=0


[channel.un:/usr/local/tomcat/work/jk2.socket]
tomcatId=localhost:8009
debug=0

[ajp13:localhost:8009]
channel=channel.socket:localhost:8009

#[channel.socket:localhost:8019]
#info=A second tomcat instance.
#debug=0
#tomcatId=localhost:8019
#lb_factor=1
#group=lb
#group=lb_1
#disabled=0

#[channel.un:/opt/33/work/jk2.socket]
#info=A second channel connecting to localhost:8019 via unix socket
#tomcatId=localhost:8019
#lb_factor=1
#debug=0

#[channel.jni:jni]
#info=The jni channel, used if tomcat is started inprocess

[status:]
info=Status worker, displays runtime informations

[vm:]
info=Parameters used to load a JVM in the server process
#JVM=C:\jdk\jre\bin\hotspot\jvm.dll
classpath=${TOMCAT_HOME}/bin/tomcat-jni.jar
classpath=${TOMCAT_HOME}/server/lib/commons-logging.jar
OPT=-Dtomcat.home=${TOMCAT_HOME}
OPT=-Dcatalina.home=${TOMCAT_HOME}
OPT=-Xmx128M
#OPT=-Djava.compiler=NONE
disabled=1

#[worker.jni:onStartup]
#info=Command to be executed by the VM on startup. This one will start
tomcat.
#class=org/apache/jk/apr/TomcatStarter
#ARG=start

## For Tomcat 5 use the 'stard' for startup argument
## ARG=stard
#disabled=1
#stdout=${serverRoot}/logs/stdout.log
#stderr=${serverRoot}/logs/stderr.log

#[worker.jni:onShutdown]
#info=Command to be executed by the VM on shutdown. This one will stop
tomcat.
#class=org/apache/jk/apr/TomcatStarter
#ARG=stop
#disabled=1

[uri:/jkstatus/*]
info=Display status information and checks the config file for changes.
group=status:

[uri:127.0.0.1:8003]
info=Example virtual host. Make sure myVirtualHost is in /etc/hosts to test
it
alias=myVirtualHost:8003

[uri:127.0.0.1:8003/ex]
info=Example webapp in the virtual host. It'll go to lb_1 ( i.e.
localhost:8019 )
context=/ex
group=lb_1

[uri:/examples]
info=Example webapp in the default context.
context=/examples
debug=0

[uri:/examples1/*]
info=A second webapp, this time going to the second tomcat only.
group=lb_1
debug=0

[uri:/examples/servlet/*]
info=Prefix mapping

[uri:/examples/*.jsp]
info=Extension mapping

[uri:/examples/*]
info=Map the whole webapp


[uri:/examples/servlet/HelloW]
info=Example with debug enabled.
debug=10

# www.domain.com > Tomcat
[uri:www.domain.com/*.jsp]
worker=ajp13:localhost:8009

============jk2.properties==================

## THIS FILE MAY BE OVERRIDEN AT RUNTIME. MAKE SURE TOMCAT IS STOPED
## WHEN YOU EDIT THE FILE.

## COMMENTS WILL BE _LOST_

## DOCUMENTATION OF THE FORMAT IN JkMain javadoc.

# Set the desired handler list
handler.list=apr,request,channelJni
#
# Override the default port for the socketChannel
channelSocket.port=8009
channelSocket.address=127.0.0.1
# Default:
# channelUnix.file=/usr/local/tomcat/work/jk2.socket
# Just to check if the the config  is working
# shm.file=${jkHome}/work/jk2.shm

# In order to enable jni use any channelJni directive
# channelJni.disabled = 0
# And one of the following directives:

# apr.jniModeSo=/opt/apache2/modules/mod_jk2.so

# If set to inprocess the mod_jk2 will Register natives itself
# This will enable the starting of the Tomcat from mod_jk2
# apr.jniModeSo=inprocess
#serverRoot=/usr/local/apache2
#apr.NativeSo=/usr/local/apache2/modules/jkjni.so

=========server.xml===============

<SNIP>

<Host name="www.domain.com" debug="1" appBase="/web/www.domain.com/htdocs"
       unpackWARs="true" autoDeploy="true">

     <Logger className="org.apache.catalina.logger.FileLogger"
             directory="logs"  prefix="domain_com." suffix=".log"
             timestamp="true"/>

     <Context path="" docBase="" debug="0" reloadable="true">

     <Logger className="org.apache.catalina.logger.FileLogger"
             prefix="domain." suffix=".log" timestamp="true" />

     <Resource name="mail/Session" auth="Container"
               type="javax.mail.Session"/>
         <ResourceParams name="mail/Session">
             <parameter>
                 <name>mail.smtp.host</name>
                 <value>localhost</value>
             </parameter>
         </ResourceParams>

     </Context>
</Host>

<SNIP>

Cheers,
Clive


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org



Mime
View raw message