Re: why we need to provide security realm name to a standalone ejb client?

2011-02-02 Thread David Jencks
I don't understand what you think is a hack.

You've set up a security realm, you login, and the login modules for the 
security realm has added one or more principals the subject.

You've mapped at least one of these principals to the appropriate application 
role that can access your ejb method.

If you want you can specify which security realm and which login module 
generated this principal. (for an example see the last paragraph on 
https://cwiki.apache.org/GMOxDOC22/configuring-run-as-and-default-subjects-and-principal-role-mapping.html)

What's insecure here?

thanks
david jencks

On Feb 2, 2011, at 10:32 PM, Shailen wrote:

> ohh.. So jndi tree gets created when we create InitialContext.
> 
> I found something which you  might be aware already.
> I have created a test security-realm. Now if I try to access my ejb with this 
> security-realm it is allowing me to access the object. But I dont want this. 
> My EJB is not secured this way.right ?
> I mean this is fishy as I dont want my EJB to be accessed by anyone else 
> using another security realm.
> Actually this is hack in security.
> May be we need to think more on other possible ways to escape from this hack.
> 
> Regards,
> Shailen (khichi.shailen...@gmail.com)
> +91-9216020360
> Mohali, Chandigarh - 160062
> 
> On Wednesday 02 February 2011 11:15 PM, David Jencks wrote:
>> 
>> The current ejb security is set up so that you need to have some credentials 
>> in some security realm in order to get the jndi tree.
>> 
>> I think you are asking for a set up so that you can get the jndi tree 
>> without any credentials but when you try to do a lookup you need to supply 
>> credentials appropriate for the object you are looking up.
>> 
>> At the moment I believe you can arrange to bind ejbs at any name you want.  
>> In particular you can bind ejbs from different apps in the same subcontext.
>> 
>> What do you want to have happen when you try to list this subcontext, but 
>> you only have permission to access some of  the contents?
>> 
>> thanks
>> david jencks
>> 
>> On Feb 2, 2011, at 3:41 AM, Shailen wrote:
>> 
>>> Yes Juergen, I second you.
>>> I have fixed my problem and I am happy to see geronimo has implemented what 
>>> you have said for webservices. see below:
>>> 
>>> 
>>> 
>>> SampleImp
>>> 
>>>   
>>> sample-realm
>>>   sample-realm
>>>   NONE
>>>   BASIC
>>>   
>>> 
>>> 
>>> 
>>> This is the code in openejb-jar.xml.  Here we are explicitly defining to 
>>> use sample-realm for webservice exposed by  SampleImp EJB. I am able to 
>>> call the webservice using the principal credentials.
>>> 
>>> I am still not very sure why geronimo can't geronimo has  
>>> like follows:
>>> 
>>> 
>>> 
>>> SampleImp
>>> 
>>>   
>>> sample-realm
>>>   
>>> 
>>> 
>>> 
>>> Can someone please put more light on it?
>>> 
>>> Regards,
>>> Shailen (khichi.shailen...@gmail.com)
>>> +91-9216020360
>>> Mohali, Chandigarh - 160062
>>> 
>>> On Wednesday 02 February 2011 01:26 PM, weberjn wrote:
 
 One could rather argue that a client should not know about an ejb's 
 security
 configuration. This should be only known in the ejb configuration, and
 nowhere else, definitivly not on the client. The ejb deployer should be 
 able
 to switch from one security realm to another, without the client knowing.
> there's no easy way to predict which application's ejb or which ejb you
> want to call
 I understand this is because security lookup is done during creation of the
 InitialContext and the lookup with JNDI name is done in the next call.
 
 An alternative would be to define an order of security realm lookups.
 
 Greetings,
 Juergen
 
 
 
 
 
 David Jencks wrote:
> This is the right place to ask this question.
> 
> Geronimo lets you set up many security realms at once.  When you connect
> from a remote client to call ejbs, there's no easy way to predict which
> application's ejb or which ejb you want to call.  So you have to specify
> how you want to log in when you connect.
> 
> We could allow specifying a default security realm for all of openejb so
> if you don't specify a realm we use the default.
> 
> thanks
> david jencks
> 
> On Feb 1, 2011, at 2:27 AM, Shailen wrote:
> 
>> Hi All,
>> 
>> I have a very simple ejb deployed on geronimo2.2.1. This ejb is secured
>> by a security realm(Database(SQL) realm). When I call this ejb from a
>> standalone java client, it restricts me from accessing it without
>> authentication.
>> 
>> But when I provide this principal and credentials then also it restricts
>> me from calling this ejb.
>> When I additionally provide realmName then it enables me to call

Re: why we need to provide security realm name to a standalone ejb client?

2011-02-02 Thread Shailen
Again, geronimo is a system once I have authenticated myself to the 
system, then I am allowed to access application. But each 
component(example EJBs) will define its own authorization. If I have 
authorized myself to the component then I can access components. So the 
security is fine.
Now to call an EJB from a standalone client without passing the 
security-realm is the question.

First look says what David is suggesting seems reasonable.
May need more brain storming here.

Regards,
Shailen (khichi.shailen...@gmail.com)
+91-9216020360
Mohali, Chandigarh - 160062


On Thursday 03 February 2011 12:02 PM, Shailen wrote:

ohh.. So jndi tree gets created when we create InitialContext.

I found something which you  might be aware already.
I have created a test security-realm. Now if I try to access my ejb 
with this security-realm it is allowing me to access the object. But I 
dont want this. My EJB is not secured this way.right ?
I mean this is fishy as I dont want my EJB to be accessed by anyone 
else using another security realm.

Actually this is hack in security.
May be we need to think more on other possible ways to escape from 
this hack.


Regards,
Shailen (khichi.shailen...@gmail.com)
+91-9216020360
Mohali, Chandigarh - 160062

On Wednesday 02 February 2011 11:15 PM, David Jencks wrote:
The current ejb security is set up so that you need to have some 
credentials in some security realm in order to get the jndi tree.


I think you are asking for a set up so that you can get the jndi tree 
without any credentials but when you try to do a lookup you need to 
supply credentials appropriate for the object you are looking up.


At the moment I believe you can arrange to bind ejbs at any name you 
want.  In particular you can bind ejbs from different apps in the 
same subcontext.


What do you want to have happen when you try to list this subcontext, 
but you only have permission to access some of  the contents?


thanks
david jencks

On Feb 2, 2011, at 3:41 AM, Shailen wrote:


Yes Juergen, I second you.
I have fixed my problem and I am happy to see geronimo has 
implemented what you have said for webservices. see below:




SampleImp

sample-realm
sample-realm
NONE
BASIC




This is the code in openejb-jar.xml.  Here we are explicitly 
defining to use sample-realm for webservice exposed by  SampleImp 
EJB. I am able to call the webservice using the principal credentials.


I am still not very sure why geronimo can't geronimo has 
 like follows:




SampleImp

sample-realm




Can someone please put more light on it?

Regards,
Shailen (khichi.shailen...@gmail.com)
+91-9216020360
Mohali, Chandigarh - 160062

On Wednesday 02 February 2011 01:26 PM, weberjn wrote:

One could rather argue that a client should not know about an ejb's security
configuration. This should be only known in the ejb configuration, and
nowhere else, definitivly not on the client. The ejb deployer should be able
to switch from one security realm to another, without the client knowing.

there's no easy way to predict which application's ejb or which ejb you
want to call

I understand this is because security lookup is done during creation of the
InitialContext and the lookup with JNDI name is done in the next call.

An alternative would be to define an order of security realm lookups.

Greetings,
Juergen





David Jencks wrote:

This is the right place to ask this question.

Geronimo lets you set up many security realms at once.  When you connect
from a remote client to call ejbs, there's no easy way to predict which
application's ejb or which ejb you want to call.  So you have to specify
how you want to log in when you connect.

We could allow specifying a default security realm for all of openejb so
if you don't specify a realm we use the default.

thanks
david jencks

On Feb 1, 2011, at 2:27 AM, Shailen wrote:


Hi All,

I have a very simple ejb deployed on geronimo2.2.1. This ejb is secured
by a security realm(Database(SQL) realm). When I call this ejb from a
standalone java client, it restricts me from accessing it without
authentication.

But when I provide this principal and credentials then also it restricts
me from calling this ejb.
When I additionally provide realmName then it enables me to call this
ejb.

My question is why do we need to provide the security realm name in the
client?

I am sorry if this is not the right place to ask such questions.
--

Regards,
Shailen (khichi.shailen...@gmail.com)
+91-9216020360
Mohali, Chandigarh - 160062




Re: why we need to provide security realm name to a standalone ejb client?

2011-02-02 Thread Shailen

ohh.. So jndi tree gets created when we create InitialContext.

I found something which you  might be aware already.
I have created a test security-realm. Now if I try to access my ejb with 
this security-realm it is allowing me to access the object. But I dont 
want this. My EJB is not secured this way.right ?
I mean this is fishy as I dont want my EJB to be accessed by anyone else 
using another security realm.

Actually this is hack in security.
May be we need to think more on other possible ways to escape from this 
hack.


Regards,
Shailen (khichi.shailen...@gmail.com)
+91-9216020360
Mohali, Chandigarh - 160062


On Wednesday 02 February 2011 11:15 PM, David Jencks wrote:
The current ejb security is set up so that you need to have some 
credentials in some security realm in order to get the jndi tree.


I think you are asking for a set up so that you can get the jndi tree 
without any credentials but when you try to do a lookup you need to 
supply credentials appropriate for the object you are looking up.


At the moment I believe you can arrange to bind ejbs at any name you 
want.  In particular you can bind ejbs from different apps in the same 
subcontext.


What do you want to have happen when you try to list this subcontext, 
but you only have permission to access some of  the contents?


thanks
david jencks

On Feb 2, 2011, at 3:41 AM, Shailen wrote:


Yes Juergen, I second you.
I have fixed my problem and I am happy to see geronimo has 
implemented what you have said for webservices. see below:




SampleImp

sample-realm
sample-realm
NONE
BASIC




This is the code in openejb-jar.xml.  Here we are explicitly defining 
to use sample-realm for webservice exposed by  SampleImp EJB. I am 
able to call the webservice using the principal credentials.


I am still not very sure why geronimo can't geronimo has 
 like follows:




SampleImp

sample-realm




Can someone please put more light on it?

Regards,
Shailen (khichi.shailen...@gmail.com)
+91-9216020360
Mohali, Chandigarh - 160062

On Wednesday 02 February 2011 01:26 PM, weberjn wrote:

One could rather argue that a client should not know about an ejb's security
configuration. This should be only known in the ejb configuration, and
nowhere else, definitivly not on the client. The ejb deployer should be able
to switch from one security realm to another, without the client knowing.

there's no easy way to predict which application's ejb or which ejb you
want to call

I understand this is because security lookup is done during creation of the
InitialContext and the lookup with JNDI name is done in the next call.

An alternative would be to define an order of security realm lookups.

Greetings,
Juergen





David Jencks wrote:

This is the right place to ask this question.

Geronimo lets you set up many security realms at once.  When you connect
from a remote client to call ejbs, there's no easy way to predict which
application's ejb or which ejb you want to call.  So you have to specify
how you want to log in when you connect.

We could allow specifying a default security realm for all of openejb so
if you don't specify a realm we use the default.

thanks
david jencks

On Feb 1, 2011, at 2:27 AM, Shailen wrote:


Hi All,

I have a very simple ejb deployed on geronimo2.2.1. This ejb is secured
by a security realm(Database(SQL) realm). When I call this ejb from a
standalone java client, it restricts me from accessing it without
authentication.

But when I provide this principal and credentials then also it restricts
me from calling this ejb.
When I additionally provide realmName then it enables me to call this
ejb.

My question is why do we need to provide the security realm name in the
client?

I am sorry if this is not the right place to ask such questions.
--

Regards,
Shailen (khichi.shailen...@gmail.com)
+91-9216020360
Mohali, Chandigarh - 160062




Re: why we need to provide security realm name to a standalone ejb client?

2011-02-02 Thread David Jencks
The current ejb security is set up so that you need to have some credentials in 
some security realm in order to get the jndi tree.

I think you are asking for a set up so that you can get the jndi tree without 
any credentials but when you try to do a lookup you need to supply credentials 
appropriate for the object you are looking up.

At the moment I believe you can arrange to bind ejbs at any name you want.  In 
particular you can bind ejbs from different apps in the same subcontext.

What do you want to have happen when you try to list this subcontext, but you 
only have permission to access some of  the contents?

thanks
david jencks

On Feb 2, 2011, at 3:41 AM, Shailen wrote:

> Yes Juergen, I second you.
> I have fixed my problem and I am happy to see geronimo has implemented what 
> you have said for webservices. see below:
> 
> 
> 
> SampleImp
> 
>   
> sample-realm
>   sample-realm
>   NONE
>   BASIC
>   
> 
> 
> 
> This is the code in openejb-jar.xml.  Here we are explicitly defining to use 
> sample-realm for webservice exposed by  SampleImp EJB. I am able to call the 
> webservice using the principal credentials.
> 
> I am still not very sure why geronimo can't geronimo has  
> like follows:
> 
> 
> 
> SampleImp
> 
>   
> sample-realm
>   
> 
> 
> 
> Can someone please put more light on it?
> 
> Regards,
> Shailen (khichi.shailen...@gmail.com)
> +91-9216020360
> Mohali, Chandigarh - 160062
> 
> On Wednesday 02 February 2011 01:26 PM, weberjn wrote:
>> 
>> One could rather argue that a client should not know about an ejb's security
>> configuration. This should be only known in the ejb configuration, and
>> nowhere else, definitivly not on the client. The ejb deployer should be able
>> to switch from one security realm to another, without the client knowing.
>>> there's no easy way to predict which application's ejb or which ejb you
>>> want to call
>> I understand this is because security lookup is done during creation of the
>> InitialContext and the lookup with JNDI name is done in the next call.
>> 
>> An alternative would be to define an order of security realm lookups.
>> 
>> Greetings,
>> Juergen
>> 
>> 
>> 
>> 
>> 
>> David Jencks wrote:
>>> This is the right place to ask this question.
>>> 
>>> Geronimo lets you set up many security realms at once.  When you connect
>>> from a remote client to call ejbs, there's no easy way to predict which
>>> application's ejb or which ejb you want to call.  So you have to specify
>>> how you want to log in when you connect.
>>> 
>>> We could allow specifying a default security realm for all of openejb so
>>> if you don't specify a realm we use the default.
>>> 
>>> thanks
>>> david jencks
>>> 
>>> On Feb 1, 2011, at 2:27 AM, Shailen wrote:
>>> 
 Hi All,
 
 I have a very simple ejb deployed on geronimo2.2.1. This ejb is secured
 by a security realm(Database(SQL) realm). When I call this ejb from a
 standalone java client, it restricts me from accessing it without
 authentication.
 
 But when I provide this principal and credentials then also it restricts
 me from calling this ejb.
 When I additionally provide realmName then it enables me to call this
 ejb.
 
 My question is why do we need to provide the security realm name in the
 client?
 
 I am sorry if this is not the right place to ask such questions.
 -- 
 
 Regards,
 Shailen (khichi.shailen...@gmail.com)
 +91-9216020360
 Mohali, Chandigarh - 160062
>>> 
>>> 
>> 



Re: why we need to provide security realm name to a standalone ejb client?

2011-02-02 Thread Shailen

Yes Juergen, I second you.
I have fixed my problem and I am happy to see geronimo has implemented 
what you have said for webservices. see below:




SampleImp

sample-realm
sample-realm
NONE
BASIC




This is the code in openejb-jar.xml.  Here we are explicitly defining to 
use sample-realm for webservice exposed by  SampleImp EJB. I am able to 
call the webservice using the principal credentials.


I am still not very sure why geronimo can't geronimo has 
 like follows:




SampleImp

sample-realm




Can someone please put more light on it?

Regards,
Shailen (khichi.shailen...@gmail.com)
+91-9216020360
Mohali, Chandigarh - 160062


On Wednesday 02 February 2011 01:26 PM, weberjn wrote:

One could rather argue that a client should not know about an ejb's security
configuration. This should be only known in the ejb configuration, and
nowhere else, definitivly not on the client. The ejb deployer should be able
to switch from one security realm to another, without the client knowing.

there's no easy way to predict which application's ejb or which ejb you
want to call

I understand this is because security lookup is done during creation of the
InitialContext and the lookup with JNDI name is done in the next call.

An alternative would be to define an order of security realm lookups.

Greetings,
Juergen





David Jencks wrote:

This is the right place to ask this question.

Geronimo lets you set up many security realms at once.  When you connect
from a remote client to call ejbs, there's no easy way to predict which
application's ejb or which ejb you want to call.  So you have to specify
how you want to log in when you connect.

We could allow specifying a default security realm for all of openejb so
if you don't specify a realm we use the default.

thanks
david jencks

On Feb 1, 2011, at 2:27 AM, Shailen wrote:


Hi All,

I have a very simple ejb deployed on geronimo2.2.1. This ejb is secured
by a security realm(Database(SQL) realm). When I call this ejb from a
standalone java client, it restricts me from accessing it without
authentication.

But when I provide this principal and credentials then also it restricts
me from calling this ejb.
When I additionally provide realmName then it enables me to call this
ejb.

My question is why do we need to provide the security realm name in the
client?

I am sorry if this is not the right place to ask such questions.
--

Regards,
Shailen (khichi.shailen...@gmail.com)
+91-9216020360
Mohali, Chandigarh - 160062





Re: why we need to provide security realm name to a standalone ejb client?

2011-02-01 Thread weberjn

One could rather argue that a client should not know about an ejb's security
configuration. This should be only known in the ejb configuration, and
nowhere else, definitivly not on the client. The ejb deployer should be able
to switch from one security realm to another, without the client knowing.
> there's no easy way to predict which application's ejb or which ejb you
> want to call
I understand this is because security lookup is done during creation of the
InitialContext and the lookup with JNDI name is done in the next call.

An alternative would be to define an order of security realm lookups.

Greetings,
Juergen





David Jencks wrote:
> 
> This is the right place to ask this question.
> 
> Geronimo lets you set up many security realms at once.  When you connect
> from a remote client to call ejbs, there's no easy way to predict which
> application's ejb or which ejb you want to call.  So you have to specify
> how you want to log in when you connect.
> 
> We could allow specifying a default security realm for all of openejb so
> if you don't specify a realm we use the default.
> 
> thanks
> david jencks
> 
> On Feb 1, 2011, at 2:27 AM, Shailen wrote:
> 
>> Hi All,
>> 
>> I have a very simple ejb deployed on geronimo2.2.1. This ejb is secured
>> by a security realm(Database(SQL) realm). When I call this ejb from a
>> standalone java client, it restricts me from accessing it without
>> authentication.
>> 
>> But when I provide this principal and credentials then also it restricts
>> me from calling this ejb.
>> When I additionally provide realmName then it enables me to call this
>> ejb.
>> 
>> My question is why do we need to provide the security realm name in the
>> client?
>> 
>> I am sorry if this is not the right place to ask such questions.
>> -- 
>> 
>> Regards,
>> Shailen (khichi.shailen...@gmail.com)
>> +91-9216020360
>> Mohali, Chandigarh - 160062
> 
> 
> 

-- 
View this message in context: 
http://apache-geronimo.328035.n3.nabble.com/why-we-need-to-provide-security-realm-name-to-a-standalone-ejb-client-tp2396336p2403732.html
Sent from the Users mailing list archive at Nabble.com.


Re: why we need to provide security realm name to a standalone ejb client?

2011-02-01 Thread David Jencks

On Feb 1, 2011, at 8:26 PM, Shailen wrote:

> Hi David,
> 
> Thanks for that information. 2 things here:
> 1. Where is that property in security realm that makes it default?

There is no way to do that currently.  I was suggesting that it is a possible 
future feature.  Patches are welcome.

> 2. I have also exported that EJB as a webservice now and when I am trying to 
> consume this webservice from soapui, its giving me exception as 
> 
> "javax.ejb.EJBAccessException: Unauthorized Access by Principal Denied: 
> Unauthorized Access by Principal Denied"
> 
> How do I call that webservice?

ejb web service security is configured similarly to web app security, but in 
the geronimo plan for the ejb.  In this case you will be able to specify the 
security realm for the web service login.

I don't see any instructions in the documentation so I suggest looking at the 
xml schema for the openejb-jar.xml (not ejb-jar.xml).

hope this helps
david jencks

> 
> Regards,
> Shailen (khichi.shailen...@gmail.com)
> +91-9216020360
> Mohali, Chandigarh - 160062
> 
> On Wednesday 02 February 2011 01:48 AM, David Jencks wrote:
>> 
>> This is the right place to ask this question.
>> 
>> Geronimo lets you set up many security realms at once.  When you connect 
>> from a remote client to call ejbs, there's no easy way to predict which 
>> application's ejb or which ejb you want to call.  So you have to specify how 
>> you want to log in when you connect.
>> 
>> We could allow specifying a default security realm for all of openejb so if 
>> you don't specify a realm we use the default.
>> 
>> thanks
>> david jencks
>> 
>> On Feb 1, 2011, at 2:27 AM, Shailen wrote:
>> 
>>> Hi All,
>>> 
>>> I have a very simple ejb deployed on geronimo2.2.1. This ejb is secured by 
>>> a security realm(Database(SQL) realm). When I call this ejb from a 
>>> standalone java client, it restricts me from accessing it without 
>>> authentication.
>>> 
>>> But when I provide this principal and credentials then also it restricts me 
>>> from calling this ejb.
>>> When I additionally provide realmName then it enables me to call this ejb.
>>> 
>>> My question is why do we need to provide the security realm name in the 
>>> client?
>>> 
>>> I am sorry if this is not the right place to ask such questions.
>>> -- 
>>> 
>>> Regards,
>>> Shailen (khichi.shailen...@gmail.com)
>>> +91-9216020360
>>> Mohali, Chandigarh - 160062
>> 



Re: why we need to provide security realm name to a standalone ejb client?

2011-02-01 Thread Shailen

Also I would like the EJB to know the user who is calling it.
I think EJBContext will fulfill this, but I am not able to get it.
I used

@Resource(type = EJBContext.class)
private EJBContext context;

But deployment fails as it is unable to inject the desired object.
How to pass the desired object from deployment descriptor?

Any help much appreciated here.
Thanks.

Regards,
Shailen (khichi.shailen...@gmail.com)
+91-9216020360
Mohali, Chandigarh - 160062


On Wednesday 02 February 2011 09:56 AM, Shailen wrote:

Hi David,

Thanks for that information. 2 things here:
1. Where is that property in security realm that makes it default?
2. I have also exported that EJB as a webservice now and when I am 
trying to consume this webservice from soapui, its giving me exception as


"javax.ejb.EJBAccessException: Unauthorized Access by Principal 
Denied: Unauthorized Access by Principal Denied"


How do I call that webservice?

Regards,
Shailen (khichi.shailen...@gmail.com)
+91-9216020360
Mohali, Chandigarh - 160062

On Wednesday 02 February 2011 01:48 AM, David Jencks wrote:

This is the right place to ask this question.

Geronimo lets you set up many security realms at once.  When you 
connect from a remote client to call ejbs, there's no easy way to 
predict which application's ejb or which ejb you want to call.  So 
you have to specify how you want to log in when you connect.


We could allow specifying a default security realm for all of openejb 
so if you don't specify a realm we use the default.


thanks
david jencks

On Feb 1, 2011, at 2:27 AM, Shailen wrote:


Hi All,

I have a very simple ejb deployed on geronimo2.2.1. This ejb is 
secured by a security realm(Database(SQL) realm). When I call this 
ejb from a standalone java client, it restricts me from accessing it 
without authentication.


But when I provide this principal and credentials then also it 
restricts me from calling this ejb.
When I additionally provide realmName then it enables me to call 
this ejb.


My question is why do we need to provide the security realm name in 
the client?


I am sorry if this is not the right place to ask such questions.
--

Regards,
Shailen (khichi.shailen...@gmail.com)
+91-9216020360
Mohali, Chandigarh - 160062




Re: why we need to provide security realm name to a standalone ejb client?

2011-02-01 Thread Shailen

Hi David,

Thanks for that information. 2 things here:
1. Where is that property in security realm that makes it default?
2. I have also exported that EJB as a webservice now and when I am 
trying to consume this webservice from soapui, its giving me exception as


"javax.ejb.EJBAccessException: Unauthorized Access by Principal Denied: 
Unauthorized Access by Principal Denied"


How do I call that webservice?

Regards,
Shailen (khichi.shailen...@gmail.com)
+91-9216020360
Mohali, Chandigarh - 160062


On Wednesday 02 February 2011 01:48 AM, David Jencks wrote:

This is the right place to ask this question.

Geronimo lets you set up many security realms at once.  When you 
connect from a remote client to call ejbs, there's no easy way to 
predict which application's ejb or which ejb you want to call.  So you 
have to specify how you want to log in when you connect.


We could allow specifying a default security realm for all of openejb 
so if you don't specify a realm we use the default.


thanks
david jencks

On Feb 1, 2011, at 2:27 AM, Shailen wrote:


Hi All,

I have a very simple ejb deployed on geronimo2.2.1. This ejb is 
secured by a security realm(Database(SQL) realm). When I call this 
ejb from a standalone java client, it restricts me from accessing it 
without authentication.


But when I provide this principal and credentials then also it 
restricts me from calling this ejb.
When I additionally provide realmName then it enables me to call this 
ejb.


My question is why do we need to provide the security realm name in 
the client?


I am sorry if this is not the right place to ask such questions.
--

Regards,
Shailen (khichi.shailen...@gmail.com)
+91-9216020360
Mohali, Chandigarh - 160062




Re: why we need to provide security realm name to a standalone ejb client?

2011-02-01 Thread David Jencks
This is the right place to ask this question.

Geronimo lets you set up many security realms at once.  When you connect from a 
remote client to call ejbs, there's no easy way to predict which application's 
ejb or which ejb you want to call.  So you have to specify how you want to log 
in when you connect.

We could allow specifying a default security realm for all of openejb so if you 
don't specify a realm we use the default.

thanks
david jencks

On Feb 1, 2011, at 2:27 AM, Shailen wrote:

> Hi All,
> 
> I have a very simple ejb deployed on geronimo2.2.1. This ejb is secured by a 
> security realm(Database(SQL) realm). When I call this ejb from a standalone 
> java client, it restricts me from accessing it without authentication.
> 
> But when I provide this principal and credentials then also it restricts me 
> from calling this ejb.
> When I additionally provide realmName then it enables me to call this ejb.
> 
> My question is why do we need to provide the security realm name in the 
> client?
> 
> I am sorry if this is not the right place to ask such questions.
> -- 
> 
> Regards,
> Shailen (khichi.shailen...@gmail.com)
> +91-9216020360
> Mohali, Chandigarh - 160062



why we need to provide security realm name to a standalone ejb client?

2011-02-01 Thread Shailen

Hi All,

I have a very simple ejb deployed on geronimo2.2.1. This ejb is secured 
by a security realm(Database(SQL) realm). When I call this ejb from a 
standalone java client, it restricts me from accessing it without 
authentication.


But when I provide this principal and credentials then also it restricts 
me from calling this ejb.

When I additionally provide realmName then it enables me to call this ejb.

My question is why do we need to provide the security realm name in the 
client?


I am sorry if this is not the right place to ask such questions.

--

Regards,
Shailen (khichi.shailen...@gmail.com)
+91-9216020360
Mohali, Chandigarh - 160062



Re: ejb client

2008-12-30 Thread axiez

Yes. It worked without any problem.

axiez wrote:
> 
> I want to run sample code to understand ejb 3.0 basics. I am new to ejb. I
> have the following java files: ShoppingCartBean.java, ShoppingCart.java
> and Client.java. The Client.java file has the following code:
> import javax.naming.InitialContext;
> public class Client {
> public static void main(String[] args) throws Exception {
> InitialContext ctx = new InitialContext();
> ShoppingCart cart = (ShoppingCart)
> ctx.lookup("ShoppingCartBean/remote");
> ...
> }
> My plan is to have client on a different JVM than ejb container. I
> wonder how the client can execute bean method without even knowing IP
> address etc of the JVM that has the other code on ejb container.
> 

-- 
View this message in context: 
http://www.nabble.com/ejb-client-tp21193112s134p21228223.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.



Re: ejb client

2008-12-30 Thread Shawn Jiang
Sure you'll want to put your remote interface classes(here is the
ShoppingCart) in your client classpath.

2008/12/31 axiez 

>
> This time it threw Exception as follows:
> Exception in thread "main" javax.naming.NamingException: Cannot lookup
> '/ShoppongCartBeanRemote'. [Root exception is java.rmi.RemoteException:
> Cannot read the response from the server. The class for an object being
> returned is not located in this system:; nested exception is:
> java.lang.ClassNotFoundException: ShoppingCart]
> at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:240)
> at javax.naming.InitialContext.lookup(Unknown Source)
> at Client.main(Client.java:12)
>
> axiez wrote:
> >
> > I want to run sample code to understand ejb 3.0 basics. I am new to ejb.
> I
> > have the following java files: ShoppingCartBean.java, ShoppingCart.java
> > and Client.java. The Client.java file has the following code:
> > import javax.naming.InitialContext;
> > public class Client {
> > public static void main(String[] args) throws Exception {
> > InitialContext ctx = new InitialContext();
> > ShoppingCart cart = (ShoppingCart)
> > ctx.lookup("ShoppingCartBean/remote");
> > ...
> > }
> > My plan is to have client on a different JVM than ejb container. I
> > wonder how the client can execute bean method without even knowing IP
> > address etc of the JVM that has the other code on ejb container.
> >
>
> --
> View this message in context:
> http://www.nabble.com/ejb-client-tp21193112s134p21227784.html
> Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.
>
>


-- 
Shawn


Re: ejb client

2008-12-30 Thread axiez

This time it threw Exception as follows:
Exception in thread "main" javax.naming.NamingException: Cannot lookup
'/ShoppongCartBeanRemote'. [Root exception is java.rmi.RemoteException:
Cannot read the response from the server. The class for an object being
returned is not located in this system:; nested exception is:
java.lang.ClassNotFoundException: ShoppingCart]
at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:240)
at javax.naming.InitialContext.lookup(Unknown Source)
at Client.main(Client.java:12)

axiez wrote:
> 
> I want to run sample code to understand ejb 3.0 basics. I am new to ejb. I
> have the following java files: ShoppingCartBean.java, ShoppingCart.java
> and Client.java. The Client.java file has the following code:
> import javax.naming.InitialContext;
> public class Client {
> public static void main(String[] args) throws Exception {
> InitialContext ctx = new InitialContext();
> ShoppingCart cart = (ShoppingCart)
> ctx.lookup("ShoppingCartBean/remote");
> ...
> }
> My plan is to have client on a different JVM than ejb container. I
> wonder how the client can execute bean method without even knowing IP
> address etc of the JVM that has the other code on ejb container.
> 

-- 
View this message in context: 
http://www.nabble.com/ejb-client-tp21193112s134p21227784.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.



Re: ejb client

2008-12-30 Thread Shawn Jiang
OK, you still need to

   - add two jars to the classpath when you execute the client app.


   1.
  
geronimo\repository\org\apache\geronimo\framework\geronimo-security\2.1.3\geronimo-security-2.1.3.jar
  2.
  
geronimo\repository\org\apache\openejb\openejb-client\3.0\openejb-client-3.0.jar


   - add a  env.put("openejb.authentication.realmName","geronimo-admin");
 before creating the InitialContext.


Re: ejb client

2008-12-30 Thread axiez

I ran "java Client" from a different PC. It threw exception as given below
Exception in thread "main" javax.naming.NoInitialContextException: Cannot
instantiate class: org.openejb.client.RemoteInitialContextFactory [Root
exception is java.lang.ClassNotFoundException:
org.openejb.client.RemoteInitialContextFactory]]



