2 Replies Latest reply on Apr 11, 2006 10:01 AM by alf1984

    Unable to test EJB from a Java application

    alf1984

      Hello,
      Could someone help or advice me : I'm trying to test my EJB from a java application but do not succeed at all.
      I'm working with Eclipse 3.1.1 (WTP conf) and JBoss server 4.0.3(SP1).
      I succeed in building my EJB deploying it on the server through an 'ear' file.
      Everything works fine when I put some servlet and html file in my deployed application, I can get interface of my EJB and use it.
      But when I just deploy my EJB (no servlet, no web archive in my application), I'm unable to test it from a simple Java application, I get the following error :

      java.lang.RuntimeException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
      at TestSimpleMonEJB.main(TestSimpleMonEJB.java:41)

      Do I miss something in the configuration ? do I use a bad JNDI name ? sth else ?

      In advance thanks for your help.

        • 1. Re: Unable to test EJB from a Java application
          jaikiran

          You need to place the "jndi.properties" file in the client classpath(the place from where you are executing your standalone java client). Sample jndi.properties will contain something like the following:

          java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
          java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
          java.naming.provider.url=jnp://localhost:1099




          • 2. Re: Unable to test EJB from a Java application
            alf1984

            Thanks jaikiran,
            It sounds to be better now.
            One more question where can I find the specification related to this "jndi.properties" (format, use,...).
            Many thanks for your help.