I am trying to create a simple project with few stateless session beans.I have spent more than a week to find problem. Have tried various depenedencies but nothing worked. May be anyone can help me with this. But when i compile it with maven i get following error:
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project test: Compilation failure: Compilation failure:
[ERROR] \workspace\test\src\main\java\com\test\services\Test1ServiceImpl.java:[14,1] cannot find symbol
[ERROR] symbol: class Stateless
[ERROR] @Stateless
[ERROR] \workspace\test\src\main\java\com\test\services\Test1ServiceImpl.java:[16,1] cannot find symbol
[ERROR] symbol: class Remote
My POM looks like this:
http://maven.apache.org/maven-v4_0_0.xsd”>
4.0.0
<groupId>com.test</groupId>
<artifactId>test</artifactId>
<version>1.0-SNAPSHOT</version>
<name>test-common</name>
<packaging>ejb</packaging>
<repositories>
<repository>
<id>repository.jboss.org-public</id>
<name>JBoss.org Maven repository</name>
<url>https://repository.jboss.org/nexus/content/groups/public</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.3</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.jboss.ejb3</groupId>
<artifactId>jboss-ejb3-ext-api</artifactId>
<version>1.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jboss-annotations-ejb3</artifactId>
<version>4.2.3.GA</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId> com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.2.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
<version>1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging-api</artifactId>
<version>1.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.3</version>
<configuration>
</configuration>
</plugin>
<plugin>
<artifactId>maven-ejb-plugin</artifactId>
<version>2.3</version>
<configuration>
<ejbVersion>3.0</ejbVersion>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
You have to include the jar which contains javax.ejb.* APIs.
Add the dependency to the following jar in your pom.xml.
For Java EE 6: http://download.java.net/maven/2/javax/javaee-api/6.0/javaee-api-6.0.jar