首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >把EJB模块打包成EAR还是JAR?

把EJB模块打包成EAR还是JAR?
EN

Stack Overflow用户
提问于 2017-11-06 23:57:37
回答 1查看 317关注 0票数 0

这个hello应该是作为EARJAR进行部署的包吗?

代码语言:javascript
复制
thufir@dur:~/NetBeansProjects/EJBModule1$ 
thufir@dur:~/NetBeansProjects/EJBModule1$ cat src/java/net/bounceme/dur/ejb/NewSessionBean.java 
package net.bounceme.dur.ejb;

import java.util.logging.Logger;
import javax.ejb.Stateless;

@Stateless(name = "FooBean", mappedName = "ejb/FooBean")
public class NewSessionBean implements NewSessionBeanRemote {

    private final static Logger log = Logger.getLogger(NewSessionBean.class.getName());

    @Override
    public void sayHello() {
        log.info("hi");
    }

}
thufir@dur:~/NetBeansProjects/EJBModule1$ 

部署:

代码语言:javascript
复制
thufir@dur:~/NetBeansProjects/EJBModule1$ 
thufir@dur:~/NetBeansProjects/EJBModule1$ asadmin list-applications
Nothing to list.
No applications are deployed to this target server.
Command list-applications executed successfully.
thufir@dur:~/NetBeansProjects/EJBModule1$ 
thufir@dur:~/NetBeansProjects/EJBModule1$ ant -p
Buildfile: /home/thufir/NetBeansProjects/EJBModule1/build.xml
Builds, tests, and runs the project EJBModule1.
Main targets:

 -profile-pre72         Profile a J2EE project in the IDE.
 clean                  Clean build products.
 compile                Compile project.
 debug                  Debug project in IDE.
 default                Build whole project.
 dist                   Build distribution (JAR).
 dist-directory-deploy  Build distribution (JAR) - if directory deployment is not supported.
 dist-ear               Build distribution (JAR) to be packaged into an EAR.
 javadoc                Build Javadoc.
 profile                Profile a J2EE project in the IDE.
 run                    Deploy to server.
 test                   Run unit tests.
 test-single            Run single unit test.
 test-single-method     Run single unit test.
Default target: default
thufir@dur:~/NetBeansProjects/EJBModule1$ 
thufir@dur:~/NetBeansProjects/EJBModule1$ ant run
Buildfile: /home/thufir/NetBeansProjects/EJBModule1/build.xml

-pre-init:

-init-private:

-init-userdir:

-init-user:

-init-project:

-init-macrodef-property:

-do-init:

-post-init:

-init-check:

-init-ap-cmdline-properties:

-init-macrodef-javac-with-processors:

-init-macrodef-javac-without-processors:

-init-macrodef-javac:

-init-macrodef-test-impl:

-init-macrodef-junit-init:

-init-macrodef-junit-single:

-init-test-properties:

-init-macrodef-junit-batch:

-init-macrodef-junit:

-init-macrodef-junit-impl:

-init-macrodef-testng:

-init-macrodef-testng-impl:

-init-macrodef-test:

-init-macrodef-junit-debug:

-init-macrodef-junit-debug-batch:

-init-macrodef-junit-debug-impl:

-init-macrodef-test-debug-junit:

-init-macrodef-testng-debug:

-init-macrodef-testng-debug-impl:

-init-macrodef-test-debug-testng:

-init-macrodef-test-debug:

-init-macrodef-java:

-init-debug-args:

-init-macrodef-nbjpda:

-init-macrodef-debug:

-init-taskdefs:

-init-ap-cmdline-supported:

-init-ap-cmdline:

init:

-init-cos:

-init-deploy:

-deps-module-jar:

-deps-ear-jar:

deps-jar:

-pre-pre-compile:

-pre-compile:

-copy-meta-inf:

-do-compile:

-post-compile:

compile:

-library-inclusion-in-archive-weblogic:

-library-inclusion-in-archive-by-user:

library-inclusion-in-archive:

-pre-dist:

-do-tmp-dist-without-manifest:

-do-tmp-dist-with-manifest:

-do-dist-directory-deploy:

-post-dist:

dist-directory-deploy:

pre-run-deploy:

-pre-nbmodule-run-deploy:

-run-deploy-nb:

-init-deploy-ant:

-init-cl-deployment-env:

-parse-glassfish-web:

-parse-sun-web:

-no-parse-sun-web:

-add-resources:

-deploy-ant:

-deploy-without-pw:
     [echo] Deploying dist/EJBModule1.jar
      [get] Getting: http://localhost:4848/__asadmin/deploy?path=/home/thufir/NetBeansProjects/EJBModule1/dist/EJBModule1.jar&force=true&name=EJBModule1
      [get] To: /tmp/gfv3945180939
   [delete] Deleting: /tmp/gfv3945180939

-deploy-with-pw:

-run-deploy-am:

-post-nbmodule-run-deploy:

post-run-deploy:

-do-update-breakpoints:

run-deploy:

run:

BUILD SUCCESSFUL
Total time: 1 second
thufir@dur:~/NetBeansProjects/EJBModule1$ 
thufir@dur:~/NetBeansProjects/EJBModule1$ asadmin list-applications
EJBModule1  <ejb>  
Command list-applications executed successfully.
thufir@dur:~/NetBeansProjects/EJBModule1$ 
thufir@dur:~/NetBeansProjects/EJBModule1$ cat src/java/net/bounceme/dur/ejb/NewSessionBean.java 
package net.bounceme.dur.ejb;

import java.util.logging.Logger;
import javax.ejb.Stateless;

@Stateless(name = "FooBean", mappedName = "ejb/FooBean")
public class NewSessionBean implements NewSessionBeanRemote {

    private final static Logger log = Logger.getLogger(NewSessionBean.class.getName());

    @Override
    public void sayHello() {
        log.info("hi");
    }

}
thufir@dur:~/NetBeansProjects/EJBModule1$ 

这只是一个“模块”;据我所知,这意味着没有web组件(WAR文件)。但它仍有可能是EAR...or,不是吗?

(构建文件/etc都是Netbeans的默认设置。)

EN

回答 1

Stack Overflow用户

发布于 2017-11-07 07:47:22

Ear用于将Jar模块和war模块捆绑在一起。因此,当企业应用程序具有以下功能时,Ear模块是有意义的:

  • 多个Jar模块
  • 多war模块
  • 多个罐子和战争模块。

此外,在上述设置中也存在类路径含义。

如果我的应用程序只有一个jar模块或war模块,我将直接部署它。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47147825

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档