Win a copy of Rust Web Development this week in the Other Languages forum!

Tong Lin

+ Follow
since Mar 24, 2004
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 Tong Lin

Hi Anselm,
Thank you for the reply. It makes sense.
My client is very thin. Does nothing but call the advice bean in HFEJB book.
[ April 26, 2004: Message edited by: Tong Lin ]
O, I searched the internet, and see somebody said you should comment out
the tile plugin and tile controller in struts-config.xml. I tried and
struts app works.
I wonder why j2ee1.3.1 ri does not like the tile definition in struts-config.xml. j2ee1.3.1 does not tile or sun ri? Anybody any experience?
17 years ago
I am using j2ee1.3.1 sun ri with struts 1.1. I got the same error message when I tried to invoke struts-blank...
[ April 22, 2004: Message edited by: Tong Lin ]
17 years ago
Yes, both JSP and EJB are deployed with J2EE RI.
Thank you Nathaniel.
My client, JSP and EJB(remote interface and local interface)s, and J2EE RI
(web and EJB containers) are located on the same physical machine.
I don't understand why it takes significant longer for client access than
JSP access.
[ April 19, 2004: Message edited by: Tong Lin ]
I tried to use client and JSP to call a remote interface EJB
located on the same machine. The remote EJB then call the local
interface EJB giving out advice as that in HFEJB advice example.
I found it takes about a second for the client to return the advice,
while the browser version invoking the JSP returns the advice almost
I wonder if anybody else has experience on this and what's the
possible reason for the speed difference.
Ok, I finally got the local interface work.
remote client -> remote EJBHome -> remote EJBObject -> remote bean with
local client -> local EJBHome -> local EJBObject -> local bean getMessage
1. As Kathy pointed out, the local client should live inside another
remote bean in order for outside remote client to access the local bean.
The local lookup string should be "java:comp/env/AdvisorLocal".
2. Add the remote and local home/object/bean in the same ejb jar with RI
(Add to Existing JAR file).
3. When you see there are two ejbs(remote and local) listed under one
jar icon, click the remote bean and "EJB Refs" tab, and add a reference
for the remote bean like this:
AdvisorLocal Session Local headfirst.AdviceHomeLocal headfirst.AdviceLocal
Then set "Enterprise Bean Name" to AdviceBeanLocal if your local bean named
This is to tell the deploytool to create local bean reference for the remote
bean in ejb-jar.xml.
You can also put the remote and local bean into different jar files for
the same ear file. Then you have to name the local bean reference as
something like "ejb-jar-ic.jar#AdviceBeanLocal" in the
"Enterprise Bean Name".
4. Verify, deploy the application with the two beans.
5. Compile your remote client with the stub created by the deploytool. And
run it.
[ March 28, 2004: Message edited by: Tong Lin ]
Thank you so much Kathy. I will try what you said. Yes, it's good
to add instructions on how to make a mini local interface work in the
book. It would be better not to have a main function inside local
client example(to indicate it can be run standalone).
I started feeling it's reasonable that local client should live
inside container after I posted my message yesterday...
BTW, I really enjoy this book(Head First EJB). You make a technology
as fun as art.
[ March 26, 2004: Message edited by: Tong Lin ]
[ March 26, 2004: Message edited by: Tong Lin ]
I found something related to the topic. It seems that the local client
needs to be in the same ear file or EJB container as the local bean in order
for it to access. The client, even running on the same JVM as the J2EE,
cannot lookup and find the local EJB home/object directly.
Any expert could share some wisdom on this? Thanks.
Sorry. It was a typo. I do have the AdvisorLocal as the JNI name in deploytool and the client lookup string.
I am using j2se 1.4.2-b28 + j2ee 1.3.1-b17. Could it be a compatible
isssue? Anybody has this j2se1.4/j2ee1.3 combination and ran the local
Advice EJB successfully?
I am new to EJB. I tried the advice example in HFEJB book. The remote
interface works as expected, but when I try the local interface, the
local client cannot find the JNI name. I specified the name in deploytool
as AdviceLocal. I wonder if anybody else got the same problem. I the
tried the program on WinNT and WinXP Pro and get the same result.
Here is the message:
C:\Java\ejb\projects\advice>java -cp %CLASSPATH%;AdviceLocalAppClient.jar AdviceLocalClient
javax.naming.NameNotFoundException: AdvisorLocal not found
at com.sun.enterprise.naming.TransientContext.doLookup(
at com.sun.enterprise.naming.TransientContext.lookup(
at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(
at Source)
Exception in thread "main" java.lang.NullPointerException
at AdviceLocalClient.go(
at AdviceLocalClient.main(
Hi there,
I am a newbie of EJB. I have a question.
We have backend access based legacy authentication before the
business data access. If I understand correctly, EJB use role
based security and it's not related to the bean coding, which means
the business logic in bean knows nothing about security and it is
supposed to be trusted. My question is how to map the function of
the old authentication to the EJB model?
Thanks in advance.