【发布时间】:2014-04-10 21:53:10
【问题描述】:
我有一个 ear 构建 pom 构建 api、ejb 和核心 java 模块。但是当我部署并启动 JBoss 时,它会部署带有耳朵名称的 ejb JNDI 名称。例如JNDI 名称是server-component-ear-0.0.1-SNAPSHOT/MyServiceBean/local
这里的 MyServiceBean 是我想从 JNDI 视图中查找的 ejb。它在 ejb 模块内。我最后的耳朵名字是server-component-ear-0.0.1-SNAPSHOT.ear
其中包含
-lib
-META-INF
-server-component-ejb-0.0.1-SNAPSHOT.jar
-server-component-core-0.0.1-SNAPSHOT.jar
听到我的earpom文件
<parent>
<groupId>xxx.group.abc</groupId>
<artifactId>component-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<name>COMPONENT EAR</name>
<artifactId>server-component-ear</artifactId>
<packaging>ear</packaging>
<dependencies>
<dependency>
<groupId>xxx.group.abc</groupId>
<artifactId>component-ejb</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>ejb</type>
<exclusions>
<exclusion>
<groupId>xxx.group.xyz</groupId>
<artifactId>some.artifact</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>xxx.group.abc</groupId>
<artifactId>server-component-core</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>jar</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.8</version>
<configuration>
<defaultLibBundleDir>lib</defaultLibBundleDir>
<modules>
<jarModule>
<groupId>xxx.group.abc</groupId>
<artifactId>component-core</artifactId>
<bundleDir>/</bundleDir>
<includeInApplicationXml>true</includeInApplicationXml>
</jarModule>
</modules>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<versionRange>[2.8,)</versionRange>
<goals>
<goal>generate-application-xml</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
我用来运行maven build 以创建ear 的服务器组件pom 文件。
<name>SERVER COMPONENT</name>
<groupId>xxx.group.abc</groupId>
<artifactId>server-component-parent</artifactId>
<packaging>pom</packaging>
<version>0.0.1-SNAPSHOT</version>
<modules>
<module>api</module>
<module>ejb</module>
<module>core</module>
<module>ear</module>
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.3</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9</version>
<executions>
<execution>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
这是ear中的application.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE application PUBLIC
"-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"
"http://java.sun.com/dtd/application_1_3.dtd">
<application>
<display-name>server-component-ear</display-name>
<module>
<java>server-component-core-0.0.1-SNAPSHOT.jar</java>
</module>
<module>
<ejb>server-component-ejb-0.0.1-SNAPSHOT.jar</ejb>
</module>
</application>
我怎样才能让它工作,因为 JNDI 名称只能是 MyServiceBean/local
【问题讨论】:
标签: java maven jakarta-ee jboss ear