axiez wrote:
> 
> I want to run sample code to understand ejb 3.0 basics. I am new to ejb. I
> have the following java files: ShoppingCartBean.java, ShoppingCart.java
> and Client.java. The Client.java file has the following code:
> import javax.naming.InitialContext;
> public class Client {
> public static void main(String[] args) throws Exception {
> InitialContext ctx = new InitialContext();
> ShoppingCart cart = (ShoppingCart)
> ctx.lookup("ShoppingCartBean/remote");
> ...
> }
> My plan is to have client on a different JVM than ejb container. I
> wonder how the client can execute bean method without even knowing IP
> address etc of the JVM that has the other code on ejb container.
> 

-- 
View this message in context: 
http://www.nabble.com/ejb-client-tp21193112s134p21227093.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.



Re: ejb client

2008-12-30 Thread Shawn Jiang
 [startup] Jndi(name=ShoppingCartBeanRemote)
-
OK, Just as David said,  the ShoppingCartBeanRemote is your EJB remote jndi
name.  you can look it up and use it in your client app.


-- 
Shawn


Re: ejb client

2008-12-30 Thread axiez

I checked the contents of jar file. The class files are in a subdirectory and
since there was no package statement, it didn't recognize I guess. I
repackaged and deployed again this time without subdirectory. Log entries
are:
15:26:51,218 INFO  [config] Configuring Service(id=Default Stateless
Container, type=Container, provider-id=Default Stateless Container)
15:26:51,250 INFO  [config] Configuring Service(id=Default Stateful
Container, type=Container, provider-id=Default Stateful Container)
15:26:51,250 INFO  [config] Configuring Service(id=Default BMP Container,
type=Container, provider-id=Default BMP Container)
15:26:51,250 INFO  [config] Configuring Service(id=Default CMP Container,
type=Container, provider-id=Default CMP Container)
15:26:51,250 INFO  [config] Configuring app:
default/Shopping/1230631009812/jar
15:26:52,484 INFO  [OpenEJB] Auto-deploying ejb ShoppingCartBean:
EjbDeployment(deployment-id=Shopping/ShoppingCartBean)
15:26:52,531 WARN  [validation] WARN ... ShoppingCartBean:  Ignoring @Remove
used on interface ShoppingCart method checkout.  Annotation only usable on
the bean class.
15:26:52,562 INFO  [config] Loaded Module:
default/Shopping/1230631009812/jar
15:26:56,343 INFO  [startup] Assembling app:
D:\g\geronimo-tomcat6-javaee5-2.1.3\var\temp\geronimo-deployer65067.tmpdir\Shopping.jar
15:26:56,437 INFO  [startup] Jndi(name=ShoppingCartBeanRemote) -->
Ejb(deployment-id=Shopping/ShoppingCartBean)
15:26:56,453 INFO  [startup] Created
Ejb(deployment-id=Shopping/ShoppingCartBean, ejb-name=ShoppingCartBean,
container=Default Stateful Container)
15:26:56,453 INFO  [startup] Deployed
Application(path=D:\g\geronimo-tomcat6-javaee5-2.1.3\var\temp\geronimo-deployer65067.tmpdir\Shopping.jar)


Shawn Jiang wrote:
> 
> The log below is from log when deploying a simple hello world EJB.  Seems
> your EJB does not get recognized.  Have you ever deployed a helloworld EJB
> before this shopping EJB ?   Can you send your src and exported jar
> as attachment for further diagnose ?
> 
> 
> 2008-12-30 15:37:42,323 INFO  [config] Configuring Service(id=Default
> Stateless Container, type=Container, provider-id=Default Stateless
> Container)
> 2008-12-30 15:37:42,323 INFO  [config] Configuring Service(id=Default
> Stateful Container, type=Container, provider-id=Default Stateful
> Container)
> 2008-12-30 15:37:42,323 INFO  [config] Configuring Service(id=Default BMP
> Container, type=Container, provider-id=Default BMP Container)
> 2008-12-30 15:37:42,323 INFO  [config] Configuring Service(id=Default CMP
> Container, type=Container, provider-id=Default CMP Container)
> 2008-12-30 15:37:42,323 INFO  [config] Configuring app:
> default/simpleEJB/1230622661698/jar
> 
> 2008-12-30 15:37:42,542 INFO  [OpenEJB] Auto-deploying ejb HelloEJB:
> EjbDeployment(deployment-id=simpleEJB/HelloEJB)
> 2008-12-30 15:37:42,542 INFO  [OpenEJB] Auto-deploying ejb
> HelloStatefulEJB:
> EjbDeployment(deployment-id=simpleEJB/HelloStatefulEJB)
> 
> 2008-12-30 15:37:42,573 INFO  [config] Loaded Module:
> default/simpleEJB/1230622661698/jar
> 2008-12-30 15:37:43,792 INFO  [startup] Assembling app:
> Y:\geronimo-tomcat6-javaee5-2.1.3\var\temp\geronimo-deployer52890.tmpdir\simpleEJB.jar
> 
> 2008-12-30 15:37:43,807 INFO  [startup] Jndi(name=HelloEJBLocal) -->
> Ejb(deployment-id=simpleEJB/HelloEJB)
> 2008-12-30 15:37:43,807 INFO  [startup] Jndi(name=HelloEJBRemote) -->
> Ejb(deployment-id=simpleEJB/HelloEJB)
> 2008-12-30 15:37:43,807 INFO  [startup] Jndi(name=HelloStatefulEJBRemote)
> --> Ejb(deployment-id=simpleEJB/HelloStatefulEJB)
> 2008-12-30 15:37:43,807 INFO  [startup] Created
> Ejb(deployment-id=simpleEJB/HelloEJB, ejb-name=HelloEJB, container=Default
> Stateless Container)
> 2008-12-30 15:37:43,807 INFO  [startup] Created
> Ejb(deployment-id=simpleEJB/HelloStatefulEJB, ejb-name=HelloStatefulEJB,
> container=Default Stateful Container)
> 
> 2008-12-30 15:37:43,807 INFO  [startup] Deployed
> Application(path=Y:\geronimo-tomcat6-javaee5-2.1.3\var\temp\geronimo-deployer52890.tmpdir\simpleEJB.jar)
> 
> 

-- 
View this message in context: 
http://www.nabble.com/ejb-client-tp21193112s134p21215132.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.



Re: ejb client

2008-12-30 Thread Shawn Jiang
The log below is from log when deploying a simple hello world EJB.  Seems
your EJB does not get recognized.  Have you ever deployed a helloworld EJB
before this shopping EJB ?   Can you send your src and exported jar
as attachment for further diagnose ?


2008-12-30 15:37:42,323 INFO  [config] Configuring Service(id=Default
Stateless Container, type=Container, provider-id=Default Stateless
Container)
2008-12-30 15:37:42,323 INFO  [config] Configuring Service(id=Default
Stateful Container, type=Container, provider-id=Default Stateful Container)
2008-12-30 15:37:42,323 INFO  [config] Configuring Service(id=Default BMP
Container, type=Container, provider-id=Default BMP Container)
2008-12-30 15:37:42,323 INFO  [config] Configuring Service(id=Default CMP
Container, type=Container, provider-id=Default CMP Container)
2008-12-30 15:37:42,323 INFO  [config] Configuring app:
default/simpleEJB/1230622661698/jar

2008-12-30 15:37:42,542 INFO  [OpenEJB] Auto-deploying ejb HelloEJB:
EjbDeployment(deployment-id=simpleEJB/HelloEJB)
2008-12-30 15:37:42,542 INFO  [OpenEJB] Auto-deploying ejb HelloStatefulEJB:
EjbDeployment(deployment-id=simpleEJB/HelloStatefulEJB)

2008-12-30 15:37:42,573 INFO  [config] Loaded Module:
default/simpleEJB/1230622661698/jar
2008-12-30 15:37:43,792 INFO  [startup] Assembling app:
Y:\geronimo-tomcat6-javaee5-2.1.3\var\temp\geronimo-deployer52890.tmpdir\simpleEJB.jar

2008-12-30 15:37:43,807 INFO  [startup] Jndi(name=HelloEJBLocal) -->
Ejb(deployment-id=simpleEJB/HelloEJB)
2008-12-30 15:37:43,807 INFO  [startup] Jndi(name=HelloEJBRemote) -->
Ejb(deployment-id=simpleEJB/HelloEJB)
2008-12-30 15:37:43,807 INFO  [startup] Jndi(name=HelloStatefulEJBRemote)
--> Ejb(deployment-id=simpleEJB/HelloStatefulEJB)
2008-12-30 15:37:43,807 INFO  [startup] Created
Ejb(deployment-id=simpleEJB/HelloEJB, ejb-name=HelloEJB, container=Default
Stateless Container)
2008-12-30 15:37:43,807 INFO  [startup] Created
Ejb(deployment-id=simpleEJB/HelloStatefulEJB, ejb-name=HelloStatefulEJB,
container=Default Stateful Container)

2008-12-30 15:37:43,807 INFO  [startup] Deployed
Application(path=Y:\geronimo-tomcat6-javaee5-2.1.3\var\temp\geronimo-deployer52890.tmpdir\simpleEJB.jar)


Re: ejb client

2008-12-30 Thread axiez

I undeployed the earlier application and issued the following command:
deploy -u system -p manager deploy path\Shopping.jar
System displayed the following message:
Depoyed default/Shopping/1230625750875/jar
Entries in geronimo.log are:
13:59:16,562 INFO  [config] Configuring Service(id=Default Stateless
Container, type=Container, provider-id=Default Stateless Container)
13:59:16,828 INFO  [config] Configuring Service(id=Default Stateful
Container, type=Container, provider-id=Default Stateful Container)
13:59:16,843 INFO  [config] Configuring Service(id=Default BMP Container,
type=Container, provider-id=Default BMP Container)
13:59:16,843 INFO  [config] Configuring Service(id=Default CMP Container,
type=Container, provider-id=Default CMP Container)
13:59:16,843 INFO  [config] Configuring app:
default/Shopping/1230625750875/jar
13:59:17,781 INFO  [config] Loaded Module:
default/Shopping/1230625750875/jar
13:59:33,609 INFO  [startup] Assembling app:
D:\g\geronimo-tomcat6-javaee5-2.1.3\var\temp\geronimo-deployer65065.tmpdir\Shopping.jar
13:59:33,609 INFO  [startup] Deployed
Application(path=D:\g\geronimo-tomcat6-javaee5-2.1.3\var\temp\geronimo-deployer65065.tmpdir\Shopping.jar)


Shawn Jiang wrote:
> 
> I see no problems in your code,I noticed some
> 
> d:\dir1\dir2\dir3\yourDirectory
> 
> 
> in the log,  can you please tell me what's your deploy method ?  I suggest
> exporting EJB to a jar file then deploy it  to geronimo with
> "deploy.bat|sh
> deploy path/to/jar".
> 
> 

-- 
View this message in context: 
http://www.nabble.com/ejb-client-tp21193112s134p21214398.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.



Re: ejb client

2008-12-29 Thread Shawn Jiang
I see no problems in your code,I noticed some

d:\dir1\dir2\dir3\yourDirectory


in the log,  can you please tell me what's your deploy method ?  I suggest
exporting EJB to a jar file then deploy it  to geronimo with "deploy.bat|sh
deploy path/to/jar".


Re: ejb client

2008-12-29 Thread axiez

ShoppingCartBean.java
import java.io.Serializable;
import java.util.HashMap;
import javax.ejb.Remove;
import javax.ejb.Stateful;
import javax.ejb.Remote;
@Stateful
@Remote(ShoppingCart.class)
public class ShoppingCartBean implements ShoppingCart, Serializable {
private HashMap cart = new HashMap();
public void buy(String product, int quantity) {
if(cart.containsKey(product)) {
int currq = cart.get(product);
currq += quantity;
cart.put(product, currq);
}
else {
cart.put(product, quantity);
}
}
public HashMap getCartContents() {
return cart;
}
@Remove
public void checkout() {
System.out.println("To be implemented");
}
}
ShoppingCart.java
import java.util.HashMap;
import javax.ejb.Remove;
public interface ShoppingCart {
void buy(String product, int quantity);
HashMap getCartContents();
@Remove void checkout();
}

axiez wrote:
> 
> I went through \var\log\geronimo.log file. It has the
> following entries:
> [startup] Assembling app: d:\dir1\dir2\dir3\yourDirectory
> [startup] Deployed Application(path=d:\dir1\dir2\dir3\yourDirectory). No
> entries matching [startup] Jndi for this application. Is it because I
> don't have ejb-jar.xml? I thought it no longer would be required.
> 
> axiez wrote:
>> 
>> I want to run sample code to understand ejb 3.0 basics. I am new to ejb.
>> I have the following java files: ShoppingCartBean.java, ShoppingCart.java
>> and Client.java. The Client.java file has the following code:
>> import javax.naming.InitialContext;
>> public class Client {
>> public static void main(String[] args) throws Exception {
>> InitialContext ctx = new InitialContext();
>> ShoppingCart cart = (ShoppingCart)
>> ctx.lookup("ShoppingCartBean/remote");
>> ...
>> }
>> My plan is to have client on a different JVM than ejb container. I
>> wonder how the client can execute bean method without even knowing IP
>> address etc of the JVM that has the other code on ejb container.
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/ejb-client-tp21193112s134p21213824.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.



Re: ejb client

2008-12-29 Thread Shawn Jiang
sure ejb-jar.xml is only optional for ejb 3.0, But I can't tell what's
wrong with your app with the info you provided.  Can you paste your
ShoppingCartBean.java, ShoppingCart.java here ?

-- 
Shawn


Re: ejb client

2008-12-29 Thread axiez

I went through \var\log\geronimo.log file. It has the
following entries:
[startup] Assembling app: d:\dir1\dir2\dir3\yourDirectory
[startup] Deployed Application(path=d:\dir1\dir2\dir3\yourDirectory). No
entries matching [startup] Jndi for this application. Is it because I don't
have ejb-jar.xml? I thought it no longer would be required.

axiez wrote:
> 
> I want to run sample code to understand ejb 3.0 basics. I am new to ejb. I
> have the following java files: ShoppingCartBean.java, ShoppingCart.java
> and Client.java. The Client.java file has the following code:
> import javax.naming.InitialContext;
> public class Client {
> public static void main(String[] args) throws Exception {
> InitialContext ctx = new InitialContext();
> ShoppingCart cart = (ShoppingCart)
> ctx.lookup("ShoppingCartBean/remote");
> ...
> }
> My plan is to have client on a different JVM than ejb container. I
> wonder how the client can execute bean method without even knowing IP
> address etc of the JVM that has the other code on ejb container.
> 

-- 
View this message in context: 
http://www.nabble.com/ejb-client-tp21193112s134p21213078.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.



Re: ejb client

2008-12-29 Thread David Blevins
I'd backup and go with the suggestion from Shawn Jiang.  You're really  
close.


It's just:

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

env.put("java.naming.provider.url", "ejbd://localhost:4201");
env.put("java.naming.security.principal", "system");
env.put("java.naming.security.credentials", "manager");
InitialContext ctx = new InitialContext(env);

ShoppingCart shoppingCart = ctx.lookup("ShoppingCartBeanRemote");

Looking at your bean code the JNDI name will likely be  
"ShoppingCartBeanRemote", but as Shawn mentions the geronimo.log file  
will list it exactly.


I would not investigate using annotations in remote clients until you  
can get a simple client like the one above working.  The reason being  
is annotations in clients only work for Java EE App Clients running in  
a Java EE App Client Container.  Java EE Application Clients are  
definitely far more complicated than plain java clients that use the  
code above.


-David


On Dec 29, 2008, at 1:39 AM, axiez wrote:



I am trying to use annotations instead of JNDI. My Bean class code is:
import java.io.*;
import java.util.*;
import javax.ejb.*;
@Stateful
@Remote(ShoppingCart.class)
public class ShoppingCartBean implements ShoppingCart, Serializable {
   private HashMap cart = new HashMapInteger>();

   public void buy(String product, int quantity) {
   if(cart.containsKey(product)) {
   int currq = cart.get(product);
   currq += quantity;
   cart.put(product, currq);
   }
   else {
   cart.put(product, quantity);
   }
   }
   public HashMap getCartContents() {
   return cart;
   }
   @Remove
   public void checkout() {
   System.out.println("To be implemented");
   }
}
I used the inPlace option of deploy command. It said "Deployed
default/yourDirectory/1230542660703/jar". From EJB 3.0 spec, it  
looks like
we can use annotations and avoid JNDI. My attempt is to use remote  
client

with simplest EJB 3.0 code.

Shawn Jiang wrote:


you need to use the bean's remote interface name here instead of the
bean class name itself.

As for "ShoppingCartBean/remote" in the lookup method, you need to
confirm it's the JNDI name of your EJB remote interface.(you can get
the JNDI name of your EJB by searching  "[startup] Jndi(name=" in the
geronimo/var/log/geronimo.log file)

2008/12/29 axiez :


I added jndi.properties. Modified code is given below:
Properties p = new Properties();
p.load(new FileInputStream("jndi.properties"));
InitialContext ctx = new InitialContext(p);
ShoppingCart cart = (ShoppingCart) ctx.lookup("ShoppingCartBean/ 
remote");
I compiled the java files and am planning to create a jar file  
"a.jar"

and
deploy it. In the lookup method given above, I simply mentioned  
the bean
class name. Nowhere did I mention jar file/module name. Is this  
correct?


axiez wrote:


I want to run sample code to understand ejb 3.0 basics. I am new  
to ejb.

I
have the following java files: ShoppingCartBean.java,  
ShoppingCart.java

and Client.java. The Client.java file has the following code:
import javax.naming.InitialContext;
public class Client {
   public static void main(String[] args) throws Exception {
   InitialContext ctx = new InitialContext();
   ShoppingCart cart = (ShoppingCart)
ctx.lookup("ShoppingCartBean/remote");
   ...
   }
   My plan is to have client on a different JVM than ejb  
container. I
wonder how the client can execute bean method without even  
knowing IP

address etc of the JVM that has the other code on ejb container.



--
View this message in context:
http://www.nabble.com/ejb-client-tp21193112s134p21199643.html
Sent from the Apache Geronimo - Users mailing list archive at  
Nabble.com.







--
Shawn




--
View this message in context: 
http://www.nabble.com/ejb-client-tp21193112s134p21200805.html
Sent from the Apache Geronimo - Users mailing list archive at  
Nabble.com.







Re: ejb client

2008-12-29 Thread axiez

I am trying to use annotations instead of JNDI. My Bean class code is:
import java.io.*;
import java.util.*;
import javax.ejb.*;
@Stateful
@Remote(ShoppingCart.class)
public class ShoppingCartBean implements ShoppingCart, Serializable {
private HashMap cart = new HashMap();
public void buy(String product, int quantity) {
if(cart.containsKey(product)) {
int currq = cart.get(product);
currq += quantity;
cart.put(product, currq);
}
else {
cart.put(product, quantity);
}
}
public HashMap getCartContents() {
return cart;
}
@Remove
public void checkout() {
System.out.println("To be implemented");
}
}
I used the inPlace option of deploy command. It said "Deployed
default/yourDirectory/1230542660703/jar". From EJB 3.0 spec, it looks like
we can use annotations and avoid JNDI. My attempt is to use remote client
with simplest EJB 3.0 code.

Shawn Jiang wrote:
> 
> you need to use the bean's remote interface name here instead of the
> bean class name itself.
> 
> As for "ShoppingCartBean/remote" in the lookup method, you need to
> confirm it's the JNDI name of your EJB remote interface.(you can get
> the JNDI name of your EJB by searching  "[startup] Jndi(name=" in the
> geronimo/var/log/geronimo.log file)
> 
> 2008/12/29 axiez :
>>
>> I added jndi.properties. Modified code is given below:
>> Properties p = new Properties();
>> p.load(new FileInputStream("jndi.properties"));
>> InitialContext ctx = new InitialContext(p);
>> ShoppingCart cart = (ShoppingCart) ctx.lookup("ShoppingCartBean/remote");
>> I compiled the java files and am planning to create a jar file "a.jar"
>> and
>> deploy it. In the lookup method given above, I simply mentioned the bean
>> class name. Nowhere did I mention jar file/module name. Is this correct?
>>
>> axiez wrote:
>>>
>>> I want to run sample code to understand ejb 3.0 basics. I am new to ejb.
>>> I
>>> have the following java files: ShoppingCartBean.java, ShoppingCart.java
>>> and Client.java. The Client.java file has the following code:
>>> import javax.naming.InitialContext;
>>> public class Client {
>>> public static void main(String[] args) throws Exception {
>>> InitialContext ctx = new InitialContext();
>>> ShoppingCart cart = (ShoppingCart)
>>> ctx.lookup("ShoppingCartBean/remote");
>>> ...
>>> }
>>> My plan is to have client on a different JVM than ejb container. I
>>> wonder how the client can execute bean method without even knowing IP
>>> address etc of the JVM that has the other code on ejb container.
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/ejb-client-tp21193112s134p21199643.html
>> Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Shawn
> 
> 

-- 
View this message in context: 
http://www.nabble.com/ejb-client-tp21193112s134p21200805.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.



Re: ejb client

2008-12-29 Thread Shawn Jiang
you need to use the bean's remote interface name here instead of the
bean class name itself.

As for "ShoppingCartBean/remote" in the lookup method, you need to
confirm it's the JNDI name of your EJB remote interface.(you can get
the JNDI name of your EJB by searching  "[startup] Jndi(name=" in the
geronimo/var/log/geronimo.log file)

2008/12/29 axiez :
>
> I added jndi.properties. Modified code is given below:
> Properties p = new Properties();
> p.load(new FileInputStream("jndi.properties"));
> InitialContext ctx = new InitialContext(p);
> ShoppingCart cart = (ShoppingCart) ctx.lookup("ShoppingCartBean/remote");
> I compiled the java files and am planning to create a jar file "a.jar" and
> deploy it. In the lookup method given above, I simply mentioned the bean
> class name. Nowhere did I mention jar file/module name. Is this correct?
>
> axiez wrote:
>>
>> I want to run sample code to understand ejb 3.0 basics. I am new to ejb. I
>> have the following java files: ShoppingCartBean.java, ShoppingCart.java
>> and Client.java. The Client.java file has the following code:
>> import javax.naming.InitialContext;
>> public class Client {
>> public static void main(String[] args) throws Exception {
>> InitialContext ctx = new InitialContext();
>> ShoppingCart cart = (ShoppingCart)
>> ctx.lookup("ShoppingCartBean/remote");
>> ...
>> }
>> My plan is to have client on a different JVM than ejb container. I
>> wonder how the client can execute bean method without even knowing IP
>> address etc of the JVM that has the other code on ejb container.
>>
>
> --
> View this message in context: 
> http://www.nabble.com/ejb-client-tp21193112s134p21199643.html
> Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.
>
>



-- 
Shawn


Re: ejb client

2008-12-28 Thread axiez

I added jndi.properties. Modified code is given below:
Properties p = new Properties();
p.load(new FileInputStream("jndi.properties"));
InitialContext ctx = new InitialContext(p);
ShoppingCart cart = (ShoppingCart) ctx.lookup("ShoppingCartBean/remote");
I compiled the java files and am planning to create a jar file "a.jar" and
deploy it. In the lookup method given above, I simply mentioned the bean
class name. Nowhere did I mention jar file/module name. Is this correct?

axiez wrote:
> 
> I want to run sample code to understand ejb 3.0 basics. I am new to ejb. I
> have the following java files: ShoppingCartBean.java, ShoppingCart.java
> and Client.java. The Client.java file has the following code:
> import javax.naming.InitialContext;
> public class Client {
> public static void main(String[] args) throws Exception {
> InitialContext ctx = new InitialContext();
> ShoppingCart cart = (ShoppingCart)
> ctx.lookup("ShoppingCartBean/remote");
> ...
> }
> My plan is to have client on a different JVM than ejb container. I
> wonder how the client can execute bean method without even knowing IP
> address etc of the JVM that has the other code on ejb container.
> 

-- 
View this message in context: 
http://www.nabble.com/ejb-client-tp21193112s134p21199643.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.



Re: ejb client

2008-12-28 Thread Shawn Jiang
With some search, it seems that you do need to provide the ejb
container info by


1, providing a jndi.properties in your client classpath with following content:

java.naming.factory.initial=org.openejb.client.RemoteInitialContextFactory
java.naming.provider.url=ejb_container_ip:4201
java.naming.security.principal=system
java.naming.security.credentials=manager


or

2, using following code to create the initial context in your client code.

Properties env = new Properties();

env.put("java.naming.factory.initial","org.apache.openejb.client.RemoteInitialContextFactory");
env.put("java.naming.factory.host", "ejb_container_ip");
env.put("java.naming.factory.port", "4201");
env.put("java.naming.security.principal", "system");
env.put("java.naming.security.credentials", "manager");
ctx = new InitialContext(env);

hope it helps.

2008/12/28 axiez :
>
> I want to run sample code to understand ejb 3.0 basics. I am new to ejb. I
> have the following java files: ShoppingCartBean.java, ShoppingCart.java and
> Client.java. The Client.java file has the following code:
> import javax.naming.InitialContext;
> public class Client {
>public static void main(String[] args) throws Exception {
>InitialContext ctx = new InitialContext();
>ShoppingCart cart = (ShoppingCart)
> ctx.lookup("ShoppingCartBean/remote");
>...
>}
>My plan is to have client on a different JVM than ejb container. I
> wonder how the client can execute bean method without even knowing IP
> address etc of the JVM that has the other code on ejb container.
> --
> View this message in context: 
> http://www.nabble.com/ejb-client-tp21193112s134p21193112.html
> Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.
>
>



-- 
Shawn


ejb client

2008-12-28 Thread axiez

I want to run sample code to understand ejb 3.0 basics. I am new to ejb. I
have the following java files: ShoppingCartBean.java, ShoppingCart.java and
Client.java. The Client.java file has the following code:
import javax.naming.InitialContext;
public class Client {
public static void main(String[] args) throws Exception {
InitialContext ctx = new InitialContext();
ShoppingCart cart = (ShoppingCart)
ctx.lookup("ShoppingCartBean/remote");
...
}
My plan is to have client on a different JVM than ejb container. I
wonder how the client can execute bean method without even knowing IP
address etc of the JVM that has the other code on ejb container.
-- 
View this message in context: 
http://www.nabble.com/ejb-client-tp21193112s134p21193112.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.



Re: AW: ejb client jndi problem

2007-09-27 Thread wanyna

Thanks.
In my test simple-ejb2-1.0.jar wrapped in an ear, test passed with jndi name 
"simple-ejb2-1.0.jar/Echo/org.apache.openejb.examples.counter.ejb2.Echo".

I am used to configure jndi name in openejb-jar.xml or other j2ee server's
application description file. Whaterver ejb wrapped in, and what type client
is, the same is jndi name.  I feel it's simple and easy to use.

I'm glad to hear you will make this consistent in next version.
But can you tell me why openejb3's jndi name was designed more complex now? 



djencks wrote:
> 
> 
> On Sep 25, 2007, at 6:47 PM, wanyna wrote:
> 
>>
>> Thanks.
>> By using jndi name like
>> "simple-ejb3/Echo/ 
>> org.apache.openejb.examples.counter.ejb3.EchoRemote",
>> client lookup success both ejb2 and ejb3 test.
>>
>> But when I wrap this ejb jar in an ear, my test application failed  
>> again.
>> What's correct jndi name in this case?
> 
> (I could be wrong in my answer).  In an ear, the first component of  
> the jndi name is the ejb jar name.  So if your ejb jar is called  
> simple-ejb3.jar, the jndi name would be
> 
> simple-ejb3.jar/Echo/org.apache.openejb.examples.counter.ejb3.EchoRemote
> 
> For a standalone ejb jar, the first component is the artifactId  
> specified in the geronimo plan for the app.  If you don't supply a  
> plan or don't supply a moduleId for the plan (it might be required,  
> I'm not sure), the default is the name of the jar with the extension  
> removed, in this case simple.ejb3.
> 
> So, you can get the same name in and out of the ear by setting the  
> artifactId to simple-ejb3.jar in the geronimo plan.
> 
> We're considering if and how to make this more consistent in 2.0.2  
> and/or 2.1
> 
> thanks
> david jencks
> 
>>
>>
>>
>>
>> Ueberbach, Michael wrote:
>>>
>>> Hi,
>>>
>>> I don't know exactly your situation, please check the following
>>> conditions:
>>> - you deployed a EJB 3.0 application in an xxx-ejb.jar
>>> - you configured an openejb-jar.xml deployment plan where you set an
>>> artifactId for your app, let's say "MyApp"
>>> - you have a session bean you want connect to, let's say  
>>> "MySessionBean"
>>> - you have build a remote interface for your session bean (EJB 3.0  
>>> means a
>>> simple interface), let's say "MySessionRemote"
>>>
>>> then the following is the right jndi name to get a connection to  
>>> your bean
>>>
>>> "MyApp/MySessionBean/my.package.MySessionRemote"
>>>
>>> You have to use the fully qualified class name for the Interface!
>>>
>>> Regards
>>> Michael
>>>
>>>
>>> -Ursprüngliche Nachricht-
>>> Von: wanyna [mailto:[EMAIL PROTECTED]
>>> Gesendet: Freitag, 21. September 2007 11:47
>>> An: user@geronimo.apache.org
>>> Betreff: ejb client jndi problem
>>>
>>>
>>> I deploy ejb jar in geronimo2.0.1, this is a ejb2 test
>>> http://www.nabble.com/file/p12813817/simple-ejb2-1.0.jar
>>> simple-ejb2-1.0.jar , and this is a ejb3 test
>>> http://www.nabble.com/file/p12813817/simple-ejb3-1.0.jar
>>> simple-ejb3-1.0.jar .
>>>
>>> Both of them deploy no error.
>>>
>>> My client is a standalone application. Test code:
>>> public class ClientTest {
>>>
>>> public static EchoRemote getEchoService(String url,
>>> String contextFactory) throws Exception {
>>> Context context = getInitialContext(contextFactory, url);
>>> Object obj = context.lookup("Echo");
>>> return (EchoRemote) obj;
>>> }
>>>
>>> public static CounterRemote getCounterService(String url,
>>> String contextFactory) throws Exception {
>>> Context context = getInitialContext(contextFactory, url);
>>> Object obj = context.lookup("SuperCounterBusinessRemote");
>>> return (CounterRemote) obj;
>>> }
>>>
>>> private static Context getInitialContext(String initContextFactory,
>>> String url) throws Exception {
>>> Properties properties = new Properties();
>>> properties.put(Context.INITIAL_CONTEXT_FACTORY,  
>>> initContextFactory);
>>> properties.put(Context.PROVIDER_URL, url

Re: AW: ejb client jndi problem

2007-09-26 Thread David Jencks


On Sep 25, 2007, at 6:47 PM, wanyna wrote:



Thanks.
By using jndi name like
"simple-ejb3/Echo/ 
org.apache.openejb.examples.counter.ejb3.EchoRemote",

client lookup success both ejb2 and ejb3 test.

But when I wrap this ejb jar in an ear, my test application failed  
again.

What's correct jndi name in this case?


(I could be wrong in my answer).  In an ear, the first component of  
the jndi name is the ejb jar name.  So if your ejb jar is called  
simple-ejb3.jar, the jndi name would be


simple-ejb3.jar/Echo/org.apache.openejb.examples.counter.ejb3.EchoRemote

For a standalone ejb jar, the first component is the artifactId  
specified in the geronimo plan for the app.  If you don't supply a  
plan or don't supply a moduleId for the plan (it might be required,  
I'm not sure), the default is the name of the jar with the extension  
removed, in this case simple.ejb3.


So, you can get the same name in and out of the ear by setting the  
artifactId to simple-ejb3.jar in the geronimo plan.


We're considering if and how to make this more consistent in 2.0.2  
and/or 2.1


thanks
david jencks






Ueberbach, Michael wrote:


Hi,

I don't know exactly your situation, please check the following
conditions:
- you deployed a EJB 3.0 application in an xxx-ejb.jar
- you configured an openejb-jar.xml deployment plan where you set an
artifactId for your app, let's say "MyApp"
- you have a session bean you want connect to, let's say  
"MySessionBean"
- you have build a remote interface for your session bean (EJB 3.0  
means a

simple interface), let's say "MySessionRemote"

then the following is the right jndi name to get a connection to  
your bean


"MyApp/MySessionBean/my.package.MySessionRemote"

You have to use the fully qualified class name for the Interface!

Regards
Michael


-Ursprüngliche Nachricht-
Von: wanyna [mailto:[EMAIL PROTECTED]
Gesendet: Freitag, 21. September 2007 11:47
An: user@geronimo.apache.org
Betreff: ejb client jndi problem


I deploy ejb jar in geronimo2.0.1, this is a ejb2 test
http://www.nabble.com/file/p12813817/simple-ejb2-1.0.jar
simple-ejb2-1.0.jar , and this is a ejb3 test
http://www.nabble.com/file/p12813817/simple-ejb3-1.0.jar
simple-ejb3-1.0.jar .

Both of them deploy no error.

My client is a standalone application. Test code:
public class ClientTest {

public static EchoRemote getEchoService(String url,
String contextFactory) throws Exception {
Context context = getInitialContext(contextFactory, url);
Object obj = context.lookup("Echo");
return (EchoRemote) obj;
}

public static CounterRemote getCounterService(String url,
String contextFactory) throws Exception {
Context context = getInitialContext(contextFactory, url);
Object obj = context.lookup("SuperCounterBusinessRemote");
return (CounterRemote) obj;
}

private static Context getInitialContext(String initContextFactory,
String url) throws Exception {
Properties properties = new Properties();
		properties.put(Context.INITIAL_CONTEXT_FACTORY,  
initContextFactory);

properties.put(Context.PROVIDER_URL, url);

return new InitialContext(properties);
}

public static void main(String[] args) throws Exception{
String url = "ejbd://localhost:4201";
String factory = 
"org.openejb.client.RemoteInitialContextFactory";
EchoRemote echo = getEchoService(url, factory);
assert("cba".equals(echo.echo("abc")));
//  CounterRemote counter = getCounterService(url, factory);
//  assert(counter.reset()==0);
//  assert(counter.increment()==1);
//  assert(counter.increment()==2);
//  assert(counter.reset()==0);
}

}

exception:
Exception in thread "main" javax.naming.NameNotFoundException: / 
Echo does
not exist in the system.  Check that the app was successfully  
deployed.
	at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java: 
237)

at javax.naming.InitialContext.lookup(InitialContext.java:351)
at test.ClientTest.getEchoService(ClientTest.java:17)
at test.ClientTest.main(ClientTest.java:40)

What's the right jndi name?

I see some other messages talk about ejb jndi, but still can't  
resolve my

problem.

I deploy ejb2 test in geronimo 1.x, client lookup no problem.
--
View this message in context:
http://www.nabble.com/ejb-client-jndi-problem- 
tf4492931s134.html#a12813817
Sent from the Apache Geronimo - Users mailing list archive at  
Nabble.com.





--
View this message in context: http://www.nabble.com/ejb-client-jndi- 
problem-tf4492931s134.html#a12892325
Sent from the Apache Geronimo - Users mailing list archive at  
Nabble.com.






Re: ejb client jndi problem

2007-09-25 Thread wanyna

By using jndi name like
"simple-ejb3/Echo/org.apache.openejb.examples.counter.ejb3.EchoRemote",
client lookup success both ejb2 and ejb3 test.

I feel what's talk about in http://openejb.apache.org/jndi-names.html is not
easy to understand.
And the default jndi name mentioned in this page not match my test.

How can I use same jndi name of a ejb in a web app or a standalone app?


prasad wrote:
> 
> Discussion in the below thread may or may not help you. Check it out.
> 
> http://www.nabble.com/forum/ViewPost.jtp?post=12197581&framed=y&skin=134
> 
> Also see
> http://openejb.apache.org/jndi-names.html
> 
> Cheers
> Prasad
> 
> On 9/21/07, wanyna <[EMAIL PROTECTED]> wrote:
>>
>> I deploy ejb jar in geronimo2.0.1, this is a ejb2 test
>> http://www.nabble.com/file/p12813817/simple-ejb2-1.0.jar
>> simple-ejb2-1.0.jar
>> , and this is a ejb3 test
>> http://www.nabble.com/file/p12813817/simple-ejb3-1.0.jar
>> simple-ejb3-1.0.jar
>> .
>>
>> Both of them deploy no error.
>>
>> My client is a standalone application. Test code:
>> public class ClientTest {
>>
>> public static EchoRemote getEchoService(String url,
>> String contextFactory) throws Exception {
>> Context context = getInitialContext(contextFactory, url);
>> Object obj = context.lookup("Echo");
>> return (EchoRemote) obj;
>> }
>>
>> public static CounterRemote getCounterService(String url,
>> String contextFactory) throws Exception {
>> Context context = getInitialContext(contextFactory, url);
>> Object obj =
>> context.lookup("SuperCounterBusinessRemote");
>> return (CounterRemote) obj;
>> }
>>
>> private static Context getInitialContext(String
>> initContextFactory,
>> String url) throws Exception {
>> Properties properties = new Properties();
>> properties.put(Context.INITIAL_CONTEXT_FACTORY,
>> initContextFactory);
>> properties.put(Context.PROVIDER_URL, url);
>>
>> return new InitialContext(properties);
>> }
>>
>> public static void main(String[] args) throws Exception{
>> String url = "ejbd://localhost:4201";
>> String factory =
>> "org.openejb.client.RemoteInitialContextFactory";
>> EchoRemote echo = getEchoService(url, factory);
>> assert("cba".equals(echo.echo("abc")));
>> //  CounterRemote counter = getCounterService(url, factory);
>> //  assert(counter.reset()==0);
>> //  assert(counter.increment()==1);
>> //  assert(counter.increment()==2);
>> //  assert(counter.reset()==0);
>> }
>>
>> }
>>
>> exception:
>> Exception in thread "main" javax.naming.NameNotFoundException: /Echo does
>> not exist in the system.  Check that the app was successfully deployed.
>> at
>> org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:237)
>> at javax.naming.InitialContext.lookup(InitialContext.java:351)
>> at test.ClientTest.getEchoService(ClientTest.java:17)
>>     at test.ClientTest.main(ClientTest.java:40)
>>
>> What's the right jndi name?
>>
>> I see some other messages talk about ejb jndi, but still can't resolve my
>> problem.
>>
>> I deploy ejb2 test in geronimo 1.x, client lookup no problem.
>> --
>> View this message in context:
>> http://www.nabble.com/ejb-client-jndi-problem-tf4492931s134.html#a12813817
>> Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/ejb-client-jndi-problem-tf4492931s134.html#a12892390
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.



Re: AW: ejb client jndi problem

2007-09-25 Thread wanyna

Thanks.
By using jndi name like
"simple-ejb3/Echo/org.apache.openejb.examples.counter.ejb3.EchoRemote",
client lookup success both ejb2 and ejb3 test.

But when I wrap this ejb jar in an ear, my test application failed again.
What's correct jndi name in this case?




Ueberbach, Michael wrote:
> 
> Hi, 
> 
> I don't know exactly your situation, please check the following
> conditions:   
> - you deployed a EJB 3.0 application in an xxx-ejb.jar
> - you configured an openejb-jar.xml deployment plan where you set an
> artifactId for your app, let's say "MyApp"
> - you have a session bean you want connect to, let's say "MySessionBean"
> - you have build a remote interface for your session bean (EJB 3.0 means a
> simple interface), let's say "MySessionRemote"
> 
> then the following is the right jndi name to get a connection to your bean
> 
> "MyApp/MySessionBean/my.package.MySessionRemote"
> 
> You have to use the fully qualified class name for the Interface!
> 
> Regards
> Michael
>  
> 
> -Ursprüngliche Nachricht-
> Von: wanyna [mailto:[EMAIL PROTECTED] 
> Gesendet: Freitag, 21. September 2007 11:47
> An: user@geronimo.apache.org
> Betreff: ejb client jndi problem
> 
> 
> I deploy ejb jar in geronimo2.0.1, this is a ejb2 test
> http://www.nabble.com/file/p12813817/simple-ejb2-1.0.jar
> simple-ejb2-1.0.jar , and this is a ejb3 test
> http://www.nabble.com/file/p12813817/simple-ejb3-1.0.jar
> simple-ejb3-1.0.jar .
> 
> Both of them deploy no error.
> 
> My client is a standalone application. Test code:
> public class ClientTest {
> 
>   public static EchoRemote getEchoService(String url,
>   String contextFactory) throws Exception {
>   Context context = getInitialContext(contextFactory, url);
>   Object obj = context.lookup("Echo");
>   return (EchoRemote) obj;
>   }
> 
>   public static CounterRemote getCounterService(String url,
>   String contextFactory) throws Exception {
>   Context context = getInitialContext(contextFactory, url);
>   Object obj = context.lookup("SuperCounterBusinessRemote");
>   return (CounterRemote) obj;
>   }
> 
>   private static Context getInitialContext(String initContextFactory,
>   String url) throws Exception {
>   Properties properties = new Properties();
>   properties.put(Context.INITIAL_CONTEXT_FACTORY, 
> initContextFactory);
>   properties.put(Context.PROVIDER_URL, url);
> 
>   return new InitialContext(properties);
>   }
>   
>   public static void main(String[] args) throws Exception{
>   String url = "ejbd://localhost:4201";
>   String factory = 
> "org.openejb.client.RemoteInitialContextFactory";
>   EchoRemote echo = getEchoService(url, factory);
>   assert("cba".equals(echo.echo("abc")));
> //CounterRemote counter = getCounterService(url, factory);
> //assert(counter.reset()==0);
> //assert(counter.increment()==1);
> //assert(counter.increment()==2);
> //assert(counter.reset()==0);
>   }
> 
> }
> 
> exception:
> Exception in thread "main" javax.naming.NameNotFoundException: /Echo does
> not exist in the system.  Check that the app was successfully deployed.
>   at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:237)
>   at javax.naming.InitialContext.lookup(InitialContext.java:351)
>   at test.ClientTest.getEchoService(ClientTest.java:17)
>   at test.ClientTest.main(ClientTest.java:40)
> 
> What's the right jndi name?
> 
> I see some other messages talk about ejb jndi, but still can't resolve my
> problem.
> 
> I deploy ejb2 test in geronimo 1.x, client lookup no problem. 
> --
> View this message in context:
> http://www.nabble.com/ejb-client-jndi-problem-tf4492931s134.html#a12813817
> Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/ejb-client-jndi-problem-tf4492931s134.html#a12892325
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.



AW: ejb client jndi problem

2007-09-21 Thread Ueberbach, Michael
Hi, 

I don't know exactly your situation, please check the following conditions:   
- you deployed a EJB 3.0 application in an xxx-ejb.jar
- you configured an openejb-jar.xml deployment plan where you set an artifactId 
for your app, let's say "MyApp"
- you have a session bean you want connect to, let's say "MySessionBean"
- you have build a remote interface for your session bean (EJB 3.0 means a 
simple interface), let's say "MySessionRemote"

then the following is the right jndi name to get a connection to your bean

"MyApp/MySessionBean/my.package.MySessionRemote"

You have to use the fully qualified class name for the Interface!

Regards
Michael
 

-Ursprüngliche Nachricht-
Von: wanyna [mailto:[EMAIL PROTECTED] 
Gesendet: Freitag, 21. September 2007 11:47
An: user@geronimo.apache.org
Betreff: ejb client jndi problem


I deploy ejb jar in geronimo2.0.1, this is a ejb2 test 
http://www.nabble.com/file/p12813817/simple-ejb2-1.0.jar simple-ejb2-1.0.jar , 
and this is a ejb3 test 
http://www.nabble.com/file/p12813817/simple-ejb3-1.0.jar simple-ejb3-1.0.jar .

Both of them deploy no error.

My client is a standalone application. Test code:
public class ClientTest {

public static EchoRemote getEchoService(String url,
String contextFactory) throws Exception {
Context context = getInitialContext(contextFactory, url);
Object obj = context.lookup("Echo");
return (EchoRemote) obj;
}

public static CounterRemote getCounterService(String url,
String contextFactory) throws Exception {
Context context = getInitialContext(contextFactory, url);
Object obj = context.lookup("SuperCounterBusinessRemote");
return (CounterRemote) obj;
}

private static Context getInitialContext(String initContextFactory,
String url) throws Exception {
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, 
initContextFactory);
properties.put(Context.PROVIDER_URL, url);

return new InitialContext(properties);
}

public static void main(String[] args) throws Exception{
String url = "ejbd://localhost:4201";
String factory = 
"org.openejb.client.RemoteInitialContextFactory";
EchoRemote echo = getEchoService(url, factory);
assert("cba".equals(echo.echo("abc")));
//  CounterRemote counter = getCounterService(url, factory);
//  assert(counter.reset()==0);
//  assert(counter.increment()==1);
//  assert(counter.increment()==2);
//  assert(counter.reset()==0);
}

}

exception:
Exception in thread "main" javax.naming.NameNotFoundException: /Echo does not 
exist in the system.  Check that the app was successfully deployed.
at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:237)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at test.ClientTest.getEchoService(ClientTest.java:17)
at test.ClientTest.main(ClientTest.java:40)

What's the right jndi name?

I see some other messages talk about ejb jndi, but still can't resolve my 
problem.

I deploy ejb2 test in geronimo 1.x, client lookup no problem. 
--
View this message in context: 
http://www.nabble.com/ejb-client-jndi-problem-tf4492931s134.html#a12813817
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: ejb client jndi problem

2007-09-21 Thread Prasad Kashyap
Discussion in the below thread may or may not help you. Check it out.

http://www.nabble.com/forum/ViewPost.jtp?post=12197581&framed=y&skin=134

Also see
http://openejb.apache.org/jndi-names.html

Cheers
Prasad

On 9/21/07, wanyna <[EMAIL PROTECTED]> wrote:
>
> I deploy ejb jar in geronimo2.0.1, this is a ejb2 test
> http://www.nabble.com/file/p12813817/simple-ejb2-1.0.jar simple-ejb2-1.0.jar
> , and this is a ejb3 test
> http://www.nabble.com/file/p12813817/simple-ejb3-1.0.jar simple-ejb3-1.0.jar
> .
>
> Both of them deploy no error.
>
> My client is a standalone application. Test code:
> public class ClientTest {
>
> public static EchoRemote getEchoService(String url,
> String contextFactory) throws Exception {
> Context context = getInitialContext(contextFactory, url);
> Object obj = context.lookup("Echo");
> return (EchoRemote) obj;
> }
>
> public static CounterRemote getCounterService(String url,
> String contextFactory) throws Exception {
> Context context = getInitialContext(contextFactory, url);
> Object obj = context.lookup("SuperCounterBusinessRemote");
> return (CounterRemote) obj;
> }
>
> private static Context getInitialContext(String initContextFactory,
> String url) throws Exception {
> Properties properties = new Properties();
> properties.put(Context.INITIAL_CONTEXT_FACTORY, 
> initContextFactory);
> properties.put(Context.PROVIDER_URL, url);
>
> return new InitialContext(properties);
> }
>
> public static void main(String[] args) throws Exception{
> String url = "ejbd://localhost:4201";
> String factory = 
> "org.openejb.client.RemoteInitialContextFactory";
> EchoRemote echo = getEchoService(url, factory);
> assert("cba".equals(echo.echo("abc")));
> //  CounterRemote counter = getCounterService(url, factory);
> //  assert(counter.reset()==0);
> //  assert(counter.increment()==1);
> //  assert(counter.increment()==2);
> //  assert(counter.reset()==0);
> }
>
> }
>
> exception:
> Exception in thread "main" javax.naming.NameNotFoundException: /Echo does
> not exist in the system.  Check that the app was successfully deployed.
> at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:237)
> at javax.naming.InitialContext.lookup(InitialContext.java:351)
> at test.ClientTest.getEchoService(ClientTest.java:17)
> at test.ClientTest.main(ClientTest.java:40)
>
> What's the right jndi name?
>
> I see some other messages talk about ejb jndi, but still can't resolve my
> problem.
>
> I deploy ejb2 test in geronimo 1.x, client lookup no problem.
> --
> View this message in context: 
> http://www.nabble.com/ejb-client-jndi-problem-tf4492931s134.html#a12813817
> Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.
>
>


Re: ejb client jndi problem

2007-09-21 Thread Lin Sun

Hi,

David has put a sample out here that does pretty much what you want to do -

http://people.apache.org/~dblevins/tmp/examples/SimpleApp/src/test/java/org/apache/openejb/examples/counter/EchoImplTest.java

You might want to modify your code a bit and try again.   I was able to 
run the EchoImplTest on g 2.0.1.


Lin


wanyna wrote:

I deploy ejb jar in geronimo2.0.1, this is a ejb2 test
http://www.nabble.com/file/p12813817/simple-ejb2-1.0.jar simple-ejb2-1.0.jar
, and this is a ejb3 test
http://www.nabble.com/file/p12813817/simple-ejb3-1.0.jar simple-ejb3-1.0.jar
.

Both of them deploy no error.

My client is a standalone application. Test code:
public class ClientTest {

public static EchoRemote getEchoService(String url,
String contextFactory) throws Exception {
Context context = getInitialContext(contextFactory, url);
Object obj = context.lookup("Echo");
return (EchoRemote) obj;
}

public static CounterRemote getCounterService(String url,
String contextFactory) throws Exception {
Context context = getInitialContext(contextFactory, url);
Object obj = context.lookup("SuperCounterBusinessRemote");
return (CounterRemote) obj;
}

private static Context getInitialContext(String initContextFactory,
String url) throws Exception {
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, 
initContextFactory);
properties.put(Context.PROVIDER_URL, url);

return new InitialContext(properties);
}

public static void main(String[] args) throws Exception{
String url = "ejbd://localhost:4201";
String factory = 
"org.openejb.client.RemoteInitialContextFactory";
EchoRemote echo = getEchoService(url, factory);
assert("cba".equals(echo.echo("abc")));
//  CounterRemote counter = getCounterService(url, factory);
//  assert(counter.reset()==0);
//  assert(counter.increment()==1);
//  assert(counter.increment()==2);
//  assert(counter.reset()==0);
}

}

exception:
Exception in thread "main" javax.naming.NameNotFoundException: /Echo does
not exist in the system.  Check that the app was successfully deployed.
at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:237)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at test.ClientTest.getEchoService(ClientTest.java:17)
at test.ClientTest.main(ClientTest.java:40)

What's the right jndi name?

I see some other messages talk about ejb jndi, but still can't resolve my
problem.

I deploy ejb2 test in geronimo 1.x, client lookup no problem. 




ejb client jndi problem

2007-09-21 Thread wanyna

I deploy ejb jar in geronimo2.0.1, this is a ejb2 test
http://www.nabble.com/file/p12813817/simple-ejb2-1.0.jar simple-ejb2-1.0.jar
, and this is a ejb3 test
http://www.nabble.com/file/p12813817/simple-ejb3-1.0.jar simple-ejb3-1.0.jar
.

Both of them deploy no error.

My client is a standalone application. Test code:
public class ClientTest {

public static EchoRemote getEchoService(String url,
String contextFactory) throws Exception {
Context context = getInitialContext(contextFactory, url);
Object obj = context.lookup("Echo");
return (EchoRemote) obj;
}

public static CounterRemote getCounterService(String url,
String contextFactory) throws Exception {
Context context = getInitialContext(contextFactory, url);
Object obj = context.lookup("SuperCounterBusinessRemote");
return (CounterRemote) obj;
}

private static Context getInitialContext(String initContextFactory,
String url) throws Exception {
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, 
initContextFactory);
properties.put(Context.PROVIDER_URL, url);

return new InitialContext(properties);
}

public static void main(String[] args) throws Exception{
String url = "ejbd://localhost:4201";
String factory = 
"org.openejb.client.RemoteInitialContextFactory";
EchoRemote echo = getEchoService(url, factory);
assert("cba".equals(echo.echo("abc")));
//  CounterRemote counter = getCounterService(url, factory);
//  assert(counter.reset()==0);
//  assert(counter.increment()==1);
//  assert(counter.increment()==2);
//  assert(counter.reset()==0);
}

}

exception:
Exception in thread "main" javax.naming.NameNotFoundException: /Echo does
not exist in the system.  Check that the app was successfully deployed.
at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:237)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at test.ClientTest.getEchoService(ClientTest.java:17)
at test.ClientTest.main(ClientTest.java:40)

What's the right jndi name?

I see some other messages talk about ejb jndi, but still can't resolve my
problem.

I deploy ejb2 test in geronimo 1.x, client lookup no problem. 
-- 
View this message in context: 
http://www.nabble.com/ejb-client-jndi-problem-tf4492931s134.html#a12813817
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.



RE: Geronimo EJB Help - Remote EJB Client Invocation

2007-02-21 Thread mark
It's a good start to work with Rick.  Thank you very much.  I'll setup the appropriate classpath.  I'm also betting that the JNDI name is throwing me off.  I'm just tyring to get a client to run from a seperate project in Eclipse at this point.  I was using the app client syntax and probably only need to look for just "ejb/Helloworld"?
 

It also appears that your running your Swing client on the same machine
as the server.  Any experience running it on another workstation? 
 Original Message Subject: RE: Geronimo EJB Help - Remote EJB Client InvocationFrom: "Carragher Jr, Richard" <[EMAIL PROTECTED]>Date: Wed, February 21, 2007 3:07 pmTo: 

We have a Swing client that accesses remote EJBs.  I'm not sure
that all of these are required, but this gets the job done. Here's our classpath:
    repository/openejb/openejb-core/2.1.1/openejb-core-2.1.1.jar    lib/geronimo-j2ee-deployment_1.1.1_spec-1.0.1.jar    lib/geronimo-kernel-1.1.1.jar    repository/geronimo/geronimo-security/1.1.1/geronimo-security-1.1.1.jar    repository/org/apache/geronimo/specs/geronimo-ejb_2.1_spec/1.0.1/geronimo-ejb_2.1_spec-1.0.1.jar    repository/org/apache/geronimo/specs/geronimo-j2ee-jacc_1.0_spec/1.1.1/geronimo-j2ee-jacc_1.0_spec-1.1.1.jar    lib/cglib-nodep-2.1_3.jar
 

For JNDI names, if you're running an Application Client, then you're
right about java:comp naming, but if you're running a standalone JVM, you have to use the jndi-name that the ejb publishes in the ejb-jar.xml.
 
Our jndi properties are:
java.naming.factory.initial=org.openejb.client.RemoteInitialContextFactoryjava.naming.provider.url="">java.naming.security.principal=systemjava.naming.security.credentials=manager
 
Hope this helps
Rick
 
 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 21, 2007 4:00 PMTo: user@geronimo.apache.orgCc: [EMAIL PROTECTED]Subject: Geronimo EJB Help - Remote EJB Client Invocation 

Hi All,
 

I've moved beyond a web application and am dabbling in EJB's.  I'm
running Geronimo 1.1.1 with a current version of Eclipse and the MyEclipse Plug-in as a development environment.  I've managed to educate myself on the MyEclipse way of EJB's using thier XDoclet support.  I've successfully produced an openejb-jar.xml deployment descriptor that results in a simple HelloWorld EJB deployed on the server.  Woo Hoo!  Hold the applause and party please, because I can't seem to call the damn thing!  Sooo, I thought I've done enough RTFM and I was ready to ask for help:) (As in not wasting anyones time, but ready to go see the professor before class)
 

1)  Remote client library requirements.  I've located the
openejb-core-2.1.1.jar.  I presumed this was all I might need for client access.  I've discovered the javax.ejb libraries aren't incorporated into this. (Specifically the javax.ejb.CreateException asserted the fact, but I'm sure this cascades catastrophically into many classes)  I know I can get them from a JBoss jar that MyEclipse includes, or maybe from the Eclipse Web Tools Project.  I worked with Visual Age for Java once upon a time and remember generating stubs and skeletons and client jar packaging.
 

Can someone direct me appropriately on Geronimo/OpenEJB client jar
generation from inside Eclipse?
 

Are all of the required client libraries for a remote call to OpenEJB
contained in the Geronimo distribution? i.e. javax.ejb  This might cascade to the web container, as in documenting what standard libraries are provided by Geronimo and what libraries are expected from other sources that might affect standard usage.  This would be really helpful.
 
 

2)  JNDI naming.  I think I might have gotten past this, but
want to confirm.  A remote object context lookup for an EJB will utilize a naming convention of "java:comp/env" concantenated ("/" presumed) with the value of the  from the beans openejb-jar.xml deployment descriptor.  i.e. ejb/HelloWorld = "java:/comp/env" + "/" + "ejb/HelloWorld" = ctx.lookup("java:comp/env/ejb/HelloWorld")  Is this correct?
 

I've downloaded MC4J in an attempt to view and validate the JNDI
tree.  It doesn't appear to be exposed via an MBean and there is no component of the console that appears to provide this information.  Is there anyway to actually see/validate the container directory entries?
 
 

3) Security Principal and Credentials.  I presumed the God
parameters of "system" and "manager" would suffice here. However, I appear to be catching an Authentication Exception.  I haven't seen any decent documentation on EJB deployment security configuration.  Is there a document somewhere specific for Geronimo/OpenEJB that clearly defines the deployment descriptor requirements in conjunction with a remote EJB client?
 
 

4) Prov

RE: Geronimo EJB Help - Remote EJB Client Invocation

2007-02-21 Thread Carragher Jr, Richard
We have a Swing client that accesses remote EJBs.  I'm not sure that all
of these are required, but this gets the job done. Here's our classpath:
repository/openejb/openejb-core/2.1.1/openejb-core-2.1.1.jar
lib/geronimo-j2ee-deployment_1.1.1_spec-1.0.1.jar
lib/geronimo-kernel-1.1.1.jar
 
repository/geronimo/geronimo-security/1.1.1/geronimo-security-1.1.1.jar
 
repository/org/apache/geronimo/specs/geronimo-ejb_2.1_spec/1.0.1/geronim
o-ejb_2.1_spec-1.0.1.jar
 
repository/org/apache/geronimo/specs/geronimo-j2ee-jacc_1.0_spec/1.1.1/g
eronimo-j2ee-jacc_1.0_spec-1.1.1.jar
lib/cglib-nodep-2.1_3.jar
 
For JNDI names, if you're running an Application Client, then you're
right about java:comp naming, but if you're running a standalone JVM,
you have to use the jndi-name that the ejb publishes in the ejb-jar.xml.
 
Our jndi properties are:
java.naming.factory.initial=org.openejb.client.RemoteInitialContextFacto
ry
java.naming.provider.url=localhost:4201
java.naming.security.principal=system
java.naming.security.credentials=manager
 
Hope this helps
Rick
 
 



From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 21, 2007 4:00 PM
To: user@geronimo.apache.org
Cc: [EMAIL PROTECTED]
Subject: Geronimo EJB Help - Remote EJB Client Invocation 


Hi All,
 
I've moved beyond a web application and am dabbling in EJB's.  I'm
running Geronimo 1.1.1 with a current version of Eclipse and the
MyEclipse Plug-in as a development environment.  I've managed to educate
myself on the MyEclipse way of EJB's using thier XDoclet support.  I've
successfully produced an openejb-jar.xml deployment descriptor that
results in a simple HelloWorld EJB deployed on the server.  Woo Hoo!
Hold the applause and party please, because I can't seem to call the
damn thing!  Sooo, I thought I've done enough RTFM and I was ready to
ask for help:) (As in not wasting anyones time, but ready to go see the
professor before class)
 
