Return-Path: Delivered-To: apmail-geronimo-user-archive@www.apache.org Received: (qmail 7226 invoked from network); 11 Mar 2009 02:21:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Mar 2009 02:21:25 -0000 Received: (qmail 66110 invoked by uid 500); 11 Mar 2009 02:21:23 -0000 Delivered-To: apmail-geronimo-user-archive@geronimo.apache.org Received: (qmail 66085 invoked by uid 500); 11 Mar 2009 02:21:23 -0000 Mailing-List: contact user-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: user@geronimo.apache.org List-Id: Delivered-To: mailing list user@geronimo.apache.org Received: (qmail 66076 invoked by uid 99); 11 Mar 2009 02:21:23 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Mar 2009 19:21:23 -0700 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of rwonly@gmail.com designates 209.85.200.170 as permitted sender) Received: from [209.85.200.170] (HELO wf-out-1314.google.com) (209.85.200.170) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Mar 2009 02:21:16 +0000 Received: by wf-out-1314.google.com with SMTP id 23so2697759wfg.25 for ; Tue, 10 Mar 2009 19:20:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=aSqcpRyA6unigWaiDulAa9OO5aqyE/1cu23Mv/QITII=; b=Xu9ZLTFo+z17albc92+P2CbjbAbbonfuIOCVPF71kTRD9Y6JZW8kvtV7RR//+jFVot nIzBblj+pb6eHDA88afeJyTXJvjTkEEunFCTUeJV4SoJsMO/OJCZHVD/9VoUhS9vvnBV DzpQgAJcOBtZ7ts6mULFzvjvY8VB2QUIBZDdg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=jy4XqCqC5jt5jEPndBXVqhByQSnW4dp3Blq2WnPvm2aHWxxOoD9g+m6CbGoROHyTWy 5xt5bm8j84XAL6RK3dfpiFza7092rV5UeDgi/BJ8R+xILJ0+3ClY5VJyrqq/U4GU3dmo Fmvs0PpERCRlUQ8uRIu/phMjSVBLMoP8SxxWc= MIME-Version: 1.0 Received: by 10.142.230.11 with SMTP id c11mr3418711wfh.219.1236738056118; Tue, 10 Mar 2009 19:20:56 -0700 (PDT) In-Reply-To: <69BEFCE5AAEBCA44B1301AD2360E83C7840D0142A0@MATSVEC14.mclane.local> References: <69BEFCE5AAEBCA44B1301AD2360E83C7840CDAB8CF@MATSVEC14.mclane.local> <25b884430903092120h72b1831va2633d82eb391c59@mail.gmail.com> <69BEFCE5AAEBCA44B1301AD2360E83C7840CDAB9EA@MATSVEC14.mclane.local> <25b884430903092246u5376a317i589e9e8e498f6991@mail.gmail.com> <25b884430903100123r7f16906i9f0fa71f89b11616@mail.gmail.com> <69BEFCE5AAEBCA44B1301AD2360E83C7840D0142A0@MATSVEC14.mclane.local> Date: Wed, 11 Mar 2009 10:20:56 +0800 Message-ID: Subject: Re: JNDI in Geronimo 2 From: Rex Wang To: user@geronimo.apache.org Content-Type: multipart/alternative; boundary=000e0cd2301a83e3750464ce84fe X-Virus-Checked: Checked by ClamAV on apache.org --000e0cd2301a83e3750464ce84fe Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Russell, could you provide the whole exception strack? I can not got your problem. here is my code: public class Client { public static void main(String[] args) throws Exception { try { Properties p =3D new Properties(); p.setProperty("java.naming.factory.initial", "org.apache.openejb.client.RemoteInitialContextFactory"); p.setProperty("java.naming.provider.url", "ejbd://localhost:4201"); InitialContext context =3D new InitialContext(p); FirstObjectRemote obj=3D (FirstObjectRemote) context.lookup("FirstObjectBeanRemote"); System.out.println(obj.hello("Rex")); } catch (Exception e) { e.printStackTrace(); } } } I try it with Tang's EJB code as follows: import javax.ejb.Stateless; @Stateless public class FirstObjectBean implements FirstObjectRemote{ public String hello(String name){ return "Hello " + name; } } import javax.ejb.Remote; @Remote public interface FirstObjectRemote { public String hello(String name); } Rex 2009/3/11 Russell Collins > Thank you Wang and Tang. Here are the things that I have done. > > > > =B7 Changed the JDK to version 1.5.0_6 > > =B7 Updated all of my classes to use this version of Java > > =B7 Changed the provider url to ejbd://localhost:4201 > > > > I get the error > > > > *java.lang.RuntimeException*: Invalid response from server: -1 > > > > > > > > > > *From:* Ying Tang [mailto:yingtang1983@gmail.com] > *Sent:* Tuesday, March 10, 2009 3:23 AM > > *To:* user@geronimo.apache.org > *Subject:* Re: JNDI in Geronimo 2 > > > > Yes, should be ejbd://localhost:4201. The same as the example in the doc= > . > > 2009/3/10 Rex Wang > > Tang, I believe Russell use a remote client, but not a application client= . > > to Russell, try "ejbd://localhost:4201" > > > Rex. > > 2009/3/10 Ying Tang > > > > Hi Russell, > > I suggest you use JDK 1.5 instead of 1.6. It is also recommended that > Eclipse and Geronimo use the same Java environment. > > Please let me know if there is still any problem. > > Best Regards, > > Ying Tang > > 2009/3/10 Russell Collins > > > > Thank you Tang. This should be real strait forward but there has got to = be > some reason why this is not working. Here is the configuration that I > have. This may help in solving this issue. > > > > Eclipse Ganymede > > Java 1.6..0_11 > > Geronimo 2.1.2 > > Geronimo 2.1.3 (tried it on both) > > > > There are a couple of other things that I tried that gave me different > results. > > 1. Added a runtime dependency to the Geronimo Runtime. This gave me a > different error. It was a java runtime error that said that the response > from the server is: -1 > > 2. Created a client j2ee application to run my app. > > > > Basically, I am following everything in that link that you sent me. I am > just getting these errors when trying to look up the object. Any more > insight would be greatly appreciated. > > > > > > *From:* Ying Tang [mailto:yingtang1983@gmail.com] > *Sent:* Monday, March 09, 2009 11:21 PM > *To:* user@geronimo.apache.org > *Subject:* Re: JNDI in Geronimo 2 > > > > Hi *Error! Filename not specified.*Russell, > > > I tried your example on Geronimo 2.1.4. > > 1. I renamed the implementation class as FirstObjectBean. A bit differe= nt > from your code: > --------------------------------------------------- > > @Stateless > > *public* *class* *FirstObjectBean* *implements* *FirstObjectRemote* { > import > > * public* *String* *hello*(*String* name){ > > *return* "Hello " + name; > > } > > } > --------------------------------------------------- > > 2. In the application client that referece the EJB, I used > --------------------------------------------------- > *import ejb.FirstObjectRemote;* > ... > *FirstObjectRemote* firstObject =3D (*FirstObjectRemote*)context.*lookup*= (" > FirstObjectBeanRemote"); > --------------------------------------------------- > 3. Add the EJB project to the build path of the application client projec= t. > > 4. Add the two projects to the Geronimo server, and run the application > client. > > The application works well and the "Hello Russel" message shows up. > > For more detailed information, please refer to: > > http://cwiki.apache.org/confluence/display/GMOxDOC22/Deploying+and+runnin= g+EJB+application+clients > > Hope this helps. > > > Best Regards, > > Ying Tang (Sophia) > > 2009/3/9 Russell Collins > > Hello. I am new to the list, new to EJB 3.0 and new to Geronimo 2. I am > pretty sure I understand all of the concepts but I am having an issue wit= h a > JNDI lookup in Geronimo. I have created a Bean and it looks as follows. > > > > Interface: > > > > @Remote > > *public* *interface* *FirstObjectRemote* { > > *public* *String* *hello*(*String* name); > > } > > > > Class: > > > > @Stateless > > *public* *class* *FirstObject* *implements* *FirstObjectRemote* { > > > > *public* *FirstObject*() { > > } > > > > @Override > > * public* *String* *hello*(*String* name){ > > *return* "Hello " + name; > > } > > > > } > > > > Everything deploys just fine (at lease I think it does). I created a tes= t > class: > > > > > > *public* *class* *TheClass* > > { > > *public* *static* *void* *main*(*String*[] args) > > { > > *Properties* prop=3D*new* *Properties*(); > > prop.*put*(*Context*.*INITIAL_CONTEXT_FACTORY*, > "org.apache.openejb.client.RemoteInitialContextFactory"); > > prop.*put*(*Context*.*PROVIDER_URL*, "ejbd://localhost:1099")= ; > > > > *try*{ > > *Context* context =3D *new* *InitialContext*(prop); > > *FirstObjectRemote* firstObject =3D (*FirstObjectRemote= * > )context.*lookup*("FirstObjectRemote"); > > *System*.*out*.*println*(firstObject.*hello*("Russell" > )); > > } > > *catch*(*Exception* ex){ > > *System*.*out*.*println*(ex.*toString*()); > > } > > > > } > > } > > > > > > I get an error I when trying to run this. The error that comes back is: > > > > > > *javax.naming.NamingException*: Cannot lookup '/FirstObjectRemote'. [Root > exception is *java.rmi.RemoteException*: Error while communicating with > server: ; nested exception is: > > java.lang.NoClassDefFoundError: javax/transaction/RollbackException= ] > > > > > > > > What am I missing? > > > > > > > > > --000e0cd2301a83e3750464ce84fe Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Russell, could you provide the whole exception strack?

