users@glassfish.java.net

Re: Invalid ejb jar ... it contains zero ejb

From: Hong Zhang <hong.hz.zhang_at_oracle.com>
Date: Wed, 10 Aug 2011 09:31:17 -0400

Anything in the server.log? If the ejb jar does contain valid EJB, one
possibility is the annotation processing failed for some reason (class
not found etc) so the ejb component annotation is not processed properly..

On 8/10/2011 9:13 AM, forums_at_java.net wrote:
> I'm getting this error message when trying to deploy my ear to glassfish
> 3.1.
>
> java.lang.IllegalArgumentException: Invalid ejb jar [myejb.jar]: it
> contains
> zero ejb.
>
> Note:
>
> 1. A valid ejb jar requires at least one session, entity (1.x/2.x
> style), or
> message-driven bean.
>
> 2. EJB3+ entity beans (@Entity) are POJOs and please package them as
> library
> jar.
>
> 3. If the jar file contains valid EJBs which are annotated with EJB
> component
> level annotations (@Stateless, @Stateful, @MessageDriven, @Singleton),
> please
> check server.log to see whether the annotations were processed properly
>
> I can see the ejb jar in the ear and in Eclipse I can see my session
> beans in
> the deployment descriptor of the ejb project. I'm using maven to build
> it.
>
> the pom for my ejb looks like this:
>
> [code]<?xml version="1.0"?>
>
> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/xsd/maven-4.0.0.xsd"
> xmlns="http://maven.apache.org/POM/4.0.0"
>
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>
> <modelVersion>4.0.0</modelVersion>
>
> <groupId>my</groupId>
>
> <artifactId>myejb</artifactId>
>
> <version>1.0.0</version>
>
> <packaging>ejb</packaging>
>
> <url>http://maven.apache.org</url>
>
> <dependencies>
>
> <dependency>
>
> <groupId>javax.persistence</groupId>
>
> <artifactId>persistence-api</artifactId>
>
> <version>1.0</version>
>
> </dependency>
>
> <dependency>
>
> <groupId>junit</groupId>
>
> <artifactId>junit</artifactId>
>
> <version>3.8.1</version>
>
> <scope>test</scope>
>
> </dependency>
>
> <dependency>
>
> <groupId>com.bm</groupId>
>
> <artifactId>ejb3unit</artifactId>
>
> <version>2.0.0-RC-1</version>
>
> <scope>test</scope>
>
> </dependency>
>
> <dependency>
>
> <groupId>ant</groupId>
>
> <artifactId>ant-apache-log4j</artifactId>
>
> <version>1.6.5</version>
>
> </dependency>
>
> <dependency>
>
> <groupId>log4j</groupId>
>
> <artifactId>log4j</artifactId>
>
> <version>1.2.14</version>
>
> </dependency>
>
> <dependency>
>
> <groupId>javaee</groupId>
>
> <artifactId>javaee-api</artifactId>
>
> <version>5</version>
>
> <scope>provided</scope>
>
> </dependency>
>
> <dependency>
>
> <groupId>my</groupId>
>
> <artifactId>mypersistence</artifactId>
>
> <version>1.0.0</version>
>
> </dependency>
>
> </dependencies>
>
> <build>
>
> <plugins>
>
> <plugin>
>
> <artifactId>maven-ejb-plugin</artifactId>
>
> <version>2.2</version>
>
> <configuration>
>
> <ejbVersion>3.0</ejbVersion>
>
> </configuration>
>
> </plugin>
>
> <plugin>
>
> <artifactId>maven-compiler-plugin</artifactId>
>
> <version>2.0.2</version>
>
> <configuration>
>
> <source>1.5</source>
>
> <target>1.5</target>
>
> </configuration>
>
> </plugin>
>
>
>
> <plugin>
>
> <groupId>org.apache.maven.plugins</groupId>
>
> <artifactId>maven-surefire-plugin</artifactId>
>
> <configuration>
>
> <skipTests>true</skipTests>
>
> </configuration>
>
> </plugin>
>
> </plugins>
>
> </build>
>
> <profiles>
>
> <profile>
>
> <activation>
>
> <activeByDefault>true</activeByDefault>
>
> </activation>
>
> <repositories>
>
> <repository>
>
> <snapshots>
>
> <enabled>true</enabled>
>
> </snapshots>
>
> <id>ejb3unit</id>
>
> <name>ejb3unit repository</name>
>
> <url>http://ejb3unit.sourceforge.net/maven2</url>
>
> </repository>
>
> </repositories>
>
> </profile>
>
> </profiles>
>
> </project>[/code]
>
>
> --
>
> [Message sent by forum member 'kikujiro']
>
> View Post: http://forums.java.net/node/831197
>
>