Jose Esteban

Ranch Hand
+ Follow
since Nov 28, 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 Jose Esteban

Never mind, everything was correct. It was my IDE which deleted the <data-source>.
15 years ago
I'm following the tutorial from the book "Jakarta Struts Live� and I have problems connecting to my database (Struts 1.1):

This is the code inside the Action class:
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {

UserRegistrationForm userForm = (UserRegistrationForm) form;
DataSource dataSource = getDataSource(request, "userDB"); // *** ERROR: GETS A NULL ***
Connection conn = dataSource.getConnection();
The data-sources in struts-config.xml:
<data-source type="org.apache.commons.dbcp.BasicDataSource" key="userDB">
<set-property property="driverClassName" value="sun.jdbc.odbc.JdbcOdbcDriver" />
<set-property property="url" value="jdbc dbc atosStruts" />
<set-property property="username" value="jose" />
<set-property property="password" value="jose" />
The init-param in web.xml:

The problem seems to be that the code in the Action class (above)

DataSource dataSource = getDataSource(request, "userDB");

returns a null.

I've debugged the application and I've realized that, inside the Struts getDataSource method, the ServletContext doesn't contain the "userDB" attribute.

Any help?

15 years ago

Originally posted by Valentin Crettaz:
I will correct the cheat sheet by tomorrow.

Hi Valentin, it seems that you have forgotten to correct the sheets. Please, don't forget to do it when you have a minute.

To facilitate your job, remember that the corrections that I propose are:
1) I propose you not to use any deprecated expressions, although they work for the moment, and DELETE any reference to RemoteException in the bean classes. HFEJB also says this in pages 233 and 235: "You MUST not declare RemoteException in your bean class, EVER."

2) ANY OTHER exceptions in the bean classes should be optional. This includes CreateException in the ejbCreateMethods and EJBException in all of the bean classes.

[ May 05, 2005: Message edited by: Jose Esteban ]
Thank you for sharing your cheat sheets.

Hi Valentin,
I understand what you mean but I don't agree with you in a thing:

Originally posted by Valentin Crettaz:
...but they still have to declare the exception in the throws clause of their methods since your bean classes must implement the javax.ejb.EntityBean interface and/or the javax.ejb.SessionBean interface and RemoteException is a checked exception.

The fact that a method in an interface declares an exception doesn't mean that the implementing method has to declare this exception (this is SCJP ). What is true is that you must not declare any new checked exceptions for an implementation method.

I agree that according to the "Java law" it should work (for the moment, because it is DEPRECATED) declaring the RemoteException , but what I can say for sure is that it is not mandatory. If you declare it (what I don't recommend since it is deprecated), it should be between square brackets. You can find lots of code to check what I say.

Besides, according to EJB 2.0 spec, section 18.3.8 (Support for deprecated use of java.rmi.RemoteException) the use of RemoteException in "business methods, ejbCreate, ejbPostCreate, ejbFind<METHOD>, ejbRemove, and the container-invoked callbacks (i.e., the methods defined in the EntityBean, SessionBean, and SessionSynchronization interfaces)" is deprecated.

So if you declare RemoteException in ejbActivate, to be consistent, you should do the same in every method mentioned in the last paragraph. But I really don't think that using deprecated expressions is correct (at least, without warning about it).

1) I propose you not to use any deprecated expressions, although they work for the moment, and DELETE any reference to RemoteException in the bean classes. HFEJB also says this in pages 233 and 235: "You MUST not declare RemoteException in your bean class, EVER."

2) ANY OTHER exceptions in the bean classes should be optional. This includes CreateException in the ejbCreateMethods and EJBException in all of the bean classes.

I hope that these suggestions will allow your cheat sheets, which are close to perfection, to get it.
[ April 27, 2005: Message edited by: Jose Esteban ]
Hi, I'm preparing the SCBCD exam and I have detected an errata in Valentin Crettaz's cheat sheets.

In every bean class the sheet says:
public void ejbPassivate()throws RemoteException, EJBException {...}
(and it is similar for the other methods from the implemented interface)

Well, the RemoteException should be deleted, because according to EJB 2.0 API:

"java.rmi.RemoteException - This exception is defined in the method signature to provide backward compatibility for enterprise beans written for the EJB 1.0 specification. Enterprise beans written for the EJB 1.1 specification should throw the javax.ejb.EJBException instead of this exception. Enterprise beans written for the EJB2.0 and higher specifications must throw the javax.ejb.EJBException instead of this exception."

