RE: [JBoss-user] [Beginners Corner] - Re: Best book to learn EJB?

2004-04-13 Thread Neil Mendoza
I'd say that Head First EJB is the best book.  It's the only EJB book
I've read which doesn't put me to sleep.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of nickman
Sent: 13 April 2004 13:02
To: [EMAIL PROTECTED]
Subject: [JBoss-user] [Beginners Corner] - Re: Best book to learn EJB?

Frank;

I recommend Enterprise JavaBeans by Richard Monson-Haefel. The subject
of the best book may be hotly contested, but in my view there is no
question that regardless of the book, you need to work on some examples.
I recommend you get XDoclet 1.2 and XPetStore 3.1 as XDoclet is the
easiest way to work with EJBs and both packages come with extensive
reference and examples.

Also check out the free EJB work book at
http://www.oreilly.com/catalog/entjbeans3/workbooks/index.html.

//Nicholas

View the original post :
http://www.jboss.org/index.html?module=bbop=viewtopicp=3830363#3830363

Reply to the post :
http://www.jboss.org/index.html?module=bbop=postingmode=replyp=383036
3


---
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470alloc_id=3638op=click
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user 
--- 
This e-mail may contain confidential and/or privileged information. If you are not the 
 
intended recipient (or have received this e-mail in error) please notify the sender  
immediately and destroy this e-mail. Any unauthorised copying, disclosure or 
distribution  
of the material in this e-mail is strictly forbidden. Prytania Group has taken every  
reasonable precaution to ensure that any attachment to this e-mail has been swept for  
viruses. However, we cannot accept liability for any damage sustained as a result of  
software viruses and would advise that you carry out your own virus checks before  
opening any attachment. 


---
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id70alloc_id638op=click
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] Jaas JSP login problem

2004-04-08 Thread Neil Mendoza





Hi,



Im using the Tomcat server which comes with jboss.
Im having a problem with jboss login using jaas via jsp. I
successfully manage to login using jaas. The System.out.println(userPrincipalName);
in the jsp snippet returns test, all well and good so far.
This then calls getUser() in the ejb snippet at the bottom of this mail. The
System.out.println(ctx.getCallerPrincipal().getName()); called in
the ejb snippet below returns nobody though.



Im not sure if the system is only logging the user
into Tomcat or if it is because there are no method-permission tags in
the ejb-jar.xml. I dont need security for my beans yet but for ctx.getCallerPrincipal()
to work does the bean need a method permission tag with unchecked instead of a
role name? If the system is only logging the user into Tomcat is there a
way to pass this login info on?



Any help would be much appreciated.



Thanks in advance,



Neil Mendoza 

--jsp
snippet--

 String
user=test;

 String
pass=test;

 try

 {

 UsernamePasswordHandler
handler = new UsernamePasswordHandler(user, pass.toCharArray());

 LoginContext
loginContext = new LoginContext(ias-login, handler);

 loginContext.login();

 try

 { 

 String
userPrincipalName = ((Principal)
loginContext.getSubject().getPrincipals().iterator().next()).getName();

 if
(userPrincipalName == null) System.out.println(name is null!);

 else
System.out.println(userPrincipalName);





 UserValue
userValue = UserManagerUtil.getLocalHome().create().getUser();



 session.setAttribute(myUserValue,
userValue);

 



 

 %

 jsp:forward
page=./index.jsp?action="" /

 %



 }

 catch
(javax.ejb.FinderException e)

 {

 errorMessage
= The login details you entered were valid with jaas but not with
ias.;

 }



 }

 catch
(javax.security.auth.login.LoginException e)

 {

 errorMessage
= The login details you entered were not valid.;

 }

---end of
jsp--



ejb
snippet---



 /**

 * Get the logged-in
user from the caller principal

 *

 * @return The logged-in user.

 * @ejb.interface-method
view-type=both

 * @ejb.transaction
type=Required

 **/

 public UserValue getUser() throws
FinderException {

 try
{

 
UserLocalHome cHome = UserUtil.getLocalHome();

 System.out.println(ctx.getCallerPrincipal().getName());

 
UserLocal ul = cHome.findByUserName(ctx.getCallerPrincipal().getName());

 
return (UserValue) ul.getUserValue();

 }
catch ( NamingException ne ) {

 
throw new EJBException(An error occurred while connecting to the
Application Server., ne );

 }

 }





---end of
ejb




---This e-mail may contain confidential and/or privileged information. If you are not the 
intended recipient (or have received this e-mail in error) please notify the sender 
immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution 
of the material in this e-mail is strictly forbidden. Prytania Group has taken every 
reasonable precaution to ensure that any attachment to this e-mail has been swept for 
viruses. However, we cannot accept liability for any damage sustained as a result of 
software viruses and would advise that you carry out your own virus checks before 
opening any attachment.