Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: JBoss EJB spec violation in AbstractStatelessSessionBean?

Hybrid View

  1. #1
    Join Date
    Feb 2006
    Posts
    164

    Default 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
    Attached Files Attached Files

  2. #2
    Join Date
    Aug 2004
    Posts
    2,715

    Default

    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

  3. #3
    Join Date
    Feb 2006
    Posts
    164

    Default

    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

  4. #4
    Join Date
    Jun 2006
    Posts
    12

    Default

    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

  5. #5
    Join Date
    Feb 2006
    Posts
    164

    Default

    No, I wasn't. Sorry.

    Ben

  6. #6
    Join Date
    Sep 2004
    Posts
    1,086

    Default

    Quote 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?

  7. #7
    Join Date
    Jun 2006
    Posts
    12

    Default

    Quote 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

  8. #8
    Join Date
    Feb 2006
    Posts
    164

    Default

    Quote 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

  9. #9
    Join Date
    Aug 2004
    Location
    Sydney
    Posts
    503

    Default

    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)

  10. #10
    Join Date
    Jun 2006
    Posts
    12

    Default

    Quote 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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •