Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!

Tarun Tyagi

Greenhorn
+ Follow
since Jun 01, 2004
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 Tarun Tyagi

You may be better off putting in extra details than putting in less than required. Particularly if Session Beans represent any business logic then you should state the operation / method names and visibility. For entities , if you know of very obvious attributes then you can add those. There are no exact answers and this is only based on my personal understanding.
Hi

I am writing to state my sincere thanks to everyone in this forum. The information here has been extremely valuable for me.
I have received the email confirmation for passing in SCEA (had submitted the essay and assignment on 24th August) and received the confirmation mail on 23rd November.

Kind Regards
Tarun
10 years ago
Thanks . I will try both the suggestions and write back .
Although , it is quite unfortunate that docs for both 8.1 and 9.0 are wrong , <jndi-name> element in ejb-jar.xml.
I am facing problems in looking up a URL object from JNDI , in an EJB , deployed in Weblogic 8.1 .
According to the Weblogic Docs , at
(http://edocs.beasys.com/wls/docs91/ejb/implementing.html)
"Configuring EJBs to Send Requests to a URL"

I have provided an entry for Resource Ref in ejb-jar.xml as

<resource-ref>
<res-ref-name>url/FileURL</res-ref-name>
<res-type>java.net.URL</res-type>
<res-auth>Container</res-auth>
</resource-ref>

and an entry for resource-description in weblogic-ejb-jar.xml as

<resource-description>
<res-ref-name>
url/FileURL
</res-ref-name>
<jndi-name>
http://www.rediff.com/
</jndi-name>
</resource-description>

In the business method in ejb the code to do the lookup is as follows

Properties h = new Properties();
h.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
h.put(Context.PROVIDER_URL, "t3://localhost:7001");
h.put(Context.SECURITY_PRINCIPAL, "weblogic");
h.put(Context.SECURITY_CREDENTIALS, "weblogic");
Context ctx = new InitialContext(h);
URL url = (URL) ctx.lookup("java:comp/env/url/FileURL");
URLConnection connection = url.openConnection();

When executing this method, a Naming execption is thrown which states

javax.naming.LinkException: . Root exception is javax.naming.NameNotFoundException: While trying to lookup 'http:./www.redif
f.com/' didn't find subcontext 'http:' Resolved ; remaining name 'http://www/rediff/com/'

I have tried the above using a file url (file:///c:/a.txt)
as well and got the same error.

If anyone has succeffully used java.net.URL as a resource from EJB in Weblogic , do let me know .

Else , pls suggest , what could be going wrong in the above scenerio .

Thanks in Advance
Tarun
Hi Guys ,

I passed the SCBCD exam with 94% ( 64 correct out of 70 ) .
Took me about 1 hr to do the exam .
This forum was of immense help . I was looking for info about drag and drop questions and found very liitle posts about it . Hence I will write something about those myself .
First , I got about say 10 drag drop questions .
Second , the exam software was nice and behaved very properly , no errors and drop worked perfect in the first time it self .
Third , if you can answer the question in multiple choice , u don't need any special practice for drag and drop questions .

In general about the exam .
I used HFE book by Kathy and Bert . ( Great book guys ) .
Used Enterpise Java Beans by Richard Monson-Haefel , as an initial text book .
Use SoftSCBCD exams . ( Nice set of questions . )
Initally it seemed to me that SoftSCBCD questions were a lil too easy , because in 2 mock exams I scored 98% . But my average on the 5 mocks was 90% .
But after the exam I can say , that SofSCBCD questions were very precise and they cover everything .
Offcourse , the exam in HFE book is tough and I scored 82% in that .

In the end , thanks again to Kathy and Bert for such a great book .
and thanks to all you guys who answer questions in this forum .


Tarun
17 years ago
Hi

I wanted to understand better how to implement CMR ( relationships in EJB ) . For a particular example of two EJBs , Bank and Branches . These two EJB have a one to many uni-directional relationship .
Bank ejb has a collection CMR field for branches and branches has a bank CMR field .
According to the Head First EJB book , fields which actually represent the relationship ( the actual foreign key field ) , must not be represented as a CMP field .

For the Branches entity , my primary key is bank code + branch code . Also bank code is a foreign key to banks table .

Now for the rules of Primary key in entity beans , all fields in Primary key , must be a CMP .
So is it correct here to represent branch code as a CMP field and ( in branches EJB ) and also have a CMR field for Banks .Is there a basic problem with this design ? .

Because for some reason , I am not able to get this relation working as it is supposed to work .
( Specially the set methods do not work as explained in the EJB spec . If I want to set all branches of a bank to another bank , the expected result is not achieved after the set operation ) . I used Websphere 5.1 for this scenario .

Please comment .

Thanks
Tarun
Hi

I wanted to understand better how to implement CMR ( relationships in EJB ) . For a particular example of two EJBs , Bank and Branches . These two EJB have a one to many uni-directional relationship .
Bank ejb has a collection CMR field for branches and branches has a bank CMR field .
According to the Head First EJB book , fields which actually represent the relationship ( the actual foreign key field ) , must not be represented as a CMP field .

For the Branches entity , my primary key is bank code + branch code . Also bank code is a foreign key to banks table .

Now for the rules of Primary key in entity beans , all fields in Primary key , must be a CMP .
So is it correct here to represent branch code as a CMP field and ( in branches EJB ) and also have a CMR field for Banks .Is there a basic problem with this design ? .

Because for some reason , I am not able to get this relation working as it is supposed to work .
( Specially the set methods do not work as explained in the EJB spec . If I want to set all branches of a bank to another bank , the expected result is not achieved after the set operation ) . I used Websphere 5.1 for this scenario .

Please comment .

Thanks
Tarun
Hi

I wanted to understand how exactly is the container able to manage transactions in case of a BMP .
In the sample code I've seen at a few places for BMPs , in the ejbLoad or ejStore method , the JDBC conection is closed at the end of the function .

Is it , that all pooled or XA connections obtained from the container via a datasource object , are automatically managed for transactions . ( Its not really clear how this happens , if the connection is closed ...!! or even the connection close is intercepted by the container ? ) .

Also , it probably may never be done , but if the connection is not obtained from the server datasource ( like a simple JDBC connection ) , will the container still be able to manage transactions .

Hope I made clear the point that I am not able to understand .


Thanks
Tarun :roll:
Hi

I am just starting to develop EJBs . I can't get to work the EJB refs as expected . In a session bean I have a lookup for an Entity bean . Both beans are in separate JAR files , but in the same ear .

The lookup from session bean to entity bean only works when
the coded name in EJB ref is defined exactly the same as JNDI name for enity bean , also the name in lookup method must be the same in session bean .

To my surprise , the JNDI name for the target EJB , defined in EJB ref for session bean , does not mater at all . Even if I change it to a non existant name , the bean lookup works .

Theoritacally I understand that EJB ref is there to provide a mapping between the name of bean mentioned in code to the actual JNDI name of another bean , at the time of deployment .

The above is happening in J2EE 1.4 envoirment .

Please let me know , what am I doing here that is wrong .

( All examples and tutorials , usually give coded name same as JNDI name ) .

Thanks
Tarun