geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lin Sun" <linsun....@gmail.com>
Subject Re: EJB Injection Problem
Date Tue, 02 Sep 2008 18:17:27 GMT
Hi,

We have a daytrader ear module
(http://svn.apache.org/viewvc/geronimo/daytrader/trunk/) that has two
application clients(wsappclient and streamer).  You can execute the
app client inside the app container.  For example, in
GERONIMO_HOME/bin directory, execute:

client.[bat|sh]
org.apache.geronimo.daytrader/daytrader-ws-client/2.2-SNAPSHOT/car
[additional parameters]

Lin

On Tue, Sep 2, 2008 at 1:57 PM, Jeremy Cowgar <jeremy@cowgar.com> wrote:
> It is a J2EE app but run outside of the container. A swing app that will
> access the Geronimo server remotely. I guess my use of "stand alone" was not
> correct. How does a user execute the ear client module?
>
> Jeremy
>
> On Sep 2, 2008, at 1:50 PM, David Jencks wrote:
>
>>
>> On Sep 2, 2008, at 5:40 AM, Jeremy Cowgar wrote:
>>
>>> I am having problems using a stand alone program.
>>
>> Injection only works with jee app clients, typically deployed as a client
>> module in an ear.  I wouldn't describe these as "stand alone"
>>
>> thanks
>> david jencks
>>
>>
>>> I have the following code:
>>>
>>> public class Main {
>>>        @EJB
>>>        private GreeterRemote greeter;
>>>
>>>        public static void main(String[] args) {
>>>                new Main();
>>>        }
>>>
>>>        public Main() {
>>>                System.out.println(greeter.getGreeting("Jeremy"));
>>>        }
>>>
>>> }
>>>
>>> greeter is always null. If I provide an initial context and do the lookup
>>> myself, it works as expected:
>>>
>>> public class Main {
>>>        private GreeterRemote greeter;
>>>
>>>        public static void main(String[] args) {
>>>                new Main();
>>>        }
>>>
>>>        public Main() {
>>>                super();
>>>
>>>                try {
>>>                        InitialContext ic = new InitialContext();
>>>                        greeter = (GreeterRemote)
>>> ic.lookup("GreeterRemote");
>>>                        System.out.println(greeter.getGreeting("Jeremy"));
>>>                } catch (NamingException e) {
>>>                        e.printStackTrace();
>>>                }
>>>
>>>        }
>>>
>>> }
>>>
>>> For the InitialContext() one to work, I have supplied a jndi.properties
>>> file:
>>>
>>>
>>> java.naming.factory.initial=org.openejb.client.RemoteInitialContextFactory
>>> java.naming.provider.url=localhost:4201
>>>
>>> Does anyone have any thoughts?
>>>
>>> Thank you,
>>>
>>> Jeremy
>>>
>>
>
>

Mime
View raw message