1)  Remote client library requirements.  I've located the
openejb-core-2.1.1.jar.  I presumed this was all I might need for client
access.  I've discovered the javax.ejb libraries aren't incorporated
into this. (Specifically the javax.ejb.CreateException asserted the
fact, but I'm sure this cascades catastrophically into many classes)  I
know I can get them from a JBoss jar that MyEclipse includes, or maybe
from the Eclipse Web Tools Project.  I worked with Visual Age for Java
once upon a time and remember generating stubs and skeletons and client
jar packaging.
 
Can someone direct me appropriately on Geronimo/OpenEJB client jar
generation from inside Eclipse?
 
Are all of the required client libraries for a remote call to OpenEJB
contained in the Geronimo distribution? i.e. javax.ejb  This might
cascade to the web container, as in documenting what standard libraries
are provided by Geronimo and what libraries are expected from other
sources that might affect standard usage.  This would be really helpful.
 
 
2)  JNDI naming.  I think I might have gotten past this, but want to
confirm.  A remote object context lookup for an EJB will utilize a
naming convention of "java:comp/env" concantenated ("/" presumed) with
the value of the  from the beans openejb-jar.xml deployment
descriptor.  i.e. ejb/HelloWorld =
"java:/comp/env" + "/" + "ejb/HelloWorld" =
ctx.lookup("java:comp/env/ejb/HelloWorld")  Is this correct?
 
