1 2 Previous Next 17 Replies Latest reply on Feb 2, 2012 7:20 AM by foutjo

    Can't resolve @Clustered in session bean

    foutjo

      Been working with jboss 5.1 and clustering and was finally able to get it to work the way that I wanted it to. (Wolf was a big help)

       

      Now I want to take the plunge and get my clustering app to work with AS7.

       

      I downloaded 7.0.2.Final and setup just a simple test.

       

      I keep getting a compile error on the @Clustered annotation in my session bean.

       

      Using Jboss 5.1 I remember that I had to include the following jar files in my classpath:

       

      jboss-j2ee.jar and jboss.ejb3x.jar

       

      1)  -  Do I still need these with AS7?

       

             I did try adding them to the classpath and I still get compile error with @Clustered

       

      Can someone tell me what I am missing?

       

      Also is there any information on how to setup clustering with AS7? 

      Coming from AS5.1 it looks like its very different.

       

      Any help is greatly appreciated.

       

      Thanks.

        • 1. Re: Can't resolve @Clustered in session bean
          sfcoy

          Hi there,

           

          You need to compile againt this jar:

           

          {code:xml}            <dependency>

                          <groupId>org.jboss.ejb3</groupId>

                          <artifactId>jboss-ejb3-ext-api</artifactId>

                          <version>2.0.0-beta-2</version>

                      </dependency>{code}

          and the package name has changed to

           

          {code:java}org.jboss.ejb3.annotation.Clustered{code}

          • 2. Re: Can't resolve @Clustered in session bean
            foutjo

            Thanks Stephen.

             

            Is it just a matter of adding this dependency definition to some configuration file?

            If yes what is the file name?

             

            Also do I have to get the jar file or is it already part of AS7?

            • 3. Re: Can't resolve @Clustered in session bean
              sfcoy

              That's a maven build time dependency.

               

              If you're not using maven it can be found in the modules/org/jboss/ejb3/main directory of your AS7 installation, where it will be named jboss-ejb3-ext-api-2.0.0-beta-2.jar

              • 4. Re: Can't resolve @Clustered in session bean
                foutjo

                I see the jar but where and how do I support it?

                 

                Do I put something in the standalone.xml file?

                 

                Thanks.

                • 5. Re: Can't resolve @Clustered in session bean
                  sfcoy

                  You don't need to do anything except compile against it.

                   

                  It will be automatically available to you at runtime.

                  • 6. Re: Can't resolve @Clustered in session bean
                    foutjo

                    I must be missing something.

                     

                    I must have screwed something up.

                     

                    Here is a list of what I have setup.

                     

                    I have the latest version of Eclipse Indigo installed.

                    In Eclipse I installed Jboss tools.

                    I setup the server for as7.

                    In the classpath of my project it points to both the jbossv7 runtime and the jave 1.6 runtime.

                    I have a SLSB that has the @Clustered annotation.

                    Get can resolve @Clustered error on clean.

                    Tried organize imports and still could not find the jar.

                     

                    Thanks.

                    • 7. Re: Can't resolve @Clustered in session bean
                      sfcoy

                      It looks like this jar is missing from the JBoss Tools eclipse runtime.

                       

                      You can add it in the Preferences from Server/Runtime Environments/Default Classpath Entries/

                       

                      The path you're looking for on AS7.0.2 is "modules/org/jboss/ejb3/main/jboss-ejb3-ext-api-2.0.0-beta-1.jar".

                       

                      This assumes current Eclipse Indigo and JBoss Tools as described at JBoss Tools 3.3 M5 is coming to town.

                      • 8. Re: Can't resolve @Clustered in session bean
                        foutjo

                        I started from scratch.

                         

                        Downloaded jbossv7.1.0.CR1b

                        Latest Version of Indigo

                        Installed JBoss Tools 3.3 M5

                         

                        Setup project with classpath to jbossv7.1.0.CR1b  runtime and the jave 1.6 runtime.

                         

                        Without even setting up the server as soon as I put @Clustered in my java bean I get the error can't resolve @Clustered type.

                        Tried organize imports and still does not find the jar file.

                         

                        I then setup the server for 7.1.0

                        Did your suggestion:

                           "modules/org/jboss/ejb3/main/jboss-ejb3-ext-api-2.0.0-beta-1.jar".

                         

                        Still get java error for @Clustered.

                         

                        Not sure what I'm missing but if you try and put the @Clustered into a java program do you get the same error?

                         

                        Thanks again for all of your help.


                        • 9. Re: Can't resolve @Clustered in session bean
                          sfcoy

                          I believe the package name changed (as above) between 5.1 and 7.x. Did you check that?

                          • 10. Re: Can't resolve @Clustered in session bean
                            foutjo

                            Stephen,

                             

                            Using Jboss 5.1 I remember that I had to include the following jar files in my classpath:

                             

                            jboss-j2ee.jar and jboss.ejb3x.jar

                             

                             

                            In your previous answer you seemed to think that it was in:

                                                modules/org/jboss/ejb3/main directory of your AS7 installation, where it will be named jboss-ejb3-ext-api-2.0.0-beta-2.jar

                             

                            The problem is how do I get my Eclipse workspace to recognize it?

                             

                            I would have thought that the @Clustered support would have been part of the standard as7 runtime jar file.

                             

                            In your current AS7 eclipse workspace can you create a bean with the @Clustered annotation without getting an error?

                             

                            Thanks.

                            • 11. Re: Can't resolve @Clustered in session bean
                              sfcoy

                              Yes I can.

                               

                              Does your import statement look like:

                               

                              {code:java}import org.jboss.ejb3.annotation.Clustered;{code}

                               

                              ?

                              • 12. Re: Can't resolve @Clustered in session bean
                                foutjo

                                Yes when using 5.1 my code had the following:

                                 

                                import org.jboss.ejb3.annotation.Clustered;

                                 

                                After update to v7.1 this was an error:  Could not resolve type.

                                 

                                Removed old import and did an organize import in Eclipse.

                                Eclipse found no match so it is still an error with unknown type.

                                • 13. Re: Can't resolve @Clustered in session bean
                                  rhusar

                                  Stephen Coy wrote:

                                   

                                  I believe the package name changed (as above) between 5.1 and 7.x. Did you check that?

                                  No it hasnt, it's still and always been org.jboss.ejb3.annotation.Clustered. You shoud update the dependency to the AS7 one for sure.

                                  • 14. Re: Can't resolve @Clustered in session bean
                                    rhusar

                                    After update to v7.1 this was an error:  Could not resolve type.

                                    Is this in Eclipse or in runtime? If you have problem only with IDE just build it manually (mvn install). For this annotation to work, make sure you are starting HA profile.

                                     

                                    ./bin/standalone.sh -c standalone-ha.xml

                                    1 2 Previous Next