7 Replies Latest reply on Jan 17, 2003 11:31 AM by Bouassida

    Still have a pb with my hello world example...

    Bouassida Newbie

      Hi,

      I'm a new bie who try to run a simple HelloWorld project.
      I've pasted my jar file in the .../server/deploy/ directory. I see the change in my server window : it tell me that myTest.jar is deployed.

      Then I want to access to my helloworld bean using my client but I've got an errror :

      D:\jboss-3.0.4_tomcat-4.1.12\client>java test/HelloWorldClient

      javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parame
      ter, or in an application resource file: java.naming.factory.initial
      at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:640)
      at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
      at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:280)
      at javax.naming.InitialContext.lookup(InitialContext.java:347)
      at test.HelloWorldClient.main(HelloWorldClient.java:37)



      And my classpath is :
      .;D:\jakarta-ant-1.5.1\lib;
      D:\jboss-3.0.4_tomcat-4.1.12\lib;
      D:\jboss-3.0.4_tomcat-4.1.12\server\default\deploy\myTest.jar;
      D:\jboss-3.0.4_tomcat-4.1.12\client\jboss-common-client.jar;
      D:\jboss-3.0.4_tomcat-4.1.12\client\jboss-client.jar;
      D:\jboss-3.0.4_tomcat-4.1.12\client\jnp-client.jar;
      D:\jboss-3.0.4_tomcat-4.1.12\client\jbosssx-client.jar;
      D:\jboss-3.0.4_tomcat-4.1.12\client\log4j.jar;
      D:\jboss-3.0.4_tomcat-4.1.12\server\default\lib\jboss-j2ee.jar;
      D:\jboss-3.0.4_tomcat-4.1.12\server\default\conf\jndi.properties;
      D:\jboss-3.0.4_tomcat-4.1.12\client\test\HelloWorldClient.class;
      D:\jboss-3.0.4_tomcat-4.1.12\client\test\HelloWorld.class;
      D:\jboss-3.0.4_tomcat-4.1.12\client\test\HelloWorldHome.class

      I would be very very happy if someone could help me cause that's driving me crazy ....

      Thanks

      Nadia

        • 1. Re: Still have a pb with my hello world example...
          Adrian Brock Master

          First you need to create a jndi.properties
          file and add it to the classpath.

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

          Second, you dont construct classpaths by naming the
          classes.
          You specify where the root of the package is located.
          In your case
          D:\jboss-3.0.4_tomcat-4.1.12\client\

          Regards,
          Adrian

          • 2. Re: Still have a pb with my hello world example...
            Bouassida Newbie

            Hi warjort,

            First : thanks for your help


            >First you need to create a jndi.properties
            file and add it to the classpath.

            --> I've done it

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

            --> That exactly what I've got.

            Second, you dont construct classpaths by naming the
            classes.
            You specify where the root of the package is located.
            In your case
            D:\jboss-3.0.4_tomcat-4.1.12\client\

            --> OK.
            I've also add j2ee.jar in my classpath

            Then, I shut the server and restart. I got another error ...arggggggggggggggg!!! ....

            This time, It is :

            D:\jboss-3.0.4_tomcat-4.1.12\client>java test/HelloWorldClient

            javax.naming.CommunicationException: Can't find SerialContextProvider at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:63)
            at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:120)
            at javax.naming.InitialContext.lookup(InitialContext.java:347)
            at test.HelloWorldClient.main(HelloWorldClient.java:15)

            D:\jboss-3.0.4_tomcat-4.1.12\client>


            If you can help me ...
            I give you my files in copy.

            Thanks.

            Regards

            Nadia

            • 3. g
              Bouassida Newbie

              hi warjort

              First of all : thanks for your help.

              Then,
              >First you need to create a jndi.properties
              file and add it to the classpath.

              --> that's what I've done.

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

              --> That exactly what I've got. OK

              >Second, you dont construct classpaths by naming the
              classes.
              >You specify where the root of the package is located.
              >In your case
              >D:\jboss-3.0.4_tomcat-4.1.12\client\

              --> OK I do it.
              I also add the j2ee.jar in my classpath.

              I got another error..... arg !!!!!!!!!!!.....
              snifff ! :-)

              Here is my new error:

              D:\jboss-3.0.4_tomcat-4.1.12\client>java test/HelloWorldClient

              javax.naming.CommunicationException: Can't find SerialContextProvider at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:63)
              at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:120)
              at javax.naming.InitialContext.lookup(InitialContext.java:347)
              at test.HelloWorldClient.main(HelloWorldClient.java:15)


              I give you my directory in attached file.
              Again, thanks for your help.
              I hope you'll be able to help me another time.

              Regards

              Nadia


              • 4. Re: Still have a pb with my hello world example...
                Bouassida Newbie

                that the 3 time I try to answer .... !!!
                It's just a test !

                • 5. Re: Still have a pb with my hello world example...
                  Bouassida Newbie

                  That the 4th time I answer !!! I hope this one will be the good one !!!

                  hi warjort

                  First of all : thanks for your help.

                  Then,
                  >First you need to create a jndi.properties
                  file and add it to the classpath.

                  --> that's what I've done.

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

                  --> That exactly what I've got. OK

                  >Second, you dont construct classpaths by naming the
                  classes.
                  >You specify where the root of the package is located.
                  >In your case
                  >D:\jboss-3.0.4_tomcat-4.1.12\client\

                  --> OK I do it.
                  I also add the j2ee.jar in my classpath.

                  I got another error..... arg !!!!!!!!!!!.....
                  snifff ! :-)

                  Here is my new error:

                  D:\jboss-3.0.4_tomcat-4.1.12\client>java test/HelloWorldClient

                  javax.naming.CommunicationException: Can't find SerialContextProvider at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:63)
                  at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:120)
                  at javax.naming.InitialContext.lookup(InitialContext.java:347)
                  at test.HelloWorldClient.main(HelloWorldClient.java:15)


                  I give you my directory in attached file.
                  Again, thanks for your help.
                  I hope you'll be able to help me another time.

                  Regards

                  Nadia

                  • 6. Re: Still have a pb with my hello world example...
                    Adrian Brock Master

                    The jndi.properties should be in the root of the jar.

                    Don't deploy a jar with a jndi.properties file,
                    you will suffer performance problems.

                    Use jboss-j2ee.jar from client/

                    Regards,
                    Adrian

                    • 7. Re: Still have a pb with my hello world example...
                      Bouassida Newbie

                      Hi,

                      All is OK !
                      It's running.

                      Thank you very much.

                      Best regards and have fun

                      Nadia