I've downloaded MC4J in an attempt to view and validate the JNDI tree.
It doesn't appear to be exposed via an MBean and there is no component
of the console that appears to provide this information.  Is there
anyway to actually see/validate the container directory entries?
 
 
3) Security Principal and Credentials.  I presumed the God parameters of
"system" and "manager" would suffice here. However, I appear to be
catching an Authentication Exception.  I haven't seen any decent
documentation on EJB deployment security configuration.  Is there a
document somewhere specific for Geronimo/OpenEJB that clearly defines
the deployment descriptor requirements in conjunction with a remote EJB
client?
 
 
4) Provider URL. Pretty basic.  "localhost:4201" as the default local
server, "server.domain.gtld:4201" for remote network clients.  Obviously
Name Services, Firewalls, and Nat impact this information.  What other
container configuration might be required for remote EJB client access
to EJB's?  I've seen reference to  descriptors for the GBean of
OpenEJB.  Can someone confirm the default and necessary requirements to
make it accessible from the localhost, a specific address, a subnet, or
globally?
 
 
 
5) How consistent is this going forward to 1.2 and 2.0?  I presume 2.0
is EJB 3.0 compliant.  I'd like to follow this lesson through to an EJB
3.

Geronimo EJB Help - Remote EJB Client Invocation

