Question

I have a maven project where i am package to EAR file and including all dependencies in /lib folder. But while deploying EAR file i am getting below 2 errors in jboss.

 1)java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/jms/JMSException

For above error i learnt that i need to remove j2ee related jar files going inside the /lib folder.

 2)java.lang.ClassCastException: com.xx.sms.ejb.ws.xxx.CoordinatorServiceBean cannot be cast to javax.servlet.Servlet

And this error i believe i should remove javax.servlet related jar files from /lib folder. Because this may be already provided by jboss servletContainer and you should exclude from your /lib folder. I am new to maven world and somehow i managed to create a EAR.

Let me know how to exclude j2ee related and servlet related jar files during packing EAR. Below is my pom.xml

<dependencies>
        <dependency>
            <groupId>com.xxx.sms</groupId> 
            <artifactId>CoordinatorBeans</artifactId> 
            <version>1.0-SNAPSHOT</version>             
        </dependency>
        <dependency>
            <groupId>com.xxx</groupId>
            <artifactId>CoordinatorWeb</artifactId>
            <version>1.0-SNAPSHOT</version>
            <type>war</type>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-ear-plugin</artifactId>
                <configuration>
                    <defaultLibBundleDir>lib</defaultLibBundleDir>
                    <earSourceDirectory>${basedir}</earSourceDirectory>
                    <earSourceIncludes>META-INF/*</earSourceIncludes>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                        </manifest>
                    </archive>
                    <generateApplicationXml>false</generateApplicationXml>
                    <applicationXML>${basedir}/META-INF/application.xml</applicationXML>
                    <modules>
                        <jarModule>
                            <groupId>com.xxx.sms</groupId> 
                            <artifactId>CoordinatorBeans</artifactId> 
                            <bundleDir>/</bundleDir>
                            <bundleFileName>CoordinatorBeans.jar</bundleFileName>
                        </jarModule>
                        <webModule>
                            <groupId>com.xxx</groupId>
                            <artifactId>CoordinatorWeb</artifactId>
                            <bundleDir>/</bundleDir>
                            <bundleFileName>CoordinatorWeb.war</bundleFileName>
                        </webModule>
                    </modules>
                </configuration>
            </plugin>
        </plugins>
        <finalName>CoordinatorApp</finalName>
    </build>
Was it helpful?

Solution

After adding exclusions for below dependency it worked.

<dependency>
    <groupId>com.sun.xml.ws</groupId>
    <artifactId>jaxws-rt</artifactId>
    <version>2.2</version>
    <exclusions>
       <exclusion>
        <groupId>*</groupId>
        <artifactId>*</artifactId>
       </exclusion>
    </exclusions>   
</dependency>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top