Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
136 views
in Technique[技术] by (71.8m points)

How to install one jar variant of JSF 2.3 (javax.faces.jar) on WildFly

I want to use the JSF 2.3 on my application, but WildFly uses the 2 JAR variant for 2.2.

Oracle said here https://javaserverfaces.java.net/2.3/download.html that won't release a 2.3 2 JAR variant.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Here's the manual procedure:

  1. Extract javax.faces.jar with a ZIP tool. You'll get 3 folders com, javax, META-INF
    (NOTE: in some versions you'll also see a jsf.js file in the root, but this is a mistake, you should ignore it, it's already located in META-INF/resources/javax.faces)

  2. Pack com and META-INF folders into jsf-impl.jar with a ZIP tool.

  3. Then, delete all files/subfolders in META-INF except of MANIFEST.MF.

  4. Pack javax and META-INF folders into jsf-api.jar with a ZIP tool.

  5. Continue here with those JARs: Upgrade JSF / Mojarra in JBoss AS / EAP / WildFly.


For the interested, JBoss AS and WildFly has internally a modular separation of Java EE based API and impl files. The separated JAR files jsf-api.jar and jsf-impl.jar are still needed. The reason is not really technical, but just an extra service to force developers programming against the right libraries. Only the API modules are exposed during compile time (usually, via the IDE-integrated plugin which adds them to "build path"). This should avoid starters accidentally finding, importing and using implementation classes such as those in com.sun.faces.* package.

Already since version 1.x, the JSF implementation Mojarra was composed of two JAR files: jsf-api.jar and jsf-impl.jar. The API JAR contained the javax.faces.* classes and the implementation JAR contained the com.sun.faces.* classes. Since the change of the build system conform Java EE Maven rules, both the API and implementation classes were merged into a single javax.faces.jar file, see also issue 2028 (started with Mojarra 2.1.6 at Dec 2011). Since Mojarra 2.3, the separated JAR files are not built anymore.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...