Glassfish 3.0: Exception while deploying ejb module…Invalid ejb j ar: it contains zero ejb

萝らか妹 提交于 2019-12-06 19:22:27
unwichtich

I don't see a problem with your setup. If you really have some class annotated with @Singleton or @Stateless inside this project, this should work.

But one important point is that if you have any dependencies which are not available in the libs of Glassfish, you have to package them with your application which is not possible with EJB/JAR packaging. You have to package it as a WAR or EAR file.

For a quick start, try the following:

Change

<packaging>ejb</packaging>

to

<packaging>war</packaging>

and change

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-ejb-plugin</artifactId>
            <version>2.3</version>
            <configuration>
                <ejbVersion>3.1</ejbVersion>
            </configuration>
        </plugin>

to

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.1.1</version>
            <configuration>
                <failOnMissingWebXml>false</failOnMissingWebXml>
            </configuration>
        </plugin>

If you want to package it as an EAR, you can use the maven-ear-plugin.

See also:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!