4 Replies Latest reply on Jan 3, 2006 1:56 PM by Tom Elrod

    Dynamic class loading of EJB3 entities

    Mike B. Newbie

      Hi,
      maybe it's a stupid question, but I can't find any solution for this.

      I deployed just interfaces implemented by my entities to the client and I'm accessing it through a SLSB.
      But I get a NoClassDefFoundError.
      I already enabled the classloading by setting the DownloadServerClasses flag, but it seems, as if the client doesn't even try to connect the codebase.

      What else do I have to do, to get the dynamic class loading working?

        • 1. Re: Dynamic class loading of EJB3 entities
          Mike B. Newbie

          ... I'm using jboss-4.0.3SP1 and the client runs with following VM-arguments:
          -Djava.security.manager=java.rmi.RMISecurityManager
          -Djava.security.policy=client.policy
          -Djava.rmi.server.codebase=http://localhost:8083/

          • 2. Re: Dynamic class loading of EJB3 entities
            Scott Stark Master

            This is a remoting issue. The implementation used by the ejb3 layer does not use the legacy class download service. See, http://labs.jboss.com/portal/jbossremoting/docs/guide/ch04.html#d0e816

            • 3. Re: Dynamic class loading of EJB3 entities
              no clouds Newbie

              Hi,

              I've exactly the same problem and I don't understand the explanations in the guide.
              Could anyone explain it for a remoting newbie!?

              Best Regards

              • 4. Re: Dynamic class loading of EJB3 entities
                Tom Elrod Master

                Sure. I'll also try to do a better job in the docs for the next release (as is only explained in the context of loading marshallers currently).

                The remote classloading (which only works from the client loading classes from the server, btw), is done via a seperate service, which is called the loader. By default, the loader is not present on the server side. In order to enable the loader server to run, will need to add the following to the remoting connector configuration:

                <attribute name="loaderport" isParam="true">5401</attribute>
                


                Note, this attribute must be set within the invoker element.

                This tells the remoting server that it needs to start a loader running on the port specified. Then, on the client side, when it receives a response from the server and is unmarshalling the response, if it tries to load a class that is not present locally, it will look to see if a loader has been specified. If it has been, it will call to that loader server and load the class dynamically.

                If getting the invoker locator url from the server, are good to go, as will already have the loaderport parameter set. Otherwise, if creating the locator url yourself on the client, then would need to make sure the loader parameter is specified. For example:

                socket://myhost:12345/?loaderport=5401
                


                I am guessing you are using ejb3, which in the latest version it pulls the locator url from the server so you should be set (only need to make sure is there on the server side configuration).

                Hope that helps.

                -Tom