Adding to the classpath for a WAR in JBoss EAP 5.x

Solution Verified - Updated -

Issue

  • How do we configure a resources directory so that, for example, property files can be found within a war, but outside the WEB-INF/classes directory?
webapp.war
├── META-INF
│   └── MANIFEST.MF
├── resources
│   └── some.properties
└── WEB-INF
    ├── classes
    │   └── ...
    └── web.xml
  • I’m in the process of upgrading our JBoss EAP application server from version 4.0.5 to 5.1 but I’m having issues deploying my existing web applications. I have several war files that have resources stored inside the war file that I access via the class loader like this.getClass().getClassLoader().getResource(...) and every getResource call seems to return null.

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 5.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content