2017-11-06 22 views
-1

このhello world EJBは、展開のためにEARまたはJARとしてパッケージ化する必要がありますか?パッケージEJBモジュールをEARまたはJARとして使用しますか?

[email protected]:~/NetBeansProjects/EJBModule1$ 
[email protected]:~/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"); 
    } 

} 
[email protected]:~/NetBeansProjects/EJBModule1$ 

展開:

[email protected]:~/NetBeansProjects/EJBModule1$ 
[email protected]:~/NetBeansProjects/EJBModule1$ asadmin list-applications 
Nothing to list. 
No applications are deployed to this target server. 
Command list-applications executed successfully. 
[email protected]:~/NetBeansProjects/EJBModule1$ 
[email protected]:~/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 
[email protected]:~/NetBeansProjects/EJBModule1$ 
[email protected]:~/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 
[email protected]:~/NetBeansProjects/EJBModule1$ 
[email protected]:~/NetBeansProjects/EJBModule1$ asadmin list-applications 
EJBModule1 <ejb> 
Command list-applications executed successfully. 
[email protected]:~/NetBeansProjects/EJBModule1$ 
[email protected]:~/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"); 
    } 

} 
[email protected]:~/NetBeansProjects/EJBModule1$ 

それはちょうど "モジュール" です。私の理解には、これはWebコンポーネント(WARファイル)がないことを意味します。しかし、それははまだEAR ...することができますか?

(ビルドファイルは/ etcは、NetBeansからのすべてのデフォルトです。)

答えて

1

耳はジャー・モジュールと戦争のモジュールtogeatherの両方をバンドルするために使用されます。

  • 複数のJARモジュール
  • 複数戦争モジュール
  • 複数のJARと戦争のモジュールを:エンタープライズアプリケーションがある場合 そこで耳のモジュールは、理にかなっています。

また、上記のセットアップではクラスパスの影響があります。

アプリケーションにjarモジュールまたはwarモジュールが1つしかない場合は、直接展開します。

関連する問題