Jakarta ee 作为企业应用程序项目的一部分部署预构建的资源适配器存档

Jakarta ee 作为企业应用程序项目的一部分部署预构建的资源适配器存档,jakarta-ee,netbeans,glassfish,netbeans-8,glassfish-4.1,Jakarta Ee,Netbeans,Glassfish,Netbeans 8,Glassfish 4.1,我有一个预构建的资源适配器存档(*.rar)文件,我需要它作为Netbeans企业应用程序项目的一部分 在Build>Packaging中的项目属性中,我添加了这个*.rar文件,并将归档位置设置为root(/) 还有一个EJB模块项目,它使用*.rar中的类。当我构建*.ear文件并手动将其部署到Glassfish时,一切都很好,我甚至不必编写application.xml 但是,当我从Netbeans部署应用程序项目时,我的EJB无法访问*.rar中的类,并抛出NoClassDefFound

我有一个预构建的资源适配器存档(
*.rar
)文件,我需要它作为Netbeans企业应用程序项目的一部分

Build>Packaging
中的项目属性中,我添加了这个
*.rar
文件,并将
归档位置设置为root(
/

还有一个EJB模块项目,它使用
*.rar
中的类。当我构建
*.ear
文件并手动将其部署到Glassfish时,一切都很好,我甚至不必编写
application.xml

但是,当我从Netbeans部署应用程序项目时,我的EJB无法访问
*.rar
中的类,并抛出
NoClassDefFoundError
。如果我将文件
application.xml
放入
src/conf/
,则从Netbeans部署失败,原因是:

IllegalArgumentException: Expected to find an expanded directory for submodule my.rar but found a JAR.  If this is a directory deployment be sure to expand all submodules.
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>EnterpriseApplication1</display-name>
  <module>
    <connector>my.rar</connector>
  </module>
  ...
</application>

企业应用1
我的父亲,拉尔
...
如何让Netbeans在部署时解包rar

您通常如何使用Netbeans开发资源适配器(不是预构建的、本机项目,不是Maven)?我看不到这方面的模板


我的Netbeans是Glassfish 4.1.1附带的8.2版本。

我发现Netbeans构建脚本使用
任务来清理、准备和部署
dist/gfdeploy/Appname
目录。此任务复制
${build.dir}
中的所有内容,因此应该可以在
预运行部署
钩子中解包RAR

复制后,
解压jar文件,但不解压rar文件。jar被解包成具有相同名称的子目录,只有
.jar
后缀被替换为
\u jar

任务由
-run deploy nb
目标调用,并且仅在从Netbeans运行时调用(当设置了
${Netbeans.home}
时)

知道了这一点,我在
build.xml
中添加了
pre-run-deploy
钩子:

<target name="pre-run-deploy" if="netbeans.home">
    <fileset dir="${build.dir}" id="nth.archive">
        <include name="my.rar">
    </fileset>
    <pathconvert property="extract.dir" refid="nth.archive">
        <!-- replace last dot with underscore -->
        <mapper type="regexp" from="(.*)[.](.*)" to="\1_\2" />
    </pathconvert>
    <delete dir="${extract.dir}"/>
    <unzip dest="${extract.dir}">
        <resources refid="nth.archive"/>
    </unzip>
    <delete>
        <fileset refid="nth.archive"/>
    </delete>
</target>

实际上,我的目标要复杂得多,因为我想扩展
${build.dir}
中与
*.rar
模式匹配的每个文件。完整的
build.xml
如下: