问题描述
我们有一些与 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.Finalmodulescom 下的库文件夹中correctionmainlibraries
.
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.Finalmodulescomcorrectionmainlibraries
.
我收到此异常
java.lang.UnsatisfiedLinkError: no xxxJavaWrapper in java.library.path
java.library.path = C:Program FilesJavajdk1.6.0_24in;.;C:WINDOWSSunJavain;C:WINDOWSsystem32;C:WINDOWS;C:apache-maven-3.0.4;C:apache-maven-3.0.4in;C:Python27;C:Program FilesJavajdk1.6.0_24;C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSSystem32Wbem
java.lang.UnsatisfiedLinkError: com.xxxJavaWrapperJNI.new_xxx()J
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和properties文件的路径
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/
在此处创建一个module.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>
将以下 jboss-deployment-structure.xml 放在 WEB-INF 中:
put the following jboss-deployment-structure.xml in WEB-INF:
<?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 aexample.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 )
问候毛里西奥·马格纳尼
RegardsMauricio Magnani
这篇关于JBOSS 7.1.1 中 DLL 的路径设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!