4 Replies Latest reply on Aug 22, 2016 5:05 PM by berhauz

    package org.jboss.ejb3.annotation does not exist

    mats001

      Hi,

       

      I was using HelloWorldMDB from QuickStart sample as a base, and started changing the sample to refer to external resource adapter. I just add "import org.jboss.ejb3.annotation.ResourceAdapter;" to HelloWorldMDB.java, but Maven ( command : "mvn  package jboss-as:deploy") gave me the following error. Since I am new to AS7, can anyone shed me some light on this ?

       

      Thanks,

       

      TS

       

      [ERROR] COMPILATION ERROR :

      [INFO] -------------------------------------------------------------

      [ERROR] \jboss-as-7.1.1.Final\jboss-jdf-jboss-as-quickstart-32304a4\helloworld-mdb\src\main\java\org\jboss\as\quickstarts\mdb\HelloWorldMDB.java:[55,32] package org.jboss.ejb3.annotation does not exist

        • 1. Re: package org.jboss.ejb3.annotation does not exist
          wdfink

          You might have to add the correct dependency to the pom.xml

           

          <dependency>

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

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

            <scope>provided</scope>

          </dependency>

          • 2. Re: package org.jboss.ejb3.annotation does not exist
            mats001

            Thanks, Wold-Dieter. That's my problem. Plus, since the artifact is not in marven repository, I have to use the following command to mannully import them to my local repository. Now it is working.

             

            mvn install:install-file -Dfile=C:\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

            • 3. Re: package org.jboss.ejb3.annotation does not exist
              wdfink

              Should be in the repository if you use the correct dependency.

              I've used a new repo and it works.

               

              See https://github.com/wfink/jboss-as-quickstart/tree/ejb-multi-server the root pom.xml and app-two/ejb/pom.xml (which use such jboss specific)

              • 4. Re: package org.jboss.ejb3.annotation does not exist
                berhauz

                alternatively, you can add the JBoss artifact repository references in your maven POM, or a parent project POM, or even the .m2 settings.xml (so that Maven will be able to resolve the dependency):

                     <repositories>
                          <repository>
                               <id>jboss-enterprise-maven-repository</id>
                               <url>https://maven.repository.redhat.com/ga/</url>
                               <releases>
                                    <enabled>true</enabled>
                               </releases>
                               <snapshots>
                                    <enabled>false</enabled>
                               </snapshots>
                          </repository>
                          <repository>
                               <id>jboss-public-repository</id>
                               <name>JBoss Public</name>
                               <url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url>
                               <releases>
                                    <enabled>true</enabled>
                                    <updatePolicy>never</updatePolicy>
                               </releases>
                               <snapshots>
                                    <enabled>false</enabled>
                                    <updatePolicy>daily</updatePolicy>
                               </snapshots>
                          </repository>
                     </repositories>

                and then add the dependency to the project in which some org.jboss annotations are used:

                        <dependency>
                             <groupId>org.jboss.ejb3</groupId>
                             <artifactId>jboss-ejb3-ext-api</artifactId>
                             <version>2.2.0.Final</version>
                             <scope>provided</scope>
                        </dependency>