I am tring to access the principal from a regular object, but not a bean. Is
there any way to get an instance of EJBContext without making my object an EJB?

I have setup the database authentication model.

Thanks
Wei

Scott M Stark wrote:

> From within an EJB you should be using EJBContext.getCallerPrincipal() to
> access the
> authenticated principal. What security have you setup for the bean?
>
> ----- Original Message -----
> From: Wei Ma
> To: [EMAIL PROTECTED]
> Sent: Tuesday, June 05, 2001 9:06 AM
> Subject: [JBoss-user] newbie question about JAAS based security model
>
> Hi all,
>   I am running JAAS based security model with JBoss.
>
>  I use SecurityAssociation.getPrincipal() to get the principal object, it
> works find until I re-deploy my project
> The following is my code and error message
> Code:
>         Principal principal = SecurityAssociation.getPrincipal();
>         String name = principal.getName();
> Error message:
>
> java.lang.NullPointerException: [Service]       at
> com.bridgewatersystems.netprofile.middleware.OrganizationEntity.<init>(Organ
> izationEntity.java:56)
> [Service]       at
> comm.bridgewatersystems.netprofile.middleware.ServiceBean.getRootOrganizatio
> n(ServiceBean.java:350)
> [Service]       at java.lang.reflect.Method.invoke(Native Method)
> [Service]       at
> org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(Stateles
> sSessionContainer.java:472)
> [Service]       at
> org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSe
> ssionInstanceInterceptor.java:87)
> [Service]       at
> org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:133)
> [Service]       at
> org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.
> java:458)
> [Service]       at
> org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:99)
> [Service]       at
> org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:19
> 0)
> [Service]       at
> org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:195)
> [Service]       at
> org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.jav
> a:271)
> [Service]       at
> org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke(JRMPContainerI
> nvoker.java:392)
> [Service]       at java.lang.reflect.Method.invoke(Native Method)
> [Service]       at
> sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:241)
> [Service]       at sun.rmi.transport.Transport$1.run(Transport.java:142)
> [Service]       at java.security.AccessController.doPrivileged(NativeMethod)
> [Service]       at
> sun.rmi.transport.Transport.serviceCall(Transport.java:139)
> [Service]       at
> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:443)
> [Service]       at
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:6
> 43)
> [Service]       at java.lang.Thread.run(Thread.java:484)
>
> Does this mean I have to restart Jboss server each time I deploy my project?
> Thanks very much
> Wei
>
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-user


_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to