开发者

In JBoss can I configure a "shared library" location?

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 inclu开发者_如何学运维ded 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.


You can deploy a jar file just like you deploy the war. Since JBoss use a shared class loader, your jar will be able to access the classes loaded from the war.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