Hai Lin

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

Recent posts by Hai Lin

All,

I am new to Tomcat cluster, so I will greatly appreciate any your help on my questin below.

I want to set up a tomcat cluster including 2 servers, but each time I only want one server is up; if that running server is down, the cluster will automatically start up the second server?

Can tomcat cluster do this? if so, could you tell me any info or link that how to do it?

Many thanks!
13 years ago
All,

Please give me some idea for my problem, it's really really annoying me now.

In a weblogic clustering env, I have one clustering server which includes M1 and M2 two managing servers, JMS server 1 (JMSServer_M1 targetted to M1), JMS server 2 (JMSServer_M2) targetted to M2. And I also have one uniform distributed queue (queue name: testQueue) targeted to the cluster.

Then I sent 10 messages to testQueue, found out the 5 messages were put to the queue in M1 and 5 messages to the M2. How can read this 10 messages out? I mean, if I ran a simple java program to get message from the cluster, it only gave either M1's 5 message, or M2's 5 message, but not all the 10 messages.

Any help will be greatly appreicated.

Hai
15 years ago
All,
I need your help for figuring out my problem now. I'm using weblogic 9.2 now, I put two very simple plain document under BEA Repository. And in my java file, I try to retrieve this two document by using weblogic 9.2's CMS API, the code is straightforward as below:
...
ITypeManager typeMgr = ContentManagerFactory.getTypeManager();
//request is HttpServletRequest
ContentContext ctx = new ContentContext(request);
ISortableFilterablePagedList typeList = typeMgr.getViewableTypes(ctx, "BEA Repository");

But why the typeList is always empty? I should get two types since I have two documents there.

Thanks in advance.

Hai
15 years ago
Hi All,
I'm using log4j to do log for the java application, and the logged file name should be automatically changed every day, for example, today's log file should be 12152004test1.log (today is Dec/15), and tomorrow's log will automatically become 12162004test1.log when I start up the application.
Could anyone tell me how to set the property about:

log4j.rootCategory=DEBUG, MYLOG
log4j.appender.MYLOG.File=C:\\tomcat\\webapps\\test\\...

Thanks a lot.

Hai
Hi Sivaraman,
Since every web application invoked in Tomcat must based on its
WEB-INF/web.xml, so if you go to your local Tomcat's
web-apps/ROOT/WEB-INF, look for web.xml, you will see the following, (or similar stuff,
varies from TomCat's version):
<!-- JSPC servlet mappings start -->

<servlet>
<servlet-name>org.apache.jsp.index_jsp</servlet-name>
<servlet-class>org.apache.jsp.index_jsp</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>org.apache.jsp.index_jsp</servlet-name>
<url-pattern>/index.jsp</url-pattern>
</servlet-mapping>

<!-- JSPC servlet mappings end -->

Those are where when you type http://localhost:8080/ goes, The Tomcat
get this request, based on the web.xml, directly make your request go to
index.jsp, if you wanna move to your own page (instead of overwritting
index.jsp), you just need to do

<servlet>
<servlet-name>org.apache.jsp.index_jsp</servlet-name>

<!-- <servlet-class>org.apache.jsp.index_jsp</servlet-class> -->
<jsp-file>/YourOwnJsp.jsp</jsp-file>
</servlet>
Then, restart server, it should go to your page when you type
http://localhost:8080/

All this relates to the Servlet mapping, there's a very good book to recommend, SCWCD exam study kit, if you go to SCWCD forum, you'll see this book is rated as "golden" book. Once you read the first 5 chapters, you'll havea great understanding for how servlet/jsp works.

I used to have the similar question as yours, after I read that book, everything is clear for me.

Hai



Originally posted by Sivaraman Lakshmanan:
hi all,
I can always put a index.jsp in the web-apps/ROOT folder which can
just refresh my page, but I want to know where it is configured that by
default tomcat request (on typing
http://localhost:8080/) goes to web-apps/ROOT folders index.jsp

Regards,
Sivaraman.L

19 years ago
Hi All,
I'm using log4j to do log for the java application, and the logged file name should be automatically changed every day, for example, today's log file should be 12152004test1.log (today is Dec/15), and tomorrow's log will automatically become 12162004test1.log when I start up the application.
Could anyone tell me how to set the property about:

log4j.rootCategory=DEBUG, MYLOG
log4j.appender.MYLOG.File=C:\\tomcat\\webapps\\test\\...

Thanks a lot.

Hai
19 years ago
Hi, guys,
Feel big doubt for the HFE page 432, question 4

Given the container-managed unidirectional relationship:
Foo (0-1) --> Bar (0-1)
And the object relations:
f1-->b1
f2-->b2

What will be true after the following code runs? (Choose all the that apply.)
f2.setBar(f1.getBar());

A. f1.getBar() == null
B. b2.getFoo() == null
C. b1.getFoo() == null
D. none of the above

the answer given by the book is A, B. Actually, why B is correct? Since the Foo and Bar are unidirectional relationship, that mean, foo can getBar(), but bar cannot get Foo, there should NOT have method like b2.getFoo() existing.

Thanks a lot for your advice.

Hai
[ August 12, 2004: Message edited by: Hai Lin ]
Hi Guys,
I only found Sybex's OCA/OCP: Introduction to Oracle9i SQL Study Guide, and OCA/OCP: Oracle9i DBA Fundamentals I Study Guide.
Since I have little Oracle knowledge, are these book good enough for passing exam or you guys have better suggestion?
Prefer any book like (SCWCD exam study it, or Head first EJB, whose style are esay to understand, hate those books like textbook)

Thanks a lot!
Hai
19 years ago
Hi Everyone,
I'm close to my SCBCD exam. But this two days I found out http://www.jdiscuss.com is not available any more, where has lots of good mock exam!
Anything wrong for jdiscuss?

Thanks.

Hai
28. Which are guaranteed by EJB 2.0?

A) Server crashes will be transparent to entity bean clients.
B) Server crashes will be transparent to stateless session bean clients.

