sunny hsiao

Greenhorn
+ Follow
since Dec 04, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by sunny hsiao

I am trying to get the apache webserver to load balance the http request. But it is only able to forward request to 1 instance of the the Tomcat. It will not forward request to the second instance of Tomcat.

the following is my worker.properties file:

worker.list=balancer

worker.worker1.port=8009
worker.worker1.host=localhost
worker.worker1.type=ajp13
worker.worker1.lbfactor=1

worker.worker2.port=8109
worker.worker2.host=localhost
worker.worker2.type=ajp13
worker.worker2.lbfactor=1

worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers= worker1, worker2
worker.loadbalancer.method=B

and my httpd.conf file:

LoadModule jk_module modules/mod_jk.so

JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel info

JkMount /* balancer

If I turn off the first Tomcat instance, I will get the Service Temporarily Unavailable error:


and in the mod_jk.log :

[Thu Feb 24 15:48:03 2011] [3188:1248] [info] jk_ajp_common.c (1215): (balancer) error sending request. Will try another pooled connection
[Thu Feb 24 15:48:03 2011] [3188:1248] [info] jk_ajp_common.c (1215): (balancer) error sending request. Will try another pooled connection
[Thu Feb 24 15:48:03 2011] [3188:1248] [info] jk_ajp_common.c (1241): (balancer) all endpoints are disconnected
[Thu Feb 24 15:48:03 2011] [3188:1248] [info] jk_ajp_common.c (1244): (balancer) increase the backend idle connection timeout or the connection_pool_minsize
[Thu Feb 24 15:48:03 2011] [3188:1248] [info] jk_ajp_common.c (1941): (balancer) sending request to tomcat failed, recoverable operation attempt=1
[Thu Feb 24 15:48:04 2011] [3188:1248] [info] jk_connect.c (451): connect to 127.0.0.1:8009 failed (errno=61)
[Thu Feb 24 15:48:04 2011] [3188:1248] [info] jk_ajp_common.c (876): Failed opening socket to (127.0.0.1:8009) (errno=61)
[Thu Feb 24 15:48:04 2011] [3188:1248] [info] jk_ajp_common.c (1273): (balancer) error connecting to the backend server (errno=61)
[Thu Feb 24 15:48:04 2011] [3188:1248] [info] jk_ajp_common.c (1941): (balancer) sending request to tomcat failed, recoverable operation attempt=2
[Thu Feb 24 15:48:04 2011] [3188:1248] [error] jk_ajp_common.c (1953): (balancer) Connecting to tomcat failed. Tomcat is probably not started or is listening on the wrong port
[Thu Feb 24 15:48:04 2011] [3188:1248] [info] mod_jk.c (2254): Service error=0 for worker=balancer

have I setup the configuration correctly? why wouldn't it access the second instance when the 1st instance has failed?

thanks.


Note: I am able to forward request to second instance of Tomcat if I specify the following: (and modify the httpd.conf file)

JkMount /taskA worker1
JkMount /taskA/* worker1
JkMount /taskB worker2
JkMount /taskB/* worker2

and even if I change my worker.properties file to the following, it is still going to the firs instance of tomcat (port 8009)

worker.worker1.port=8109
worker.worker1.host=localhost
worker.worker1.type=ajp13
worker.worker1.lbfactor=1

worker.worker2.port=8109
worker.worker2.host=localhost
worker.worker2.type=ajp13
worker.worker2.lbfactor=1
14 years ago
In my humble opinion, I don�t think it is possible for another TestClass to come and intentionally hack the LockManager�s hashmap object reservation and attempt to book an already locked record with a different lockCookie.

I think the only way the SecurityException can be thrown is if there are two different versions of clients, 1 client has a booking method that uses lockRecord, update, and unlock. Another client has a version with booking method that just calls the updateRecord without lock. And the SecurityException is thrown when thread 1 locked the record but before it can perform the updates, second client directly performs the updateRecord method.

Which I guess is possible if in future; another programmer decides to make change to the application and if he/she was careless and just decide to call the updateRecord method in its� booking method, instead of the lock, update, unlock steps.

What do you all think? Do you all have a something like checkLockingOwner method?
Hello Ranchers,

I am doing the URLyBird project. and I have a question on the SecurityException that is thrown by the updateRecord method.


The JavaDoc for updateRecord(long recNo, String[] data, long lockCookie) below suggests that the updateRecord() method should do a check on the LockManager�s reservations (a hashmap object that stores the record number as the key and lockCookie as the value) against the parameters provided to the updateRecord() prior to committing the changes to the database.

// Modifies the fields of a record. The new value for field n
// appears in data[n]. Throws SecurityException
// if the record is locked with a cookie other than lockCookie.
public void updateRecord(long recNo, String[] data, long lockCookie)
throws RecordNotFoundException, SecurityException;

But investigating the business logic of how a record is locked, updated, and unlocked or the private property of the reservations, it seems it is not very likely that the SecurityException will be thrown at all.

If this is the case, should we still implement that checking against the LockManager�s reservations? (the hashmap object) For me, I implemented a method called checkForSameLockingOwner(long recNo, long suppliedCookie) in LockManager class and is called from the Data�s updateRecord method.

The SecurityException is thrown if checkForSameLockingOwner methods returns a false result.


Thanks.
[ April 30, 2008: Message edited by: sunny hsiao ]
I'm interested in doing IBM test 286 (Application development with IBM Websphere studio v5.0) Does anybody know how much is cost?

Do I go to the Prometric website to buy the exam voucher first?

thanks