5 Replies Latest reply on May 18, 2007 3:10 PM by Peter Johnson

    Problem with deployed .jar files

    jacob mogensen Newbie

      I using JBoss (4.0.3SP1) from eclipse (myeclipse) in my work, and I have noticed a stage behaviour, that I think might be a bug.

      When I run the server, and deploy a .jar file that use a class in another .jar file, the program simple stop (the first .jar file) if the second jar file is not deployed. There is no error or warning info.

      If I run the deployed .jar file with java, I get a ClassNotFoundException exception if the second .jar file is not found. However in JBoss there is no error, no information that something is wrong, noting at all.

      I would like some indication whether or not my program is stop, or it is running normally...

      I don't know if this is JBoss or Eclipse or MyEclipse specifics, nor if it is only my computer.

      Can someone please cast some light on this problem?

      jacob m
      (sorry about my pour english)

        • 1. Re: Problem with deployed .jar files
          Peter Johnson Master

          A jar file is deployed only it it contains EJBs (or a message-driven POJO or possibly other things that I can't recall right now). If the jar file contains only library classes, it is not deployed. If you have a jar file containing EJBs that needs a library jar, you should package both of them in an ear file.

          • 2. Re: Problem with deployed .jar files
            jacob mogensen Newbie

            Thanks for the reply.

            What you are witting is not wrong, the problem can be solved be deploying it as a EAR file. Then the exception 'ClassNotFoundException' will be shown.

            However, that does not solve the problem that I'am talking about. If I deploy one jar file, that depends on another jar file, the execution of the first jar file will stop without any errors or warnings, if the second jar file is missing.

            Should the missing jar files not also result in a 'ClassNotFoundException'?

            jacob m

            • 3. Re: Problem with deployed .jar files
              Peter Johnson Master

               

              Should the missing jar files not also result in a 'ClassNotFoundException'?


              That depends entirely on the class that is missing. I guess I would need to know more about the contents of your two jar files. And what you put into META-INF/application.xml if you packaged them as an ear file.

              • 4. Re: Problem with deployed .jar files
                jacob mogensen Newbie

                First of all, that that you will take your time to help me.

                I don't pack them as EAR files. I'm deploying a jar file, and "forget" to deploy the second jar file.

                The content of the jar files is very simply. They both contain another jar file, which have one class, that print text to the screen (it is the way things are written where I work).

                e.g.
                jar1>
                write "I'm alive"
                use jar2 to print a line
                write "I will never be written"

                jar2>
                write "I don't exist"

                The result is:
                "I'm alive"

                If I deploy both jar files it works fine. But when I 'forget' the second jar file the program stop.

                If I use 'java -cd jar1.jar ...' and it can find the second file, i get a 'ClassNotFoundException'. If I run them from eclipse, I get a 'ClassNotFoundException'. But in JBoss I get nothing...? No print to the error log, no print to the screen, nothing... the first jar files simple stops, and JBoss keep working as nothing has ever happened.

                I can show the code, but i guess it will be just as easy for you to create the test your self.

                jacob m

                • 5. Re: Problem with deployed .jar files
                  Peter Johnson Master

                  It sounds as if you have a simple class, not an EJB, is that correct? If so, as I said in my first reply, such a jar file will not deploy.

                  Perhaps you should post the source for the class.