The correct answer is A, any one coule give me explanation.
Thanks a lot.

Hai
Thanks a lot for your good answer, guys!

Hai
Hi All,
About Head First EJB Page 157, it say, even a given bean can expose both a remote and local client view, you can't mix local and remote interfaces together?
It's hard to understand what is "you can't mix local and remote interfaces together"
For example, local interface has method getLocalPrice(), while remote interface has method called getRemotePrice(), and one Bean called PriceBean, does this mean PriceBean either implement getLocalPrice() or getRemotePrice(), cannot implement both of them?
Thanks a lot in advance!

Hai
Hi All,
I read Spec page 361: The Container must throw the java.lang.IllegalStateException if the EJBContext.setRollbackOnly() method is invoked from a business method executing with the Supports, NotSupported, or Never transaction attribute.

Why there's exception for Supports Attribute? I understand, there's no transaction context for 'never' attribute, and unspecified transaction context for 'NotSupported' attribute, but method with 'Supports' attribute can have a valid transaction context (as long as the invoking method -- which invokes this 'Supports' attribute method -- has a valid transaction context, the 'Supports' attribute method will use this transaction context, so, the setRollbackOnly() can be invoked --- Why still IllegalStateException? Unless the invoking method has no valid transaction context, then the IllegalStateException should be thrown

Wait for you guys' suggestion.

Hai
Aatir,
I think the book's answer is correct.
Because as for ejbActivate(), ejbPassivate(), setEntityContext(), whithin this three methods there's no valid Tranaction context. Please take a look spec Page 80 (for stateful Session Bean), Page 180 (for Entity Bean), since no valid tx ctx within these methods, of course 4, 5, 6 are wrong, while in the 1, 2, 3 methods, valid tx ctx are there.
since MessageDriven Bean and stateless bean has no ejbActivate(), ejbPassivate(), so we don't need to concern this two types of bean here.

Hope it can help you.

Hai
Hi All,
Due to my machine's enviroment setting got something wrong, so I cannot do the test for my question now, hoping you guys' can give me some advices:

Suppose we have a remote client:

public class AdviceClient {
...
//suppose we already get the EJB home interface back, the SuggestionGiver
//is the component interface
SuggestionGiver sg = home.create();
String suggestion = sg.getSuggestion(this);
...
public void fromClient() {
...
}
}

if the remote client can really pass itself, then that means the client is available for bean's business method, then the bean's business method can invoke Client's method (here is fromClient() method)

I know, passing client itself is a little weird, but technically, is it fine?

Thanks a lot in advance.

Hai