1 Reply Latest reply on Feb 5, 2002 12:19 PM by Darrin Addams

    Running Interest Example from Client

    Darrin Addams Newbie


      First post this, so go easy please.

      I've got over the first few hurdles including browsing to and expecting some sort of page :)

      I've run the servlet calling the EJB example and I've built and run the Interest example after installing ant.

      The only development work I've done with EJBs so far is a set of simple session beans for BEA's WebLogic Server and I expected just to be able to compile my EJBs for JBoss with no problems. Unfortunately I have indeed had some problems so I've tried the Interest example to try and understand it a bit better. Other than this, I'm really impressed at how fast and efficient it runs on my 160MB 223MMX NT4.0 server...

      Anyway, my question is this. I've successfully installed Ant and built and deployed the Interest example. I can run the client the example provides using the xml control file but I'd really like to run it from the command line.

      My batch file (winnt) I use looks like this:

      java -cp %CLASSPATH%;%JBOSS_HOME%\client\jboss-j2ee.jar; /
      %JBOSS_HOME\client\jboss-client.jar; /
      %JBOSS_HOME\client\jnp-client.jar; /
      c:\examples\build-examples\interest\classes; /
      %JBOSS_HOME\client\jndi.jar;. /
      -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory /
      -Djava.naming.provider.url=localhost:1099 /
      -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces /

      Unfortunately, I can't get it to run like this even though it appears to mirror exactly what the example's xml control file does. Can anyone shed some light on this or offer some sort of example of a command line call that will call the services of an EJB deployed on JBoss?

        • 1. Re: Running Interest Example from Client
          Darrin Addams Newbie

          OK sorted it.

          There were a few simple mistakes in the above command line mainly no closing % for the env variables. However, to run the Interest example from the command line you have to specify the following on your class path:

          1. %JBOSS_HOME%\client\jboss-j2ee.jar
          2. %JBOSS_HOME%\client\jboss-client.jar
          3. %JBOSS_HOME%\client\jnp-client.jar
          4. %JBOSS_HOME%\client\jndi.jar
          5. c:\examples\build-examples\interest\classes
          6. c:\examples\resources

          Line 4 represents the root relative to the EJB's package name, in the example's case:

          This means that the InterestClient class is located at:


          Note that your command line must refer to the InterestClient class as such e.g.

          java -cp -D<property list> org.jboss.docs.interest.InterestClient

          Line 6 of the class path list includes the resources directory and simply contains the jndi.properties file which in turn contains the following:


          Alternatively, you can specify each of these using the -D option.

          So we have the final command line:

          java -cp %CLASSPATH%;%JBOSS_HOME%\client\jboss-j2ee.jar;%JBOSS_HOME%\client\jboss-client.jar;%JBOSS_HOME%\client\jnp-client.jar;c:\examples\build-examples\interest\classes;%JBOSS_HOME%\client\jndi.jar;c:\examples\resources;. org.jboss.docs.interest.InterestClient

          OR if you want to specify the jndi properties on the same line and not use the jndi.properties file in the resources directory:

          java -cp %CLASSPATH%;%JBOSS_HOME%\client\jboss-j2ee.jar;%JBOSS_HOME%\client\jboss-client.jar;%JBOSS_HOME%\client\jnp-client.jar;c:\examples\build-examples\interest\classes;%JBOSS_HOME%\client\jndi.jar;c:\examples\resources;. -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.provider.url=localhost:1099 -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces org.jboss.docs.interest.InterestClient

          Hope that helps.