You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by vl...@mobido.ru on 2007/02/05 18:37:10 UTC

Problem to acess protected EJB from a java client application


Hi all

I'm having a problem accessing protected EJB from a java client
application. When trying to create remote object the application throws
java.rmi.AccessException. It works fine if no application security is
applied.

The code and deployment files were downloaded from Geronimo EJB sample, but
lots of changes have been made.

Here's the code snippet

    Hashtable env = new Hashtable();

env.put("java.naming.factory.initial","org.openejb.client.RemoteInitialContextFactory");
    env.put("java.naming.provider.url","localhost:4201");
    env.put("java.naming.security.principal","system");
    env.put("java.naming.security.credentials","manager");

    javax.naming.InitialContext initialContext = new
javax.naming.InitialContext(env);

    Object objRef =
initialContext.lookup("org.apache.geronimo.samples.bank.ejb.BankManagerFacadeBean");
    BankManagerFacadeHome bankManagerHome = (BankManagerFacadeHome)objRef;

//the next line throws java.rmi.AccessException
    bankManager = bankManagerHome.create();

The URL's of the application's deployment descriptors are:
http://212.176.60.113/jtest/application.xml
http://212.176.60.113/jtest/geronimo-application.xml
http://212.176.60.113/jtest/ejb-jar.xml
http://212.176.60.113/jtest/openejb-jar.xml

Could somebody suggest where is the problem ?

Thenks in advance

Vladimir

Re: Problem to acess protected EJB from a java client application

Posted by Lasantha Ranaweera <la...@opensource.lk>.
Hi,

There is a problem in the client jar file. It does not pickup the jar 
files in a Windows environment :-( . I will fix this error soon & thanks 
for the reporting.

To the client application to work correctly following jar files must be 
included in to your classpath.

openejb-core-2.1.1jar
cglib-nodep-2.1_3.jar
geronimo-j2ee_1.4_spec-1.1.jar
geronimo-security-1.1.1.jar
geronimo-kernel-1.1.1.jar

Thanks,
Lasantha
vl_avan@mobido.ru wrote:
>
> Hi, Lasantha
>
> Sorry for missing important details. Geronimo server 1.1.1 deployed on 
> Windows XP workstation. The server and the client application reside 
> on the same machine.
>
> Thenk You for your interest and for a good sample application
>
> Vladimir
>
> Inactive hide details for Lasantha Ranaweera 
> <la...@opensource.lk>Lasantha Ranaweera <la...@opensource.lk>
>
>
>                         *Lasantha Ranaweera <la...@opensource.lk>*
>
>                         06.02.2007 12:56
>                         Please respond to
>                         user@geronimo.apache.org
>
> 	
>
> To
> 	
> user@geronimo.apache.org
>
> cc
> 	
>
> Subject
> 	
> Re: Problem to acess protected EJB from a java client application
>
> 	
>
>
> Hi,
>
> Is this both client and server machines are residing in the same machine
> ? Does your problem comes in Windows or Linux environment?
>
> Thanks,
> Lasantha
>
> vl_avan@mobido.ru wrote:
> >
> > There are geronimo-security-1.1.1 jar and openejb-core-2.1.1 jar in
> > the application class path/
> >
> > One more fact. Application works OK when default securety principal
> > name attribute is changed from "guest" to "supervisor", but it is not
> > the solution.
> >
> > <security:security>
> > <security:default-principal>
> > <security:principal
> > 
> class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"
> > name="*guest*"/>
> > </security:default-principal>
> > <security:role-mappings>
> > <security:role role-name="clerk">
> > <security:principal
> > 
> class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"
> > name="employee"/>
> > </security:role>
> > <security:role role-name="supervisor">
> > <security:principal
> > 
> class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"
> > name="admin"/>
> > </security:role>
> > </security:role-mappings>
> > </security:security>
> >
> >
> > Vladimir
> > Inactive hide details for "Radu Dumitrescu" <rd...@pss.ro>"Radu
> > Dumitrescu" <rd...@pss.ro>
> >
> >
> >                         *"Radu Dumitrescu" <rd...@pss.ro>*
> >
> >                         06.02.2007 10:52
> >                         Please respond to
> >                         user@geronimo.apache.org
> >
> >
> >
> > To
> >
> > <us...@geronimo.apache.org>
> >
> > cc
> >
> >
> > Subject
> >
> > Re: Problem to acess protected EJB from a java client application
> >
> >
> >
> >
> > You should add the geronimo-security jar and openejb-core jar to the
> > application classpath. The two jars are in geronimo repository folder.
> >
> > Regards,
> > Radu Dumitrescu
> > ----- Original Message -----
> > *From:* _vl_avan@mobido.ru_ <ma...@mobido.ru>
> > *To:* _user@geronimo.apache.org_ <ma...@geronimo.apache.org>
> > *Sent:* Monday, February 05, 2007 7:37 PM
> > *Subject:* Problem to acess protected EJB from a java client application
> >
> > Hi all
> >
> > I'm having a problem accessing protected EJB from a java client
> > application. When trying to create remote object the application
> > throws java.rmi.AccessException. It works fine if no application
> > security is applied.
> >
> > The code and deployment files were downloaded from Geronimo EJB
> > sample, but lots of changes have been made.
> >
> > Here's the code snippet
> >
> > Hashtable env = new Hashtable();
> > 
> env.put("java.naming.factory.initial","org.openejb.client.RemoteInitialContextFactory");
> > env.put("java.naming.provider.url","localhost:4201");
> > env.put("java.naming.security.principal","system");
> > env.put("java.naming.security.credentials","manager");
> >
> > javax.naming.InitialContext initialContext = new
> > javax.naming.InitialContext(env);
> >
> > Object objRef =
> > 
> initialContext.lookup("org.apache.geronimo.samples.bank.ejb.BankManagerFacadeBean");
> > BankManagerFacadeHome bankManagerHome = (BankManagerFacadeHome)objRef;
> >
> > //the next line throws java.rmi.AccessException
> > bankManager = bankManagerHome.create();
> >
> > The URL's of the application's deployment descriptors are:_
> > __http://212.176.60.113/jtest/application.xml__
> > __http://212.176.60.113/jtest/geronimo-application.xml__
> > __http://212.176.60.113/jtest/ejb-jar.xml__
> > __http://212.176.60.113/jtest/openejb-jar.xml_
> >
> > Could somebody suggest where is the problem ?
> >
> > Thenks in advance
> >
> > Vladimir
> >
> > ------------------------------------------------------------------------
> >
> >
> > --
> > This message was scanned for spam and viruses by BitDefender.
> > For more information please visit http://linux.bitdefender.com/
> > --
> > This message was scanned for spam and viruses by BitDefender.
> > For more information please visit http://linux.bitdefender.com/
> >
>
>


Re: Problem to acess protected EJB from a java client application

Posted by vl...@mobido.ru.
Hi,  Lasantha

Sorry for missing important details. Geronimo server 1.1.1 deployed on
Windows XP workstation. The server and the client application reside on the
same machine.

Thenk You for your interest and for a good sample application

Vladimir



                                                                           
             Lasantha                                                      
             Ranaweera                                                     
             <lasantha@opensou                                          To 
             rce.lk>                   user@geronimo.apache.org            
                                                                        cc 
             06.02.2007 12:56                                              
                                                                   Subject 
                                       Re: Problem to acess protected EJB  
             Please respond to         from a java client application      
             user@geronimo.apa                                             
                  che.org                                                  
                                                                           
                                                                           
                                                                           
                                                                           




Hi,

Is this both client and server machines are residing in the same machine
? Does your problem comes in Windows or Linux environment?

Thanks,
Lasantha

vl_avan@mobido.ru wrote:
>
> There are geronimo-security-1.1.1 jar and openejb-core-2.1.1 jar in
> the application class path/
>
> One more fact. Application works OK when default securety principal
> name attribute is changed from "guest" to "supervisor", but it is not
> the solution.
>
> <security:security>
> <security:default-principal>
> <security:principal
>
class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"
> name="*guest*"/>
> </security:default-principal>
> <security:role-mappings>
> <security:role role-name="clerk">
> <security:principal
>
class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"
> name="employee"/>
> </security:role>
> <security:role role-name="supervisor">
> <security:principal
>
class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"
> name="admin"/>
> </security:role>
> </security:role-mappings>
> </security:security>
>
>
> Vladimir
> Inactive hide details for "Radu Dumitrescu" <rd...@pss.ro>"Radu
> Dumitrescu" <rd...@pss.ro>
>
>
>                         *"Radu Dumitrescu" <rd...@pss.ro>*
>
>                         06.02.2007 10:52
>                         Please respond to
>                         user@geronimo.apache.org
>
>
>
> To
>
> <us...@geronimo.apache.org>
>
> cc
>
>
> Subject
>
> Re: Problem to acess protected EJB from a java client application
>
>
>
>
> You should add the geronimo-security jar and openejb-core jar to the
> application classpath. The two jars are in geronimo repository folder.
>
> Regards,
> Radu Dumitrescu
> ----- Original Message -----
> *From:* _vl_avan@mobido.ru_ <ma...@mobido.ru>
> *To:* _user@geronimo.apache.org_ <ma...@geronimo.apache.org>
> *Sent:* Monday, February 05, 2007 7:37 PM
> *Subject:* Problem to acess protected EJB from a java client application
>
> Hi all
>
> I'm having a problem accessing protected EJB from a java client
> application. When trying to create remote object the application
> throws java.rmi.AccessException. It works fine if no application
> security is applied.
>
> The code and deployment files were downloaded from Geronimo EJB
> sample, but lots of changes have been made.
>
> Here's the code snippet
>
> Hashtable env = new Hashtable();
>
env.put("java.naming.factory.initial","org.openejb.client.RemoteInitialContextFactory");

> env.put("java.naming.provider.url","localhost:4201");
> env.put("java.naming.security.principal","system");
> env.put("java.naming.security.credentials","manager");
>
> javax.naming.InitialContext initialContext = new
> javax.naming.InitialContext(env);
>
> Object objRef =
>
initialContext.lookup("org.apache.geronimo.samples.bank.ejb.BankManagerFacadeBean");

> BankManagerFacadeHome bankManagerHome = (BankManagerFacadeHome)objRef;
>
> //the next line throws java.rmi.AccessException
> bankManager = bankManagerHome.create();
>
> The URL's of the application's deployment descriptors are:_
> __http://212.176.60.113/jtest/application.xml__
> __http://212.176.60.113/jtest/geronimo-application.xml__
> __http://212.176.60.113/jtest/ejb-jar.xml__
> __http://212.176.60.113/jtest/openejb-jar.xml_
>
> Could somebody suggest where is the problem ?
>
> Thenks in advance
>
> Vladimir
>
> ------------------------------------------------------------------------
>
>
> --
> This message was scanned for spam and viruses by BitDefender.
> For more information please visit http://linux.bitdefender.com/
> --
> This message was scanned for spam and viruses by BitDefender.
> For more information please visit http://linux.bitdefender.com/
>


Re: Problem to acess protected EJB from a java client application

Posted by Lasantha Ranaweera <la...@opensource.lk>.
Hi,

Is this both client and server machines are residing in the same machine 
? Does your problem comes in Windows or Linux environment?

Thanks,
Lasantha

vl_avan@mobido.ru wrote:
>
> There are geronimo-security-1.1.1 jar and openejb-core-2.1.1 jar in 
> the application class path/
>
> One more fact. Application works OK when default securety principal 
> name attribute is changed from "guest" to "supervisor", but it is not 
> the solution.
>
> <security:security>
> <security:default-principal>
> <security:principal 
> class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"
> name="*guest*"/>
> </security:default-principal>
> <security:role-mappings>
> <security:role role-name="clerk">
> <security:principal 
> class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"
> name="employee"/>
> </security:role>
> <security:role role-name="supervisor">
> <security:principal 
> class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"
> name="admin"/>
> </security:role>
> </security:role-mappings>
> </security:security>
>
>
> Vladimir
> Inactive hide details for "Radu Dumitrescu" <rd...@pss.ro>"Radu 
> Dumitrescu" <rd...@pss.ro>
>
>
>                         *"Radu Dumitrescu" <rd...@pss.ro>*
>
>                         06.02.2007 10:52
>                         Please respond to
>                         user@geronimo.apache.org
>
> 	
>
> To
> 	
> <us...@geronimo.apache.org>
>
> cc
> 	
>
> Subject
> 	
> Re: Problem to acess protected EJB from a java client application
>
> 	
>
>
> You should add the geronimo-security jar and openejb-core jar to the 
> application classpath. The two jars are in geronimo repository folder.
>
> Regards,
> Radu Dumitrescu
> ----- Original Message -----
> *From:* _vl_avan@mobido.ru_ <ma...@mobido.ru>
> *To:* _user@geronimo.apache.org_ <ma...@geronimo.apache.org>
> *Sent:* Monday, February 05, 2007 7:37 PM
> *Subject:* Problem to acess protected EJB from a java client application
>
> Hi all
>
> I'm having a problem accessing protected EJB from a java client 
> application. When trying to create remote object the application 
> throws java.rmi.AccessException. It works fine if no application 
> security is applied.
>
> The code and deployment files were downloaded from Geronimo EJB 
> sample, but lots of changes have been made.
>
> Here's the code snippet
>
> Hashtable env = new Hashtable();
> env.put("java.naming.factory.initial","org.openejb.client.RemoteInitialContextFactory");
> env.put("java.naming.provider.url","localhost:4201");
> env.put("java.naming.security.principal","system");
> env.put("java.naming.security.credentials","manager");
>
> javax.naming.InitialContext initialContext = new 
> javax.naming.InitialContext(env);
>
> Object objRef = 
> initialContext.lookup("org.apache.geronimo.samples.bank.ejb.BankManagerFacadeBean");
> BankManagerFacadeHome bankManagerHome = (BankManagerFacadeHome)objRef;
>
> //the next line throws java.rmi.AccessException
> bankManager = bankManagerHome.create();
>
> The URL's of the application's deployment descriptors are:_
> __http://212.176.60.113/jtest/application.xml__
> __http://212.176.60.113/jtest/geronimo-application.xml__
> __http://212.176.60.113/jtest/ejb-jar.xml__
> __http://212.176.60.113/jtest/openejb-jar.xml_
>
> Could somebody suggest where is the problem ?
>
> Thenks in advance
>
> Vladimir
>
> ------------------------------------------------------------------------
>
>
> -- 
> This message was scanned for spam and viruses by BitDefender.
> For more information please visit http://linux.bitdefender.com/
> -- 
> This message was scanned for spam and viruses by BitDefender.
> For more information please visit http://linux.bitdefender.com/
>


Re: Problem to acess protected EJB from a java client application

Posted by vl...@mobido.ru.
There are geronimo-security-1.1.1 jar and openejb-core-2.1.1 jar in the
application class path/

One more fact. Application works OK when default securety principal name
attribute is changed from "guest" to "supervisor", but it is not the
solution.

  <security:security>
    <security:default-principal>
      <security:principal
class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"
           name="guest"/>
    </security:default-principal>
    <security:role-mappings>
      <security:role role-name="clerk">
          <security:principal
class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"
              name="employee"/>
      </security:role>
      <security:role role-name="supervisor">
          <security:principal
class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"
              name="admin"/>
      </security:role>
    </security:role-mappings>
  </security:security>


Vladimir


                                                                           
             "Radu Dumitrescu"                                             
             <rd...@pss.ro>                                                  
                                                                        To 
             06.02.2007 10:52          <us...@geronimo.apache.org>          
                                                                        cc 
                                                                           
             Please respond to                                     Subject 
             user@geronimo.apa         Re: Problem to acess protected EJB  
                  che.org              from a java client application      
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




You should add the geronimo-security jar and openejb-core jar to the
application classpath. The two jars are in geronimo repository folder.

Regards,
Radu Dumitrescu
----- Original Message -----
From: vl_avan@mobido.ru
To: user@geronimo.apache.org
Sent: Monday, February 05, 2007 7:37 PM
Subject: Problem to acess protected EJB from a java client application



Hi all

I'm having a problem accessing protected EJB from a java client
application. When trying to create remote object the application throws
java.rmi.AccessException. It works fine if no application security is
applied.

The code and deployment files were downloaded from Geronimo EJB sample, but
lots of changes have been made.

Here's the code snippet

Hashtable env = new Hashtable();
env.put("java.naming.factory.initial","org.openejb.client.RemoteInitialContextFactory");

env.put("java.naming.provider.url","localhost:4201");
env.put("java.naming.security.principal","system");
env.put("java.naming.security.credentials","manager");

javax.naming.InitialContext initialContext = new
javax.naming.InitialContext(env);

Object objRef =
initialContext.lookup("org.apache.geronimo.samples.bank.ejb.BankManagerFacadeBean");

BankManagerFacadeHome bankManagerHome = (BankManagerFacadeHome)objRef;

//the next line throws java.rmi.AccessException
bankManager = bankManagerHome.create();

The URL's of the application's deployment descriptors are:
http://212.176.60.113/jtest/application.xml
http://212.176.60.113/jtest/geronimo-application.xml
http://212.176.60.113/jtest/ejb-jar.xml
http://212.176.60.113/jtest/openejb-jar.xml

Could somebody suggest where is the problem ?

Thenks in advance

Vladimir






--
This message was scanned for spam and viruses by BitDefender.
For more information please visit http://linux.bitdefender.com/
--
This message was scanned for spam and viruses by BitDefender.
For more information please visit http://linux.bitdefender.com/



Re: Problem to acess protected EJB from a java client application

Posted by Radu Dumitrescu <rd...@pss.ro>.
You should add the geronimo-security jar and openejb-core jar to the application classpath. The two jars are in geronimo repository folder.

Regards,
Radu Dumitrescu
  ----- Original Message ----- 
  From: vl_avan@mobido.ru 
  To: user@geronimo.apache.org 
  Sent: Monday, February 05, 2007 7:37 PM
  Subject: Problem to acess protected EJB from a java client application


  Hi all

  I'm having a problem accessing protected EJB from a java client application. When trying to create remote object the application throws java.rmi.AccessException. It works fine if no application security is applied.

  The code and deployment files were downloaded from Geronimo EJB sample, but lots of changes have been made.

  Here's the code snippet

  Hashtable env = new Hashtable();
  env.put("java.naming.factory.initial","org.openejb.client.RemoteInitialContextFactory");
  env.put("java.naming.provider.url","localhost:4201");
  env.put("java.naming.security.principal","system");
  env.put("java.naming.security.credentials","manager");

  javax.naming.InitialContext initialContext = new javax.naming.InitialContext(env);

  Object objRef = initialContext.lookup("org.apache.geronimo.samples.bank.ejb.BankManagerFacadeBean");
  BankManagerFacadeHome bankManagerHome = (BankManagerFacadeHome)objRef;

  //the next line throws java.rmi.AccessException
  bankManager = bankManagerHome.create(); 

  The URL's of the application's deployment descriptors are:
  http://212.176.60.113/jtest/application.xml
  http://212.176.60.113/jtest/geronimo-application.xml
  http://212.176.60.113/jtest/ejb-jar.xml
  http://212.176.60.113/jtest/openejb-jar.xml

  Could somebody suggest where is the problem ?

  Thenks in advance

  Vladimir




------------------------------------------------------------------------------



  -- 
  This message was scanned for spam and viruses by BitDefender.
  For more information please visit http://linux.bitdefender.com/