How to access a file in a JBoss deployment?

Solution Verified - Updated -

Issue

  • Is it possible to access a resource in deployment with the following code only when deployment is exploded (extracted into a directory structure)?  Unable to get the resource when deploying in the form of a jar archive such as an EAR:

    URL url = SomeClass.class.getResource("SomeResource");
    FileInputStream stream = new FileInputStream (new File (url));
    

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 5.x
    • 6.0.x
    • 6.1.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