Jo Liang

+ Follow
since Dec 10, 2001
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jo Liang

I know class variable is never thread safe but how about final class variable? Can we say it is thread safe since the value can't be changed?
Thank you.
- Jo
When a Servlet implments SingleThreadModel then the local, instance and request variables are thread safe.
Therefore, I think I could said the belowing serlvet, which implements SingleThreadModel and has a instance variable, is thread safe, right?

import javax.servlet.*;
import javax.servlet.http.*;
public class MyServlet implements SingleThreadModel {
public String var; //Instance variable
public doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServeltException{

But can we say the Servlet is ThreadSafe if it implements SingleThreadModel but has a "class variable"??
Like this:
import javax.servlet.*;
import javax.servlet.http.*;
public class MyServlet implements SingleThreadModel {
static public String var; //class variable
public doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServeltException{
Is this Servlet is ThreadSafe? Cause I think class variable is never thread-safe.
Thank you.
I have problem running Java Sun J2EE tutorial examples on the tomcat-1.4.12. I believe the problem is tomcat has trouble reading web.xml. But since the web.xml is from Java example, I assume it is correct but something wrong with Tomcat.

Here is my system:
OS: WindowsNT
Java: java version "1.4.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_01-b03)
Tomcat: tomcat-1.4.12

Once I add the example WAR file with web.xml:
<?xml version="1.0" encoding="ISO-8859-1" ?>
- <web-app xmlns="" xmlns:xsi="" xsi:schemaLocation=" web-app_2_4.xsd" version="2.4">

When I start Tomcat and I get this error message:
Feb 25, 2003 11:56:08 AM org.apache.commons.digester.Digester error
SEVERE: Parse Error at line 6 column 19: Document root element "web-app", must match DOCTYPE root "
org.xml.sax.SAXParseException: Document root element "web-app", must match DOCTYPE root "null".
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.j
at org.apache.xerces.util.ErrorHandlerWrapper.error(
at org.apache.xerces.impl.XMLErrorReporter.reportError(
at org.apache.xerces.impl.XMLErrorReporter.reportError(
at org.apache.xerces.impl.dtd.XMLDTDValidator.rootElementSpecified(

It seems like the opache commons-digester fail parsing web.xml. So I downloaded the last commons-digester.tar from Jakarta-Apache and put it in %CATALINA_HOME%/server/lib (replace the original one). However, I still have this error.
All my setup is pretty standard. So I feel it is very strange that I got this error and couldn't find much answer from web.
Thanks for helping in advance.
- Jo
19 years ago
Hi, I am using WebLogic 6.1 + SP2 and I have same question.
Here is the WebLogic Problem Solved list:
I assume that WebLogic 7.0 don't have those problem since those problem really caused our servers down and I have applied at last 5 patches on our WebLogic 6.1 server.
Of course, the newer version comes better features. But it might be helpful and practical that you just look at the list and to see what problem you have and could be fixed by newer version or just adding some patches, since you might not use all the features of the WebLogic.
- Jo
19 years ago
I think tradictional eduction teach you a way of study, a way to learn, to look for answer, which is very helpful while you are preparing your certification.
Even if you are not CS major, if you have spent quite amout of time in school and learn the right way to study. Then you will also get benefit from certification.
- Jo
Hi there,
What is the difference between jsp:foward and HttpServletResponse.sendRedirect??
Here is some API regarding to each technique.
<jsp:forward />:
This method is used to re-direct, or "forward" the current ServletRequest and ServletResponse to another active component in the application.

Sends a temporary redirect response to the client using the specified redirect location URL. This method can accept relative URLs.
But does that really make difference when coding the application?
Thank you.
- Jo
20 years ago
What CAN directly cause a thread to stop executing?
A. Existing from a synchronized block
B. Calling the wait method on an object
C. Calling notify method on an object
D. Calling read method on an InputStream object
E. Calling the SetPriority method on a Thread object
Can somebody help me with this one? Thank you.
An other question, while a thread is running (already got the CUP), it that possible that other tread with higher priority (in Ready-to-Run state) takes over?

1.public class SyncTest {
2.private int x;
3.private int y;
4.public synchronized void setX (int i) ( x=1; )
5.public synchronized void setY (int i) ( y=1; )
6.public synchronized void setXY(int 1)( set X(i); setY(i); )
7.public synchronized Boolean check() ( return x !=y; )
Under which conditions will check () return true when called from a different class?
A.check() can never return true
B.check() can return true when setXY is called by multiple threads
C.check() can return true when multiple threads call setX and setY separately.
D.Check() can only return true if SyncTest is changed to allow x and y to be set separately.

The given answer is B. But I am not sure that's the right answer. And I don't know what is the point of this question. What does it try to test?
Thank you in advance.

(Marilyn disabled smilies)
[ May 05, 2002: Message edited by: Marilyn deQueiroz ]
Oh, yeah, that makes sence. Thanks alot.
60. What is the output displayed by the following code?
public class TestIPApp {
public static void main(String args[]) throws IOException {
RandomAccessFile file = new RandomAccessFile("test.txt", "rw");
Select correct answer:
A) 123456
B) 7890
C) 1000000
D) .0001
The answer is B. But why?
Thank you very much.
How many objects are candidates for garbage collection by the end of the following code sinppet:
1.String s = "Hello";
2.s = "Hello" + " World";
A) 1
B) 2
C) 3
D) 4
E) none

This answer is B.
Can somebody explain why? Thanks