0

Currently I have a problem during migrating a Java Enterprise project form old WAS-8 to Liberty Profile 17. In my case the environment cannto find a bunch of css/js files in the richfaces jar. Loading a page in the browser, WLP17 writes warnings like this into the logfile:

[WARNING ] SRVE0190E: File not found: /org.richfaces.resources/javax.faces.resource/org.richfaces.staticResource/4.5.17.Final/PackedCompressed/org.richfaces/jquery.js

I build the project using maven and I defined the richfaces dependency in the parent pom like this:

<dependency>
    <groupId>org.richfaces</groupId>
    <artifactId>richfaces</artifactId>
    <version>4.5.17.Final</version>
</dependency>

Then, I have several EJB and WAR projects that are packed together into an EAR file. The WAR projects using richfaces contain a richfaces dependency with scope provided:

<dependency>
    <groupId>org.richfaces</groupId>
    <artifactId>richfaces</artifactId>
    <scope>provided</scope>
</dependency>

Finally, the EAR pom has the dependency on richfaces to ensure that the library is included in the EAR file. For any reason the liberty is not able to find resources located in the richfaces jar.

I inspected the created EAR file, it contains the richfaces libraries. Then, I inspected the richfaces libraries, the also contain the files that are not found.

Is there any more configuration I have to do?

Andy Guibert
  • 41,446
  • 8
  • 38
  • 61
Joko
  • 600
  • 3
  • 15
  • 1
    Since you're trying to serve static web resources it may make sense to package the richfaces library in the WAR projects - rather that at the EAR level like you seem to be doing. – wtlucy Nov 21 '17 at 17:04
  • Why exactly should I pack the richfaces library into each WAR project? For my understanding it is visible as well as its resource are in the scope for all libraries and archives hat are packed within the EAR file. I can use richfaces tags in the JSF pages without runtime exceptions. – Joko Nov 22 '17 at 08:20
  • I made another interesting observation: Some projects static resources (like js and css files) that were placed in subfolders (like resouorces/css/foo/bar.css) referenced with the library-attribute (library="css/foo") weren't found as well. I moved them to the css folder and now they are found. – Joko Nov 22 '17 at 08:25
  • I think that must be any missconfiguration issue of my WLP 17 or a bug ... – Joko Nov 22 '17 at 08:26
  • I have just tested out your idea, @wtlucy. It works now. I cannot imagine why, but maybe I will find any explaination eventually. – Joko Nov 22 '17 at 10:39
  • I have a better understanding of why you've seen this behavior - so I've added a more decisive answer – wtlucy Nov 22 '17 at 19:43

2 Answers2

2

Jar libraries which are expected to serve static files from META-INF/resources/ should be bundled in the web application WAR. Section 4.6 from the Servlet 3.0 spec is relevant:

The getResource and getResourceAsStream methods take a String with a leading “/” as an argument that gives the path of the resource relative to the root of the context or relative to the META-INF/resources directory of a JAR file inside the web application’s WEB-INF/lib directory...

wtlucy
  • 704
  • 3
  • 10
0

@wtlucy's comment did solve my problem. Thank you.

I have put the richfaces libraries into the WAR files that need these libraries.

Joko
  • 600
  • 3
  • 15