It would be great if Valentin corrects the errata in his wonderful cheet sheets.

[ October 11, 2005: Message edited by: Jose Esteban ]
It's a great score. You are almost in the 9x.
I'm sure that you'll get a great score.

Good luck!!
Thanks to all of you for your congrats!!!

Originally posted by Jesus Angeles:
what is the difference between your enthuware average scores, and this real exam score you had?

Take into account that I didn�t do the Enthuware questions as complete mock exams, but as custom tests chapter by chapter. After every test I went over my mistakes.

Besides, my preparation wasn�t as good while I was doing these mock exams as when I did the HFS exam two day before the real one.

In general, scores were between 80% and 90%. So I can propose the equation:
Enthuware score + (5% to 10%) = real score

Of course, this is only a conjecture as it is based only on my experience and with the limitations related at the beginning of this post. If I had done an Enthuware exam the day before the real one it is probably that both exams would have had similar scores. I don�t know it for sure.
Now that I have a little time I�ll tell you my preparation strategy:

1) I read every chapter of HFSJ and made the exercises. I didn�t try to memorize everything at this stage; I concentrated on getting the concepts. While doing the exercises I would consult the book if necessary. Besides I coded as much as possible.

I think that HFSJ is a good book, well, a GREAT book, to get the concepts but it is not so good to arrange your mind and to have a global vision of the material. BTW, I already have in my hands HF EJB, so you can imagine that I'm really happy with HFSJ.

2) I decided to elaborate my own study notes. I used the Study Guide by Mikalai Zaikin (thanks), HFSJ and some other books, and mainly, Servlet 2.4 and JSP 2.0 Spec.

The study notes are organized according to the objectives of the exam. They have 75 pages including examples of everything that appears on the objectives. I also made two pages with UML diagrams of all the Servlet API (methods included). That helped.

One advantage of the study notes is that it was easier for me to go over them again and again than to go over an 800 pages book. Besides, the organization of the notes according to the objectives helped to arrange my mind.

It was a hard work but, after making the exam, I can say that the 75 pages of study notes contains every you need to get a 100% on the exam.

3) After studying the notes I practiced with the JWebPlus exam simulator (questions are quite similar to those in the real exam). I recommend it. I did every question, chapter by chapter.

4) Two days before the exam I did the HFSJ final mock exam. Really tough; I only scored 71%. I concentrated on understanding my mistakes.

5) The day before the exam I went over my study notes for the last time.

The total time of preparation was around three months. I admire those people who are able to prepare the exam in two weeks but I doubt that the foundations acquired in two weeks can be good.

That�s all ranchers,
[ April 15, 2005: Message edited by: Jose Esteban ]
Thank you everybody!!!

What's next? Well, I'm into SCBCD so those who are interested in the subject will can see me in that forum very soon.

I hope that forum to be as helpful as this one.
Hi everybody, that�s my percentage of failures.

So my real score is 92%.

If you read a post that I sent yesterday, you�ll check what was my score in the HFS final mock exam: 71%

So magic equation holds again: HFS mock exam + 20% = real score

The exam is not difficult if you know the subject. Some questions are tough, but others are pretty easy. In general, I found easier the questions about Servlets than those about JSPs.

Not too much to add to the advice given in previous posts by people who passed the exam. Only say that they are true, and my piece of advice is to take their advice.

Time given is enough. I got a little nervous because the questions in the beginning took me much more time than I expected. But then, easier questions appeared and finally there was plenty of time.

I�ve had fun in this forum and, besides, I�ve learnt a lot of things. Thanks to everybody.

Now, it is time to fly from here. I�ll miss all of you.


Originally posted by Paul Bourdeaux:
I have never tried to configure a mapping with that kind of url pattern, but I assume it will work

I did it, and it works.

Originally posted by Paul Bourdeaux:
However, I think that the mock exam assumes that no extravagant mapping has taken place,

Too much assumption for an exam!! Moreover, Spec JSP.5.4 warns explicity about this possibility:
"<jsp:include page="/templates/copyright.html"/>
It is likely a static object, but it could be mapped into, for instance, a servlet via web.xml."

Originally posted by Paul Bourdeaux:
... have them add a clause like
C. <jsp:include page="/segments/footer.html" /> (Assume that /segments/footer.html is a valid html page and no url remapping has taken place)

I agree. It would be a correct wording.