8 Replies Latest reply on Jun 9, 2010 6:08 AM by mahanare

    EJB 3 clustering error



      I am trying to create  clustered EJBs in a clustered jboss environment based on a load balancing requirement in our project.


      with some references on internet

      I tried


      and also

      @Clustered(loadBalancePolicy = org.jboss.ha.framework.interfaces.RoundRobin.class)


      annotations in my SLSB EJB 3.0 bean class.


      But I am getting



      java.lang.annotation.AnnotationFormatError: Invalid default: public abstract java.lang.Class org.jboss.annotation.ejb.Clustered.loadBalancePolicy()
      at java.lang.reflect.Method.getDefaultValue(Method.java:726)
      at sun.reflect.annotation.AnnotationType.<init>(AnnotationType.java:99)





      Am i missing anything, please suggest if i need to do something else. any references will help.


      thanks in advance, harinath

        • 1. Re: EJB 3 clustering error

          Hello Harinath


          Are you starting the JBOSS server with a "clustered" configuration? ie the "all" configuration ?


          What version of JBOSS are you using ?


          Have you tried @Clustered(loadBalancePolicy="RoundRobin") ? (Note the quotes and String type instead of class)



          • 2. Re: EJB 3 clustering error

            Hi Mark,


            Jboss version is 4.2.3.


            Jboss cluster: Actually Jboss is more customized in our product and i think yes. but not sure if i am missing any configuration. we actually have custom configuration for the product (instead of "all").


            yes, I tried. (giving string value is throwing compilation error).


            @Clustered(loadBalancePolicy = RoundRobin.class)


            any suggestions to explore more on this?


            Thanks for responding to my query.



            • 3. Re: EJB 3 clustering error

              when a @Clustered EJB deployed in a non clustered profile, this error occurs. you can try it in the all profile, if it works, you need to customize the all profile from scratch.

              • 4. Re: EJB 3 clustering error



                I had that error before and that was the cause.

                • 5. Re: EJB 3 clustering error

                  jboss q wrote:


                  when a @Clustered EJB deployed in a non clustered profile, this error occurs.


                  Is that the case with AS-5.x and later too? I would have expected it to ignore that annotation if the profile doesn't support clustering.

                  • 6. Re: EJB 3 clustering error

                    Yes, after adding the jboss cluster service xml into deploy folder and adding jbossha.jar to lib folder, this error has disappeared.

                    • 7. Re: EJB 3 clustering error

                      And now the client complains with the "Caught: java.lang.RuntimeException: cluster invocation failed" error.


                      D:\projects\groovy>groovy hello.groovy
                      Caught: java.lang.RuntimeException: cluster invocation failed, last exception was:
                              at hello.run(hello.groovy:68)


                      Any thoughts?


                      • 8. Re: EJB 3 clustering error

                        My bad, server bind address was that caused that error.


                        Its working finally. I see load being balanced to multiple servers in round robin fashion.


                        Thanks, Harinath