2007-02-21 Thread mark
Hi All,
 

I've moved beyond a web application and am dabbling in EJB's.  I'm
running Geronimo 1.1.1 with a current version of Eclipse and the MyEclipse Plug-in as a development environment.  I've managed to educate myself on the MyEclipse way of EJB's using thier XDoclet support.  I've successfully produced an openejb-jar.xml deployment descriptor that results in a simple HelloWorld EJB deployed on the server.  Woo Hoo!  Hold the applause and party please, because I can't seem to call the damn thing!  Sooo, I thought I've done enough RTFM and I was ready to ask for help:) (As in not wasting anyones time, but ready to go see the professor before class)
 

1)  Remote client library requirements.  I've located the
openejb-core-2.1.1.jar.  I presumed this was all I might need for client access.  I've discovered the javax.ejb libraries aren't incorporated into this. (Specifically the javax.ejb.CreateException asserted the fact, but I'm sure this cascades catastrophically into many classes)  I know I can get them from a JBoss jar that MyEclipse includes, or maybe from the Eclipse Web Tools Project.  I worked with Visual Age for Java once upon a time and remember generating stubs and skeletons and client jar packaging.
 

Can someone direct me appropriately on Geronimo/OpenEJB client jar
generation from inside Eclipse?
 

Are all of the required client libraries for a remote call to OpenEJB
contained in the Geronimo distribution? i.e. javax.ejb  This might cascade to the web container, as in documenting what standard libraries are provided by Geronimo and what libraries are expected from other sources that might affect standard usage.  This would be really helpful.
 
 

2)  JNDI naming.  I think I might have gotten past this, but
want to confirm.  A remote object context lookup for an EJB will utilize a naming convention of "java:comp/env" concantenated ("/" presumed) with the value of the  from the beans openejb-jar.xml deployment descriptor.  i.e. ejb/HelloWorld = "java:/comp/env" + "/" + "ejb/HelloWorld" = ctx.lookup("java:comp/env/ejb/HelloWorld")  Is this correct?
 

I've downloaded MC4J in an attempt to view and validate the JNDI
tree.  It doesn't appear to be exposed via an MBean and there is no component of the console that appears to provide this information.  Is there anyway to actually see/validate the container directory entries?
 
 

3) Security Principal and Credentials.  I presumed the God
parameters of "system" and "manager" would suffice here. However, I appear to be catching an Authentication Exception.  I haven't seen any decent documentation on EJB deployment security configuration.  Is there a document somewhere specific for Geronimo/OpenEJB that clearly defines the deployment descriptor requirements in conjunction with a remote EJB client?
 
 

4) Provider URL. Pretty basic.  "localhost:4201" as the default
local server, "server.domain.gtld:4201" for remote network clients.  Obviously Name Services, Firewalls, and Nat impact this information.  What other container configuration might be required for remote EJB client access to EJB's?  I've seen reference to  descriptors for the GBean of OpenEJB.  Can someone confirm the default and necessary requirements to make it accessible from the localhost, a specific address, a subnet, or globally?
 
 
 

5) How consistent is this going forward to 1.2 and 2.0?  I presume
2.0 is EJB 3.0 compliant.  I'd like to follow this lesson through to an EJB 3.0 with Web Service Exposure.  Maybe even some web service transaction examples!
 
 
 

BTW, I'm running this development concurrently on my Windows platform
and OS X:) 
 
