5 Replies Latest reply on Jun 14, 2013 4:39 AM by Radim Hanus

    @TransactionTimeout Annotation not found

    Hans-Michael Rupp Novice

      Hello,

       

      using a pom.xml generated by jboss-javaee6-webapp archetype

      following the example given in https://docs.jboss.org/author/display/AS7/EJB+3+Reference+Guide

      I try to annotate a @TransactionTimeout on an EJB method.

      However the compiler does not recognize it.

      Also when I look up the JEE6 Api Doc (http://docs.oracle.com/javaee/6/api/) there is no such Annotation.

      ?????

      Is it jboss-specific? Which dependency do I have to add to my pom to be able to use it?

       

      Thanks,

       

      Hans

        • 1. Re: @TransactionTimeout Annotation not found
          Radim Hanus Expert

          yes it's jboss ejb3 extension annotation defined in jboss-ejb3-ext-api-2.0.0.jar

           

                  <dependency>

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

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

                       <version>2.0.0</version>

                      <scope>provided</scope>

                  </dependency>

          • 2. Re: @TransactionTimeout Annotation not found
            Hans-Michael Rupp Novice

            I have added this dependency, and the Annotation is still not found.

             

            <dependencyManagement>

                    <dependencies>

                        <!-- JBoss distributes a complete set of Java EE 6 APIs including

                            a Bill of Materials (BOM). A BOM specifies the versions of a "stack" (or

                            a collection) of artifacts. We use this here so that we always get the correct

                            versions of artifacts. Here we use the jboss-javaee-6.0-with-tools stack

                            (you can read this as the JBoss stack of the Java EE 6 APIs, with some extras

                            tools for your project, such as Arquillian for testing) and the jboss-javaee-6.0-with-hibernate

                            stack you can read this as the JBoss stack of the Java EE 6 APIs, with extras

                            from the Hibernate family of projects) -->

                        <dependency>

                            <groupId>org.jboss.bom</groupId>

                            <artifactId>jboss-javaee-6.0-with-tools</artifactId>

                            <version>${jboss.bom.version}</version>

                            <type>pom</type>

                            <scope>import</scope>

                        </dependency>

                        <dependency>

                            <groupId>org.jboss.bom</groupId>

                            <artifactId>jboss-javaee-6.0-with-hibernate</artifactId>

                            <version>${jboss.bom.version}</version>

                            <type>pom</type>

                            <scope>import</scope>

                        </dependency>

                    </dependencies>

                </dependencyManagement>

               

                <dependencies>

             

                    <!-- First declare the APIs we depend on and need for compilation.

                        All of them are provided by JBoss AS 7 -->

                       

                        <dependency>

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

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

                         <version>2.0.0</version>

                        <scope>provided</scope>

                    </dependency>

             

            Might this be caused by the entries in the dependency Management section?

            • 3. Re: @TransactionTimeout Annotation not found
              Hans-Michael Rupp Novice

              I had to import the artifact manually with

              mvn install:install-file -Dfile=D:\jboss-as-7.1.1.Final\modules\org\jboss\ejb3\main\jboss-ejb3-ext-api-2.0.0.jar -DgroupId="org.jboss.ejb3" -DartifactId="jboss-ejb3-ext-api" -Dversion="2.0.0" -Dpackaging=jar

              Now the package is found, but the import somehow conflicts with other annotations used in this sample project:

               

              An annotation processor threw an uncaught exception.

              Consult the following stack trace for details.

              java.lang.IllegalArgumentException: The argument does not represent an annotatio

              n type: Model

                      at com.sun.tools.javac.processing.JavacRoundEnvironment.getElementsAnnot

              atedWith(JavacRoundEnvironment.java:119)

               

              An annotation processor threw an uncaught exception.

              Consult the following stack trace for details.

              java.lang.IllegalArgumentException: The argument does not represent an annotatio

              n type: Observes

                      at com.sun.tools.javac.processing.JavacRoundEnvironment.getElementsAnnot

              atedWith(JavacRoundEnvironment.java:119)

              • 5. Re: @TransactionTimeout Annotation not found
                Radim Hanus Expert

                I use following deps config and it works for me well

                 

                    <dependencyManagement>

                        <dependencies>

                            <!-- Define the version of JBoss' Java EE 6 APIs we want to import.

                               Any dependencies from org.jboss.spec will have their version defined by this

                               BOM -->

                            <!-- JBoss distributes a complete set of Java EE 6 APIs including

                                a Bill of Materials (BOM). A BOM specifies the versions of a "stack" (or

                                a collection) of artifacts. We use this here so that we always get the correct

                                versions of artifacts. Here we use the jboss-javaee-6.0 stack (you can

                                read this as the JBoss stack of the Java EE 6 APIs). You can actually

                                use this stack with any version of JBoss AS that implements Java EE 6, not

                                just JBoss AS 7! -->

                            <dependency>

                                <groupId>org.jboss.spec</groupId>

                                <artifactId>jboss-javaee-6.0</artifactId>

                                <version>3.0.0.Final</version>

                                <type>pom</type>

                                <scope>import</scope>

                            </dependency>

                        </dependencies>

                    </dependencyManagement>

                 

                   <dependencies>

                      <!-- Import the CDI API, we use provided scope as the API is included

                         in JBoss AS 7 -->

                      <dependency>

                         <groupId>javax.enterprise</groupId>

                         <artifactId>cdi-api</artifactId>

                         <scope>provided</scope>

                      </dependency>

                 

                      <!-- Import the Common Annotations API (JSR-250), we use provided scope

                         as the API is included in JBoss AS 7 -->

                      <dependency>

                         <groupId>org.jboss.spec.javax.annotation</groupId>

                         <artifactId>jboss-annotations-api_1.1_spec</artifactId>

                         <scope>provided</scope>

                      </dependency>

                 

                 

                      <!-- Import the Servlet API, we use provided scope as the API is included

                         in JBoss AS 7 -->

                      <dependency>

                         <groupId>org.jboss.spec.javax.servlet</groupId>

                         <artifactId>jboss-servlet-api_3.0_spec</artifactId>

                         <scope>provided</scope>

                      </dependency>

                 

                      <dependency>

                                <groupId>org.jboss.spec.javax.ejb</groupId>

                                <artifactId>jboss-ejb-api_3.1_spec</artifactId>

                      </dependency>

                 

                        <dependency>

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

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

                             <version>2.0.0</version>

                            <scope>provided</scope>

                        </dependency>

                   </dependencies>