tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jerry Birchler" <jrbirch...@attbi.com>
Subject Re: integrating tomcat 4.04 into iplanet 4.1 using nsapi_redirector on linux
Date Fri, 02 Aug 2002 12:34:05 GMT
I don't know of any command in linux that checks permissions on a socket.
There is a kernel header file that sets permissions called ioperm. There's
even a man page for it, but I haven't played around with it. Basically, I
don't know how to check this.

Both netscape and tomcat run with webserv as the user. My listener is on
port 8009. All the directories and files associated with my web server and
tomcat are owned by webserv with read and sometimes execute amd write for
everyone.

Anyway, I'm still having problems.

After playing around a bit more, I get a little better results(????) in that
the browser returns html, but it is not running the JSP. Instead all code
between <% and %> shows up when I view the page source, but is otherwise
hidden. When I view a JSP in netscape's doc root, I see the entire text
rendered and all code between <% and %> as if it were just text. So, the
bottom line is that a JSP referenced from netscape to tomcat in tomcat's doc
root behaves different than JSP in netscape's doc root. I got this result by
changing the mime type for jsp to text/plain from it's default value of
magnus-internal/servlet. Reverting the mime back to magnus-internal/servlet
produces the same error 500 message. Changing the IE to display
"non-friendly errors" did not shed any light on this. The only difference in
logs for this is that when I revert back to the magnus-internal/servlet mime
type, I get this in the netscape errors log:

[02/Aug/2002:00:09:13] config (32160): for host XX.XX.XXX.XXX trying to GET
/examples/jsp/snp/snoop.jsp, handle-processed reports: no way to service
request for /examples/jsp/snp/snoop.jsp

I don't get this error when I change the mime-type to text/plain. BEA
suggests using text/jsp for integrating its application server. I tried that
and got the same result after restarting netscape. I've even tried arbitrary
values and got the same result. Finally, I removed the mime altogether--same
result--no errors, but JSP does not execute and is hidden unless I source
the page. Same thing.

One other detail that may be important is that my linux machine has two
NICS. One is a fixed external IP, and the other is a fixed local IP. My
network is working fine, but I was just wondering if there are special
configuration considerations for a multi-homed system. My guess is no,
because most production applications I've worked on are multi-homed.

# #Here is my makefile process:
1. Download tomcat 4.04 connectors source
2. copy the Makefile.solaris to Makefile.linux (which was not a part of the
distribution, unfortunately)
3. changed references from SOLARIS and solaris to LINUX and linux
4. added SUITSPOT_HOME to /etc/bashrc
5. changed this line in the Makefile from:

INCLUDEDIR=$(SUITSPOT_HOME)/include

to:

INCLUDEDIR=$(SUITSPOT_HOME)/plugins/include

6. created a "links" shell and gave it execute access:

# vi links:
ln -fs ../common/jk_ajp12_worker.o
ln -fs ../common/jk_ajp13.o
ln -fs ../common/jk_ajp13_worker.o
ln -fs ../common/jk_connect.o

# chmod +x links

I had to do this because the references are not quite right in the Makefile

7. Then I ran the Makefile using gmake like this:

# gmake -f Makefile.linux all

It failed for references. I ran my "links" shell and reran make like this:

# ./links
# gmake -f Makefile.linux all

That built nsapi_redirector.so. I created some directories and copied the
binary into /opt/tomcat/bin/netscape/linux/i386.

Hopefully, someone has actually done the specific thing I am trying to do.
I've included all relevant files below if it will help someone help me.

# vi /etc/init.d/tomcat
#!/bin/sh
CLASSPATH=/opt/tomcat/common/lib/servlet.jar
export CLASSPATH
su - webserv -c "/opt/tomcat/bin/catalina.sh $@"

# vi /opt/tomcat/conf/jk/workers.properties
# ************ Begin worker.properties **************
worker.ajp13.type=ajp13

#
# Specifies the load balance factor when used with
# a load balancing worker.
# Note:
#  ----> lbfactor must be > 0
#  ----> Low lbfactor means less work done by the worker.
worker.ajp13.lbfactor=1

#
# Specify the size of the open connection cache.
#worker.ajp13.cachesize

#
#------ DEFAULT LOAD BALANCER WORKER DEFINITION ----------------------
#---------------------------------------------------------------------
#

#
# The loadbalancer (type lb) worker perform weighted round-robin
# load balancing with sticky sessions.
# Note:
#  ----> If a worker dies, the load balancer will check its state
#        once in a while. Until then all work is redirected to peer
#        worker.
worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=ajp13

#
# worker.tomcat_home should point to the location where you
# installed tomcat. This is where you have your conf, webapps and lib
# directories.
#
worker.tomcat_home=/opt/tomcat

#
# worker.java_home should point to your Java installation. Normally
# you should have a bin and lib directories beneath it.
#
worker.java_home=/usr/java

#
# You should configure your environment slash... ps=\ on NT and / on UNIX
# and maybe something different elsewhere.
#
ps=/

#
#------ ADVANCED MODE ------------------------------------------------
#---------------------------------------------------------------------
#

#
#------ DEFAULT worker list ------------------------------------------
#---------------------------------------------------------------------
#
# The worker that your plugins should create and work with
worker.list=ajp13

#
#------ DEFAULT ajp13 WORKER DEFINITION ------------------------------
#---------------------------------------------------------------------
#

#
# Defining a worker named ajp13 and of type ajp13
# Note that the name and the type do not have to match.
#
worker.ajp13.port=8009
worker.ajp13.host=localhost

# ************ End worker.properties **************

# #netscape obj.conf snippets

...

Init fn="load-modules" funcs="jk_init,jk_service"
shlib="/opt/tomcat/bin/netscap
e/linux/i386/nsapi_redirector.so"
Init fn="jk_init" worker_file="/opt/tomcat/conf/jk/workers.properties"
log_level
="debug" log_file="/opt/tomcat/nsapi.log"

...

NameTrans fn="pfx2dir" from="/examples" dir="/opt/tomcat/webapps/examples"

...

NameTrans fn="assign-name" from="/servlet/*" name="Mservlet"
NameTrans fn="assign-name" from="/examples/*" name="Mservlet"

...

Service fn="jk_service" type="text/plain" worker="ajp13"

...

<Object name="ServletByExt">
ObjectType fn="force-type" type="text/plain"
Service fn="jk_service" worker="ajp13"
</Object>

...

<Object name="Mservlet"
#ObjectType fn="force-type" type="text/plain"
Service fn="jk_service" worker="ajp13"
</Object>

# vi nsapi.log
[Thu Aug 01 11:17:14 2002]  [jk_worker.c (206)]: close_workers will destroy
work
er ajp13
[Thu Aug 01 11:17:19 2002]  [jk_worker.c (88)]: Into wc_open
[Thu Aug 01 11:17:19 2002]  [jk_worker.c (222)]: Into build_worker_map,
creating
 1 workers
[Thu Aug 01 11:17:19 2002]  [jk_worker.c (228)]: build_worker_map, creating
work
er ajp13
[Thu Aug 01 11:17:19 2002]  [jk_worker.c (148)]: Into wc_create_worker
[Thu Aug 01 11:17:19 2002]  [jk_worker.c (162)]: wc_create_worker, about to
crea
te instance ajp13 of ajp13
[Thu Aug 01 11:17:19 2002]  [jk_ajp13_worker.c (108)]: Into
ajp13_worker_factory
[Thu Aug 01 11:17:19 2002]  [jk_worker.c (171)]: wc_create_worker, about to
vali
date and init ajp13
[Thu Aug 01 11:17:19 2002]  [jk_ajp_common.c (1178)]: Into
jk_worker_t::validate
[Thu Aug 01 11:17:19 2002]  [jk_ajp_common.c (1198)]: In
jk_worker_t::validate f
or worker ajp13 contact is localhost:8009
[Thu Aug 01 11:17:19 2002]  [jk_ajp_common.c (1226)]: Into jk_worker_t::init
[Thu Aug 01 11:17:19 2002]  [jk_worker.c (187)]: wc_create_worker, done
[Thu Aug 01 11:17:19 2002]  [jk_worker.c (238)]: build_worker_map, removing
old
ajp13 worker
[Thu Aug 01 11:17:19 2002]  [jk_worker.c (250)]: build_worker_map, done
[Thu Aug 01 11:17:19 2002]  [jk_worker.c (111)]: wc_open, done 1
[Thu Aug 01 11:17:20 2002]  [jk_nsapi_plugin.c (298)]: jk_init, a second
passed

