私は EAR ファイルにパッケージ化し、/lib フォルダーにすべての依存関係を含む Maven プロジェクトを持っています。しかし、EAR ファイルのデプロイ中に、jboss で 2 つ以下のエラーが発生します。
1)java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/jms/JMSException
上記のエラーについて、/lib フォルダー内にある j2ee 関連の jar ファイルを削除する必要があることを知りました。
2)java.lang.ClassCastException: com.xx.sms.ejb.ws.xxx.CoordinatorServiceBean cannot be cast to javax.servlet.Servlet
そして、このエラーは、javax.servlet 関連の jar ファイルを /lib フォルダーから削除する必要があると思います。これは jboss servletContainer によってすでに提供されている可能性があるため、/lib フォルダーから除外する必要があります。私はmavenの世界に不慣れで、どうにかしてEARを作成することができました。
EAR のパッキング中に j2ee 関連およびサーブレット関連の jar ファイルを除外する方法を教えてください。以下は私の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>