Peter Routtier-Wone wrote:
>
> You appear to be trying to use the HelloHome interface.
>
> I think what you are after is the Hello interface; home interfaces are
> infrastructural stuff designed to allow the container factories to
> manufacture instances of the appropriate classes and to allow the container
> to interact with those instances in the process of managing their life
> cycles. You do not use them directly.
Yes you do. A client looks up the bean in JNDI, getting a reference to
its home interface, then calls 'create' or 'findByXXX' methods on it.
>
> Have another look at the sample that works.
Please do.
InitialContext ctx = new InitialContext();
Object o = ctx.lookup("ClientManager");
ClientManagerHome clientHome =
(ClientManagerHome)PortableRemoteObject.narrow(o,
ClientManagerHome.class);
clientManager = clientHome.create();
Note use of the Home interface and the call to the create method.
>
> There is an excellent (if gigantic) book called "Professional Java Server
> Programming J2EE Edition" that goes into every single element of the Java 2
> enterprise edition platform from JDBC to EJB including the EJB2.0
> message-driven bean extensions. You may find this useful.
>
> ----- Original Message -----
> From: "Pär Fornland" <[EMAIL PROTECTED]>
> To: "'JBoss-User'" <[EMAIL PROTECTED]>
> Sent: Thursday, March 08, 2001 11:23 AM
> Subject: SV: [jBoss-User] ouch, newbie trouble
>
> Hmm. Been there. Done that. Doesn't help.
>
> Thanks for the effort though.
>
> ______________________________________s_p_r_a_y_
> Dr. Pär Fornland
>
> > -----Ursprungligt meddelande-----
> > Från: William Keller [mailto:[EMAIL PROTECTED]]
> > Skickat: den 8 mars 2001 03:08
> > Till: JBoss-User
> > Ämne: Re: [jBoss-User] ouch, newbie trouble
> >
> >
> > Ooooooooops I almost forgot!!
> >
> > That shold be:
> >
> > <?xml version="1.0" encoding="Cp1252"?>
> >
> > <jboss>
> >
> > <enterprise-beans>
> >
> >
> > <session>
> >
> > <ejb-name>parfo.Hello</ejb-name>
> >
> > <jndi-name>parfo.Hello</jndi-name>
> >
> > </session>
> >
> >
> > </enterprise-beans>
> >
> >
> > </jboss>
> >
> >
> > Memory just doesn't server me right these days!
> >
> > ----- Original Message -----
> > From: "William Keller" <[EMAIL PROTECTED]>
> > To: "JBoss-User" <[EMAIL PROTECTED]>
> > Sent: Thursday, March 08, 2001 11:56 AM
> > Subject: Re: [jBoss-User] ouch, newbie trouble
> >
> >
> > You could try adding a jboss.xml file to look like:
> >
> > <?xml version="1.0" encoding="Cp1252"?>
> >
> > <jboss>
> >
> > <session>
> >
> > <ejb-name>parfo.Hello</ejb-name>
> >
> > <jndi-name>parfo.Hello</jndi-name>
> >
> > </session>
> >
> > </jboss>
> >
> >
> > Note: The jndi-name tag is used to set the jndi name for that
> > bean (which is
> > described in teh ejb-jar.xml). It is this name you use to call in the
> > client. This file must be packaged up in the same directory
> > (META-INF) as
> > the ejb-jar.xml. Give it a go!
> >
> > ----- Original Message -----
> > From: "Pär Fornland" <[EMAIL PROTECTED]>
> > To: "'JBoss-User'" <[EMAIL PROTECTED]>
> > Sent: Thursday, March 08, 2001 10:20 AM
> > Subject: [jBoss-User] ouch, newbie trouble
> >
> >
> > Hi guys,
> >
> > I am investigating how useful EJB can be for the product for
> > which I am the
> > architect. I know just the big picture of EJB. Downloaded
> > jBoss, and
> > guess how pleased I was to see it running immediately. Wrote
> > a simple Hello
> > World example, and could _deploy_ it successfully immediately too.
> > Happiness!
> >
> > Running Solaris, JDK1.3, jBoss-2.0-FINAL.
> >
> > Enter: dark clouds
> >
> > I have been trying for DAYS now to run my client. I've tried
> > modifying the
> > ejb-jar.xml. I've tried changing names of packages. I've
> > tried adding a
> > jboss.xml file. I've tried many ways to write the client.
> > It just won't
> > run. (I've searched the archive of this list, but didn't
> > find anything
> > similar.)
> >
> > I get this when I deploy it:
> > +++++++++++++++
> > [Auto deploy] Auto deploy of
> > file:/info/dev-parfo/jBoss-2.0_FINAL/deploy/HelloWorld.ja
> > r
> > [J2EE Deployer] Stopping module HelloWorld.jar
> > [Container factory]
> > Undeploying:file:/info/dev-parfo/jBoss-2.0_FINAL/bin/../tmp/de
> > ploy/HelloWorl
> > d.jar/ejb1020.jar
> > [Container factory] Undeployed application:
> > file:/info/dev-parfo/jBoss-2.0_FINAL/bin/../tmp/deploy/HelloWo
> > rld.jar/ejb102
> > 0.jar
> > [J2EE Deployer] Destroying application HelloWorld.jar
> > [J2EE Deployer] deployment.cfg file deleted.
> > [J2EE Deployer] File tree
> > file:/info/dev-parfo/jBoss-2.0_FINAL/tmp/deploy/HelloWorld.jar
> > deleted.
> > [J2EE Deployer] Deploy J2EE application:
> > file:/info/dev-parfo/jBoss-2.0_FINAL/deploy/HelloWorld.jar
> > [J2EE Deployer] Create application HelloWorld.jar
> > [J2EE Deployer] Installing EJB package: HelloWorld.jar
> > [J2EE Deployer] Starting module HelloWorld.jar
> > [Container factory]
> > Deploying:file:/info/dev-parfo/jBoss-2.0_FINAL/bin/../tmp/depl
> > oy/HelloWorld.
> > jar/ejb1022.jar
> > [Verifier] Verifying
> > file:/info/dev-parfo/jBoss-2.0_FINAL/bin/../tmp/deploy/HelloWo
> > rld.jar/ejb102
> > 2.jar
> > [Container factory] Deploying parfo.Hello
> > [Container factory] Deployed application:
> > file:/info/dev-parfo/jBoss-2.0_FINAL/bin/../tmp/deploy/HelloWo
> > rld.jar/ejb102
> > 2.jar
> > [J2EE Deployer] J2EE application:
> > file:/info/dev-parfo/jBoss-2.0_FINAL/deploy/HelloWorld.jar is
> > deployed.
> > +++++++++++++++++
> >
> >
> > Is that correct?
> >
> > Then when I run my client, I get this error:
> > ++++++++++++++++++
> > javax.naming.NameNotFoundException: parfo.HelloHome not bound
> > at
> > sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer
> > (StreamRemoteC
> > all.java:245)
> > at
> > sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCal
> > l.java:220)
> > at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:122)
> > at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
> > at
> > org.jnp.interfaces.NamingContext.lookup(NamingContext.java:295)
> > at
> > org.jnp.interfaces.NamingContext.lookup(NamingContext.java:279)
> > at javax.naming.InitialContext.lookup(InitialContext.java:350)
> > at HelloClient.main(HelloClient.java:23)
> > +++++++++++++++++
> >
> >
> > My ejb-jar.xml looks like this:
> > +++++++++++++
> > <?xml version="1.0" encoding="Cp1252"?>
> > <ejb-jar>
> > <description>Lek med beans</description>
> > <display-name>TestAvBeans</display-name>
> > <enterprise-beans>
> > <session>
> > <ejb-name>parfo.Hello</ejb-name>
> > <home>parfo.HelloHome</home>
> > <remote>parfo.Hello</remote>
> > <ejb-class>parfo.HelloBean</ejb-class>
> > <session-type>Stateless</session-type>
> > <transaction-type>Bean</transaction-type>
> > </session>
> > </enterprise-beans>
> > </ejb-jar>
> > ++++++++++++++++++
> >
> >
> > My client code looks like this:
> > ++++++++++++++
> > import parfo.*;
> >
> > import javax.ejb.*;
> > import javax.naming.*;
> > import javax.rmi.*;
> > import java.util.*;
> >
> > public class HelloClient {
> > public static void main(String[] args) {
> > try {
> > System.setProperty("java.naming.factory.initial",
> >
> > "org.jnp.interfaces.NamingContextFactory");
> > System.setProperty("java.naming.provider.url",
> > "localhost:1099");
> >
> > Properties props = System.getProperties();
> > System.out.println("Got props");
> >
> > Context ctx = new InitialContext(props);
> > System.out.println("Got context");
> >
> > Context context = new InitialContext();
> > Object boundObject =
> > context.lookup("java:parfo.HelloHome");
> > HelloHome helloHome = (HelloHome)
> > PortableRemoteObject.narrow(
> > boundObject, HelloHome.class);
> > Hello _hello = helloHome.create();
> >
> > HelloHome home;
> > home = (HelloHome) ctx.lookup("java:parfo/HelloHome");
> > System.out.println("Got home object #1");
> >
> > home = (HelloHome) ctx.lookup("HelloHome");
> > System.out.println("Got home object #2");
> >
> > home = (HelloHome) PortableRemoteObject.narrow(
> > ctx, HelloHome.class);
> > System.out.println("Got home object #3");
> >
> > Hello hello = home.create();
> >
> > System.out.println(hello.hello());
> >
> > hello.remove();
> > }
> > catch (Exception e) {
> > e.printStackTrace();
> > }
> > }
> > }
> > ++++++++++++
> >
> > and even though I try different ways to get the reference to the Home
> > object, none of them work (I comment out different ones to test.)
> >
> > Any ideas?
> >
> > Kind regards
> > Pär
> >
> >
> > ______________________________________s_p_r_a_y_
> > Dr. Pär Fornland
> >
> >
> >
> > --
> > --------------------------------------------------------------
> > To subscribe: [EMAIL PROTECTED]
> > To unsubscribe: [EMAIL PROTECTED]
> >
> >
> >
> > --
> > --------------------------------------------------------------
> > To subscribe: [EMAIL PROTECTED]
> > To unsubscribe: [EMAIL PROTECTED]
> >
> >
> >
> > --
> > --------------------------------------------------------------
> > To subscribe: [EMAIL PROTECTED]
> > To unsubscribe: [EMAIL PROTECTED]
> >
> >
>
> --
> --------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
>
> --
> --------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]