File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes Security Management fails... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Security Management fails..." Watch "Security Management fails..." New topic

Security Management fails...

Manish S Malhotra
Ranch Hand

Joined: Jan 19, 2007
Posts: 61
Hi All,
I'm using EJB2.0 with WSAD 5.0.

I'm having a simple EJB deployed on the WSAD's test Server.
This EJB logs the message given by the client EJB.

Following is its Deployment Descriptor, which is having one role and method permission.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "">
<ejb-jar id="ejb-jar_ID">
<session id="SCEASLSessionBean">

This is the client from which I'm calling this Bean.

public class StatelessBeanClient
public static void main(String[] args)
SCEASLSessionBeanHome home = null;
SCEASLSessionBean bean = null;
try {
Properties prop = new Properties();
//prop.put(Context.SECURITY_PRINCIPAL, "manager2");
//prop.put(Context.SECURITY_CREDENTIALS, "manager2");
prop.put(Context.PROVIDER_URL, "iiop://");
InitialContext context = new InitialContext(prop);
Object object =context.lookup("ejb/com/scea/test/ejb/sls/SCEASLSessionBeanHome");
home = (SCEASLSessionBeanHome) PortableRemoteObject.narrow(object, SCEASLSessionBeanHome.class);

bean = home.create();
bean.logMessage("Hello from Test Client....");
} catch (NamingException e) {
catch (RemoteException e) {
catch (CreateException e) {
try {
if (bean != null)
} catch (RemoteException e) {
} catch (RemoveException e) {


Issue is irrespective of the PRINCIPAL I'm passing or not passing I'm able to access the method Bean.
Ideally it should container should throw SecuritException.

Please correct me If I'm wrong or I have to do some more configuration in the deployment descrp. for enabling the security.

And I have one more small issue, As I start the Test Server I can the output of the Sysouts on the console but when I run any other Java Application the existing server console overwritten with the new Sysouts of the Java Application. And I'm not able to see the Server side Sysouts.

So, can any body please give me direction to solve the above two issues.

Thanks for your help!


"Abstraction is the key thing while designing"
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

Have you enabled Global Secuiry in WAS? If remember right you have to tell the server whether any security is used at all.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Manish S Malhotra
Ranch Hand

Joined: Jan 19, 2007
Posts: 61
Hi Paul,
Thanks for your valuable time.
I'm using WSAD5.0. Its having embedded WAS Test Server.
I'm not able to find any page where I can enable the Global Security for the Server.
On the security tab there are only options to enable "Enable Security" which is asking for Local OS Authentication and second is Enforce Java 2 Security.

But both are not what we have discussed I think.

Can you please guide how to enable that security in WSAD's Test Server?

It is sorta covered in the JavaRanch Style Guide.
subject: Security Management fails...
jQuery in Action, 3rd edition