Announcement Announcement Module
Collapse
No announcement yet.
JBoss EJB spec violation in AbstractStatelessSessionBean? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JBoss EJB spec violation in AbstractStatelessSessionBean?

    Hi, everyone.

    This is a new thread off "Error deploying SLSB+Spring on JBoss". I don't normally re-start threads this way, but there is new and (I believe) significant information that may be unrelated to the "Error deploying SLSB+Spring on JBoss" as it was originally posted, and I need to post it in a way that makes it clear to all what the essential problem is, so here goes...

    The ProSpring book has a simple Spring EJB example, also posted here:

    http://www.javaworld.com/javaworld/j...springejb.html

    ...for which the source code is posted here:

    http://java.apress.com/book/suppleme...D=405&sID=2446

    I downloaded the above and imported the Chapter 13 project into my JBoss Eclipse IDE. I then created a build file (attached for your convenience), and attempted to deploy it to the JBoss app server.

    The app server console shows the following deployment error:

    08:19:07,011 WARN [verifier] EJB spec violation:
    Bean : EchoServiceEJB
    Section: 22.2
    Warning: The Bean Provider must specify the fully-qualified name of the Java class that implements the enterprise bean's business methods in the <ejb-class> element.
    Info : Class not found on 'com.apress.prospring.ch13.ejb.EchoServiceEJB': Unexpected error during load of: com.apress.prospring.ch13.ejb.EchoServiceEJB, msg=org/springframework/ejb/support/AbstractStatelessSessionBean

    08:19:07,027 WARN [verifier] EJB spec violation:
    Bean : CounterServiceEJB
    Section: 22.2
    Warning: The Bean Provider must specify the fully-qualified name of the Java class that implements the enterprise bean's business methods in the <ejb-class> element.
    Info : Class not found on 'com.apress.prospring.ch13.ejb.CounterServiceEJB': Unexpected error during load of: com.apress.prospring.ch13.ejb.CounterServiceEJB, msg=org/springframework/ejb/support/AbstractStatefulSessionBean

    08:19:07,027 ERROR [MainDeployer] Could not create deployment: file:/C:/Program Files/jboss-4.0.3SP1/server/default/tmp/deploy/tmp18149ch13.ear-contents/ch13-ejb.jar
    org.jboss.deployment.DeploymentException: Verification of Enterprise Beans failed, see above for error messages.
    at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java: 575)

    ...rest of stack deleted for brevity, but bottom line is that the app server chokes on it and auto-undeploys the Enterprise App.
    ----------------------------------------------

    Just so you know what I have and have not modified: This is essentially an UNMODIFIED deployment, i.e. unlike what I posted in "Error deploying SLSB+Spring on JBoss", in this simple downloaded example I did NOT modify the source code or the spring config xmls. All I did was move the files into the JBoss-standard locations (as best I understand them), create the packaging-build.xml (the ant build file), as is normal in the JBoss Eclipse IDE, and tweak the application.xml for the context-root for the servlet (which shouldn't affect the EJB deployment, in any case).

    What is significant, is that I'm getting essentially the same error, as reported in the "Error deploying SLSB+Spring on JBoss" thread.

    My top suspects at this point are either:

    (a) The Spring framework does not correctly implement the AbstractStatelessSessionBean (spring-framework-1.2.6 download), or

    (b) JBoss (jboss-4.0.3SP1) does not conform to the EJB 2.x spec, or

    (c) I'm doing something wrong (subtle or stupid) in my deployment or build setup.

    Naturally, I'm hoping for (c) , but if it turns out to be (a) or (b), it may be a Spring show-stopper for many of us.

    I have attached the packaging-build.xml, so that any of you can download the source from Apress (If you do, please be respectful to the author, and buy the book.), move the files around to conform to the packaging-build.xml, and attempt to deploy it yourself.

    I can also email you a zip of the project, of course, since the source appears to be freely available on the web, but again, I would just ask that you buy the associated book first, to be fair to the author.

    Ben

  • #2
    If he does not see this thread, maybe you can drop Rob Harrop a message about it, as he is the author of the book. He surely can help you about this issue.

    Regards,
    Andreas

    Comment


    • #3
      Thanks. I probably will if I (or someone on this forum) doesn't figure this out soon.

      Fyi, I see here that the publisher requires that you buy the book before downloading the code, which is fair. See:

      http://support.apress.com/

      ...for details.

      Be aware that the JNDI code sample for Chapter 13 appears to have a small bug in it. I'm posting errata for it now at the book site. After I fixed the apparent bug, it worked as shown in the book, and is a good, simple lesson in use of JNDI in Spring.

      Ben

      Comment


      • #4
        Ben,

        I am running into a similar problem (simple EJB derived from AbstractStatelessSessionBean and JBoss complaining with the same Class Not Found error you indicated above). Were you able to resolve this problem? If so, can you post the resolution here? Also, I was unable to find any errata for the book (which I do own) on the APress website.

        Thanks,

        Marc

        Comment


        • #5
          No, I wasn't. Sorry.

          Ben

          Comment


          • #6
            Originally posted by benethridge
            08:19:07,011 WARN [verifier] EJB spec violation:
            Bean : EchoServiceEJB
            Section: 22.2
            Warning: The Bean Provider must specify the fully-qualified name of the Java class that implements the enterprise bean's business methods in the <ejb-class> element.
            Info : Class not found on 'com.apress.prospring.ch13.ejb.EchoServiceEJB': Unexpected error during load of: com.apress.prospring.ch13.ejb.EchoServiceEJB, msg=org/springframework/ejb/support/AbstractStatelessSessionBean
            As far as I can tell it's a classloading problem. Where did you put spring.jar?

            Comment


            • #7
              Originally posted by dejanp
              As far as I can tell it's a classloading problem. Where did you put spring.jar?
              Thanks for the responses. I was able to find my problem. Someone had worked around a JBoss 4.0.2 issue with JDOM by adding JDOM-specific jars to the JBoss class path at startup (jdom.jar, jaxen-jdom.jar, jaxen-core.jar, saxpath.jar). Apparently, there is something particular to the way in which JBoss deploys session beans structured in this way that results in this error (although other session beans deploy without problems). My guess is that it had something to do with the ejbXXX methods being implemented in a base class rather than in the class explicitly named in the ejb-class element in the ejb-jar.xml file. Removing the classpath modification fixed the problem.

              The JDOM issue that had been worked around has been fixed in JBoss 4.0.3, so an upgrade to 4.0.3 fixes both problems. I did find that I needed to have the spring.jar in the JBoss server/xxx/lib directory, even though it is included in the ear being deployed.

              Marc

              Comment


              • #8
                Originally posted by dejanp
                As far as I can tell it's a classloading problem. Where did you put spring.jar?
                Sorry, I don't remember. We dropped Spring/EJB/JBoss and JBoss in favor of Tomcat/Spring/Eclipse(generic).

                Ben

                Comment


                • #9
                  Seems like this mostly solved, but putting .jar files in the lib directory in the .ear file seems to be the most trouble free approach with JBoss.

                  Code:
                  myapp.ear
                    META-INF
                      application.xml
                    lib
                      spring
                        spring.jar
                      othertoolkit
                        blah.jar
                        blah2.jar
                    myapp-web.war
                    myapp-ejb.jar
                  where application.xml contains module definitions for the ejb + war files, but also java modules definitions for each jar in the lib directory.

                  You should avoid putting jars in server\default\lib (or all\lib or whatever server configuration you're using)

                  Comment


                  • #10
                    Originally posted by gmatthews
                    Seems like this mostly solved, but putting .jar files in the lib directory in the .ear file seems to be the most trouble free approach with JBoss.

                    Code:
                    myapp.ear
                      META-INF
                        application.xml
                      lib
                        spring
                          spring.jar
                        othertoolkit
                          blah.jar
                          blah2.jar
                      myapp-web.war
                      myapp-ejb.jar
                    where application.xml contains module definitions for the ejb + war files, but also java modules definitions for each jar in the lib directory.

                    You should avoid putting jars in server\default\lib (or all\lib or whatever server configuration you're using)
                    Thanks... this worked. Now I just need to convince the guys responsible for the ant tasks that build the .ear to make the necessary changes

                    Comment


                    • #11
                      Thats good news.

                      The other benefit is that you can actually have a remote chance of knowing where a jar came from instead of having a gajillion jar files all in web-inf\lib

                      Comment


                      • #12
                        Quick question.
                        Which ant task are you using to generate lib subdirectory in ear file and put there *.jar files.
                        Does ear task have such functionality?

                        Comment


                        • #13
                          <copy> and then <ear>

                          Comment


                          • #14
                            After playing a little I am sticking with zipfileset with attribute lib or lib/spring or lib/whatever.
                            Like this
                            Code:
                            <target name="make-ear" description="Should be called either from ear or ear-compile">
                                    <mkdir dir="${distribution.dir}" />
                                    <ear destFile="${distribution.dir}/${ear.name}" appxml="${meta-inf.dir}/application.xml">
                                        <!-- jars to be included from these dirs -->
                                        <fileset dir="${common.jar.dir}" />
                                        <fileset dir="${dao.jar.dir}" />
                                        <fileset dir="${facade.jar.dir}" />
                                        <fileset dir="${webapp.war.dir}" />
                                        <!-- include jboss-app.xml -->
                                        <metainf dir="${meta-inf.dir}">
                                            <include name="jboss-app.xml" />
                                        </metainf>
                                         <!-- here you go!!! -->
                                        <zipfileset dir="${lib.dir}" prefix="lib"/>
                                    </ear>
                                </target>
                            Wouldn't be nice to have a dedicated lib element in ear target as we have in war?
                            Code:
                            <war destfile="myapp.war" webxml="src/metadata/myapp.xml">
                              <fileset dir="src/html/myapp"/>
                              
                              <lib dir="thirdparty/libs">
                                <exclude name="jdbc1.jar"/>
                              </lib>
                              
                            </war>

                            Comment

                            Working...
                            X