在JBoss中,我可以配置一个“共享库”位置? [英] In JBoss can I configure a "shared library" location?

查看:165
本文介绍了在JBoss中,我可以配置一个“共享库”位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在开发环境中使用JBoss 4.2.2.GA应用服务器。我有一个WAR文件, MyWar.war 和一个JAR文件 ExternalJar.jar 。这些文件的结构如下:



应用程序WAR文件:

  MyWar.war 
|
| --- AppClass1.class
|
| --- AppClass2.class

外部jar文件(由客户端提供):

  ExternalJar.jar 
|
| --- ExternalClass.class

ExternalClass需要使用AppClass1和AppClass2才能使用ExternalClass。当我在JBoss中部署WAR并将JAR放在JBoss的类路径中时,当我运行应用程序时,我会在实例化 ExternalClass 时得到一个LinkageError。看起来好像WAR看到了 ExternalClass ,但是 ExternalClass 无法访问WAR内的类。



如果我在WAR文件(WEB-INF / lib)中手动放置 ExternalJar ,它可以正常工作。但是,我们宁愿不修改存档文件,以保持与我们的生产部署的一致性。



JBoss中是否有任何配置或设置允许共享库文件夹包含在应用程序的类路径中

解决方案

您可以禁用WAR文件类加载器隔离执行以下操作:



打开此文件
%JBOSS_HOME%\server\< serverName> \deploy\jboss -web.deployer\META-INF\jboss-service.xml



将此属性设置为true:
< attribute name =UseJBossWebLoader> true< / attribute>



你应该可以把你的扩展名文件在您的WAR文件的 deploy / 目录中。



如果要加载多个文件,此设置可能会导致问题WAR文件具有相同的库,因此YMMV。


I am using JBoss 4.2.2.GA app server in a development environment. I have a WAR file, MyWar.war, and a JAR file ExternalJar.jar. These files are structured in the following way:

Application WAR file:

MyWar.war
|
|--- AppClass1.class
|
|--- AppClass2.class    

External jar file (provided by client):

ExternalJar.jar
|
|--- ExternalClass.class

ExternalClass needs to use AppClass1 and AppClass2 needs to use ExternalClass. When I deploy the WAR in JBoss and put JAR in JBoss' class path, I get a LinkageError on instantiating ExternalClass when I run the app. It seems as though the WAR sees the ExternalClass, but ExternalClass cannot access classes within the WAR.

If I manually put ExternalJar in the WAR file (WEB-INF/lib), it works fine. But we'd rather not modify archive files to maintain consistency with our production deployments.

Is there any configuration or setting in JBoss that allows for a shared library folder that will be included in the class path for the app?

解决方案

You can disable WAR file class loader isolation by doing the following:

Open this file %JBOSS_HOME%\server\<serverName>\deploy\jboss-web.deployer\META-INF\jboss-service.xml

Set this attribute to true: <attribute name="UseJBossWebLoader">true</attribute>

You should be able to put your extension JAR file in the deploy/ directory with your WAR file.

This setting could cause issues if you're loading multiple WAR files with the same libraries, so YMMV.

这篇关于在JBoss中,我可以配置一个“共享库”位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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