JBOSS 7.1.1中DLL的路径设置 [英] Path setting for DLL's in JBOSS 7.1.1

查看:139
本文介绍了JBOSS 7.1.1中DLL的路径设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一些与Java,VB相关的DLL.在Joss 4.X中,我们曾经将其放置在Application Server下的bin目录中.

We have some DLL's which are related to Java,VB. In Joss 4.X , We used to place in bin directory under Application Server.

我们迁移到JBOSS 7.1.1,当我从bin目录中删除并将它们放置在C:\jboss-as-7.1.1.Final\modules\com\correction\main\libraries下的library文件夹中时.

We migrated to JBOSS 7.1.1 and when I removed from bin directory and placed them in libraries folder under C:\jboss-as-7.1.1.Final\modules\com\correction\main\libraries .

我遇到了例外情况

java.lang.UnsatisfiedLinkError: no xxxJavaWrapper in java.library.path
java.library.path = C:\Program Files\Java\jdk1.6.0_24\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\apache-maven-3.0.4;C:\apache-maven-3.0.4\bin;C:\Python27;C:\Program Files\Java\jdk1.6.0_24;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
java.lang.UnsatisfiedLinkError: com.xxxJavaWrapperJNI.new_xxx()J

module.xml

module.xml

<?xml version="1.0" encoding="UTF-8"?>
    <module xmlns="urn:jboss:module:1.0" name="com.correction">
        <resources>
            <resource-root path="xxx.jar"/>
            <resource-root path="xyz.jar"/>
            <resource-root path="libraries"/>
        </resources>
        <dependencies>
            <system export="true">
                <paths>
                    <path name="libraries"/>
                </paths>
                <exports>
                    <include-set>
                        <path name="libraries"/>
                    </include-set>
                </exports>
            </system>
        </dependencies>
    </module>

但是我将相同的dll放在bin文件夹中,它工作正常. 我想将它们放在模块文件夹中,然后从此处而不是bin中设置路径,以便将所有与应用程序相关的jar,属性和dll文件放在一个位置,以便于维护.

But I place the same dll's in bin folder, it is working fine. I want to place them in module folder and set the path from there instead of bin so that I can have all the application related jar's, properties and dll files at one place for ease maintainance.

我还想知道如何在jboss 7.1.1中设置txt和属性文件的路径

Also I want to know how to set the path of txt and properties files in jboss 7.1.1

问候 斯里尼

推荐答案

配置 module.xml 如下:

<module xmlns="urn:jboss:module:1.1" name="com.correction">
    <resources>
        <resource-root path="xxx.jar"/>
        <resource-root path="xyz.jar"/>
        <resource-root path="lib/win-x86_64"/>
    </resources>

   <dependencies>
       <module name="sun.jdk"/>
    </dependencies>
</module>

将DLL放入目录 lib/win-x86_64 .检查项目的其他依赖项.

Put the DLLs into the directory lib/win-x86_64. Check the another dependencies of your project.

在应用程序的 WEB-INF 中,创建文件 jboss-deployment-structure.xml 并将内容放在下面:

In WEB-INF of your application creating the file jboss-deployment-structure.xml and put the content below:

<jboss-deployment-structure>
  <deployment>
     <dependencies>
        <module name="com.correction"/>
     </dependencies>
  </deployment>
</jboss-deployment-structure>

仅此而已.

另一个问题:如何使JBoss 7上部署的应用程序可以访问这些属性文件?

Another Question: How can you make these properties files accessible to applications deployed on JBoss 7?

创建一个自定义模块,在其中放置属性文件,并将 jboss-deployment-structure.xml 放入应用程序归档文件(WAR/EAR)中以使用该自定义模块

create a custom module where you put your properties files and put jboss-deployment-structure.xml to your application archive (WAR/EAR) to use that custom module.

$ JBOSS_HOME/modules 下创建新的模块目录(在此示例中使用app/conf)

Create the new module directory under $JBOSS_HOME/modules(using app/conf in this example)

mkdir -p $JBOSS_HOME/modules/app/conf/main/properties/

将属性文件放入 $ JBOSS_HOME/modules/app/conf/main/properties/

在此处创建模块.xml $ JBOSS_HOME/modules/app/conf/main/module.xml

Create a module.xmlhere $JBOSS_HOME/modules/app/conf/main/module.xml

<module xmlns="urn:jboss:module:1.1" name="app.conf">
   <resources>
      <resource-root path="properties"/>
   </resources>
</module>

WEB-INF 中放入以下 jboss-deployment-structure.xml :

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
   <deployment>
      <dependencies>
            <module name="app.conf" />
   </dependencies>
   </deployment>
</jboss-deployment-structure>

然后,您可以使用以下代码访问属性文件(示例假设您有一个 $ JBOSS_HOME/modules/app/conf/main/properties/)中的example.properties文件

Then you can access your properties files using thecode below (example assumes you have a example.propertiesfile in $JBOSS_HOME/modules/app/conf/main/properties/)

Thread.currentThread().getContextClassLoader().getResource("example.properties");

Ps:我使用了JBoss AS 7.1.2(JBoss EAP 6)

Ps: I used JBoss AS 7.1.2 ( JBoss EAP 6 )

问候 毛里西奥·马格纳尼(Mauricio Magnani)

Regards Mauricio Magnani

这篇关于JBOSS 7.1.1中DLL的路径设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