I can not got= your problem.

here is my code:
public class Client {
=A0=A0= =A0 public static void main(String[] args) throws Exception {

=A0=A0= =A0 =A0=A0=A0 try {
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 Properties p =3D new Properties();
=A0=A0= =A0 =A0=A0=A0 =A0=A0=A0 p.setProperty("java.naming.factory.initial&quo= t;, "org.apache.openejb.client.RemoteInitialContextFactory");
= =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 p.setProperty("java.naming.provider.url&= quot;, "ejbd://localhost:4201");
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 InitialCont= ext context =3D new InitialContext(p);

=A0=A0=A0 =A0=A0=A0 =A0=A0=A0= FirstObjectRemote obj=3D (FirstObjectRemote) context.lookup("FirstObj= ectBeanRemote");
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 System.out.println(o= bj.hello("Rex"));

=A0=A0=A0 =A0=A0=A0 } catch (Exception e) {
=A0=A0=A0 =A0=A0=A0 =A0= =A0=A0 e.printStackTrace();
=A0=A0=A0 =A0=A0=A0 }

=A0=A0=A0 }
= }

I try it with Tang's EJB code as follows:
import javax.ejb.= Stateless;
@Stateless
public class FirstObjectBean implements FirstOb= jectRemote{
=A0=A0=A0 =A0=A0=A0 public String hello(String name){
=A0=A0=A0 =A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 return "Hello " + n= ame;
=A0=A0=A0 =A0=A0 }
}


import javax.ejb.Remote;
@Rem= ote
public interface FirstObjectRemote {
=A0=A0=A0 public String hell= o(String name);
}



Rex



2009/3/11 Ru= ssell Collins <Russell.Collins@mclaneat.com>

Thank you Wang an= d Tang.=A0 Here are the things that I have done.

=A0

=B7=A0=A0=A0=A0=A0=A0=A0=A0 Changed the JDK to version 1.5.0_6

=B7=A0=A0=A0=A0=A0=A0=A0=A0 Updated all of my classes to use this version of Java

=B7=A0=A0=A0=A0=A0=A0=A0=A0 Changed the provider url to ejbd://localhost:4201

=A0

I get the error <= /span>

=A0

java.lang.RuntimeException: Invalid res= ponse from server: -1

=A0

=A0

=A0

=A0

From: Ying Tang [mailto:yingtan= g1983@gmail.com]
Sent: Tuesday, March 10, 2009 3:23 AM


To: us= er@geronimo.apache.org
Subject: Re: JNDI in Geronimo 2

=A0

Yes,=A0 should be ejbd://localhost:4201. The same as the example in the doc.

2009/3/10 Rex Wang <rwonly@gmail.com>

Tang, I believe Russell use a remote client, but not a application client.

to Russell, try "ejbd://localhost:4201"


Rex.

2009/3/10 Ying Tang <yingtang1983@gmail.com>

=A0

Hi Russell,

I suggest you use JDK 1.5 instead of 1.6. It is also recommended that Eclip= se and Geronimo use the same Java environment.

Please let me know if there is still any problem.

Best Regards,

Ying Tang

2009/3/10 Russell Collins <Russell.Collins@mclaneat.com>

=A0

Thank you Tang.= =A0 This should be real strait forward but there has got to be some reason why this = is not working.=A0 Here is the configuration that I have.=A0 This may help in solving this issue.

=A0

Eclipse Ganymede<= /span>

Java 1.6..0_11

Geronimo 2.1.2

Geronimo 2.1.3 (t= ried it on both)

=A0

There are a coupl= e of other things that I tried that gave me different results.=A0

1.=A0=A0=A0 Added a runtime dependency to the Geronimo Runtime.=A0 This gave me a different error.=A0 It was a java runtime error that said that the response from the server is: -1

2.=A0=A0=A0 Created a client j2ee application to run my app.

=A0

Basically, I am f= ollowing everything in that link that you sent me.=A0 I am just getting these errors when trying to look up the object.=A0 Any more insight would be greatly appreciated.

=A0

=A0

From: Ying Tang [mailto:yingtang1983@gmail.com]
Sent: Monday, March 09, 2009 11:21 PM
To: us= er@geronimo.apache.org
Subject: Re: JNDI in Geronimo 2

=A0

Hi Error! Filename not specified.Russell,



I tried your example on Geronimo 2.1.4.

1. I renamed the implementation class=A0 as FirstObjectBean.=A0 A bit different from your code:
---------------------------------------------------

@Stateless

public <= span style=3D"font-size: 10pt; font-family: "Courier New"; color:= rgb(0, 64, 128);">class FirstObjectBean implements FirstObjectRemote { import

=A0=A0 public String<= /span> hello(String name){

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 return "Hello " + name;

=A0=A0 }

}
---------------------------------------------------

2.=A0 In the application client that referece the EJB, I used
---------------------------------------------------
import ejb.FirstOb= jectRemote;
...
FirstObjectRemote firstObject =3D (F= irstObjectRemote)context.lookup("FirstObjectBeanRemote");
---------------------------------------------------
3. Add the EJB project to the build path of the application client project.=
4. Add the two projects to the Geronimo server, and run the application cli= ent.

The application works well and the "Hello Russel" message shows u= p.

For more detailed information, please refer to:
http://cwiki.apache.o= rg/confluence/display/GMOxDOC22/Deploying+and+running+EJB+application+clien= ts

Hope this helps.


Best Regards,

Ying Tang=A0 (Sophia)

2009/3/9 Russell Collins <Russell.Collins@mclaneat.com>

Hello.=A0 I am new to the list, new to E= JB 3.0 and new to Geronimo 2.=A0 I am pretty sure I understand all of the concepts but I am having an issue with a JNDI lookup in Geronimo.=A0 I have created a Bean and it looks as follows.

=A0

Interface:

=A0

@Remote

public <= span style=3D"font-size: 10pt; font-family: "Courier New"; color:= rgb(0, 64, 128);">interface FirstObjectRemote {

=A0=A0=A0=A0=A0 public = String hello(St= ring name);

}

=A0

Class:

=A0

@Stateless

public <= span style=3D"font-size: 10pt; font-family: "Courier New"; color:= rgb(0, 64, 128);">class FirstObject implements FirstObjectRemote {=

= =A0

=A0=A0 public = FirstObject() {

=A0=A0 }

= =A0

=A0=A0 @Override

=A0=A0 public String<= /span> hello(String name){

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 return "Hello " + name;

=A0=A0 }

= =A0

}

=A0

Everything deploys just fine (at lease I= think it does).=A0 I created a test class:

=A0

=A0

public <= span style=3D"font-size: 10pt; font-family: "Courier New"; color:= rgb(0, 64, 128);">class TheClass

{=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0

public static voidmain(String[] args)

=A0=A0=A0=A0=A0 {

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Properties prop=3Dnew Properties(= );

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 prop.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.Re= moteInitialContextFactory");

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 prop.put(Context.PROVIDER_URL, "ejbd://localhost:1099");

=A0=A0=A0=A0=A0

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 try{=A0

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Context context =3D new InitialContext= (prop);

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 FirstObjectRemote firstObject (FirstObjectRemote)context.lookup("FirstOb= jectRemote");

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 System.out.print= ln(firstObject.hello("Russell"));

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 }

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 catch(Exception ex){<= /span>

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 System.out.print= ln(ex.toString());

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 }

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0

=A0=A0=A0=A0=A0 }=A0=A0=A0=A0

}

=A0

=A0

I get an error I when trying to run this.=A0 The error that comes back is:

=A0

=A0

javax.naming.NamingException: Cannot lo= okup '/FirstObjectRemote'. [Root exception is java.rm= i.RemoteException: Error while communicating with server: ; nested exception is:

=A0=A0=A0=A0=A0 java.lang.NoClassDefFoundError: javax/transaction/RollbackException]=

=A0

=A0

=A0

What am I missing?

=A0

=A0

=A0

=A0


--000e0cd2301a83e3750464ce84fe--