我試圖將EAR文件部署到應用程序服務器。該項目使用NetBeans 7中的Maven 3構建。部署ear文件時出現問題
當我嘗試部署Glassfish和Websphere CE時,告訴我某些類即使它們打包在EAR文件中也無法找到。應用程序服務器可以查看包中的其他類,但不是全部。
問題是什麼?我一直在努力解決這一整天。我查看了Maven POM文件,並且一直在閱讀有關部署描述符的內容,但我似乎並未在進行中。
我得到的錯誤是 SEVERE:Class [className] not found。加載時出錯[類名]
下面是該項目的主要POM文件:
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>SeaMarNetting</artifactId>
<groupId>com.manageinc.seamar</groupId>
<version>1.0RC1</version>
</parent>
<groupId>${project.parent.groupId}</groupId>
<artifactId>SeaMarNetting-ear</artifactId>
<packaging>ear</packaging>
<version>${project.parent.version}</version>
<name>SeaMarNetting-ear JEE5 Assembly</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>${project.parent.groupId}</groupId>
<artifactId>SeaMarNetting-project-deps</artifactId>
<version>${project.parent.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>${project.parent.groupId}</groupId>
<artifactId>SeaMarNetting-ejb</artifactId>
<version>${project.parent.version}</version>
<type>ejb</type>
</dependency>
<dependency>
<groupId>${project.parent.groupId}</groupId>
<artifactId>SeaMarNetting-jpa</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>${project.parent.groupId}</groupId>
<artifactId>SeaMarNetting-web</artifactId>
<version>${project.parent.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>com.manageinc.seamar</groupId>
<artifactId>SeaMarNetting-web</artifactId>
<version>1.0RC1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>${source.version}</source>
<target>${compile.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.4.2</version>
<configuration>
<version>5</version>
<displayName>SeaMarNetting</displayName>
<modules>
<jarModule>
<groupId>${project.parent.groupId}</groupId>
<artifactId>SeaMarNetting-jpa</artifactId>
</jarModule>
<ejbModule>
<groupId>${project.parent.groupId}</groupId>
<artifactId>SeaMarNetting-ejb</artifactId>
</ejbModule>
<webModule>
<groupId>${project.parent.groupId}</groupId>
<artifactId>SeaMarNetting-web</artifactId>
<contextRoot>/nets</contextRoot>
</webModule>
</modules>
</configuration>
</plugin>
</plugins>
</build>
我試圖改變範圍的建議,但我得到了同樣的錯誤消息。我剛開始使用Maven,我確信這是簡單的,我不知道。
謝謝。
感謝您回覆TedPrz。問題是持久層的瓶子沒有被glassfish看到。耳朵由ejb,web和jpa中的每個jar組成。我可以在Websphere Express上部署和運行應用程序,但不能在glassfish和Websphere CE上運行。有問題的罐子在EAR裏面。 – user1054606 2012-01-09 22:53:46
你確定耳朵包裝正確嗎?有什麼辦法可以發佈部分.xml文件嗎? – Ted 2012-01-10 12:13:48
不,我不確定EAR是否正確打包。我開始使用Maven構建的現有項目。這是我第一次使用Maven。該項目在NetBeans中正常生成並在生產服務器上運行。我試圖建立一個開發服務器。 – user1054606 2012-01-10 16:39:09