9 Replies Latest reply on Jul 3, 2002 5:18 PM by johnyzee

    Problem in running JBoss examples

    novice22

      Hello guys,

      Anybody has runned the JBoss documentation examples? I downloaded documentation-example.zip and tried one of the example "Interest". This example uses Ant builder. When I was running: ant intro-interest-client, I got following messages:

      C:\jboss\exm\examples\build>ant intro-interest-client
      Buildfile: build.xml

      validate-servlet:

      validate-jboss:

      fail_if_not_valid:

      init:
      [echo] Using JBoss directory=c:\jboss
      [echo] Using base classpath=C:\jboss\client\jboss-j2ee.jar;C:\jboss\client\
      jaas.jar;C:\jboss\client\jbosssx-client.jar;C:\jboss\client\jboss-client.jar;C:\
      jboss\client\jnp-client.jar;C:\jboss\exm\examples\COULD_NOT_FIND_SERVLET_JAR
      [echo] Using Source directory=C:\jboss\exm\examples
      [echo] Using Build directory=C:\jboss\exm\examples/build-examples

      intro-interest-client:

      compile:

      interest-client:
      [java] java.lang.NoClassDefFoundError: javax/net/SocketFactory
      [java] at org.jnp.interfaces.NamingContextFactory.getInitialContext(Nam
      ingContextFactory.java:38)
      [java] at javax.naming.spi.NamingManager.getInitialContext(NamingManage
      r.java:665)
      [java] at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.
      java:246)
      [java] at javax.naming.InitialContext.init(InitialContext.java:222)
      [java] at javax.naming.InitialContext.(InitialContext.java:178)
      [java] at org.jboss.docs.interest.InterestClient.main(InterestClient.ja
      va:27)
      [java] Exception in thread "main"
      [java] Java Result: 1

      BUILD SUCCESSFUL

      Total time: 3 seconds
      C:\jboss\exm\examples\build>

      Is there anybody had the same problem and knows what happened?

      Thanks

        • 1. Re: Problem in running JBoss examples
          nirgos

          try making the following changes



          to




          • 2. Re: Problem in running JBoss examples
            novice22

            Hi,

            Thanks for the reply. However, there are no any directories called catalina/common/lib under my jboss directory. In fact there is no servlet.jar at all under the jboss directory. By the way, I'm using jboss 3.0. Which version of jboss are you using? Do you have the servlet.jar mentioned above under you jboss_dist?

            • 3. Re: Problem in running JBoss examples
              avitous

              I succeeded in getting the interest example working with JBoss 3.0 with Jetty servlet container (this is the default configuration installed from jboss-3.0.0.zip - you only have the 'catalina' subdir if you grabbed the alternate version with the Tomcat [Catalina] servlet container.)

              The documentation examples are, as delivered, configured for JBoss 2.x, and require some tweaks to get running for 3.0. Note that my changes are a 'brutal hack' but it did work...

              0. Ensure JBOSS_DIST environment variable points to your JBoss installation directory. If you're running WinXP and JDK 1.4 (like me) you'll also need to get Ant 1.5beta3 as 1.4.1 is broken with XP/JDK1.4. Also make sure you PRESERVED CASE when unpacking documentation-example.zip! (with InfoZIP's 'unzip', option is '-U'.)

              1. In build\build.xml, in the 'validate-servlet' target, add the following to grab the servlet jar:


              Note that I used '${jboss.dist}' as '${env.JBOSS_DIST}' still evaluates to a null string for me (and yes, I *do* have JBOSS_DIST defined!). Possible Ant problem still on XP, or I'm doing something dumb, but the above form worked for me. I'm presuming you'll need the same for the Tomcat version as well.

              2. For the client libraries, add the following to build\build.xml, also in the validate-servlet target (otherwise you'll get 'class not found' errors when running the client):












              Change the 'validate-jboss' target as follows:



              <!-- -->
              <!-- -->


              (I added a new 'available' task for base.path_30 and commented out the others as they were overriding my change.)

              3. Build in this order (from the build dir):

              ant intro-interest-compile
              ant intro-interest-jar
              ant intro-interest-ear
              ant intro-interest-deploy
              -- this didn't work; I manually copied
              interest.jar to
              JBOSS_DIST/server/default/deploy
              (see below)
              ant intro-interest-client

              4. Deployment target directory needs to be changed in the build.xml that is bundled with the 'interest' source directory (org\jboss\docs\interest) as follows:

              <!-- [06/28/02 ajv] Changed deployment target for JBoss 3.0 -->







              This needs to be changed system-wide, perhaps in build\build.xml so it's properly picked up for all the examples; as is, you'll need to make this change separately for each one...

              Hope this works for you. I'm attaching my changed copy of build\build.xml if above mangled text isn't clear enough.

              Anderson

              ** oops, the 'Attach Files' feature isn't working for this forum! Hope the above description is clear enough for now.

              • 4. Re: Problem in running JBoss examples
                avitous

                This was also discussed elsewhere in this forum at http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t=forums/ last reply points to a message in jboss-development list at
                http://www.mail-archive.com/jboss-development@lists.sourceforge.net/msg25136.html//www.mail-archive.com/jboss-development@lists.sourceforge.net/msg25136.html
                with a solution similar to mine.

                Oh well, I had more fun grunting through it myself...

                • 5. Re: Problem in running JBoss examples
                  johnyzee

                  Thanks avitous for sharing your very helpful experiences. I have the ejb running in JBoss, but I can't seem to run the client.

                  Whenever I do the context lookup, I get "Can't find SerialContextProvider". JBoss is running with ejb deployed, and I know the JNDI name is correct.

                  I'm thinking the problem may be with the jndi.properties file setup, but I don't know. I would really appreciate any help anyone could offer.

                  • 6. Re: Problem in running JBoss examples
                    nirgos

                    I am using linux and had the same problem with the client. It seems some jars are not in the class path. what i did was

                    In /examples/build/build.xml

                    Under section

                    I added the following jars (lines)





                    You should also note that the deployment directory is actually "(jboss dir)/server/default/deploy"

                    it's not "(jboss dir)/deploy" as assumed by the examples
                    This can be corrected by changing the build.xml for each example.

                    for interest example change (examples)/org/jboss/docs/interest/build.xml
                    at lines saying "${jboss.dist}/deploy"
                    to "${jboss.dist}/server/default/deploy"

                    • 7. Re: Problem in running JBoss examples
                      triggsie

                      I am getting the same NamingException and have not been able to nut it out.As far as I can see everything is as per the example.

                      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 com.titan.clients.Client_1.main(Client_1.java:30)

                      If anyone can resolve this it shall be appreciated.

                      Chris

                      • 8. Re: Problem in running JBoss examples
                        triggsie

                        I finally got the client example to run. I'll step through the discovery process as it may help.

                        Instead of using the jndi.properties file I hard coded the properties:

                        public static Context getInitialContext() throws javax.naming.NamingException {
                        java.util.Properties properties = new java.util.Properties();
                        properties.put(javax.naming.Context.PROVIDER_URL, "jnp://localhost:1099");
                        properties.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
                        return new InitialContext(properties);
                        }

                        This gave class not found errors which I then traced to jar files in $JBOSS_HOME/client/

                        To get the client to run I had to add the following to my CLASSPATH:
                        jboss-client.jar
                        jboss-common-client.jar
                        jboss-j2ee.jar
                        jbosssx-client.jar
                        jnp-client.jar
                        log4j.jar

                        I have since tested the client with the jndi.properties file and all is OK.

                        Smokin -- Triggsie

                        • 9. Re: Problem in running JBoss examples
                          johnyzee

                          Hardcoding the JNDI properties did the trick. Thanks Triggsie for that helpful piece of advice.