Sorin Alexandru

Greenhorn
+ Follow
since Nov 30, 2008
Merit badge: grant badges
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Sorin Alexandru

Dear all,

In the PetStore application, web.xml contains the following mappings:

.... and:


If I navigate in my browser to http://localhost:8087/petstore/faces/catalog.jsp?catid=Cats#feline01,1,
what servlet mappings will be performed: both the FacesServlet (because of the /faces) and the ControllerServlet (because of /catalog)
or just the best match, which is ControllerServlet ?

Also, when I debug the ControllerServlet, I see in the debugger that getRequestURI() is /petstore/catalog and getServletPath() is /catalog. Where is /faces then ?

Thank you,
Best regards,
Sorin
14 years ago
JSF
Dear all,
In the book "EJB 3 in Action" (by Debu Panda, Reza Rahman and Derek Lane) I've found the following passage: "Keep in mind that you must not inject a stateful session bean into a stateless object, such as stateless session bean or servlet that may be shared by multiple concurrent clients (you should use JNDI in such cases instead)." Could someone please elaborate on that ?
I don't see how JNDI could help in such a case and why dependency injection is an issue. (I realize that using a stateful bean inside a stateless one is not very useful, since after each method call the stateless object "forgets the state".)

Thank you,
Greetings,
Sorin

Cameron Wallace McKenzie wrote:Indeed!

I mean, if you have a fully working EJB 2.x application, and you need to add a single EJB, would you upgrade to EJB3.0, or just add a new EJB2.x bean to the application. A good architect would know that you don't change an entire implementation for one additional feature. A question like that might appear on the exam, and indeed, in that type of scenario, going with EJB2.x would be the correct answer!

EJB 2.x components still exist out there! You'd be a pretty miserable J2EE architect if you didn't know anything about them.

The questions won't hit hard on EJB2.x. You need to know some of the differences between the older and newer versions of EJB, which isn't too difficult, because you really can't learn EJB3 from any resource without hearing a bit about how new EJB strategies are different or better than previous versions. And that's about the depth you need to know.

Certainly don't focus all your efforts on EJB 2.x, but know the differences between older and newer versions.

-Cameron McKenzie



Thank you Cameron.
Regarding the first part of your answer where you say either upgrade everything to EJB3.0 or just add a new EJB2.x bean, I guess there is a third way: add a new EJB3.0 to the existing framework of EJBs 2.x.

Greetings,
Sorin

Hi,

At SCEA 5 can you still get questions about EJB before 3.0 ?

Thanks,
Sorin

Jeanne Boyarsky wrote:

Sorin Alexandru wrote: Do you have a good use case for the pass-by-reference scenario in EJB ?


