-1

When I use the below code it returns the version as 1.0.0.0_2-1

String version = FacesContext.class.getPackage().getImplementationVersion();

But when I check the MANIFEST.MF file in MYAPP.ear\MyWEB.war\WEB-INF\lib\jsf-impl.jar\META-INF\ it mentioned as below.

Implementation-Version: 2.0.2-FCS

So my question is which one is the correct version this project use? I use Oracle Weblogic 12C instance.

ever alian
  • 1,028
  • 3
  • 15
  • 45
  • Oracle 12C is a SQL database not a Java EE server. And, as indicated by the question, that server apparently already ships with JSF out the box. You should remove the webapp-supplied JSF libraries in case you're facing consequences of conflict between multiple different versioned JSF API/impl libraries in runtime classpath. – BalusC May 15 '15 at 10:58
  • @BalusC I have no any issue. But I want to how to find the correct one? `1.0.0.0_2-1` what is the meaning of this? Yes I use Weblogic 12c. – ever alian May 16 '15 at 03:43

2 Answers2

0

For the question :

    which one is the correct version this project use?

Implementation-Version: 2.0.2-FCS is the correct version this project use.

You can find the solution here.

Community
  • 1
  • 1
Chirag Patel
  • 500
  • 1
  • 6
  • 17
  • I saw this answer. That's why I am confuse. Did you see what I get when I try `String version = FacesContext.class.getPackage().getImplementationVersion();` ? it is `1.0.0.0_2-1` – ever alian May 15 '15 at 08:13
0

Oracle WebLogic ships as being a Java EE application server already with among others JSF out the box. You don't and shouldn't need to manually install JSF by providing it along with the webapp.

The 1.0.0.0_2-1 you're seeing is coming from WebLogic-bundled JSF. It's clearly a JSF 2.1 implementation, but unfortunately the revision is missing in there. You can't control that. Oracle apparently modified the JAR and manifest. Java EE application server vendors have their own build system which generate JARs based on source code files. So the JAR file name and manifest contents may come out differently than those from "official" JARs.

In any case, if you didn't modify a standard WebLogic 12c setup as currently latest available (12.1.3), then I can tell that it's actually Mojarra 2.1.20.

Manually installing JSF along with the webapp is only necessary on barebones servletcontainers which doesn't ship with JSF out the box, such as Tomcat and Jetty. When you do so on Java EE containers like WebLogic anyway, then you'll risk problems caused by classpath conflicts. Don't do that. In your specific case, you can see that WebLogic bundled JSF implementation is actually being used. But the API and the web resources (such as jsf.js) will still come from the WAR. That will end up in conflicts sooner or later.

See also:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • one additional question. So my ear contains `jsf-impl.jar` having version `Implementation-Version: 2.0.2-FCS`. which means `jsf 2.0` isn't it? But web server contains `jsf 2.1`. which means eventually application use `jsf 2.1` environment? – ever alian May 17 '15 at 15:37
  • That's Mojarra 2.0.2, which is quite ancient. Get rid of it. – BalusC May 17 '15 at 17:31
  • My question is even I include the `jsf-impl.jar` with old version, eventually the application runs in server jsf version. is it? – ever alian May 18 '15 at 02:27
  • The API will be. The impl depends on classloading configuration. The resources will come from WAR. In any case, this is a terrible idea. **Get rid of it**. Upgrading server-bundled JSF should happen in server installation itself. Some servers support a webapp-supplied configuration parameter (e.g. in web.xml or some server-specific xml) to suppress this. – BalusC May 18 '15 at 05:33
  • According to [this](http://stackoverflow.com/questions/20083068/how-to-find-out-the-current-version-of-mojarra-which-my-weblogic-is-using) I have `glassfish.jsf_1.0.0.0_2-1-5.jar` in the said location. So I am not using 2.1.20 right? – ever alian May 19 '15 at 06:05
  • Nope. That's Mojarra 2.1.5. – BalusC May 19 '15 at 06:08
  • I'm really lost now. Could you please guild me how to find exactly which version I am using? – ever alian May 19 '15 at 06:52
  • Your WebLogic 12c has clearly Mojarra 2.1.5 bundled. – BalusC May 19 '15 at 08:26
  • Yes. So I'm not using JSF 2.1.20 right? Meaning that I don't have ViewScoped reload in taghandler fix. Am I correct? – ever alian May 19 '15 at 09:04
  • That's correct. Either upgrade WebLogic or its bundled JSF. – BalusC May 19 '15 at 09:05