Thanks for any help.  I greatly appreciate it!
 
Mark Aufdencamp
[EMAIL PROTECTED]



Newbie question about ejb client jar

2006-05-23 Thread Jay D. McHugh

Hello all,

I have just started learning how about EJB's and most of what I have 
found as far as tutorials refer to EJB containers besides the one in 
Geronimo.


My question is where would I find either the location of the client jar 
file that is created when I deploy an EJB -or- a tutorial/reference 
(preferably on-line) that gives a clear explanation of the process from 
EJB deployment to the creation of a client that uses the newly deployed 
EJB within Geronimo?


Thanks in advance,


Jay


Re: Remote EJB client apps

2006-03-15 Thread Gianny Damour

Hi,

Here is how to get an initial context:
   Properties p = new Properties();
   p.put("java.naming.factory.initial", 
"org.openejb.client.RemoteInitialContextFactory");

   p.put("java.naming.provider.url", "127.0.0.1:4201");
 
   InitialContext ctx = new InitialContext(p);
   BasicStatefulHome home = (BasicStatefulHome) 
ctx.lookup("client/tests/stateless/BasicStatelessHome");


And how to declare the JNDI name in the openejb-jar.xml DD:
   
   BasicStatefulBean
   client/tests/stateless/BasicStatelessHome

Thanks,
Gianny

Aaron Mulder wrote:


Actually, application clients are the one thing that can use JNDI
lookups to access EJBs (but not other components such as JMS or JDBC
resources) -- that's what the jndi-name setting in openejb-jar.xml is
used for.  If you have a J2EE application client (that runs in a
client container) then you can still use java:comp/env for everything,
but if you have a client that does not run in a client container then
you need the InitialContext settings like you're talking about.

Unfortunately, I don't have those settings off the top of my head -- I
know it's been on the mailing list before though.

Thanks,
  Aaron

On 3/15/06, David Carew <[EMAIL PROTECTED]> wrote:
 


By "Remote EJB client apps" I mean a standalone app running  a different
machine  from the Geronimo server accessing EJBs running on the Geronimo
server.

What are the properties required for InitialContext for a remote EJB Client
doing a JNDI lookup ?

Besides the stubs specific to the EJBs I need to call, what jar files do I
need in the remote client JVMs classpath ?

I've seen in a few threads where it has been said that Geronimo doesn't have
a Global JNDI namespace. If I understand this correctly all JNDI lookups
(including those from remote EJB clients) must be done via java:comp/env. Is
that correct ?

TIA



   




 






Re: Remote EJB client apps

2006-03-15 Thread Aaron Mulder
Actually, application clients are the one thing that can use JNDI
lookups to access EJBs (but not other components such as JMS or JDBC
resources) -- that's what the jndi-name setting in openejb-jar.xml is
used for.  If you have a J2EE application client (that runs in a
client container) then you can still use java:comp/env for everything,
but if you have a client that does not run in a client container then
you need the InitialContext settings like you're talking about.

Unfortunately, I don't have those settings off the top of my head -- I
know it's been on the mailing list before though.

Thanks,
   Aaron

On 3/15/06, David Carew <[EMAIL PROTECTED]> wrote:
> By "Remote EJB client apps" I mean a standalone app running  a different
> machine  from the Geronimo server accessing EJBs running on the Geronimo
> server.
>
> What are the properties required for InitialContext for a remote EJB Client
> doing a JNDI lookup ?
>
> Besides the stubs specific to the EJBs I need to call, what jar files do I
> need in the remote client JVMs classpath ?
>
> I've seen in a few threads where it has been said that Geronimo doesn't have
> a Global JNDI namespace. If I understand this correctly all JNDI lookups
> (including those from remote EJB clients) must be done via java:comp/env. Is
> that correct ?
>
> TIA
>
>
>


Remote EJB client apps

2006-03-15 Thread David Carew
By "Remote EJB client apps" I mean a standalone app running  a different machine  from the Geronimo server accessing EJBs running on the Geronimo server.What are the properties required for InitialContext for a remote EJB Client doing a JNDI lookup ?
Besides the stubs specific to the EJBs I need to call, what jar files do I need in the remote client JVMs classpath ?I've seen in a few threads where it has been said that Geronimo doesn't have a Global JNDI namespace. If I understand this correctly all JNDI lookups (including those from remote EJB clients) must be done via java:comp/env. Is that correct ?
TIA


Secure connection between EJB client and server

2006-03-06 Thread Tero Mäntyvaara
Hi!

I am searching Java Enterprise Edition server capable of securing communication 
between EJB client and server.

I found that Geronimo 1.0 doumentation mentions that it does not support secure 
connection between EJB client and server "Currently secure
access to EJBs is not supported" (9.6. Configuring SSL/HTTPS).

When this feature is going to be supported?

Tero Mäntyvaara



Securing connection between EJB client and server

2006-03-03 Thread Tero Mäntyvaara
Hi!

I found that Geronimo 1.0 doumentation mentions that it does not suppot
securing connection between EJB client and server "Currently secure
access to EJBs is not supported" (9.6. Configuring SSL/HTTPS).

When this feature is going to be supported?

Tero Mäntyvaara