9 Replies Latest reply on Nov 21, 2003 12:16 AM by tonic889

    JBoss using cached .jar??

    tonic889

      I have a .jar file which contains the following files:

      META-INF/ejb-jar.xml
      META-INF/MANIFEST.MF
      org/voodoochild/ejb/User.class
      org/voodoochild/ejb/User.java
      org/voodoochild/ejb/UserBean.class
      org/voodoochild/ejb/UserBean.java
      org/voodoochild/ejb/UserHome.class
      org/voodoochild/ejb/UserHome.java

      The files are supposed to represent my first attempt at an entity EJB. When I copied this jar file to /jboss/server/all/deploy, I got an error in server.log while attempting to deploy. So I changed the code, recompiled, re-jared, and copied the jar out to the same path. JBoss again attempted to deploy the .jar, however, I am still getting this error.

      What's confusing is that the error message in server.log in the second deployment attempt refers to a method defintion that no longer exists in the .jar file. This method existed in my first attempt at the EJB, but was changed when I modified my code after the first attempt. I am *certain* that I am using the right source files, have recompiled them successfully, and copied the new .jar out to the deployment directory. I have tried shutting down jboss completely and restart, with no luck.

      The only thing I can think of is that JBoss is somehow using a cached copied of my first .jar. Is such a thing possible in JBoss? Are there other possible causes that could explain why it's still showing errors from a method that no longer exists?

        • 1. Re: JBoss using cached .jar??
          jonlee

          It is a bit difficult to tell as you have provided no log output. However, it may be that the deployment problem is the declaration of a method in the interface that has no match in the implementation. Otherwise post the relevant log sections with errors.

          • 2. Re: JBoss using cached .jar??
            tonic889

            I have attached a log file and the .jar file in question for reference. Deploying the .jar file generates many errors, but of particular concern to me is the error on lines 144-148:

            2003-11-14 10:28:52,454 WARN [org.jboss.ejb.EJBDeployer.verifier] EJB spec violation:
            Bean : User
            Method : public String ejbCreate(String, String, String, int, String, String, String, String) throws RemoteException, CreateException
            Section: 10.6.4
            Warning: The return type of an ejbCreate(...) method must be the entity bean's primary key type.

            As you will see from the attached .jar file the ejbCreate method in UserBean accepts Integer parameters instead of int parameters and returns an Integer instead of a String. Only when I first deployed the .jar did the ejbCreate method listed in the log file exist. What gives?

            • 3. Re: JBoss using cached .jar??
              jonlee

              You need to explicitly declare the FQDN for the return class.

              <?xml version="1.0"?>
              <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
              <ejb-jar>
               <enterprise-beans>
               <entity>
               <ejb-name>User</ejb-name>
               <home>org.voodoochild.ejb.UserHome</home>
               <remote>org.voodoochild.ejb.User</remote>
               <ejb-class>org.voodoochild.ejb.UserBean</ejb-class>
               <persistence-type>Container</persistence-type>
               <prim-key-class>java.lang.Integer</prim-key-class>
               <reentrant>False</reentrant>
               <cmp-field><field-name>accessLevel</field-name></cmp-field>
               <cmp-field><field-name>email</field-name></cmp-field>
               <cmp-field><field-name>firstname</field-name></cmp-field>
               <cmp-field><field-name>lastname</field-name></cmp-field>
               <cmp-field><field-name>hostname</field-name></cmp-field>
               <cmp-field><field-name>lastlogin</field-name></cmp-field>
               <cmp-field><field-name>password</field-name></cmp-field>
               <cmp-field><field-name>passcode</field-name></cmp-field>
               <cmp-field><field-name>userid</field-name></cmp-field>
               <cmp-field><field-name>username</field-name></cmp-field>
               <primkey-field>userid</primkey-field>
               <abstract-schema-name>users</abstract-schema-name>
               </entity>
               </enterprise-beans>
              </ejb-jar>


              Also, your signatures don't match and that is causing the remainder of the errors. lastname does not translate to setLastName. It translates to setLastname. And so on.

              Especially, user_id <> setUserID.

              Also your postcreate will need to be fixed once you've repaired the rest.

              Hope that gets you under way.

              • 4. Re: JBoss using cached .jar??
                tonic889

                Thanks. I think I can fix the errors, but my question is why does the log file say:

                2003-11-14 19:46:00,768 WARN [org.jboss.ejb.EJBDeployer.verifier] EJB spec violation:
                Bean : User
                Method : public String ejbCreate(String, String, String, int, String, String, String, String) throws RemoteException, CreateException
                Section: 10.6.4

                ...When the only ejbCreate method in my source code are:

                public Integer ejbCreate(String firstName, String lastName, String email, Integer accessLevel, String password, String passcode, String userName, String hostname) throws RemoteException, CreateException {

                and

                public Integer ejbCreate() throws CreateException {
                return null;
                }

                ?

                • 5. Re: JBoss using cached .jar??
                  jonlee

                  It is possible the redeploy conditions caused a mangling from the past deployment. However, I haven't seen this issue on my deployment, even switching around values from java.lang.String. It is possible that the JBoss deployer got confused.

                  If you can reproduce it, log it as a bug at SourceForge.

                  • 6. Re: JBoss using cached .jar??
                    tonic889

                    Is there a way to force the deployer into redeploying everything? I restarted the JBoss server, but I'm still getting this problem.

                    • 7. Re: JBoss using cached .jar??
                      jonlee

                      On a reboot of JBoss, everything is redeployed. There is no caching. So I would look very carefully at your build, perhaps inspect the classes to see that the class method signatures match your source methods. I would also check the JAR deployment log to make sure the JAR name matches the one you think is being deployed when the problem occurs.

                      • 8. Re: JBoss using cached .jar??
                        jonlee

                        Your example in a deployable state.

                        • 9. Re: JBoss using cached .jar??
                          tonic889

                          Unfortunately, it's still not working for me. Amazingly I'm still getting the same error messages as before. I can only guess that there is something wrong my version of JBoss (or installation/configuration thereof). Thanks anyway for your help.