This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Glassfish @Runas exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Glassfish @Runas exception" Watch "Glassfish @Runas exception" New topic

Glassfish @Runas exception

Josip Juric

Joined: Nov 23, 2012
Posts: 2

I'm getting an exception trying to run my code with @runAs. I"ve got a remote client which calls RunAsSecurityBeanImpl bean. In RunAsSecurityBeanImpl bean i've injected PrintRoleBean with @EJB just to see which princple is used. My glassfish contains the roles needed which is manager.I've googled the exception but I haven't found an answer to why an exception is raised. Running my remote client I get the following exception:

This is the code for the remote client:

The remote interface for RunAsSecurityBeanImpl:

The injected bean in RunAsSecurityBeanImpl:

I've added the roles in glassfish-web.xml:

Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper

Joined: Apr 07, 2010
Posts: 2007

Hi Josip

The error doesn't really ring a bell to me other than that you are using a file realm to store your Principals and Principal Groups and it seems your appserver has a problem reading that file.

Did you try everything without security enabled? Did you try using a Servlet and a login-form?

Why did you add the Principal mapping in the glassfish-web.xml instead of sun-ejb-jar.xml in the META-INF directory of your EJB project?

I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Glassfish @Runas exception
It's not a secret anymore!