# vi catalina_log.2002-08-01.txt
2002-08-01 23:16:41 Ajp13Processor[8009][1] waiting for next socket to be
assign
ed...
2002-08-01 23:16:41 Ajp13Processor[8009][1]  Background thread has been
started
2002-08-01 23:16:41 Ajp13Connector[8009] added processor to available
processors
, available=1
2002-08-01 23:16:41 Ajp13Processor[8009][2] Starting background thread
2002-08-01 23:16:41 Ajp13Processor[8009][2]  Background thread has been
started
2002-08-01 23:16:41 Ajp13Connector[8009] added processor to available
processors
, available=2
2002-08-01 23:16:41 Ajp13Processor[8009][3] Starting background thread
2002-08-01 23:16:41 Ajp13Processor[8009][2] waiting for next socket to be
assign
ed...
2002-08-01 23:16:41 Ajp13Processor[8009][3]  Background thread has been
started
2002-08-01 23:16:41 Ajp13Connector[8009] added processor to available
processors
, available=3
2002-08-01 23:16:41 Ajp13Processor[8009][4] Starting background thread
2002-08-01 23:16:41 Ajp13Processor[8009][3] waiting for next socket to be
assign
ed...
2002-08-01 23:16:41 Ajp13Processor[8009][4]  Background thread has been
started
2002-08-01 23:16:41 Ajp13Connector[8009] added processor to available
processors
, available=4
2002-08-01 23:16:41 Ajp13Processor[8009][4] waiting for next socket to be
assign
ed...

# vi localhost_examples_log.2002-08-01.txt
2002-08-01 23:16:36 WebappLoader[/examples]: Deploying class repositories to
wor
k directory /opt/jakarta-tomcat-4.0.4/work/Standalone/localhost/examples
2002-08-01 23:16:36 WebappLoader[/examples]: Reloading checks are enabled
for th
is Context
2002-08-01 23:16:36 StandardManager[/examples]: Seeding random number
generator
class java.security.SecureRandom
2002-08-01 23:16:36 StandardManager[/examples]: Seeding of random number
generat
or has been completed
2002-08-01 23:16:37 ContextConfig[/examples]: Added certificates -> request
attr
ibute Valve
2002-08-01 23:16:37 ContextConfig[/examples]: Configured an authenticator
for me
thod FORM
2002-08-01 23:16:37 ContextListener: contextInitialized()
2002-08-01 23:16:37 SessionListener: contextInitialized()
2002-08-01 23:16:37 ContextListener:
attributeReplaced('org.apache.catalina.WELC
OME_FILES', '[Ljava.lang.String;@42bece')
2002-08-01 23:16:37 StandardWrapper[/examples:default]: Loading container
servle
t default
2002-08-01 23:16:37 default: init
2002-08-01 23:16:38 StandardWrapper[/examples:invoker]: Loading container
servle
t invoker
2002-08-01 23:16:38 invoker: init
2002-08-01 23:16:38 jsp: init

# vi catalina.out
===================================
Ajp13Connector active threads=6
java.lang.ThreadGroup[name=Ajp13Connector[8009],maxpri=10]
    Thread[Ajp13Connector[8009],5,Ajp13Connector[8009]]
    Thread[Ajp13Processor[8009][0],5,Ajp13Connector[8009]]
    Thread[Ajp13Processor[8009][1],5,Ajp13Connector[8009]]
    Thread[Ajp13Processor[8009][2],5,Ajp13Connector[8009]]
    Thread[Ajp13Processor[8009][3],5,Ajp13Connector[8009]]
    Thread[Ajp13Processor[8009][4],5,Ajp13Connector[8009]]
===================================


--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message