A few application servers have allowed pass-by-reference for local beans in 2.X as well. I recommend not using this "feature." Even if the bean is passed by reference, changing it yields two problems:
  • if you ever want to add a remote interface, you have a problem/rewrite ahead of you
  • the caller isn't aware the bean changed (as it isn't common) which introduces subtle defects


  • Hi Jeanne,

    I wasn't referring to the bean being passed by reference.
    I meant the bean could have a business method which gets a parameter passed by reference. In that case, a call on that parameter would mean a callback to the client side, which is a potentially interesting feature. The only issue I see is if the client is behind a firewall, then the callback can't be done.

    Greetings,
    Sorin

    Dear all,

    I understand EJB 3.0 supports RMI-IIOP and this protocols allows the pass-by-reference style, so in principle we could have an EJB method, say
    ,
    where MyType implements java.rmi.Remote (NOT Serializable, in which case it would be pass-by-value semantics).

    Does this really work ? Do you have a good use case for the pass-by-reference scenario in EJB ?

    Thank you,
    Best regards,
    Sorin

    Thanks for your answers.
    The really unclear issue was why would you inject a stateful bean into a stateless one (even using JNDI) ? But I guess there are scenarios where you
    need to do something like this:
    1. call a stateless bean method
    1.1 stateful bean proxy = JNDI lookup
    1.2 stateful bean proxy -> call method 1
    1.3 stateful bean proxy -> call method 2
    1.4 stateful bean proxy -> call method 3
    Do you have real life examples of this kind ?

    The scenario where you'd use a stateful bean from a servlet is clear: a typical web shopping cart application (like the Java petstore).

    Greetings,
    Sorin

    Dear all,

    In the book "EJB 3 in Action" (by Debu Panda, Reza Rahman and Derek Lane) I've found the following passage:
    "Keep in mind that you must not inject a stateful session bean into a stateless object, such as stateless session bean or servlet that may be
    shared by multiple concurrent clients (you should use JNDI in such cases instead)."

    Could someone please elaborate on that ? I don't see how JNDI could help in such a case and why dependency injection is an issue.

    (I realize that using a stateful bean inside a stateless one is not very useful, since after each method call the stateless object "forgets the state".)

    Thank you,
    Greetings,
    Sorin

    Benjamin Dittwald wrote:yeah thanks for the hint, i solved it with container managed authentication.

    This how to helped me with it.

    regards,
    benjamin



    You could also go on with what you started, doing the following:
    - when the user logs in, you keep his/her credentials (e.g. an instance of the LoginBean) in the session
    - in the filter you check if the LoginBean instance is present in the session and depending on that, you forward to the right page

    I hope this helps.
    (example: http://forums.sun.com/thread.jspa?forumID=881&threadID=5050520)

    Greetings,
    Sorin
    16 years ago
    JSF

    Jonathan Aotearoa wrote:If you're of the opinion that all the options you listed have exactly the same performance, scalability, and memory usage characteristics, then pick some other defining attribute(s) such as ease of development, available expertise etc.



    Yes, I agree with that.

    Sorin

    Jonathan Aotearoa wrote:For example.

    Are you being asked to design a complex user interface where lots of ajax enabled components might be appropriate, or are you being asked to design an application which, for the most part, only displays large amounts of effectively read-only data?

    If performance is a critical NFR, how performant are the competing technologies and/or frameworks?



    Fine. You can do Ajax from a JSP (in a JSP/servlets implementation), or from Struts or from JSF, or GWT, or Flex, etc. So again, all these solutions are possible and from the performance point of view there's no difference (you're still using Ajax).

    Sorin

    Jonathan Aotearoa wrote:By requirements I mean the nature of the application you've been assigned to design and the non-functional requirements you've been asked to fulfill.

    ...you can't select the technology based on the requirements, because the technologies are equivalent.



    I disagree. Competing technologies may target to the same problem, e.g. building web applications, but they're never equivalent. They all have their strengths and weaknesses.



    It would help a lot if you could give examples of such requirements. Or just if you could be more concrete.

    Thanks,
    Sorin

    Jonathan Aotearoa wrote:

    so I guess you should use Sun technologies, indeed.



    My advice to you is focus on the problem. Select the technology based on the requirements not on whether it originated from Sun.



    That's quite clear, but in most cases you can't select the technology based on the requirements, because the technologies are equivalent.
    So for a given requirement, you could in principle select any technology. If that was not the case, it would mean the requirement is poorly specified.

    But maybe I misunderstand you, so can you please give examples of such requirements ?

    Or by "requirement" do you mean something like: "you have to use JSF" ? In that case, it's clear what you have to do ....

    Bill Zelan wrote:Probably you need to use ejb3 and jsf instead of struts or springframework, as this is an exam from Sun



    Sun shouldn't care about this, right ? If your solution is correct, does the technology matter ?
    But probably they are biased, so I guess you should use Sun technologies, indeed.

    Marcel Wentink wrote:

    This has to do with the reasons you mentioned: demography, work culture, mature technologies, etc.



    You misunderstood the work culture thing I think. The work culture is very much against older people working. The other factors demography, mature technologies are just that dominant that you do see older programmers. Actually I am happy to have a job at 43, and I am doing very much to keep my knowledge up to date and I am looking of ways to do some management stuff. Frankly I do that because I would be dead scared to be unemployed when I would in say ten years, be 53. I do not have a very uptimistic view on my market position in ten years time. I'll be older, more work will be outsourced, and getting into management has not had much result. I'll tell it to you straight, if I was a student right now, I would not choose Information Science again. Not because I do not like the job as such though, but because of what I stated above.



    No, I got your point about the work culture. I just have a different experience here at work, where I see several people in their 50s being hired as developers in spite of their age. I think that's good. So you think that above 40 is harder to get a job ?

    The bottom line is: what can we do to preserve our flexibility in finding a decent job ?
    - on one hand you'd like to stay technical, since this offers you the most of flexibility (as opposed to moving into management)
    - on the other hand it's harder to get a job as you age
    Any ideas ?

    Sorin

    16 years ago